/* The shared Home page, "Hearth" (v1.68.0): warm paper, deep teal ink, terracotta for today. One colour carries the brand; colour elsewhere
   means something (today, late, done, the open tab). Light and dark follow the phone. */
:root {
  --bg: #FBF7F1; --surface: #F3EDE4; --card: #FFFFFF; --text: #1F2A2E; --muted: #857C70; --faint: #BDB3A5; --line: #E8E0D4; --hover: #F5EFE6;
  --accent: #0F6E68; --accent-ink: #0B5752; --accent-soft: rgba(15, 110, 104, .10); --ring: rgba(15, 110, 104, .24);
  --today: #C2410C; --today-bg: #FBE9DD; --late: #B42318; --late-bg: #FDECEA;
  --glass: rgba(251, 247, 241, .74); --glass-line: rgba(232, 224, 212, .9);
  --shadow: 0 1px 2px rgba(60, 44, 20, .05), 0 8px 22px rgba(60, 44, 20, .08); --radius: 14px;
  --wash: radial-gradient(70% 40% at 50% -10%, rgba(15, 110, 104, .07), transparent 70%);
  --title: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1A1816; --surface: #24211E; --card: #2A2623; --text: #EEE7DC; --muted: #A69D90; --faint: #6B635A; --line: #34302B; --hover: #26221F;
          --accent: #3FB5A8; --accent-ink: #7DD3C8; --accent-soft: rgba(63, 181, 168, .14); --ring: rgba(63, 181, 168, .32);
          --today: #F08A5D; --today-bg: rgba(240, 138, 93, .15); --late: #F2786C; --late-bg: rgba(242, 120, 108, .15);
          --glass: rgba(26, 24, 22, .72); --glass-line: rgba(255, 255, 255, .05);
          --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 26px rgba(0, 0, 0, .35);
          --wash: radial-gradient(70% 40% at 50% -10%, rgba(63, 181, 168, .10), transparent 70%); }
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--text); background: var(--wash), var(--bg); background-attachment: fixed; min-height: 100vh;
       font: 17px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Segoe UI", "Helvetica Neue", sans-serif;
       -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; letter-spacing: .005em; -webkit-tap-highlight-color: transparent; }
main { max-width: 680px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); font-size: .8em; }
.pad { padding: 24px 0; }

/* ---- sign in ---- */
.signin { max-width: 22rem; margin: 14vh auto 0; }
.signin h1 { font-family: var(--title); font-size: 2.3em; font-weight: 600; letter-spacing: -.01em; margin: 0 0 .15em; color: var(--text); }
.signin label { display: block; margin: 1.1em 0 .35em; font-weight: 600; font-size: .85em; color: var(--muted); }
.signin input { width: 100%; padding: .75em .9em; font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 12px; outline: 0; }
.signin input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.signin button { margin-top: 1.6em; width: 100%; padding: .8em; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
.err { color: var(--late); font-size: .9em; }

/* ---- the title bar: frosted glass over the list ---- */
header { position: sticky; top: 0; z-index: 5; margin: 0 -16px; padding: calc(14px + env(safe-area-inset-top)) 16px 12px; background: var(--glass);
         border-bottom: 1px solid var(--glass-line); -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px); }
.title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.title h1 { font-family: var(--title); font-size: 2.15em; font-weight: 600; letter-spacing: -.01em; margin: 0; color: var(--text); }
.title h1::after { content: ""; display: inline-block; width: .32em; height: .32em; margin-left: .12em; border-radius: 50%; background: var(--today); vertical-align: .08em; }
.signout { color: var(--muted); font-size: .8em; text-decoration: none; cursor: pointer; }
.tabs { display: inline-flex; gap: 2px; margin-top: 10px; padding: 3px; background: var(--surface); border-radius: 11px; }
.tab { background: none; border: 0; padding: 6px 16px; border-radius: 9px; font-weight: 600; font-size: .92em; color: var(--muted); cursor: pointer; }
.tab.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(60, 44, 20, .12); }
.tab .n { margin-left: .4em; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.tab.on .n { color: var(--accent); }
.fresh { text-align: center; margin: 28px 0 0; color: var(--faint); }

/* ---- the add card: apart from the list ---- */
.addcard { margin: 14px 0 20px; padding: 4px 14px 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); transition: box-shadow .15s, border-color .15s; }
.addcard:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.add { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.add .plus { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 600; font-size: 18px; line-height: 23px; text-align: center; }
.add input { flex: 1; min-width: 0; font: inherit; color: var(--text); background: transparent; border: 0; outline: 0; padding: 8px 0; }
.add input::placeholder { color: var(--muted); }
.hint { font-size: .74em; color: var(--faint); padding-left: 34px; margin-top: -4px; }
.addcard:not(:focus-within) .hint { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px 34px; }
.chip { font-size: .78em; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); border: 0; cursor: pointer; }

/* ---- groups and rows ---- */
.group { margin-bottom: 22px; }
.group.shut { margin-bottom: 10px; }
h3 { display: flex; align-items: center; gap: 6px; font-size: .95em; font-weight: 700; color: var(--accent-ink); margin: 0 0 4px; padding: 0 0 6px 2px;
     border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; }
h3 .chev { display: inline-block; width: 14px; color: var(--muted); font-size: 1.15em; line-height: 1; transform: rotate(90deg); transition: transform .15s; }
.group.shut h3 .chev { transform: rotate(0deg); }
h3 .name { flex: 1; }
h3 .count { color: var(--muted); font-weight: 600; font-size: .9em; font-variant-numeric: tabular-nums; }
.group:not(.shut) h3 .count { visibility: hidden; }
.row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 6px 6px 4px; border-radius: 10px; transition: background .15s; }
.row:hover { background: var(--hover); }
.row.new { animation: arrive 1.4s ease-out; }
@keyframes arrive { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
.row.leaving { transition: opacity .25s ease, transform .25s ease; opacity: 0; transform: translateX(14px); }
.box { flex: none; width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1.6px solid var(--faint); background: transparent; cursor: pointer; position: relative; transition: background .15s, border-color .15s; }
.box:hover { border-color: var(--accent); }
.box.done, .box.pop { background: var(--accent); border-color: var(--accent); }
.box.done::after, .box.pop::after { content: ""; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.box.pop { animation: pop .38s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.22); box-shadow: 0 0 0 8px var(--ring); } 100% { transform: scale(1); box-shadow: 0 0 0 0 transparent; } }
.box.gone { border-style: dashed; }
.text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; cursor: text; }
.meta { font-size: .76em; color: var(--muted); margin-top: 1px; }
.row.done .text > span:first-child, .row.gone .text > span:first-child { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.due { flex: none; font-size: .76em; font-weight: 600; color: var(--muted); background: var(--surface); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.due.today { color: var(--today); background: var(--today-bg); }
.due.late { color: var(--late); background: var(--late-bg); }
.btns { flex: none; display: flex; white-space: nowrap; user-select: none; }
.btns button { background: none; border: 0; width: 32px; height: 32px; border-radius: 8px; font-size: 1em; line-height: 1; cursor: pointer; color: var(--faint); opacity: 0; transition: opacity .15s, color .15s, background .15s; }
.row:hover .btns button, .btns button:focus-visible { opacity: 1; }
.btns button:hover { background: var(--line); }
.b-menu:hover { color: var(--accent); }
.b-del:hover { color: var(--late); }
@media (hover: none) { .btns button { opacity: .8; } }
.empty { color: var(--faint); font-size: .85em; padding: 10px 0 4px 38px; }
.undo { flex: none; border: 0; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; font-size: .8em; padding: 5px 12px; border-radius: 999px; cursor: pointer; }

/* ---- a row being edited: a card of its own ---- */
.row.editing { background: var(--card); box-shadow: var(--shadow); align-items: flex-start; padding: 10px 12px 10px 8px; margin: 6px -4px; }
.row.editing .box { margin-top: 2px; }
.edit { flex: 1 1 auto; min-width: 0; }
.edit input { width: 100%; font: inherit; color: var(--text); background: transparent; border: 0; outline: 0; padding: 0; }
.edit .chips { margin-left: 0; }

/* ---- the @ list ---- */
.at { position: absolute; z-index: 20; left: 16px; right: 16px; max-width: 520px; margin: 0 auto; max-height: 52vh; overflow: auto; background: var(--card); border: 1px solid var(--line);
      border-radius: 14px; box-shadow: 0 14px 40px rgba(40, 28, 10, .18); padding: 6px; }
.at div { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 9px; cursor: pointer; }
.at div.sel, .at div:hover { background: var(--accent-soft); }
.at .drill { color: var(--accent); font-weight: 700; font-size: 1.3em; line-height: 1; padding: 0 4px 0 12px; }
.datepick { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }

/* ---- the Undo bar at the bottom ---- */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 30; width: max-content; max-width: calc(100% - 32px);
         display: flex; align-items: center; gap: 16px; padding: 12px 14px 12px 18px; border-radius: 14px; background: #24302F; color: #F3EEE6; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-size: .92em; }
.toast button { border: 0; background: none; color: #8FE0D5; font-weight: 700; padding: 2px 4px; cursor: pointer; }
.toast[hidden] { display: none; }

/* ---- a phone: larger type (v1.66.0) ---- */
@media (max-width: 600px) {
  body { font-size: 19px; }
  .title h1 { font-size: 2em; }
  .tab { font-size: .9em; padding: 7px 16px; }
  h3 { font-size: .92em; }
  .row { min-height: 50px; gap: 13px; }
  .box { width: 24px; height: 24px; }
  .box.done::after, .box.pop::after { left: 8px; top: 3.5px; width: 5.5px; height: 11px; }
  .due { font-size: .74em; }
  .meta { font-size: .76em; }
  .hint, .empty { font-size: .78em; }
  .chip { font-size: .76em; }
  .at div { padding: 12px; }
  .undo { font-size: .78em; }
  .toast { font-size: .9em; }
  .muted { font-size: .78em; }
}
@media (prefers-reduced-motion: reduce) { .box.pop, .row.new { animation: none; } .row.leaving { transition: none; } }
