:root {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--page);
  color-scheme: light;
  --page: #f6f0e9;
  --surface: #fffbf6;
  --sidebar: #eadecf;
  --ink: #372821;
  --muted: #6a584b;
  --line: #ddcdbc;
  --accent: #684332;
  --accent-hover: #523324;
  --tint: #e5d3c1;
  --radius: 15px;
  --focus: #82573e;
  --on-accent: #fff9f3;
  --nav-ink: #574539;
  --hover: #e8d8c9;
  --selected-ink: #503526;
  --icon: #735c4b;
  --avatar: #dfc8b2;
  --field-line: #d3beab;
  --field-focus: #946f53;
  --focus-halo: #946f5326;
  --input: #fcf7f1;
  --placeholder: #766354;
  --subtle-line: #e8dccf;
  --voice-active: #784d36;
  --voice-bg: #f1e1d1;
  --error: #914051;
  --overdue: #944531;
  --success: #45634a;
  --danger: #903a45;
  --toast: #423127;
  --toast-action: #f6d9b8;
  --attention-edge: #98663f;
  --attention-bg: #f1e3d1;
  --attention-ink: #60402a;
  --toast-ink: #fff8f0;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #271d19;
  --surface: #322620;
  --sidebar: #2d221d;
  --ink: #f6eae0;
  --muted: #c5b0a1;
  --line: #554236;
  --accent: #dfb899;
  --accent-hover: #f0cdb0;
  --tint: #49362b;
  --toast-ink: #38271e;
  --focus: #e7b997;
  --on-accent: #342219;
  --nav-ink: #d9c3b2;
  --hover: #3c2e26;
  --selected-ink: #f8e4d1;
  --icon: #c9ab95;
  --avatar: #503b2f;
  --field-line: #614a3c;
  --field-focus: #c69d7d;
  --focus-halo: #c69d7d30;
  --input: #30231e;
  --placeholder: #b5a18f;
  --subtle-line: #48392e;
  --voice-active: #f2cba9;
  --voice-bg: #4e372a;
  --error: #f3b1b8;
  --overdue: #f3b599;
  --success: #b6d2b4;
  --danger: #f1aab0;
  --toast: #e9d6c3;
  --toast-action: #66422e;
  --attention-edge: #c89c72;
  --attention-bg: #493626;
  --attention-ink: #efd4b4;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h1, h2, p { margin: 0; }
h2 { font-size: 1.125rem; font-weight: 650; letter-spacing: -.022em; }
[hidden] { display: none !important; }
[data-icon] svg { display: block; width: 18px; height: 18px; flex: none; }
span[data-icon] { display: inline-flex; align-items: center; justify-content: center; }

.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 30px 16px 21px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}
.brand, .profile { display: flex; align-items: center; gap: 11px; padding-inline: 9px; }
.brand { height: 36px; margin-bottom: 46px; }
.brand strong, .mobile-brand {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -.025em;
}
.brand-icon {
  width: 33px;
  height: 33px;
  flex: none;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
}
.brand-icon svg { width: 19px; height: 19px; }
nav { display: grid; gap: 5px; overflow-y: auto; }
nav button, .sidebar-bottom button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  min-height: 43px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--nav-ink);
  text-align: left;
  font-size: .875rem;
  font-weight: 560;
}
nav button:hover, .sidebar-bottom button:hover { background: var(--hover); color: var(--ink); }
nav button[aria-current] { background: var(--tint); color: var(--selected-ink); font-weight: 680; }
nav [data-icon] { color: var(--icon); }
nav [aria-current] [data-icon] { color: var(--accent); }
.nav-count { margin-left: auto; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.sidebar-bottom { display: grid; gap: 13px; margin-top: auto; }
.profile { border-top: 1px solid var(--line); padding-top: 15px; font-size: .875rem; }
.avatar {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: var(--avatar);
  color: var(--accent);
  font-weight: 650;
}

main { min-width: 0; }
.content { max-width: 1100px; margin-inline: auto; padding: 24px clamp(28px, 5vw, 74px) 65px; }
.topbar { display: flex; align-items: center; justify-content: flex-end; min-height: 45px; gap: 10px; }
.search-trigger, .secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: .875rem;
}
.search-trigger:hover, .secondary:hover { background: var(--surface); color: var(--accent); }
.menu-toggle, .mobile-brand { display: none !important; }

.welcome { margin: 20px 0 33px; }
.welcome time {
  display: block;
  color: var(--accent);
  font-size: .875rem;
  font-weight: 650;
  letter-spacing: .012em;
}
.welcome time::first-letter { text-transform: uppercase; }
.welcome h1 {
  margin-top: 8px;
  font: 500 clamp(2.45rem, 4.7vw, 4rem)/1.07 Georgia, "Times New Roman", serif;
  letter-spacing: -.048em;
  overflow-wrap: anywhere;
}
#composer-title { margin-bottom: 12px; }
.theme-switch { display: flex; align-items: center; padding: 3px; gap: 2px; border: 1px solid var(--line); background: var(--sidebar); border-radius: 10px; }
.theme-switch button { display: inline-flex; gap: 6px; align-items: center; justify-content: center; min-height: 34px; padding: 5px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: .825rem; }
.theme-switch button:hover { color: var(--ink); background: var(--hover); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--accent); font-weight: 650; box-shadow: 0 1px 4px #35231720; }
:root[data-theme="dark"] .theme-switch button[aria-pressed="true"] { background: var(--tint); color: var(--selected-ink); }
.theme-switch [data-icon] svg { width: 16px; height: 16px; }
.capture-box {
  overflow: hidden;
  border: 1px solid var(--field-line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 3px 9px #5432220b;
}
.capture-box:focus-within { border-color: var(--field-focus); box-shadow: 0 0 0 2px var(--focus-halo); }
#capture-text {
  display: block;
  width: 100%;
  min-height: 88px;
  max-height: 38vh;
  padding: 16px 16px 10px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  resize: vertical;
}
#capture-text:focus { outline: 0; }
textarea, input, select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--input);
}
textarea::placeholder, input::placeholder { color: var(--placeholder); }
.composer-footer { margin: 0 12px; padding: 9px 0; border-top: 1px solid var(--subtle-line); }
.composer-footer, .dialog-actions, .backup-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.capture-hint { padding-left: 3px; color: var(--muted); font-size: .825rem; }
.capture-actions { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.primary, .voice-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 13px;
  font-size: .875rem;
  font-weight: 650;
  white-space: nowrap;
}
.primary { color: var(--on-accent); background: var(--accent); }
.primary:hover { background: var(--accent-hover); }
.primary:disabled { opacity: .5; }
.voice-button { color: var(--accent); background: transparent; }
.voice-button:hover { background: var(--tint); }
.voice-button[aria-pressed="true"] { color: var(--voice-active); background: var(--voice-bg); }
.voice-button svg { width: 16px; height: 16px; }
.dictation-status { margin: 0; padding: 0 15px 11px; color: var(--muted); font-size: .875rem; line-height: 1.45; }
.dictation-status:empty { padding: 0; }
.dictation-status.error { color: var(--error); }

.quick-actions { display: flex; flex-wrap: wrap; gap: 5px 17px; margin-top: 9px; }
.quick-actions button {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: .825rem;
}
.quick-actions button:hover { color: var(--accent); text-decoration: underline; }
.quick-actions svg { width: 15px; height: 15px; }

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(200px, 1fr);
  gap: 34px;
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.dashboard[data-overview="false"] { display: block; }
.list-panel, .follow-panel { min-width: 0; }
.follow-panel { border-left: 1px solid var(--line); padding-left: 24px; }
.list-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.list-count { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.list-count:empty { display: none; }
.empty { padding: 9px 0; color: var(--muted); font-size: .925rem; line-height: 1.5; }
.list-heading .text-button { min-height: 26px; margin-left: auto; padding: 0 1px; }

.task-group + .task-group { margin-top: 12px; }
.task-group h3 { margin: 0 0 4px; color: var(--muted); font-size: .825rem; font-weight: 600; }
.task-row { display: flex; align-items: center; gap: 6px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-open { flex: 1; min-width: 0; text-align: left; background: none; border: 0; border-radius: 7px; color: var(--ink); padding: 6px; }
.task-open:hover, .preview-item:hover { background: var(--tint); }
.task-name { display: block; font-size: .9375rem; font-weight: 580; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-meta { display: block; font-size: .825rem; color: var(--muted); margin-top: 4px; }
.task-meta.overdue { color: var(--overdue); }
.preview-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  min-height: 41px;
  padding: 8px 5px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  color: var(--ink);
}
.preview-item [data-icon] { color: var(--accent); padding-top: 1px; }
.preview-content { min-width: 0; }
.status-button, .icon-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
}
.status-button:hover, .icon-button:hover { background: var(--tint); }
.done-row .status-button { color: var(--success); }
.done-row .task-name { text-decoration: line-through; }
.text-button {
  min-height: 36px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 650;
  font-size: .875rem;
  text-align: left;
}
.text-button:hover { text-decoration: underline; }
.danger { color: var(--danger); }

dialog {
  width: min(510px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 19px 64px #2e1b1240;
}
dialog::backdrop { background: #2c1d1575; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
dialog label { display: grid; gap: 5px; margin-bottom: 11px; font-size: .875rem; font-weight: 600; color: var(--muted); min-width: 0; }
dialog :is(textarea, select, input:not([type=file])) { width: 100%; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1.45fr 1fr; gap: 10px; }
.search-results, .dialog-actions, .backup-actions { margin-top: 10px; }
.search-results p, dialog > p { color: var(--muted); font-size: .9rem; line-height: 1.5; }
.backup-actions { justify-content: flex-start; flex-wrap: wrap; }
#export-trigger { text-decoration: none; }
#backup-status:empty { display: none; }
#backup-manual { margin-top: 12px; }
#backup-manual[hidden] { display: none; }
#backup-restore { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
#backup-restore summary { cursor: pointer; color: var(--accent); font-weight: 600; }
#backup-restore[open] summary, #backup-input { margin-bottom: 10px; }
#backup-restore label { margin: 12px 0 5px; }
#backup-apply:disabled { opacity: .55; }
.toast {
  position: fixed;
  z-index: 4;
  bottom: 20px;
  right: 20px;
  max-width: calc(100% - 40px);
  padding: 11px 14px;
  border-radius: 9px;
  background: var(--toast);
  color: var(--toast-ink);
  font-size: .875rem;
}
.toast:empty { display: none; }
.toast button { background: none; border: 0; color: var(--toast-action); font: inherit; font-weight: 700; text-decoration: underline; margin-left: 9px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 940px) {
  .shell { grid-template-columns: 214px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .content { padding-inline: 28px; }
  .dashboard { gap: 23px; grid-template-columns: minmax(0, 1.45fr) minmax(174px, 1fr); }
  .follow-panel { padding-left: 17px; }
}
@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar {
    display: none;
    position: fixed;
    z-index: 3;
    inset: 62px auto 0 0;
    width: min(275px, 85vw);
    height: auto;
    padding-top: 16px;
    box-shadow: 4px 10px 25px #35241826;
  }
  .sidebar .brand { display: none; }
  .menu-open .sidebar { display: flex; }
  .menu-toggle { display: grid !important; }
  .mobile-brand { display: block !important; }
  .content { padding: 8px 19px 43px; }
  .topbar { min-height: 54px; justify-content: flex-start; gap: 8px; border-bottom: 1px solid var(--line); }
  .theme-switch { margin-left: auto; }
  .search-trigger { min-height: 36px; }
  .welcome { margin-top: 25px; }
}
@media (max-width: 520px) {
  .content { padding-inline: 15px; }
  .search-label, .theme-label { display: none; }
  .theme-switch button { width: 33px; padding: 5px; }
  .search-trigger { padding: 7px 9px; }
  .welcome { margin-bottom: 26px; }
  .welcome h1 { font-size: clamp(2.12rem, 10vw, 2.55rem); }
  .dashboard { grid-template-columns: 1fr; gap: 18px; margin-top: 27px; padding-top: 18px; }
  .follow-panel { border-left: 0; border-top: 1px solid var(--line); padding: 16px 0 0; }
  .composer-footer { gap: 7px; flex-wrap: wrap; }
  .quick-actions { gap: 0 12px; }
}
@media (max-width: 365px) {
  .capture-hint { flex-basis: 100%; }
}

.attention {
  margin: -14px 0 22px;
  padding: 10px 13px;
  border-left: 3px solid var(--attention-edge);
  background: var(--attention-bg);
  color: var(--attention-ink);
  border-radius: 0 8px 8px 0;
  font-size: .875rem;
}
.inbox-review { margin-top: 16px; }
.team-panel:not([hidden]) { margin-top: 26px; }
.team-panel .list-heading { justify-content: space-between; flex-wrap: wrap; }
.workload-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(100px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.workload-summary, .review-summary { color: var(--muted); font-size: .875rem; line-height: 1.5; }
.team-tasks-title { margin-top: 26px; }
.team-panel:not([hidden]) + .dashboard { margin-top: 10px; padding-top: 7px; }

.review-dialog { width: min(730px, calc(100% - 24px)); }
.review-summary { margin-bottom: 12px; }
.review-row {
  margin: 0 0 12px;
  padding: 10px 13px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
}
.review-row legend { padding: 0 5px; color: var(--accent); font-size: .875rem; font-weight: 650; }
.review-row .review-keep { display: flex; align-items: center; gap: 7px; }
dialog .review-keep input { width: 16px; height: 16px; accent-color: var(--accent); }
.review-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 9px; }
.review-actions { justify-content: flex-end; flex-wrap: wrap; }
.form-error { margin-top: 8px; color: var(--error); font-size: .875rem; line-height: 1.4; }
.form-error:empty, .review-row .task-meta:empty { display: none; }

@media (max-width: 540px) {
  .composer-footer { flex-wrap: wrap; }
  .capture-hint { flex-basis: 100%; }
  .capture-actions { min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
  .capture-actions .secondary, .capture-actions .primary, .capture-actions .voice-button { padding-inline: 9px; }
  .review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workload-row { grid-template-columns: minmax(0, 1fr) auto; }
  .workload-summary { grid-row: 2; grid-column: 1 / -1; }
}

.review-first { display: block; margin-top: 5px; color: var(--ink); font-weight: 600; }

#photo-dialog { width: min(610px, calc(100% - 24px)); }
.photo-pickers { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
#photo-preview {
  display: block; width: 100%; height: auto; max-height: 33vh; object-fit: contain;
  border: 1px solid var(--line); border-radius: 8px; background: var(--page); margin-top: 12px;
}
#photo-status { margin: 10px 0; }
#photo-result textarea { display: block; resize: vertical; }
@media (pointer: fine) { #photo-shoot { display: none; } }
@media (max-width: 680px) { .composer-footer { flex-wrap: wrap; } .capture-actions { flex-wrap: wrap; } }
