/* Ripple List: the Version 2 design system (claude/capture-cards-design.md, section 5).
   Fonts are served from this app (SIL Open Font License, see ../fonts/*-OFL.txt). */

@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/fraunces-latin-500-normal.2285bacdef39.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/fraunces-latin-600-normal.b8dca52ca5f9.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/instrument-sans-latin-400-normal.c178fc5e2d41.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/instrument-sans-latin-500-normal.552cbb998bb6.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/instrument-sans-latin-600-normal.36a59be54659.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/jetbrains-mono-latin-500-normal.a21e038a03f7.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/jetbrains-mono-latin-600-normal.075ec35bc15b.woff2") format("woff2"); }

:root {
  color-scheme: light;

  /* Neutrals */
  --paper: #F4F1EA;
  --surface: #FFFFFF;
  --surface-raised: #FBFAF6;
  --surface-sunken: #E9E4D8;
  --ink: #1F1E1B;
  --ink-muted: #5E5A52;
  --ink-soft: #3F3C36;
  --placeholder: #7A7468;
  --hairline: #E2DCCF;
  --field-border: #D9D2C3;
  --dashed-border: #BDB4A2;
  --scrim: rgba(31, 30, 27, 0.45);
  --urgent: #8A4F07;
  --on-deep: #FFFFFF;   /* text on a card colour, a selected chip or a button */
  --on-ink: #FFFFFF;    /* text on ink: the Capture button, toasts */
  --shadow: 0 6px 16px rgba(31, 30, 27, 0.22);
  --hero-sky: #E3EBE4;
  --hero-sun: #F2DFAA;

  /* One colour per card: deep for text, icons and buttons; tint for fills */
  --med: #A8325A;     --med-tint: #F7E1E8;
  --todo: #2B5B9E;    --todo-tint: #DFE8F5;
  --note: #8A5F00;    --note-tint: #F6EACB;
  --thought: #6A45A8; --thought-tint: #E9E1F5;
  --golf: #2D6A4A;    --golf-tint: #DDEBE2;
  --buy: #B24E14;     --buy-tint: #F8E3D4;
  --list: #1D6B73;    --list-tint: #D8ECEE;
  --inbox: #5E5A52;   --inbox-tint: #E9E4D8;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Dark: chosen in the app (data-theme="dark"), or the device's setting when the
   app is on Auto. Card colours get lighter so they read on dark, and text on
   them turns dark. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1A1917;
  --surface: #24221F;
  --surface-raised: #201E1C;
  --surface-sunken: #121110;
  --ink: #F2EEE6;
  --ink-muted: #B3AC9F;
  --ink-soft: #D6D0C4;
  --placeholder: #8E877B;
  --hairline: #36332E;
  --field-border: #4A463F;
  --dashed-border: #6A645A;
  --scrim: rgba(0, 0, 0, 0.6);
  --urgent: #F0B35A;
  --on-deep: #1A1917;
  --on-ink: #1A1917;
  --shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  --hero-sky: #1F2A23;
  --hero-sun: #D9D3BC;

  --med: #F09BB7;     --med-tint: #3B2229;
  --todo: #93B8F2;    --todo-tint: #1F2B3D;
  --note: #E3C072;    --note-tint: #352B18;
  --thought: #C4A9F0; --thought-tint: #2C2539;
  --golf: #8ECDA8;    --golf-tint: #1F3027;
  --buy: #F3AC80;     --buy-tint: #3A2719;
  --list: #85D0D6;    --list-tint: #1B3133;
  --inbox: #B3AC9F;   --inbox-tint: #2C2A26;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #1A1917;
    --surface: #24221F;
    --surface-raised: #201E1C;
    --surface-sunken: #121110;
    --ink: #F2EEE6;
    --ink-muted: #B3AC9F;
    --ink-soft: #D6D0C4;
    --placeholder: #8E877B;
    --hairline: #36332E;
    --field-border: #4A463F;
    --dashed-border: #6A645A;
    --scrim: rgba(0, 0, 0, 0.6);
    --urgent: #F0B35A;
    --on-deep: #1A1917;
    --on-ink: #1A1917;
    --shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
    --hero-sky: #1F2A23;
    --hero-sun: #D9D3BC;

    --med: #F09BB7;     --med-tint: #3B2229;
    --todo: #93B8F2;    --todo-tint: #1F2B3D;
    --note: #E3C072;    --note-tint: #352B18;
    --thought: #C4A9F0; --thought-tint: #2C2539;
    --golf: #8ECDA8;    --golf-tint: #1F3027;
    --buy: #F3AC80;     --buy-tint: #3A2719;
    --list: #85D0D6;    --list-tint: #1B3133;
    --inbox: #B3AC9F;   --inbox-tint: #2C2A26;
  }
}
:root[data-theme="dark"] .hero__art { filter: brightness(0.55) saturate(0.8); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero__art { filter: brightness(0.55) saturate(0.8); }
}

/* Colour keys: set --deep and --tint for a component and everything in it */
.tile--med, .badge--med, .button--med, .chip--med, .dot--med, .tone--med                     { --deep: var(--med);     --tint: var(--med-tint); }
.tile--todo, .badge--todo, .button--todo, .chip--todo, .dot--todo, .tone--todo, .card-todo   { --deep: var(--todo);    --tint: var(--todo-tint); }
.tile--note, .badge--note, .button--note, .chip--note, .dot--note, .tone--note               { --deep: var(--note);    --tint: var(--note-tint); }
.tile--thought, .badge--thought, .button--thought, .chip--thought, .dot--thought, .tone--thought { --deep: var(--thought); --tint: var(--thought-tint); }
.tile--golf, .badge--golf, .button--golf, .chip--golf, .dot--golf, .tone--golf               { --deep: var(--golf);    --tint: var(--golf-tint); }
.tile--buy, .badge--buy, .button--buy, .chip--buy, .dot--buy, .tone--buy                     { --deep: var(--buy);     --tint: var(--buy-tint); }
.tile--list, .badge--list, .button--list, .chip--list, .dot--list, .tone--list               { --deep: var(--list);    --tint: var(--list-tint); }
.tile--inbox, .badge--inbox, .button--inbox, .chip--inbox, .dot--inbox, .tone--inbox         { --deep: var(--inbox);   --tint: var(--inbox-tint); }
.button--ink                                                                                  { --deep: var(--ink); }

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Text size, chosen on the home page. Every font size is in rem, so the whole
   app scales from here; spacing and touch targets stay put. */
html[data-text="large"] { font-size: 112.5%; }
html[data-text="larger"] { font-size: 125%; }
body {
  margin: 0;
  background: var(--surface-sunken);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.plain { background: var(--paper); }
h1, h2, h3, p { margin: 0; }
a { color: var(--golf); }
button, input, textarea, select { font: inherit; color: inherit; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 2px; }
.icon { display: block; flex-shrink: 0; width: 24px; height: 24px; }
[x-cloak], [hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* HTMX request indicators (htmx's own inline styles are off, for the CSP) */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease-in; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* App frame: phone-first, centred on anything wider */
.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
}
.app-main { flex: 1 0 auto; padding-bottom: 24px; }

/* Bottom bar: Today · Library · [+ Capture] · Calendar · History */
.bottom-nav {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  padding: 8px 4px calc(14px + var(--safe-bottom));
  background: var(--surface-raised);
  border-top: 1px solid var(--hairline);
}
.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 52px;
  color: var(--ink-muted);
  font-size: 0.7188rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 12px;
}
.bottom-nav__item .icon { width: 22px; height: 22px; }
.bottom-nav__item[aria-current="page"] { color: var(--ink); font-weight: 600; }
.bottom-nav__capture {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.7188rem;
  font-weight: 600;
}
.capture-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  margin-top: -34px;
  border-radius: 30px;
  border: 4px solid var(--surface-raised);
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: var(--shadow);
}
.capture-button .icon { width: 26px; height: 26px; }

/* Capture home */
.hero {
  position: relative;
  height: calc(250px + var(--safe-top));
  overflow: hidden;
  border-radius: 0 0 28px 28px;
  background: var(--hero-sky);
}
.hero__sun {
  position: absolute;
  right: 34px;
  top: calc(38px + var(--safe-top));
  width: 52px;
  height: 52px;
  border-radius: 26px;
  background: var(--hero-sun);
}
.hero__text {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: calc(30px + var(--safe-top)) 22px 0;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.hero__greeting {
  font-family: var(--font-display);
  font-size: 2.125rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.hero__prompt { font-size: 1rem; color: var(--ink-soft); }
.hero__art { position: absolute; left: 0; bottom: 0; display: block; width: 100%; height: 150px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 20px 0;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 96px;
  padding: 10px 6px;
  border-radius: 20px;
  background: var(--tint);
  color: var(--ink);
  text-decoration: none;
}
.tile .icon { width: 30px; height: 30px; color: var(--deep); }
.tile--wide {
  grid-column: span 3;
  flex-direction: row;
  justify-content: flex-start;
  gap: 14px;
  min-height: 72px;
  padding: 0 18px;
}
.tile__text { display: flex; flex-direction: column; gap: 2px; }
.tile__name { font-size: 0.9375rem; font-weight: 600; }
.tile__desc { font-size: 0.8125rem; color: var(--ink-soft); }

.panel { display: flex; flex-direction: column; gap: 10px; margin: 20px 20px 0; }
.panel__title { font-size: 0.9375rem; font-weight: 600; }
.empty {
  padding: 14px;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 0.875rem;
}

.account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin: 24px 20px 0;
  color: var(--ink-muted);
  font-size: 0.875rem;
}
.account__who { flex: 1 1 auto; }
.account__who strong { color: var(--ink); font-weight: 600; }
.account form { margin: 0; }
.account__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Card screens */
.screen { padding: var(--safe-top) 20px 0; }
.screen-header { display: flex; align-items: center; justify-content: space-between; min-height: 60px; }
.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  color: var(--ink);
}
.icon-button:hover { background: var(--surface-sunken); }
.icon-button-spacer { width: 44px; }
.mono-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.card-intro { display: flex; align-items: center; gap: 14px; margin: 8px 0 20px; }
.badge {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: var(--tint);
}
.badge .icon { width: 30px; height: 30px; color: var(--deep); }
.card-title { font-family: var(--font-display); font-size: 1.875rem; font-weight: 600; line-height: 1.1; }
.card-desc { margin-top: 4px; font-size: 0.875rem; color: var(--ink-muted); }
.notice {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--hairline);
  border-radius: 20px;
  background: var(--surface);
  line-height: 1.5;
}

/* Buttons and fields */
.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 56px;
  padding: 0 20px;
  border: 0;
  border-radius: 16px;
  background: var(--deep, var(--ink));
  color: var(--on-deep);
  font-size: 1.0625rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 0.9375rem; font-weight: 600; }
.input {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border: 1.5px solid var(--field-border);
  border-radius: 14px;
  background: var(--surface);
  font-size: 1.0625rem;
}
.input:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
.form-error {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--med-tint);
  color: var(--med);
  font-size: 0.9375rem;
  font-weight: 500;
}

/* Single-column pages: sign in, offline */
.solo {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 420px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(56px + var(--safe-top)) 20px calc(32px + var(--safe-bottom));
}
.solo__icon { width: 72px; height: 72px; border-radius: 18px; }
.solo__title { font-family: var(--font-display); font-size: 2rem; font-weight: 600; line-height: 1.1; }
.solo__lede { color: var(--ink-muted); line-height: 1.5; }
.solo__form { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.solo__help { color: var(--ink-muted); font-size: 0.875rem; }

/* Messages after saving: a toast that fades by itself */
.toasts {
  position: fixed;
  top: calc(12px + var(--safe-top));
  left: 50%;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 40px);
  max-width: 440px;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 0.9375rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: toast 4.5s ease forwards;
}
@keyframes toast {
  0% { opacity: 0; transform: translateY(-8px); }
  8%, 82% { opacity: 1; transform: none; }
  100% { opacity: 0; visibility: hidden; }
}

/* Just captured */
.recent {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--hairline);
}
.recent__row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 13px 14px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
.recent__row:hover { background: var(--surface-raised); }
.recent__row:focus-visible { outline-offset: -3px; }
.dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background: var(--deep, var(--inbox));
}
.recent__tag { flex-shrink: 0; width: 3.6rem; font-size: 0.8125rem; font-weight: 600; }
.recent__text { flex: 1 1 auto; min-width: 0; overflow: hidden; font-size: 0.9375rem; white-space: nowrap; text-overflow: ellipsis; }
.recent__time { flex-shrink: 0; font-size: 0.8125rem; color: var(--ink-muted); }

/* Chips: real radio buttons and checkboxes, drawn as the design's chips */
.chip-group { display: flex; flex-direction: column; min-width: 0; margin: 0; padding: 0; border: 0; }
.chip-group > legend { float: left; width: 100%; margin-bottom: 10px; padding: 0; }
.chip-group > legend + * { clear: both; }
.chips--grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.chips--wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 0 8px;
  border: 1.5px solid var(--field-border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.chip:has(input:checked) { border-color: var(--deep, var(--ink)); background: var(--deep, var(--ink)); color: var(--on-deep); }
.chip:has(input:focus-visible) { outline: 2.5px solid var(--deep, var(--ink)); outline-offset: 2px; }
.chip--urgent:has(input:checked) { border-color: var(--urgent); background: var(--urgent); }
.chip--pill { min-height: 44px; padding: 0 16px; border-radius: 22px; }
.chip--small { gap: 7px; min-height: 44px; padding: 0 12px; border-radius: 22px; font-size: 0.875rem; }
.chip .dot { width: 8px; height: 8px; border-radius: 4px; }
.chip:has(input:checked) .dot { background: var(--on-deep); }
.chip .icon { width: 16px; height: 16px; }
.chip--add { border-style: dashed; border-color: var(--dashed-border); background: transparent; color: var(--ink-muted); }
.chip--add:has(input:checked) { border-color: var(--deep, var(--ink)); background: var(--surface); color: var(--deep, var(--ink)); }
.reveal { display: none; margin-top: 10px; }
.chip-group:has(input[data-reveals]:checked) .reveal { display: block; }

/* Card screens (ToDo and the cards to come): full screen, no bottom bar */
.app--card { padding-bottom: calc(28px + var(--safe-bottom)); }
.card-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(12px + var(--safe-top)) 12px 8px;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
}
.card-header .mono-label { min-width: 0; overflow: hidden; letter-spacing: 0.04em; text-overflow: ellipsis; text-transform: none; white-space: nowrap; }
.header-save {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--deep, var(--ink));
  font-size: 1.0625rem;
  font-weight: 600;
  cursor: pointer;
}
.card-body { padding: 16px 20px 0; }
.card-body .card-intro { margin: 0 0 20px; }
.card-form { display: flex; flex-direction: column; gap: 20px; }
.card-form :focus-visible { outline-color: var(--deep, var(--ink)); }
.from-inbox {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1.5px dashed var(--dashed-border);
  border-radius: 14px;
  background: var(--surface-raised);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}
.field-error { color: var(--med); font-size: 0.875rem; font-weight: 500; }
.field-hint { color: var(--ink-muted); font-size: 0.8125rem; }
.input[aria-invalid="true"], .quick__text[aria-invalid="true"] { border-color: var(--med); }
.input--detail { height: 48px; font-size: 1rem; }
input[type="date"].input { display: block; min-width: 0; -webkit-appearance: none; appearance: none; }
input[type="date"].input::-webkit-date-and-time-value { text-align: left; }

/* Optional details: added above Save in the order they're tapped */
.details { display: flex; flex-direction: column; gap: 20px; }
.details:not(:has(> .detail:not([hidden]))) { display: none; }
.detail__head { display: flex; align-items: center; justify-content: space-between; }
.detail__remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -10px -12px -10px 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
}
.detail__remove .icon { width: 16px; height: 16px; }
.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1.5px solid var(--field-border);
  border-radius: 14px;
  background: var(--surface);
  font-size: 0.9375rem;
  line-height: 1.4;
  cursor: pointer;
}
.check input { flex-shrink: 0; width: 22px; height: 22px; margin: 0; accent-color: var(--deep, var(--ink)); }
.add-details { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.add-details:not(:has(.add-detail:not([hidden]))) { display: none; }
.add-details__rule { display: flex; align-items: center; gap: 10px; }
.add-details__title {
  flex-shrink: 0;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.7188rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.add-details__line { flex-grow: 1; height: 1px; background: var(--hairline); }
.add-details__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.add-detail {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}
.add-detail .icon { width: 18px; height: 18px; color: var(--deep, var(--ink)); }
.danger-zone { display: flex; justify-content: center; margin-top: 28px; }
.text-button {
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--med);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Quick capture: a bottom sheet from the + button, or its own page without JavaScript */
dialog.sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 32px);
  margin: 0 auto;
  padding: 12px 20px calc(28px + var(--safe-bottom));
  overflow: auto;
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--paper);
  color: var(--ink);
}
dialog.sheet::before {
  content: "";
  display: block;
  width: 40px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 3px;
  background: var(--field-border);
}
dialog.sheet::backdrop { background: var(--scrim); }
dialog.sheet[open] { animation: sheet-up 180ms ease-out; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) {
  dialog.sheet[open], .toast { animation: none; }
}
.sheet--page { padding: calc(20px + var(--safe-top)) 20px calc(28px + var(--safe-bottom)); }
.quick { display: flex; flex-direction: column; gap: 14px; }
.quick__head { display: flex; align-items: center; justify-content: space-between; }
.sheet-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; line-height: 1.15; }
.close-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--surface-sunken);
  color: var(--ink);
  cursor: pointer;
}
.close-button .icon { width: 18px; height: 18px; }
.quick__text {
  width: 100%;
  min-height: 110px;
  padding: 14px 16px;
  border: 1.5px solid var(--field-border);
  border-radius: 16px;
  background: var(--surface);
  font-size: 1.125rem;
  line-height: 1.45;
  resize: none;
}
.suggest {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1.5px dashed var(--deep, var(--inbox));
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.suggest .dot { width: 8px; height: 8px; border-radius: 4px; }
.file-under { margin: 0; padding: 0; border: 0; min-width: 0; }
.file-under__label { margin-bottom: 8px; padding: 0; color: var(--ink-muted); font-size: 0.8125rem; }
.file-under .chips--wrap { gap: 6px; }

/* To-do list */
.panel__head { display: flex; align-items: center; justify-content: space-between; }
.panel__link, .text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--todo);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.header-link {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0 10px 0 4px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}
.header-link .icon { width: 22px; height: 22px; }
a.header-save { text-decoration: none; }
.card-todo .button { gap: 8px; }
.card-todo .button .icon { width: 20px; height: 20px; }
.todo-group { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.todo-group__head { display: flex; align-items: baseline; gap: 8px; }
.todo-group__title { font-family: var(--font-display); font-size: 1.375rem; font-weight: 600; }
.todo-group__count { color: var(--ink-muted); font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; }
.todo-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--hairline);
}
.todo-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 56px;
  padding: 14px 16px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
.todo-row:hover { background: var(--surface-raised); }
.todo-row:focus-visible { outline-offset: -3px; }
.todo-row__title { font-size: 1rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.todo-row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--ink-muted); font-size: 0.8125rem; }
.todo-row__meta:empty { display: none; }
.todo-row__context { color: var(--todo); font-weight: 600; }
.todo-row__due { color: var(--med); font-weight: 600; }
.tag { padding: 2px 8px; border-radius: 8px; font-size: 0.75rem; font-weight: 600; }
.tag--important { background: var(--todo-tint); color: var(--todo); }
.tag--urgent { background: var(--urgent); color: var(--on-deep); }
.todo-empty { margin-top: 24px; }
.home-link { margin-top: 24px; }

/* Theme and text-size switches on the home page */
.theme-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 20px 0; }
.theme-switch__label { color: var(--ink-muted); font-size: 0.875rem; }
.theme-switch__options { display: flex; padding: 4px; border-radius: 16px; background: var(--surface-sunken); }
.theme-switch__options button {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.theme-switch__options button .icon { width: 16px; height: 16px; }
.theme-switch__options button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }

/* Reading a to-do, with its comments */
.read-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.read-head__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.read-title { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.read-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag--context { background: var(--surface); border: 1px solid var(--hairline); color: var(--todo); }
.read-tags { align-items: center; }
/* The Edit pill sits at the far right of the tag row, as big as a tag but easy to tap. */
.tag--action { position: relative; margin-left: auto; padding: 2px 12px; border: 1px solid var(--todo); background: var(--todo); color: var(--on-deep); text-decoration: none; }
.tag--action::after { content: ""; position: absolute; inset: -12px -8px; }  /* a 44px tap area around a tag-sized pill */
.read-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.facts {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 0 16px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: var(--hairline);
}
.facts > div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 16px; background: var(--surface); }
.facts > .facts__wide { flex-direction: column; gap: 6px; }
.facts dt { color: var(--ink-muted); font-size: 0.875rem; }
.facts dd { margin: 0; font-size: 0.9375rem; font-weight: 600; text-align: right; }
.facts .facts__wide dd { font-weight: 400; text-align: left; }
.facts .facts__due { color: var(--med); }
.button--outline { border: 1.5px solid var(--deep, var(--ink)); background: transparent; color: var(--deep, var(--ink)); }
.comments { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.comments__title { font-family: var(--font-display); font-size: 1.375rem; font-weight: 600; }
.comments__empty { color: var(--ink-muted); font-size: 0.9375rem; }
.comment-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.comment { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--hairline); border-radius: 14px; background: var(--surface); font-size: 0.9375rem; }
.comment__meta { color: var(--ink-muted); font-size: 0.8125rem; }
.comment__meta strong { color: var(--ink); font-weight: 600; }
.comment-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.comment-form__text { min-height: 90px; font-size: 1rem; }
.theme-switch + .theme-switch { margin-top: 10px; }
.theme-switch__label { min-width: 6.5rem; }

/* Completing a to-do: a red pill, then a confirmation sheet at thumb height */
.read-tags__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.read-tags__actions .tag--action { margin-left: 0; }
.tag--complete { margin-left: 0; border-color: var(--med); background: transparent; color: var(--med); }
.facts dd.facts__tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; font-weight: 600; }
.done-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--golf-tint);
  color: var(--ink);
  font-size: 0.9375rem;
}
.done-banner strong { color: var(--golf); }
.done-banner form { margin: 0; }
.tag--reopen { margin-left: 0; cursor: pointer; font: inherit; font-size: 0.75rem; font-weight: 600; }
.confirm__task { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; overflow-wrap: anywhere; }
.confirm__hint { color: var(--ink-muted); font-size: 0.875rem; }
.confirm__actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 6px; }
.button--plain { border: 1.5px solid var(--field-border); background: var(--surface); color: var(--ink); }
.button--complete { background: var(--med); color: var(--on-deep); }

/* Recently completed, at the bottom of the to-do list */
.todo-group--done { margin-top: 32px; }
.todo-row--done .todo-row__title { color: var(--ink-muted); text-decoration: line-through; text-decoration-color: var(--dashed-border); }
.todo-row__completed { display: inline-flex; align-items: center; gap: 5px; color: var(--golf); font-weight: 600; }
.todo-row__completed .icon { width: 15px; height: 15px; }

/* Completing from the list: a round tick at the left of each open row, like
   Reminders (the owner's choice, 4 October). It opens the same "Mark this
   completed?" sheet. The ring sits on the title's first line at any text size. */
.todo-item { display: flex; align-items: stretch; background: var(--surface); }
.todo-item > .todo-row { flex: 1; min-width: 0; padding-left: 0; background: transparent; }
.todo-tick {
  display: flex;
  flex: none;
  align-items: flex-start;
  width: 52px;  /* 12px edge, a 30px ring, a 10px gap to the title; the full row height is tappable */
  padding: calc(14px + 0.65rem - 15px) 0 0 12px;  /* row padding + half the title's line (1rem × 1.3) − half the ring */
  color: var(--placeholder);
  -webkit-tap-highlight-color: transparent;
}
.todo-tick:focus-visible { outline-offset: -3px; }
.todo-tick__ring {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 2px solid currentColor;
  border-radius: 50%;
  transition: background-color 120ms ease-out, color 120ms ease-out;
}
.todo-tick .icon { width: 18px; height: 18px; opacity: 0.4; }
.todo-tick:active { color: var(--med); }
.todo-tick:active .todo-tick__ring { background: var(--med-tint); }
.todo-tick:active .icon { opacity: 1; }
@media (hover: hover) {
  .todo-item:hover { background: var(--surface-raised); }
  .todo-tick:hover { color: var(--med); }
  .todo-tick:hover .todo-tick__ring { background: var(--med-tint); }
  .todo-tick:hover .icon { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .todo-tick__ring { transition: none; }
}
