:root {
  color-scheme: light;
  --bg: #f3f1eb;
  --surface: #fbfaf6;
  --white: #fff;
  --ink: #202520;
  --muted: #747a73;
  --line: #dadbd4;
  --line-dark: #c2c5bd;
  --green: #315f52;
  --green-dark: #22493f;
  --green-soft: #e5eeea;
  --red: #a54c45;
  --amber: #a46a2d;
  --shadow: 0 18px 55px rgb(32 37 32 / 9%);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgb(49 95 82 / 20%); outline-offset: 2px;
}
[hidden] { display: none !important; }

.eyebrow { margin: 0 0 5px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.muted, .hint { color: var(--muted); }
.brand-symbol { display: grid; width: 50px; height: 50px; place-items: center; color: white; background: var(--green); border-radius: 15px; font-size: 24px; font-weight: 800; }
.brand-symbol.small { width: 34px; height: 34px; border-radius: 10px; font-size: 17px; }

.login-shell { display: grid; min-height: 100vh; padding: 24px; place-items: center; background: radial-gradient(circle at 30% 15%, #fff 0, transparent 35%); }
.login-card { width: min(100%, 410px); padding: 40px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.login-card .brand-symbol { margin-bottom: 30px; }
.login-card h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 38px; line-height: 1.17; letter-spacing: -.04em; }
.login-card > .muted { margin: 12px 0 28px; }

label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 750; }
input, select, textarea { width: 100%; color: var(--ink); background: var(--white); border: 1px solid var(--line-dark); border-radius: 8px; }
input, select { min-height: 43px; padding: 0 12px; }
textarea { padding: 12px; line-height: 1.55; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #949b92; }
input:focus, select:focus, textarea:focus { border-color: var(--green); }
.login-card input { margin-bottom: 18px; }

.button { min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 8px; font-weight: 750; }
.button.primary { color: #fff; background: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { color: var(--green-dark); background: var(--green-soft); border-color: #cbded6; }
.button.compact { min-height: 34px; padding: 0 11px; font-size: 12px; white-space: nowrap; }
.button.full { width: 100%; }
.text-button, .icon-button { min-height: 38px; padding: 0 9px; background: transparent; border: 0; border-radius: 8px; }
.text-button:hover, .icon-button:hover { background: var(--green-soft); color: var(--green-dark); }
.icon-button { min-width: 38px; font-size: 19px; }
.muted-button { color: var(--muted); }
.form-error, .success-note { min-height: 18px; margin: 8px 0 6px; color: var(--red); font-size: 12px; }
.success-note { color: var(--green); }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; height: 70px; padding: 0 max(24px, calc((100vw - 1500px) / 2)); align-items: center; justify-content: space-between; background: rgb(251 250 246 / 92%); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand > span:last-child { display: grid; gap: 2px; }
.brand b { font-size: 15px; }
.brand small { color: var(--muted); font-size: 10px; }
.top-actions { display: flex; align-items: center; gap: 2px; }
.count-badge { display: inline-grid; min-width: 19px; height: 19px; padding: 0 5px; place-items: center; color: var(--green-dark); background: var(--green-soft); border-radius: 20px; font-size: 10px; }

.dashboard { display: grid; width: min(100%, 1500px); min-height: calc(100vh - 70px); margin: 0 auto; grid-template-columns: 390px minmax(0, 1fr); }
.composer-panel { padding: 32px; background: var(--surface); border-right: 1px solid var(--line); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.panel-heading h1, .overview-header h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 31px; line-height: 1.15; letter-spacing: -.035em; }
.voice-box { margin-top: 24px; padding: 14px; background: #eff2ed; border: 1px solid #d7ddd7; border-radius: 11px; }
.voice-heading, .voice-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.voice-heading label { margin: 0; }
.voice-button { display: grid; width: 34px; height: 34px; place-items: center; background: var(--white); border: 1px solid var(--line); border-radius: 50%; }
.voice-button.listening { color: white; background: var(--red); border-color: var(--red); animation: pulse 1.25s infinite; }
.voice-box textarea { margin-top: 10px; background: rgb(255 255 255 / 70%); }
.voice-actions { margin-top: 8px; align-items: flex-end; }
.voice-actions .hint { max-width: 180px; font-size: 10px; line-height: 1.4; }
.divider { display: flex; margin: 24px 0 20px; align-items: center; gap: 10px; color: var(--muted); font-size: 10px; }
.divider::before, .divider::after { height: 1px; flex: 1; content: ""; background: var(--line); }
.field { margin-bottom: 15px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inline-field { display: grid; grid-template-columns: 1fr auto; gap: 5px; }
.switch-row { display: flex; margin: 1px 0 15px; align-items: center; justify-content: space-between; cursor: pointer; }
.switch-row span { display: grid; gap: 2px; }
.switch-row small { color: var(--muted); font-size: 10px; font-weight: 500; }
.switch-row input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-row i { position: relative; width: 40px; height: 23px; background: var(--line-dark); border-radius: 30px; transition: .2s; }
.switch-row i::after { position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; content: ""; background: white; border-radius: 50%; transition: .2s; }
.switch-row input:checked + i { background: var(--green); }
.switch-row input:checked + i::after { transform: translateX(17px); }

.overview { min-width: 0; padding: 38px 42px 80px; }
.overview-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.overview-header h1 { font-size: 36px; }
.overview-header p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.overview-stats { display: flex; gap: 20px; color: var(--muted); font-size: 11px; }
.overview-stats b { display: block; color: var(--ink); font-family: Georgia, serif; font-size: 25px; font-weight: 500; }
.area-sections { display: grid; margin-top: 29px; gap: 30px; }
.area-block { min-width: 0; }
.area-block-header { display: flex; padding-bottom: 9px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-dark); }
.area-block-title { display: flex; min-width: 0; align-items: center; gap: 10px; }
.area-index { display: grid; width: 23px; height: 23px; place-items: center; color: var(--green-dark); background: var(--green-soft); border-radius: 7px; font-size: 10px; font-weight: 800; }
.area-block h2 { margin: 0; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.area-block-header small { color: var(--muted); }
.task-list { display: grid; }
.task-row { display: grid; min-width: 0; padding: 13px 2px; grid-template-columns: 26px minmax(180px, 1fr) minmax(120px, 180px) auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); transition: opacity .2s, transform .2s; }
.task-row.archiving { opacity: 0; transform: translateX(14px); }
.complete-check { position: relative; display: grid; width: 21px; height: 21px; place-items: center; }
.complete-check input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.complete-check i { display: grid; width: 19px; height: 19px; place-items: center; background: var(--white); border: 1.5px solid var(--line-dark); border-radius: 5px; font-size: 12px; font-style: normal; }
.complete-check input:focus-visible + i { outline: 3px solid rgb(49 95 82 / 20%); }
.task-info { min-width: 0; }
.task-title-line { display: flex; min-width: 0; align-items: center; gap: 7px; }
.task-title-line strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.pin-mark { color: var(--amber); font-size: 11px; }
.task-meta { display: flex; margin-top: 5px; flex-wrap: wrap; gap: 5px 11px; color: var(--muted); font-size: 10px; }
.priority { padding: 2px 6px; color: var(--tag-color); background: color-mix(in srgb, var(--tag-color) 9%, white); border-radius: 20px; }
.tag-urgent_important { --tag-color: #a54c45; }
.tag-urgent_not_important { --tag-color: #a46a2d; }
.tag-not_urgent_important { --tag-color: #315f52; }
.tag-not_urgent_not_important { --tag-color: #747a73; }
.overdue { color: var(--red); font-weight: 700; }
.progress-cell { display: grid; grid-template-columns: 1fr 32px; align-items: center; gap: 7px; }
.progress-cell input { min-height: 20px; padding: 0; accent-color: var(--green); }
.progress-cell output { color: var(--green-dark); font-size: 10px; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; opacity: .5; }
.task-row:hover .row-actions, .row-actions:focus-within { opacity: 1; }
.row-action { display: grid; width: 29px; height: 29px; padding: 0; place-items: center; background: transparent; border: 0; border-radius: 6px; font-size: 13px; }
.row-action:hover { color: var(--green-dark); background: var(--green-soft); }
.row-action.danger:hover { color: var(--red); background: #f7e7e5; }
.area-empty { padding: 18px 3px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.empty-state { margin-top: 32px; padding: 50px 20px; text-align: center; background: var(--surface); border: 1px dashed var(--line-dark); border-radius: 14px; }
.empty-state p { color: var(--muted); }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: flex-end; background: rgb(22 27 23 / 38%); backdrop-filter: blur(3px); }
.drawer { width: min(100%, 520px); height: 100%; overflow: auto; background: var(--surface); box-shadow: -15px 0 50px rgb(22 27 23 / 15%); animation: slide-in .2s ease-out; }
.drawer-header { position: sticky; top: 0; z-index: 2; display: flex; padding: 25px 28px 18px; align-items: flex-start; justify-content: space-between; background: rgb(251 250 246 / 94%); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.drawer-header h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 29px; }
.drawer-content { padding: 24px 28px 60px; }
.drawer-empty { padding: 45px 0; color: var(--muted); text-align: center; }
.archive-item { display: grid; padding: 14px 0; grid-template-columns: 1fr auto; gap: 14px; border-bottom: 1px solid var(--line); }
.archive-item strong { display: block; font-size: 13px; }
.archive-item small { color: var(--muted); font-size: 10px; }
.week-card { margin-bottom: 14px; padding: 18px; background: var(--white); border: 1px solid var(--line); border-radius: 11px; }
.week-card h3 { margin: 0; font-size: 15px; }
.week-card > p { color: var(--muted); font-size: 12px; line-height: 1.65; }
.week-card ul { margin: 12px 0 0; padding-left: 18px; font-size: 12px; line-height: 1.8; }
.settings-section { margin-bottom: 30px; }
.settings-section h3 { margin: 0 0 6px; font-size: 15px; }
.settings-section > p { margin: 0 0 15px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.settings-actions { display: flex; margin-top: 10px; gap: 8px; }
.area-checks { display: grid; gap: 5px; }
.area-check { display: flex; min-height: 41px; margin: 0; padding: 0 10px; align-items: center; justify-content: space-between; background: var(--white); border: 1px solid var(--line); border-radius: 8px; }
.area-check input { width: 18px; min-height: 18px; accent-color: var(--green); }
.key-status { margin-top: 7px; color: var(--green); font-size: 11px; }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: grid; gap: 8px; }
.toast { max-width: 340px; padding: 11px 15px; color: white; background: var(--green-dark); border-radius: 9px; box-shadow: var(--shadow); font-size: 12px; animation: toast-in .2s ease-out; }
.toast.error { background: var(--red); }
.mobile-only { display: none; }

@keyframes slide-in { from { transform: translateX(35px); opacity: .5; } }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgb(165 76 69 / 15%); } }

@media (max-width: 1050px) {
  .dashboard { grid-template-columns: 350px minmax(0, 1fr); }
  .composer-panel { padding: 28px 24px; }
  .overview { padding: 34px 28px 70px; }
  .task-row { grid-template-columns: 26px minmax(150px, 1fr) 130px auto; }
}

@media (max-width: 820px) {
  .topbar { height: auto; min-height: 62px; padding: 10px 14px; gap: 8px; }
  .brand small { display: none; }
  .top-actions { gap: 0; }
  .top-actions .text-button { min-height: 35px; padding: 0 7px; font-size: 11px; }
  .dashboard { display: block; min-height: 0; }
  .composer-panel { padding: 22px 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .mobile-only { display: grid; }
  .overview { padding: 26px 18px 60px; }
  .overview-header { align-items: flex-start; }
  .overview-header h1 { font-size: 30px; }
  .overview-stats { display: grid; gap: 7px; text-align: right; }
  .overview-stats span { display: flex; align-items: baseline; justify-content: flex-end; gap: 5px; }
  .overview-stats b { font-size: 20px; }
  .area-sections { gap: 26px; }
  .task-row { grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; }
  .progress-cell { grid-column: 2 / 4; grid-row: 2; }
  .row-actions { opacity: .8; }
  .drawer { width: 100%; }
  .drawer-header, .drawer-content { padding-left: 20px; padding-right: 20px; }
}

@media (max-width: 430px) {
  .brand b { font-size: 13px; }
  .brand-symbol.small { width: 30px; height: 30px; }
  .top-actions .muted-button, #notify-button { display: none; }
  .login-card { padding: 30px 24px; }
  .login-card h1 { font-size: 33px; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .overview-header p:last-child { display: none; }
}
