/* todonelo — layout modelled on Microsoft To Do, with the todonelo jade accent. */
@import url('/tokens.css');

:root {
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --page: #faf9f8;
  --sidebar: #f3f4f2;
  --surface: #ffffff;
  --surface-2: #f6f7f5;
  --row: rgba(255, 255, 255, 0.97);
  --row-hover: #f5f7f6;
  --row-selected: #e8f2ee;
  --text: #1a1d1c;
  --text-2: #5d6361;
  --text-3: #858b89;
  --line: #e3e5e3;
  --line-strong: #cfd3d1;
  --danger: #c4314b;
  --warn-bg: #fff4d6;
  --warn-text: #5a4300;
  --overdue: #c4314b;
  --shadow-row: 0 0.3px 0.9px rgba(0, 0, 0, 0.1), 0 1.6px 3.6px rgba(0, 0, 0, 0.08);
  --shadow-pop: 0 6px 14px rgba(0, 0, 0, 0.13), 0 1px 4px rgba(0, 0, 0, 0.1);
  --radius: 6px;
  --sidebar-width: 290px;
  --detail-width: 360px;
  --strip: 0px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #161a19; --sidebar: #1c1f1e; --surface: #252928; --surface-2: #2b2f2e; --row: #252928; --row-hover: #2d3231; --row-selected: #1d3a31;
    --text: #e9f1ee; --text-2: #b3bcb8; --text-3: #8c9592; --line: #343938; --line-strong: #444a48; --danger: #ff8f9f; --overdue: #ff8f9f;
    --warn-bg: #3a3218; --warn-text: #f3dd9b; --shadow-row: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #161a19; --sidebar: #1c1f1e; --surface: #252928; --surface-2: #2b2f2e; --row: #252928; --row-hover: #2d3231; --row-selected: #1d3a31;
  --text: #e9f1ee; --text-2: #b3bcb8; --text-3: #8c9592; --line: #343938; --line-strong: #444a48; --danger: #ff8f9f; --overdue: #ff8f9f;
  --warn-bg: #3a3218; --warn-text: #f3dd9b; --shadow-row: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.4 var(--font); color: var(--text); background: var(--page); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: 0.5; }
a { color: var(--brand-text); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.icon { flex: none; display: block; }
code { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; font-size: 0.92em; }
.hint { color: var(--text-2); font-size: 13px; }
.error { color: var(--danger); }

.boot { height: 100vh; display: grid; place-items: center; }
.boot img { animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0.5; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* ---------- Buttons ---------- */
.button, .settings-section button:not(.icon-button), .row > button, .auth-form button, .dialog-actions button, .secret-box button, .signin-card .button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 6px 14px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); text-decoration: none; font-weight: 500;
}
.button:hover, .settings-section button:not(.icon-button):hover, .row > button:hover, .auth-form button:hover, .dialog-actions button:hover { background: var(--surface-2); }
button.primary, .button.primary { background: var(--brand); color: var(--brand-contrast); border-color: transparent; }
button.primary:hover, .button.primary:hover { background: var(--brand-hover); }
button.primary:active { background: var(--brand-pressed); }
button.danger, .button.danger { color: var(--danger); }
button.primary.danger { background: var(--danger); color: #fff; }
button.large, .button.large { min-height: 44px; font-size: 15px; justify-content: center; width: 100%; }
.button.google { background: var(--surface); color: var(--text); border-color: var(--line-strong); font-weight: 600; gap: 10px; }
.button.google:hover { background: var(--surface-2); }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.settings-section h2 .google-g { flex: none; }
button.link { border: 0 !important; background: none !important; color: var(--brand-text); padding: 4px 0 !important; min-height: 0 !important; font-weight: 500; }
.icon-button { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; color: var(--text-2); }
.icon-button:hover { background: rgba(127, 127, 127, 0.14); color: var(--text); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Layout ---------- */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.layout { flex: 1; display: flex; min-height: 0; }
.drag-strip { height: var(--strip); flex: none; -webkit-app-region: drag; }
.desktop { --strip: 40px; }
.desktop-mac .sidebar .drag-strip { height: 44px; }
.desktop-win .main .drag-strip, .desktop-linux .main .drag-strip { margin-right: 0; }
.desktop button, .desktop input, .desktop a, .desktop textarea, .desktop select { -webkit-app-region: no-drag; }
.desktop-win.with-detail .detail .detail-scroll, .desktop-linux.with-detail .detail .detail-scroll { padding-top: 4px; }
.desktop-win:not(.with-detail) .main-header, .desktop-linux:not(.with-detail) .main-header { padding-right: 150px; }
.desktop-win.with-detail .detail .drag-strip, .desktop-linux.with-detail .detail .drag-strip { height: 44px; }

.agent-banner { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--warn-bg); color: var(--warn-text); font-size: 13px; flex-wrap: wrap; }
.agent-banner button { margin-left: auto; text-decoration: underline; font-weight: 600; }

/* ---------- Sidebar ---------- */
.sidebar { width: var(--sidebar-width); flex: none; background: var(--sidebar); display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; }
.sidebar-top { padding: 12px 12px 4px; display: grid; gap: 10px; }
.account { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 8px; text-align: left; width: 100%; }
.account:hover { background: rgba(127, 127, 127, 0.12); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--brand-contrast); font-weight: 600; font-size: 15px; flex: none; }
.account-text { display: grid; min-width: 0; }
.account-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-sub { color: var(--text-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.search input { flex: 1; border: 0; background: none; outline: none; min-width: 0; color: var(--text); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.nav { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav hr { border: 0; border-top: 1px solid var(--line); margin: 8px 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 10px 0 12px; border-radius: 6px; color: var(--text); text-decoration: none; position: relative; width: 100%; }
.nav-item:hover { background: rgba(127, 127, 127, 0.12); }
.nav-item.active { background: var(--brand-soft); font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: var(--brand); }
.nav-item .icon { color: var(--brand-text); }
.smart .nav-item .icon-sun { color: #c27c0e; }
.smart .nav-item .icon-star { color: #c4568f; }
.smart .nav-item .icon-calendar { color: #10808a; }
.smart .nav-item .icon-all { color: #5b5fc7; }
.smart .nav-item .icon-checkCircle { color: #2f8f5b; }
.nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count { color: var(--text-2); font-size: 12px; font-weight: 400; min-width: 18px; text-align: right; }
.emoji { width: 20px; text-align: center; font-size: 16px; line-height: 1; }
.nav-item.renaming { background: var(--surface); box-shadow: inset 0 0 0 1px var(--brand); }
.nav-item.renaming input, .group-header.renaming input { flex: 1; border: 0; background: none; outline: none; min-width: 0; }
.group { margin: 2px 0; }
.group-header { display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 10px 0 12px; width: 100%; border-radius: 6px; color: var(--text); text-align: left; }
.group-header:hover { background: rgba(127, 127, 127, 0.12); }
.group-header .icon:first-child { color: var(--text-2); }
.group-lists { padding-left: 14px !important; border-left: 1px solid var(--line); margin-left: 21px !important; }
.group-empty { height: 6px; }
.sidebar-bottom { display: flex; align-items: center; gap: 4px; padding: 8px; border-top: 1px solid var(--line); }
.new-list { flex: 1; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 6px; color: var(--brand-text); font-weight: 500; }
.new-list:hover { background: rgba(127, 127, 127, 0.12); }
.drop-into { box-shadow: inset 0 0 0 2px var(--brand) !important; background: var(--brand-soft) !important; }
.drop-before { box-shadow: inset 0 2px 0 var(--brand) !important; }
.drop-after { box-shadow: inset 0 -2px 0 var(--brand) !important; }

/* ---------- Themes (list backgrounds) ---------- */
.main { --theme: #4a6fd1; --on-theme: #ffffff; --on-theme-soft: rgba(255, 255, 255, 0.85); background: var(--theme); }
.theme-blue { --theme: #4a6fd1; } .theme-indigo { --theme: #5b5fc7; } .theme-purple { --theme: #8a5fc9; } .theme-pink { --theme: #c4568f; }
.theme-red { --theme: #cc4b45; } .theme-orange { --theme: #d2742a; } .theme-green { --theme: #2f8a58; } .theme-teal { --theme: #0f7f8a; } .theme-gray { --theme: #66707a; }
.theme-sunrise { --theme: linear-gradient(165deg, #f4b66a 0%, #e07a6f 48%, #9a64b5 100%); }
.theme-ocean { --theme: linear-gradient(165deg, #3d8fd1 0%, #2160a3 55%, #163f72 100%); }
.theme-forest { --theme: linear-gradient(165deg, #4b9a63 0%, #2c6e51 55%, #1b4a3c 100%); }
.theme-dusk { --theme: linear-gradient(165deg, #5b4fa3 0%, #8a5aa6 50%, #c96f8a 100%); }
.theme-meadow { --theme: linear-gradient(165deg, #9ccc65 0%, #4fa36a 55%, #1f7a62 100%); }
.theme-sand { --theme: linear-gradient(165deg, #ead2a6 0%, #d3ad7c 55%, #b8875a 100%); --on-theme: #3b2a17; --on-theme-soft: rgba(59, 42, 23, 0.8); }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; background: var(--theme); }
.swatch.on { border-color: var(--text); box-shadow: inset 0 0 0 2px var(--surface); }
.theme-swatch-blue { --theme: #4a6fd1; } .theme-swatch-indigo { --theme: #5b5fc7; } .theme-swatch-purple { --theme: #8a5fc9; } .theme-swatch-pink { --theme: #c4568f; }
.theme-swatch-red { --theme: #cc4b45; } .theme-swatch-orange { --theme: #d2742a; } .theme-swatch-green { --theme: #2f8a58; } .theme-swatch-teal { --theme: #0f7f8a; } .theme-swatch-gray { --theme: #66707a; }
.theme-swatch-sunrise { --theme: linear-gradient(165deg, #f4b66a, #e07a6f 48%, #9a64b5); } .theme-swatch-ocean { --theme: linear-gradient(165deg, #3d8fd1, #163f72); }
.theme-swatch-forest { --theme: linear-gradient(165deg, #4b9a63, #1b4a3c); } .theme-swatch-dusk { --theme: linear-gradient(165deg, #5b4fa3, #c96f8a); }
.theme-swatch-meadow { --theme: linear-gradient(165deg, #9ccc65, #1f7a62); } .theme-swatch-sand { --theme: linear-gradient(165deg, #ead2a6, #b8875a); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .main:not(.settings-main) { box-shadow: inset 0 0 0 100vmax rgba(0, 0, 0, 0.32); } }
:root[data-theme="dark"] .main:not(.settings-main) { box-shadow: inset 0 0 0 100vmax rgba(0, 0, 0, 0.32); }

/* ---------- Main pane ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.main-header { padding: 18px 28px 8px; color: var(--on-theme); flex: none; }
.title-row { display: flex; align-items: center; gap: 6px; min-height: 40px; }
.title-row h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 10px; }
.title-emoji { font-size: 24px; }
.title-rename input { font-size: 24px; font-weight: 600; background: rgba(255, 255, 255, 0.2); border: 0; border-bottom: 2px solid var(--on-theme); color: var(--on-theme); outline: none; padding: 2px 6px; border-radius: 4px 4px 0 0; min-width: 260px; }
.header-more { color: var(--on-theme); }
.header-more:hover { background: rgba(255, 255, 255, 0.2); color: var(--on-theme); }
.toolbar { margin-left: auto; display: flex; gap: 4px; }
.tool { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 6px; color: var(--on-theme); font-size: 13px; }
.tool:hover, .tool.active { background: rgba(255, 255, 255, 0.2); }
.subtitle { margin: 2px 0 0; font-size: 13px; color: var(--on-theme-soft); }
.sort-chip { display: inline-flex; align-items: center; gap: 2px; margin-top: 8px; background: rgba(255, 255, 255, 0.22); border-radius: 14px; padding: 2px 4px 2px 10px; font-size: 12px; }
.sort-chip button { color: var(--on-theme); display: flex; align-items: center; gap: 4px; padding: 3px; border-radius: 10px; }
.sort-chip button:hover { background: rgba(255, 255, 255, 0.2); }
.mobile-back { display: none; }

.add-task { margin: 8px 28px 6px; background: var(--row); border-radius: var(--radius); box-shadow: var(--shadow-row); flex: none; opacity: 0.92; transition: opacity 0.15s; }
.add-task.focused, .add-task:focus-within { opacity: 1; }
.add-row { display: flex; align-items: center; gap: 14px; height: 52px; padding: 0 16px; }
.add-icon { width: 20px; display: grid; place-items: center; color: var(--brand-text); }
.add-icon .ring { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--text-3); }
.add-row input { flex: 1; border: 0; outline: none; background: none; font-size: 14px; min-width: 0; }
.add-row input::placeholder { color: var(--brand-text); }
.add-task.focused .add-row input::placeholder, .add-task:focus-within .add-row input::placeholder { color: var(--text-3); }
.add-tools { display: none; align-items: center; gap: 2px; padding: 4px 10px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.add-task.focused .add-tools, .add-task:focus-within .add-tools { display: flex; }
.add-tool { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border-radius: 4px; color: var(--text-2); font-size: 12px; }
.add-tool:hover { background: rgba(127, 127, 127, 0.14); }
.add-tool.set { color: var(--brand-text); }
.add-submit { margin-left: auto; height: 28px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); font-size: 12px; font-weight: 600; }

.task-scroll { flex: 1; overflow-y: auto; padding: 0 28px 28px; }
.task-list { display: grid; gap: 2px; }
.task { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 6px 12px 6px 16px; background: var(--row); border-radius: var(--radius); box-shadow: var(--shadow-row); cursor: default; user-select: none; }
.task:hover { background: var(--row-hover); }
.task.selected { background: var(--row-selected); }
.task.dragging { opacity: 0.45; }
.task-body { flex: 1; min-width: 0; display: grid; gap: 1px; cursor: pointer; }
.task-title { overflow-wrap: anywhere; }
.task.completed .task-title { text-decoration: line-through; color: var(--text-2); }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; color: var(--text-2); font-size: 12px; }
.meta { display: inline-flex; align-items: center; gap: 4px; }
.meta.due.overdue { color: var(--overdue); }
.meta.due.today { color: var(--brand-text); }
.sep { color: var(--text-3); }
.check { position: relative; width: 22px; height: 22px; display: grid; place-items: center; flex: none; color: var(--brand); }
.check .ring { position: absolute; inset: 2px; border-radius: 50%; border: 1.5px solid var(--text-3); transition: background 0.15s, border-color 0.15s; }
.check .icon { position: relative; opacity: 0; transition: opacity 0.12s; }
.check:hover .icon { opacity: 0.7; }
.check:hover .ring { border-color: var(--brand); }
.check[aria-checked="true"] .ring { background: var(--brand); border-color: var(--brand); }
.check[aria-checked="true"] .icon { opacity: 1; color: var(--brand-contrast); }
.check.small { width: 18px; height: 18px; }
.check.small .ring { inset: 1px; }
.star { color: var(--text-3); width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; flex: none; }
.star:hover { color: var(--brand); background: rgba(127, 127, 127, 0.1); }
.star.on { color: var(--brand); }
.category { padding: 0 6px 0 2px; border-radius: 9px; }
.category i, .category-chip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--cat); }
.cat-blue { --cat: #3b82f6; } .cat-green { --cat: #22a06b; } .cat-orange { --cat: #f08c2e; } .cat-purple { --cat: #9b59d0; } .cat-red { --cat: #e5484d; } .cat-yellow { --cat: #e3b40c; }
.category-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; margin: 2px 6px 2px 0; border-radius: 12px; background: color-mix(in srgb, var(--cat) 16%, transparent); color: var(--text); font-size: 12px; }
.section-toggle { display: inline-flex; align-items: center; gap: 8px; margin: 14px 0 8px; padding: 5px 12px 5px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.18); color: var(--on-theme); font-weight: 600; font-size: 13px; }
.section-toggle:hover { background: rgba(0, 0, 0, 0.26); }
.theme-sand .section-toggle { background: rgba(255, 255, 255, 0.45); }
.section-count { font-weight: 400; opacity: 0.85; }
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; color: var(--on-theme); padding: 64px 24px; }
.empty .icon { opacity: 0.85; }
.empty h2 { margin: 8px 0 0; font-size: 18px; font-weight: 600; }
.empty p { margin: 0; max-width: 340px; color: var(--on-theme-soft); }
.empty.small { color: var(--text-2); padding: 32px 12px; }
.empty.small p { color: var(--text-2); }

/* ---------- Details pane ---------- */
.detail { width: var(--detail-width); flex: none; background: var(--page); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.detail-scroll { flex: 1; overflow-y: auto; padding: 16px; display: grid; align-content: start; gap: 8px; }
.detail-card { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.detail-card.head { padding: 10px 6px 4px 12px; }
.detail-title-row { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; }
.detail-title-row .check { margin-top: 4px; }
.detail-title { flex: 1; border: 0; background: none; resize: none; outline: none; font-size: 18px; font-weight: 600; line-height: 1.35; padding: 3px 0; min-height: 30px; overflow: hidden; }
.detail-title-row.completed .detail-title { text-decoration: line-through; color: var(--text-2); }
.steps { list-style: none; margin: 0; padding: 0; }
.step { display: flex; align-items: center; gap: 10px; min-height: 40px; padding-left: 2px; border-bottom: 1px solid var(--line); }
.step-title { flex: 1; border: 0; background: none; outline: none; min-width: 0; padding: 6px 0; }
.step.completed .step-title { text-decoration: line-through; color: var(--text-2); }
.step .icon-button { opacity: 0; }
.step:hover .icon-button, .step .icon-button:focus-visible { opacity: 1; }
.add-step { display: flex; align-items: center; gap: 12px; min-height: 42px; color: var(--brand-text); padding-left: 1px; }
.add-step input { flex: 1; border: 0; outline: none; background: none; min-width: 0; }
.add-step input::placeholder { color: var(--brand-text); }
.add-step input:focus::placeholder { color: var(--text-3); }
.detail-row { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: 0; }
.detail-button { flex: 1; display: flex; align-items: center; gap: 16px; min-height: 52px; padding: 10px 14px; text-align: left; color: var(--text-2); }
.detail-button:hover { background: var(--surface-2); }
.detail-row.set .detail-button { color: var(--brand-text); }
.detail-text { flex: 1; display: flex; flex-wrap: wrap; align-items: center; }
.detail-row .clear { margin-right: 8px; }
.note-card { padding: 4px; }
.note { width: 100%; border: 0; outline: none; background: none; resize: none; min-height: 110px; padding: 10px; line-height: 1.5; overflow: hidden; }
.created-by { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12px; margin: 4px 4px; }
.detail-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 12px; }
.suggestions-head { display: flex; align-items: center; justify-content: space-between; }
.suggestions h2 { margin: 0; font-size: 18px; }
.suggestions h3 { margin: 12px 0 4px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.suggestion-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.suggestion-list li { display: flex; align-items: center; gap: 8px; padding: 8px 6px 8px 12px; background: var(--surface); border-radius: 4px; border: 1px solid var(--line); }
.suggestion-list li > div { flex: 1; display: grid; min-width: 0; }
.suggestion-list .icon-button { color: var(--brand-text); }

/* ---------- Menus, dialogs, toasts ---------- */
.menu-layer { position: fixed; inset: 0; z-index: 50; }
.menu { position: absolute; min-width: 248px; max-width: min(340px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow-y: auto; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-pop); padding: 4px; border: 1px solid var(--line); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 36px; padding: 6px 10px; border-radius: 4px; text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); }
.menu-item .icon { color: var(--text-2); }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-item .icon-check { color: var(--brand); }
.menu-label { flex: 1; }
.menu-hint { color: var(--text-3); font-size: 12px; }
.icon-space { width: 18px; }
.menu-heading { padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.menu-input { display: flex; align-items: center; gap: 12px; padding: 6px 10px; flex-wrap: wrap; }
.menu-input .icon { color: var(--text-2); }
.menu-input span { flex: 1; }
.menu-input input { width: 100%; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); }
.swatches { display: grid; grid-template-columns: repeat(5, 30px); gap: 8px; padding: 8px 10px; }
.dialog-layer { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.35); display: grid; place-items: center; padding: 16px; }
.dialog { width: min(440px, 100%); background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 22px 22px 18px; }
.dialog h2 { margin: 0 0 8px; font-size: 18px; }
.dialog p { margin: 0 0 12px; color: var(--text-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.repeat-form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field input, .field select { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); min-width: 0; }
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.field.inline { grid-template-columns: auto 80px 1fr; align-items: center; }
.weekday-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span { display: inline-block; padding: 6px 10px; border-radius: 16px; border: 1px solid var(--line-strong); cursor: pointer; text-transform: capitalize; }
.pill input:checked + span { background: var(--brand); color: var(--brand-contrast); border-color: var(--brand); }
.pill input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 70; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px; background: #26302d; color: #f2f6f4; box-shadow: var(--shadow-pop); pointer-events: auto; animation: rise 0.2s ease-out; }
.toast.muted { background: var(--surface); color: var(--text-2); border: 1px solid var(--line); }
.toast span { flex: 1; }
.toast button { color: #8ee0c5; font-weight: 600; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Settings ---------- */
.settings-main { background: var(--page); --on-theme: var(--text); --on-theme-soft: var(--text-2); }
.settings-header { border-bottom: 1px solid var(--line); padding-bottom: 0; }
.tabs { display: flex; gap: 4px; margin-top: 10px; overflow-x: auto; }
.tab { display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand-text); border-bottom-color: var(--brand); font-weight: 600; }
.settings-body { flex: 1; overflow-y: auto; padding: 20px 28px 48px; }
.settings-body > * { max-width: 760px; }
.lead { color: var(--text-2); font-size: 15px; margin: 0 0 16px; }
.settings-section { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 14px; display: grid; gap: 10px; justify-items: start; }
.settings-section > * { margin: 0; }
.settings-section h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.settings-section h2 .icon { color: var(--brand-text); }
.settings-section h3 { font-size: 14px; margin-top: 6px; }
.switch-row, .select-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 36px; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 40px; height: 22px; border-radius: 11px; background: var(--line-strong); position: relative; flex: none; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch-row input:checked + .switch { background: var(--brand); }
.switch-row input:checked + .switch::after { transform: translateX(18px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--brand); outline-offset: 2px; }
.select-row select { padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); }
.copy-field { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.copy-field code { flex: 1; overflow-x: auto; white-space: nowrap; }
.copy-field.small code { font-size: 12px; color: var(--text-2); }
.item-list { list-style: none; padding: 0; width: 100%; display: grid; }
.item-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.item-list li > div { display: grid; gap: 2px; min-width: 0; }
.item-list li span { color: var(--text-2); font-size: 12px; }
.item-list li strong { display: inline-flex; align-items: center; gap: 6px; }
.settings-form { display: grid; gap: 12px; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.settings-form.inline { grid-template-columns: 1fr auto; align-items: end; background: none; border: 0; padding: 0; }
.choice { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.choice legend { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; padding: 0; }
.choice label, .check-row { display: flex; align-items: center; gap: 8px; }
.list-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-left: 24px; }
.choice:has(input[value="all"]:checked) .list-checks { display: none; }
.secret-box { width: 100%; padding: 14px; border-radius: 8px; background: var(--brand-soft); display: grid; gap: 10px; }
.secret-box p { margin: 0; font-weight: 600; }
.secret { display: block; padding: 10px; border-radius: 6px; background: var(--surface); word-break: break-all; user-select: all; }
.codes { margin: 0; padding-left: 24px; columns: 2; gap: 24px; }
.codes li { margin: 4px 0; }
.codes code { font-size: 14px; letter-spacing: 0.04em; }
.activity { list-style: none; padding: 0; width: 100%; display: grid; }
.activity li { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.activity .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity time { color: var(--text-3); font-size: 12px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.links { font-size: 13px; }

/* ---------- Sign-in ---------- */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 520px) 1fr; background: var(--page); }
.signin .drag-strip.wide { position: fixed; top: 0; left: 0; right: 0; height: 40px; }
.signin-card { padding: 56px 48px; display: grid; align-content: center; gap: 18px; }
.signin-card h1 { font-size: 28px; line-height: 1.2; margin: 8px 0 0; letter-spacing: -0.015em; }
.signin-card .lead { margin: 0; }
.lockup { display: flex; align-items: center; gap: 12px; }
.wordmark { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.brand-tile { border-radius: 10px; }
.auth-form { display: grid; gap: 12px; max-width: 380px; }
.footer-links { font-size: 13px; margin-top: 16px; }
.signin-art { background: linear-gradient(165deg, #179a7e 0%, #0a6551 100%); display: grid; place-items: center; padding: 48px; overflow: hidden; }
.art-window { width: min(460px, 100%); background: linear-gradient(165deg, #f4b66a 0%, #e07a6f 48%, #9a64b5 100%); border-radius: 14px; padding: 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3); display: grid; gap: 4px; transform: rotate(-2deg); }
.art-title { color: #fff; font-size: 22px; font-weight: 600; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.art-row { display: flex; align-items: center; gap: 12px; background: #fff; color: #1a1d1c; border-radius: 6px; padding: 10px 14px; }
.art-row > span:nth-child(2) { flex: 1; display: grid; }
.art-row small { color: #5d6361; display: inline-flex; align-items: center; gap: 4px; }
.art-row .ring { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #858b89; display: grid; place-items: center; }
.art-row.done .ring { background: #0b7a62; border-color: #0b7a62; color: #fff; }
.art-row.done b { text-decoration: line-through; color: #5d6361; font-weight: 400; }
.art-row b { font-weight: 400; }
.art-row .icon-starFilled { color: #0b7a62; }
.art-agent { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 12px; padding: 6px 4px; opacity: 0.95; }
.art-agent span { font-weight: 700; }
.card-page { max-width: 560px; margin: 8vh auto; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 12px; }
.card-page h1 { font-size: 22px; margin: 4px 0 0; }
.card-page p { margin: 0; }
.brand-row { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.consent fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 0 0 12px; display: grid; gap: 6px; }
.consent legend { font-weight: 600; padding: 0 4px; }
.consent label { display: flex; gap: 8px; align-items: center; }
.list-choices { display: grid; gap: 4px; padding-left: 24px; }
.consent .actions { display: flex; gap: 8px; margin-top: 12px; }
.consent .actions button { padding: 8px 18px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; }
.consent .actions button.primary { background: var(--brand); color: var(--brand-contrast); border-color: transparent; }
.docs-page { max-width: 860px; margin: 0 auto; padding: 32px 24px 64px; }
.docs-page h1 { font-size: 30px; margin: 20px 0 8px; }
.docs-page h2 { margin-top: 32px; }
.docs-page pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow-x: auto; }
.endpoints { width: 100%; border-collapse: collapse; font-size: 13px; }
.endpoints th, .endpoints td { text-align: left; padding: 8px; border-top: 1px solid var(--line); vertical-align: top; }

/* ---------- Narrow screens: one pane at a time, like the phone app ---------- */
@media (max-width: 760px) {
  .sidebar, .main, .detail { width: 100%; border: 0; }
  .app[data-screen="home"] .main, .app[data-screen="home"] .detail { display: none; }
  .app[data-screen="main"] .sidebar, .app[data-screen="main"] .detail { display: none; }
  .app[data-screen="detail"] .sidebar, .app[data-screen="detail"] .main { display: none; }
  .sidebar { padding-top: env(safe-area-inset-top); background: var(--page); }
  .nav-item, .group-header { height: 48px; font-size: 16px; }
  .sidebar-bottom { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .main-header { padding: calc(8px + env(safe-area-inset-top)) 16px 8px; }
  .mobile-back { display: inline-flex; align-items: center; gap: 2px; color: var(--on-theme); margin: 0 0 6px -6px; padding: 6px 6px 6px 0; font-size: 15px; }
  .detail .mobile-back { color: var(--brand-text); margin: 0 0 4px -6px; }
  .title-row h1 { font-size: 28px; }
  .tool span { display: none; }
  .task-scroll { padding: 0 12px 16px; }
  .add-task { margin: 0; border-radius: 0; opacity: 1; padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -1px 0 var(--line); }
  .detail { background: var(--page); }
  .detail-scroll { padding: calc(10px + env(safe-area-inset-top)) 12px 16px; }
  .detail-footer { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .step .icon-button { opacity: 1; }
  .settings-body { padding: 16px 12px 40px; }
  .activity li { grid-template-columns: 1fr; gap: 2px; }
  .codes { columns: 1; }
  .signin { grid-template-columns: 1fr; }
  .signin-art { display: none; }
  .signin-card { padding: calc(32px + env(safe-area-inset-top)) 20px 32px; align-content: start; }
  .menu { min-width: min(280px, calc(100vw - 16px)); }
  .menu-item { min-height: 44px; }
}

@media print {
  .sidebar, .detail, .add-task, .toolbar, .header-more, .toasts, .agent-banner, .mobile-back { display: none !important; }
  .app, .layout, .main, .task-scroll { height: auto; overflow: visible; display: block; background: none !important; box-shadow: none !important; }
  .main-header { color: #000; }
  .task { box-shadow: none; border-bottom: 1px solid #ccc; border-radius: 0; }
  .section-toggle { color: #000; background: none; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
