/* Todoehet — local system fonts, shared colour tokens, mobile first. */
:root {
  color-scheme: light;
  --accent: #24594a;
  --paper: #faf9f5;
  --surface: #ffffff;
  --ink: #202c35;
  --danger: #a52e32;
  --amber: #865500;
  --highlight: #ffe9a8;
  --shadow-ink: #14251e;
  --muted: color-mix(in srgb, var(--ink) 74%, var(--paper));
  --border: color-mix(in srgb, var(--ink) 24%, var(--surface));
  --soft: color-mix(in srgb, var(--accent) 9%, var(--surface));
  --warning-bg: color-mix(in srgb, var(--amber) 12%, var(--surface));
  --danger-bg: color-mix(in srgb, var(--danger) 7%, var(--surface));
  --on-accent: var(--surface);
  --focus: var(--amber);
  --space-1: .25rem; --space-2: .5rem; --space-3: .75rem;
  --space-4: 1rem; --space-6: 1.5rem; --space-8: 2rem; --space-12: 3rem;
  --radius-sm: .5rem; --radius: .75rem; --radius-lg: 1rem;
  --shadow: 0 2px 8px color-mix(in srgb, var(--shadow-ink) 5%, transparent), 0 12px 32px color-mix(in srgb, var(--shadow-ink) 4%, transparent);
  --text-xs: .75rem; --text-sm: .875rem; --text-base: 1rem;
  --text-lg: 1.125rem; --text-xl: 1.5rem; --text-display: clamp(1.75rem, 4vw, 2.5rem);
  font: 400 1rem/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --accent: #a0d4bc; --paper: #121b18; --surface: #1c2823;
    --ink: #e6eee8; --danger: #ffabb0; --amber: #f4ca78;
    --highlight: #66501f; --shadow-ink: #000000;
    --on-accent: var(--paper);
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
header, nav, main { width: 100%; max-width: 64rem; margin-inline: auto; padding: var(--space-4); }
header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-xl); font-weight: 800; letter-spacing: -.04em; text-decoration: none; color: var(--ink); }
.brand .icon, .brand-dot { color: var(--accent); }
.brand-dot { margin-left: -.4rem; }
nav { display: flex; flex-wrap: nowrap; gap: var(--space-1); overflow-x: auto; padding-top: 0; scrollbar-width: thin; }
nav a { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 44px; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); color: var(--muted); font-size: var(--text-sm); font-weight: 600; text-decoration: none; }
nav a:hover, nav a[aria-current="page"] { color: var(--accent); background: var(--soft); }
nav a[aria-current="page"] { box-shadow: inset 0 -2px var(--accent); }
main { padding-top: var(--space-2); padding-bottom: var(--space-12); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: var(--text-display); line-height: 1.15; letter-spacing: -.04em; font-weight: 750; margin-bottom: var(--space-6); }
h2 { font-size: var(--text-lg); line-height: 1.3; letter-spacing: -.015em; font-weight: 700; margin: var(--space-8) 0 var(--space-3); }
p { margin-bottom: var(--space-4); }
small, .note, .muted, .quick-hint { font-size: var(--text-sm); color: var(--muted); }
.eyebrow { font-size: var(--text-xs); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--space-2); }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-width: 44px; min-height: 44px; padding: var(--space-2) var(--space-3); border: 1px solid transparent; border-radius: var(--radius-sm); font: inherit; font-size: var(--text-sm); font-weight: 650; line-height: 1.3; text-decoration: none; cursor: pointer; color: var(--on-accent); background: var(--accent); }
button:hover, .button:hover { background: color-mix(in srgb, var(--accent) 86%, var(--ink)); }
button:disabled { opacity: .55; cursor: not-allowed; }
.secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.secondary:hover { background: var(--soft); color: var(--accent); }
.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 55%, var(--surface)); }
.danger:hover { background: var(--danger-bg); }
.icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; vertical-align: middle; }
input, textarea, select { width: 100%; max-width: 100%; min-height: 44px; font: inherit; line-height: 1.5; padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
label { display: block; margin: var(--space-4) 0; font-size: var(--text-sm); font-weight: 600; }
label > input, label > textarea, label > select { display: block; margin-top: var(--space-2); font-weight: 400; }
textarea { min-height: 6rem; resize: vertical; }
time, input[type="time"], input[type="datetime-local"], .chip { font-variant-numeric: tabular-nums; }
.quick-add { position: sticky; top: 0; z-index: 3; padding: var(--space-4); margin: 0 0 var(--space-6); background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.quick-add label { margin: 0 0 var(--space-2); color: var(--accent); }
.input-row { display: flex; align-items: stretch; gap: var(--space-2); }
.input-row > button { flex-shrink: 0; }
/* Mirror and input share exact text metrics; never add padding to inline marks. */
.field-wrap { position: relative; flex: 1 1 auto; min-width: 0; background: var(--surface); border-radius: var(--radius-sm); }
.field-wrap > input, .highlight-layer { font: inherit; letter-spacing: inherit; line-height: inherit; padding: var(--space-3); border-width: 1px; border-style: solid; }
.field-wrap > input { position: relative; z-index: 1; background: transparent; margin: 0; width: 100%; }
.highlight-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; white-space: pre; color: transparent; border-color: transparent; }
.highlight-layer mark { background: var(--highlight); color: transparent; border-radius: var(--space-1); padding: 0; }
.highlight-layer .literal { background: transparent; text-decoration: underline dotted var(--amber); text-underline-offset: .2em; text-decoration-thickness: 2px; }
.chip { background: var(--soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--surface)); border-radius: var(--radius-sm); padding: var(--space-3); font-size: var(--text-sm); margin: var(--space-3) 0 0; overflow-wrap: anywhere; }
.warning { background: var(--warning-bg); color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--surface)); padding: var(--space-3); border-radius: var(--radius-sm); overflow-wrap: anywhere; }
#quick-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
#quick-chips:empty { display: none; }
.recognition-chip { background: var(--soft); color: var(--accent); border: 1px solid var(--border); border-radius: var(--radius-lg); font-size: var(--text-sm); }
.recognition-chip:hover { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.quick-hint { margin: var(--space-2) 0 0; line-height: 1.4; }
.reminder { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin: var(--space-3) 0; padding: var(--space-4); overflow-wrap: anywhere; }
.reminder .title { color: var(--ink); font-size: var(--text-lg); font-weight: 650; line-height: 1.4; text-decoration: none; }
.reminder .title:hover { color: var(--accent); text-decoration: none; }
.reminder time { display: block; color: var(--muted); font-size: var(--text-base); font-weight: 550; margin-top: var(--space-2); }
.note { white-space: pre-wrap; margin-top: var(--space-3); }
.actions, .actions form { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.actions { border-top: 1px solid color-mix(in srgb, var(--border) 65%, transparent); padding-top: var(--space-3); margin-top: var(--space-4); }
.actions label { margin: 0; }
.actions select { width: auto; margin: 0; font-size: var(--text-sm); padding: var(--space-2); }
.input-row .button-label { display: none; }
.header-note { color: var(--muted); font-size: var(--text-xs); }
.logout-form { margin-top: var(--space-8); }
.action-menu { position: relative; }
.action-menu summary { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-width: 44px; min-height: 44px; padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-size: var(--text-sm); font-weight: 650; cursor: pointer; list-style: none; }
.action-menu summary::-webkit-details-marker { display: none; }
.action-menu summary:hover, .action-menu[open] summary { background: var(--soft); }
.more-menu { margin-left: auto; }
.menu-panel { position: absolute; z-index: 4; right: 0; top: calc(100% + var(--space-2)); display: grid; gap: var(--space-2); width: min(16rem, calc(100vw - 4rem)); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.snooze-menu .menu-panel { left: 50%; right: auto; transform: translateX(-50%); }
.menu-panel .button, .menu-panel button { width: 100%; justify-content: flex-start; }
.menu-panel form, .menu-panel label, .menu-panel select { width: 100%; }
.menu-panel .button-label { display: inline; }
.late .reminder { border-left: 3px solid var(--danger); }
.late h2 { color: var(--danger); }
.empty { padding: var(--space-8) var(--space-4); border: 1px dashed var(--border); border-radius: var(--radius-lg); text-align: center; color: var(--muted); }
.empty p:last-child { margin: 0; }
.empty-title { font-size: var(--text-xl); color: var(--ink); font-weight: 650; letter-spacing: -.025em; }
.edit-form, #settings-form { max-width: 40rem; padding: var(--space-4); margin-bottom: var(--space-6); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.checkbox { display: flex; gap: var(--space-2); align-items: center; }
.checkbox input { width: 1.25rem; min-height: 1.25rem; margin: 0; accent-color: var(--accent); }
#settings-result, #notification-result { margin-block: var(--space-3); }
.history { margin-top: var(--space-4); font-size: var(--text-sm); color: var(--muted); }
.history summary { cursor: pointer; min-height: 44px; padding-block: var(--space-3); }
.history ul { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; margin: 0; padding: 0; }
.history li { padding: var(--space-1) var(--space-2); background: var(--soft); border-radius: var(--radius-sm); font-variant-numeric: tabular-nums; }
#undo-bar { position: fixed; z-index: 5; bottom: var(--space-4); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: var(--space-4); max-width: calc(100% - 2rem); padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); color: var(--ink); }
dialog { width: calc(100% - 2rem); max-width: 30rem; padding: var(--space-6); background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
dialog h2 { margin-top: 0; }
dialog::backdrop { background: color-mix(in srgb, var(--shadow-ink) 55%, transparent); }
.login { max-width: 28rem; padding-top: clamp(2rem, 10vh, 7rem); }
.login .brand { margin-bottom: var(--space-12); }
.login form { padding: var(--space-4); border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.login form button { width: 100%; }
.quick-page header, .quick-page main { max-width: 38rem; }
.quick-page main { padding-top: var(--space-8); }
.quick-page .field-wrap { font-size: var(--text-lg); }
.quick-page #quick-submit { width: 100%; margin-top: var(--space-3); }
#quick-saved { padding: var(--space-4); background: var(--soft); color: var(--accent); border: 1px solid var(--border); border-radius: var(--radius); overflow-wrap: anywhere; }
#snooze-sheet:not(dialog) { max-width: 38rem; padding-top: var(--space-8); }
#snooze-sheet:not(dialog) form { display: flex; flex-wrap: wrap; gap: var(--space-2); }
#snooze-sheet:not(dialog) label { flex-basis: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (min-width: 640px) {
  header, nav, main { padding-inline: var(--space-8); }
  header { padding-top: var(--space-6); }
  main { padding-top: var(--space-6); }
  .quick-add { position: relative; padding: var(--space-6); }
  .reminder { padding: var(--space-6); }
  .reminder > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-6); }
  .reminder time { flex-shrink: 0; margin: 0; }
  .actions .button-label, .input-row .button-label { display: inline; }
  .actions .danger { margin-left: 0; }
  .edit-form, #settings-form { padding: var(--space-6); }
}
@media (prefers-reduced-motion: no-preference) {
  button, .button, nav a { transition: background-color 150ms ease, border-color 150ms ease; }
}
