/* Reminders — modelled on Apple Reminders. Light and dark follow the device. */
:root {
  --bg: #ffffff;
  --side: #f2f2f7;
  --card: #ffffff;
  --sunk: #f2f2f7;
  --ink: #1c1c1e;
  --ink-2: #3c3c43;
  --ink-3: #8a8a8e;
  --line: #d8d8dc;
  --sep: #e5e5ea;
  --accent: #007aff;
  --red: #ff3b30;
  --orange: #ff9500;
  --ok: #248a3d;
  --ok-tint: #e3f6e8;
  --bad: #d70015;
  --bad-tint: #ffe5e3;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 6px 24px rgb(0 0 0 / .08);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --side: #2c2c2e;
    --card: #2c2c2e;
    --sunk: #3a3a3c;
    --ink: #f2f2f7;
    --ink-2: #d1d1d6;
    --ink-3: #98989f;
    --line: #48484a;
    --sep: #38383a;
    --accent: #0a84ff;
    --red: #ff453a;
    --orange: #ff9f0a;
    --ok: #30d158;
    --ok-tint: #12351d;
    --bad: #ff6961;
    --bad-tint: #3d1715;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 30px rgb(0 0 0 / .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.4 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
.icon { width: 18px; height: 18px; flex: none; }
h1, h2 { margin: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.hint { color: var(--ink-3); font-size: 13.5px; margin: 6px 0 12px; }

/* ---- layout */
.app { display: grid; grid-template-columns: 290px 1fr; min-height: 100vh; min-height: 100dvh; }
.side { background: var(--side); padding: 18px 14px; border-right: 1px solid var(--sep); position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; }
.main { padding: 26px 40px 120px; max-width: 860px; width: 100%; }
.back { display: none; }

/* ---- smart-list tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.tile { position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 6px 4px; padding: 9px 11px 8px; border-radius: 12px; background: var(--card); color: var(--ink); box-shadow: 0 1px 1px rgb(0 0 0 / .04); }
.tile.wide { grid-column: span 2; }
.tile[aria-current] { background: var(--accent); color: #fff; }
.tile[aria-current] .tile-icon { background: #fff !important; color: var(--accent); }
.tile[aria-current] .tile-label { color: #fff; }
.tile-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.tile-icon .icon { width: 17px; height: 17px; }
.tile-day { font-weight: 700; font-size: 13px; }
.tile-n { font-size: 24px; font-weight: 700; line-height: 30px; text-align: right; }
.tile-label { grid-column: span 2; font-weight: 600; color: var(--ink-3); font-size: 14px; }

.side-h { font-size: 13px; font-weight: 700; color: var(--ink-3); margin: 22px 8px 6px; }
.lists { display: grid; gap: 1px; }
.lists a { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; color: var(--ink); }
.lists a:hover { background: rgb(127 127 127 / .1); }
.lists a[aria-current] { background: rgb(127 127 127 / .2); }
.list-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.list-dot .icon { width: 14px; height: 14px; }
.list-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-n { color: var(--ink-3); font-variant-numeric: tabular-nums; }

.add-list { margin: 6px 0 0; }
.add-list summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--ink-3); padding: 8px; border-radius: 8px; font-weight: 500; }
.add-list summary::-webkit-details-marker { display: none; }
.add-list summary:hover { color: var(--accent); }
.add-list form { padding: 6px 8px 10px; }
.side-foot { margin-top: auto; padding-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-foot a { display: flex; align-items: center; gap: 6px; color: var(--ink-2); padding: 6px 8px; border-radius: 8px; }
.side-foot a[aria-current] { background: rgb(127 127 127 / .2); }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; background: var(--sw); position: relative; cursor: pointer; }
.swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch:has(input:checked) { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--sw); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; }

/* ---- list page */
.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.list-head h1 { font-size: 32px; font-weight: 700; letter-spacing: -.01em; }
.list-count { font-size: 32px; font-weight: 600; font-variant-numeric: tabular-nums; }
.list-tools { display: flex; gap: 18px; align-items: flex-start; font-size: 14px; margin: 2px 0 8px; }
.edit-list summary { list-style: none; cursor: pointer; color: var(--accent); }
.edit-list summary::-webkit-details-marker { display: none; }
.edit-list form { margin-top: 10px; width: min(360px, 90vw); }
.section { font-size: 19px; font-weight: 700; margin: 22px 0 2px; }
.section.overdue { color: var(--red); }
.empty { color: var(--ink-3); text-align: center; font-size: 20px; margin: 70px 0; }

.rems { list-style: none; margin: 0; padding: 0; }
.rem { display: flex; align-items: flex-start; gap: 12px; padding: 9px 0 0; position: relative; transition: opacity .35s, transform .35s; }
.rem-body { flex: 1; min-width: 0; padding-bottom: 9px; border-bottom: 1px solid var(--sep); cursor: pointer; }
.rem-tools { display: flex; align-items: center; gap: 2px; align-self: stretch; padding-bottom: 9px; border-bottom: 1px solid var(--sep); }
.rem-title { overflow-wrap: anywhere; }
.prio { color: var(--c); font-weight: 700; }
.rem-notes { color: var(--ink-3); font-size: 13.5px; white-space: pre-line; margin-top: 1px; }
.rem-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }
.due.overdue { color: var(--red); }
.repeat { display: inline-flex; align-items: center; gap: 3px; }
.repeat .icon { width: 13px; height: 13px; }
.rem-url { color: var(--accent); }
.flag { color: var(--orange); width: 16px; height: 16px; margin-right: 4px; }
.tool { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--ink-3); padding: 6px; border-radius: 7px; cursor: pointer; opacity: 0; transition: opacity .15s; font-size: 13px; }
.tool .icon { width: 18px; height: 18px; }
.tool.tomorrow span { display: none; }
.rem:hover .tool, .rem:focus-within .tool, .tool:focus-visible { opacity: 1; }
.tool:hover { background: rgb(127 127 127 / .12); color: var(--accent); }
.tool.info:hover { color: var(--accent); }
@media (hover: none) { .tool { opacity: 1; } }

/* The round complete button */
.radio { flex: none; width: 22px; height: 22px; margin-top: 0; border-radius: 50%; border: 1.6px solid var(--line); background: none; padding: 0; display: grid; place-items: center; cursor: pointer; color: transparent; transition: background .15s, border-color .15s; position: relative; }
.radio::after { content: ""; position: absolute; inset: -10px; }  /* bigger tap target */
.radio .icon { width: 13px; height: 13px; }
.radio:hover { border-color: var(--c, var(--accent)); }
.radio[aria-pressed="true"] { background: var(--c, var(--accent)); border-color: var(--c, var(--accent)); color: #fff; }
.radio[aria-pressed="true"]::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; }
.rem.done .rem-title .t { color: var(--ink-3); }
.rem.leaving { opacity: 0; transform: translateX(8px); }
.radio.ghost { border-style: dashed; cursor: default; }

.quick-add { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--sep); }
.quick-add input { flex: 1; border: 0; background: none; padding: 4px 0; outline: none; min-width: 0; }
.quick-add input::placeholder { color: var(--ink-3); }
.quick-add .btn { opacity: 0; pointer-events: none; transition: opacity .15s; }
.quick-add:focus-within .btn { opacity: 1; pointer-events: auto; }

/* ---- forms, cards, buttons */
.card { background: var(--card); border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow); margin: 0 0 18px; }
.card h2 { font-size: 18px; margin-bottom: 4px; }
.sub-h { margin-top: 24px !important; }
.stack { display: grid; gap: 12px; }
.field-row { display: flex; gap: 12px; align-items: flex-end; }
.field-row.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 200px; }
.narrow { max-width: 200px; }
label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg);
  font-size: 16px; font-weight: 400; color: var(--ink); min-height: 42px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; min-height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-danger { color: var(--bad); }
.btn-sm { min-height: 32px; padding: 5px 12px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: default; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }
.link-btn.strong { font-weight: 700; }
.row-between { display: flex; justify-content: space-between; gap: 10px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-family: var(--mono); font-size: 14px !important; }

.flashes { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: 10px; background: var(--sunk); font-weight: 400; font-size: 14px; margin: 0; }
.flash-ok { background: var(--ok-tint); color: var(--ok); }
.flash-bad { background: var(--bad-tint); color: var(--bad); }

table.kv { width: 100%; border-collapse: collapse; margin: 6px 0 10px; }
table.kv th { text-align: left; font-weight: 500; padding: 9px 0; border-top: 1px solid var(--sep); }
table.kv td { padding: 9px 0; border-top: 1px solid var(--sep); }
.r { text-align: right; }
.more summary { cursor: pointer; color: var(--accent); font-size: 14px; margin: 4px 0; }
.steps { padding-left: 20px; margin: 8px 0; display: grid; gap: 6px; font-size: 14px; color: var(--ink-2); }

/* ---- sign-in */
.center { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px 16px; }
.login-card { width: 100%; max-width: 380px; display: grid; gap: 14px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 700; }
.brand img { border-radius: 10px; }

/* ---- password show/hide */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 68px !important; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 34px; padding: 0 12px; border: 0; border-radius: 7px; background: none; color: var(--accent); font-size: 14px; font-weight: 600; cursor: pointer; }

/* ---- details sheet */
.sheet { border: 0; padding: 0; border-radius: 16px; width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); background: var(--side); color: var(--ink); box-shadow: var(--shadow); }
.sheet::backdrop { background: rgb(0 0 0 / .35); }
.sheet form { padding: 14px 16px 18px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { font-size: 16px; }
.group { background: var(--card); border-radius: 12px; padding: 4px 12px; display: grid; }
.group > input, .group > textarea { border: 0 !important; box-shadow: none !important; background: none !important; padding: 9px 0 !important; border-radius: 0 !important; }
.group > * + * { border-top: 1px solid var(--sep) !important; }
.group .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; font-weight: 400; font-size: 15px; color: var(--ink); }
.group .row input, .group .row select { width: auto; min-height: 34px; padding: 4px 8px; background: var(--sunk); border-color: transparent; }
.group-hint { margin: 6px 0; font-size: 12.5px; }
.seg { display: inline-flex; background: var(--sunk); border-radius: 9px; padding: 2px; }
.seg label { display: block; font-weight: 500; font-size: 13px; color: var(--ink); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 5px 9px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.seg input:checked + span { background: var(--card); box-shadow: 0 1px 3px rgb(0 0 0 / .15); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.switch { appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .2s; }
.switch:checked { background: var(--orange); }
.switch:checked::after { transform: translateX(18px); }
.sheet-actions { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---- in-page pop-ups */
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 10px; z-index: 50; width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; display: grid; gap: 8px; border-left: 4px solid var(--c, var(--accent)); animation: pop .25s ease-out; }
.toast-title { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.toast-title .icon { color: var(--c, var(--accent)); }
.toast-sub { color: var(--ink-3); font-size: 13.5px; }
.toast-actions { display: flex; gap: 8px; justify-content: flex-end; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }

/* ---- phone */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: max(14px, env(safe-area-inset-top)) 16px 110px; }
  .back { display: inline-flex; align-items: center; gap: 2px; font-size: 17px; margin: 0 0 8px -6px; }
  .back .icon { width: 22px; height: 22px; }
  .home { margin: 0 -2px; }
  .home .tiles { gap: 11px; }
  .home .tile { padding: 11px 12px 10px; }
  .home .lists { background: var(--card); border-radius: 12px; padding: 4px 10px; }
  .home .lists a { padding: 10px 2px; border-radius: 0; }
  .home .lists a + a { border-top: 1px solid var(--sep); }
  .home .side-foot { margin-top: 22px; }
  body:has(.home) { background: var(--side); }
  body:has(.home) .back { display: none; }
  .list-head h1, .list-count { font-size: 30px; }
  .tool.tomorrow span { display: inline; }
  .toasts { left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); width: auto; }
  .card { padding: 16px; }
}
