/* To-Do's look, taken unchanged from the approved design
   (prototype/four-lists.html). Additions for the real app are at the end. */
/* Layout: one narrow column, binder-style index tabs in a sticky header; the active tab's color tints the page. */
:root {
  --bg: #eef0f3;
  --surface: #ffffff;
  --ink: #1a1c21;
  --muted: #5f6672;
  --line: #dcdfe5;
  --today: #cf3129;   --today-soft: #fbe4e2;  --today-on: #ffffff;
  --week: #ea7a1e;    --week-soft: #fdeadb;   --week-on: #2a1500;
  --month: #f2c12e;   --month-soft: #fdf3d2;  --month-on: #2e2400;
  --done: #23824a;    --done-soft: #dff1e6;   --done-on: #ffffff;
  --mark: #fff0a8;
  --shadow: 0 1px 2px rgb(20 24 32 / .06), 0 2px 8px rgb(20 24 32 / .05);
  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a; --surface: #1e2127; --ink: #eceef2; --muted: #9ba2ae; --line: #2e323a;
    --today: #f0605a; --today-soft: #3a1e1d; --today-on: #1a0605;
    --week: #f39143;  --week-soft: #3a2716;  --week-on: #1f0e00;
    --month: #f5cd4c; --month-soft: #383015; --month-on: #221a00;
    --done: #4cc07d;  --done-soft: #17301f;  --done-on: #04170b;
    --mark: #6b5a12;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161a; --surface: #1e2127; --ink: #eceef2; --muted: #9ba2ae; --line: #2e323a;
  --today: #f0605a; --today-soft: #3a1e1d; --today-on: #1a0605;
  --week: #f39143;  --week-soft: #3a2716;  --week-on: #1f0e00;
  --month: #f5cd4c; --month-soft: #383015; --month-on: #221a00;
  --done: #4cc07d;  --done-soft: #17301f;  --done-on: #04170b;
  --mark: #6b5a12;
  --shadow: 0 1px 2px rgb(0 0 0 / .4);
  color-scheme: dark;
}

[data-list="today"] { --c: var(--today); --c-soft: var(--today-soft); --c-on: var(--today-on); }
[data-list="week"]  { --c: var(--week);  --c-soft: var(--week-soft);  --c-on: var(--week-on); }
[data-list="month"] { --c: var(--month); --c-soft: var(--month-soft); --c-on: var(--month-on); }
[data-list="done"]  { --c: var(--done);  --c-soft: var(--done-soft);  --c-on: var(--done-on); }

* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 96px;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.wrap { max-width: 680px; margin: 0 auto; }

/* Header */
header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: var(--bg);
  padding-block: 18px 0;
  display: grid; gap: 14px;
}
.topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
h1 {
  font-family: var(--f-display); font-weight: 800; font-size: 1.6rem;
  letter-spacing: -0.02em; margin: 0; line-height: 1.1;
  display: flex; align-items: center; gap: 10px;
}
.swatch { display: inline-grid; grid-template-columns: repeat(4, 7px); gap: 3px; }
.swatch i { width: 7px; height: 20px; border-radius: 2px; background: var(--c); }

.status {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .8rem; font-weight: 500; color: var(--muted);
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status[data-state="live"]::before { background: var(--done); }
.status[data-state="syncing"]::before { background: var(--month); }
.status[data-state="offline"]::before { background: var(--week); }

.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; padding: 11px 40px 11px 38px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.search input:focus { outline: none; border-color: var(--ink); }
.search .clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--muted); padding: 6px 8px; border-radius: 6px;
}
kbd { font: 600 .72rem var(--f-body); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--muted); }

/* Index tabs */
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; align-items: end; }
.tab {
  border: 0; border-radius: 10px 10px 0 0;
  background: var(--c-soft); color: var(--ink);
  padding: 9px 8px 8px; text-align: left;
  display: grid; gap: 2px; min-width: 0;
  border-top: 4px solid var(--c);
  transition: padding .15s ease, background .15s ease;
}
.tab .name { font-family: var(--f-display); font-weight: 600; font-size: .95rem; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab .count { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"] { background: var(--c); color: var(--c-on); padding-top: 14px; }
.tab[aria-selected="true"] .count { color: inherit; opacity: .8; }
.tab.drop { outline: 2px dashed var(--c); outline-offset: -4px; }
.rule { height: 4px; background: var(--c); border-radius: 0 0 4px 4px; }
.searching .tab[aria-selected="true"] { background: var(--c-soft); color: var(--ink); padding-top: 9px; }
.searching .rule { background: var(--line); }

/* Main */
main { display: grid; gap: 18px; padding-top: 18px; }
.addrow { display: flex; gap: 8px; }
.addrow input {
  flex: 1; min-width: 0; padding: 12px 14px;
  border: 1px solid var(--line); border-left: 4px solid var(--c);
  border-radius: 10px; background: var(--surface);
}
.addrow input:focus { outline: none; border-color: var(--c); }
.btn {
  border: 0; border-radius: 10px; padding: 0 16px; font-weight: 600;
  background: var(--c); color: var(--c-on); white-space: nowrap;
}
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 8px 14px; }
.btn.ghost.armed { background: var(--today); color: var(--today-on); border-color: var(--today); }

.group { display: grid; gap: 8px; }
.group h2 {
  margin: 0; font-family: var(--f-display); font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.group h2::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

ul.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  background: var(--surface); border-radius: 10px; padding: 10px 10px 10px 12px;
  box-shadow: var(--shadow);
}
.item.dragging { opacity: .45; }
.check {
  width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--c);
  background: transparent; padding: 0; display: grid; place-items: center; color: var(--c-on);
}
.check:hover { background: var(--c-soft); }
.item[data-list="done"] .check { background: var(--c); }
.check svg { display: none; }
.item[data-list="done"] .check svg { display: block; }

.body { min-width: 0; display: grid; gap: 1px; }
.text {
  border: 0; background: none; padding: 0; text-align: left;
  overflow-wrap: anywhere; cursor: text; font-size: 1rem;
}
.item[data-list="done"] .text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.edit { width: 100%; padding: 4px 6px; margin: -5px -7px; border: 1px solid var(--c); border-radius: 6px; background: var(--surface); }
.edit:focus { outline: none; }
.meta { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }

.actions { display: flex; align-items: center; gap: 4px; }
.mv {
  width: 26px; height: 26px; border-radius: 50%; padding: 0;
  border: 2px solid var(--c); background: transparent;
  font: 700 .7rem var(--f-body); color: var(--muted);
  display: grid; place-items: center;
}
.mv:hover { background: var(--c-soft); color: var(--ink); }
.mv[aria-current="true"] { background: var(--c); color: var(--c-on); cursor: default; }
.del {
  width: 30px; height: 30px; border: 0; background: none; color: var(--muted);
  border-radius: 8px; display: grid; place-items: center; margin-left: 2px;
}
.del:hover { background: var(--today-soft); color: var(--today); }

.empty {
  border: 2px dashed var(--line); border-radius: 12px; padding: 22px 18px;
  color: var(--muted); text-align: center; text-wrap: balance;
}
.empty strong { display: block; color: var(--ink); font-family: var(--f-display); font-size: 1.05rem; font-weight: 600; margin-bottom: 4px; }
.footrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: .85rem; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  max-width: calc(100% - 32px);
  background: var(--ink); color: var(--bg);
  border-radius: 12px; padding: 10px 10px 10px 16px;
  display: flex; align-items: center; gap: 14px; z-index: 20;
  box-shadow: 0 6px 24px rgb(0 0 0 / .25);
}
.toast button { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; padding: 6px 8px; }

@media (max-width: 460px) {
  h1 { font-size: 1.35rem; }
  .tab .name { font-size: .82rem; }
  .item { grid-template-columns: auto minmax(0, 1fr); }
  .actions { grid-column: 2; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* --- Additions for the real app ------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; }
a.status { text-decoration: none; }
.status[data-state="signedout"]::before { background: var(--today); }
.status[data-state="signedout"] { color: var(--ink); cursor: pointer; }
noscript p { margin: 24px 0; }

/* The sign-in page, in the same palette */
.login { max-width: 360px; margin: 0 auto; padding-top: 12vh; display: grid; gap: 16px; text-align: center; }
.login h1 { justify-content: center; font-size: 1.8rem; }
.login form { display: grid; gap: 12px; text-align: left; }
.login label.field { font-weight: 600; font-size: .9rem; }
.login input[type=password] {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-left: 4px solid var(--today); border-radius: 10px; background: var(--surface);
}
.login input[type=password]:focus { outline: none; border-color: var(--today); }
.login .trust { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .9rem; }
.login .btn { padding: 12px 16px; background: var(--today); color: var(--today-on); }
.login .error { color: var(--today); font-weight: 600; margin: 0; }

/* No tick box on the left (Mike, 2026-10-19): the row is text, then buttons.
   On a Done task the green ¹3 is live -- it sends the task back. */
.item { grid-template-columns: minmax(0, 1fr) auto; padding-left: 14px; }
.mv.undone { cursor: pointer; }
.mv.undone:hover { background: var(--c-soft); color: var(--ink); }
@media (max-width: 460px) {
  .item { grid-template-columns: minmax(0, 1fr); }
  .actions { grid-column: 1; }
}

/* Work Hours / After Hours (Mike, 2026-10-19). Each section: heading, its own
   add box, then its tasks in Mike's order (new tasks join the bottom). */
main { gap: 26px; }
.sect { gap: 10px; }
.sect + .sect { border-top: 1px dashed var(--line); padding-top: 18px; }
.placeholder {
  list-style: none; border: 2px dashed var(--line); border-radius: 10px;
  padding: 12px 14px; color: var(--muted); font-size: .9rem;
}
ul.items:has(.drop-line) .placeholder { display: none; }
.footrow.hint { font-size: .8rem; }

/* Dragging a task: the row lifts and follows the finger, a colored line shows
   where it will land, the row it came from stays as a faint outline. */
.item { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.item .edit { -webkit-user-select: text; user-select: text; }
@media (pointer: fine) { .item { cursor: grab; } }
.ghost {
  position: fixed; left: 0; top: 0; z-index: 30; margin: 0; pointer-events: none;
  list-style: none; box-shadow: 0 10px 28px rgb(0 0 0 / .25); opacity: .96;
}
.drop-line { list-style: none; height: 4px; border-radius: 2px; background: var(--c); margin: -1px 0; }
.is-dragging, .is-dragging * { cursor: grabbing !important; }
.is-dragging .tab { transition: none; }

/* "hidden" must win over any display rule (.toast is display:flex). The design
   had this in its claude.ai page wrapper, which wasn't copied; without it the
   empty note box stayed on screen as a black blob (Mike, 2026-10-19). */
[hidden] { display: none !important; }
