/* ==========================================================================
   twoweeks.dev design system — "Blueprint & Paper"
   Light: warm drafting paper with a faint graph grid.
   Dark:  blueprint navy with cyan drafting lines.
   Type:  Fraunces (display), Inter (text), JetBrains Mono (time).
   ========================================================================== */

@font-face { font-family: "Fraunces"; src: url("../fonts/fraunces-var.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("../fonts/fraunces-var-italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-var.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

/* ---------- tokens ---------- */
:root {
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --paper: #f4efe4;
  --paper-2: #ebe4d5;
  --surface: #fffdf8;
  --surface-2: #f6f1e7;
  --ink: #1f2330;
  --ink-2: #464c5c;
  --muted: #7b8191;
  --line: rgba(31, 35, 48, 0.12);
  --line-strong: rgba(31, 35, 48, 0.28);
  --grid-line: rgba(31, 35, 48, 0.055);

  --brick: #c4553d;
  --brick-2: #a8442e;
  --brick-soft: rgba(196, 85, 61, 0.12);
  --brick-ink: #ffffff;
  --amber: #e2a23a;
  --amber-soft: rgba(226, 162, 58, 0.22);
  --moss: #3d8b68;
  --moss-soft: rgba(61, 139, 104, 0.14);
  --sky: #3b7dd8;
  --danger: #c63d3d;
  --danger-soft: rgba(198, 61, 61, 0.1);

  --prio-0: #b9b3a6;
  --prio-1: #3d8b68;
  --prio-2: #3b7dd8;
  --prio-3: #e07b2a;
  --prio-4: #c63d3d;

  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px;
  --shadow-1: 0 1px 2px rgba(31,35,48,.06), 0 6px 20px -10px rgba(31,35,48,.25);
  --shadow-2: 0 2px 6px rgba(31,35,48,.08), 0 24px 48px -20px rgba(31,35,48,.35);
  --ring: 0 0 0 3px rgba(196, 85, 61, 0.28);
  --ease: cubic-bezier(.2,.7,.2,1);
}
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e2440; --paper-2: #0b1d34; --surface: #14304f; --surface-2: #1a3a5e;
    --ink: #e9eef6; --ink-2: #c1cde0; --muted: #86a0c2;
    --line: rgba(170, 205, 255, 0.16); --line-strong: rgba(170, 205, 255, 0.34); --grid-line: rgba(170, 205, 255, 0.075);
    --brick: #e0785e; --brick-2: #c85f45; --brick-soft: rgba(224, 120, 94, 0.18); --brick-ink: #17110f;
    --amber: #f0b650; --amber-soft: rgba(240, 182, 80, 0.22);
    --moss: #5cc494; --moss-soft: rgba(92, 196, 148, 0.16);
    --sky: #6aa4f2; --danger: #ef6b6b; --danger-soft: rgba(239, 107, 107, 0.14);
    --prio-0: #7d8fa8; --prio-1: #5cc494; --prio-2: #6aa4f2; --prio-3: #f39b4a; --prio-4: #ef6b6b;
    --shadow-1: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-2: 0 2px 6px rgba(0,0,0,.4), 0 28px 60px -24px rgba(0,0,0,.7);
    --ring: 0 0 0 3px rgba(224, 120, 94, 0.35);
  }
}
:root[data-theme="dark"] {
  --paper: #0e2440; --paper-2: #0b1d34; --surface: #14304f; --surface-2: #1a3a5e;
  --ink: #e9eef6; --ink-2: #c1cde0; --muted: #86a0c2;
  --line: rgba(170, 205, 255, 0.16); --line-strong: rgba(170, 205, 255, 0.34); --grid-line: rgba(170, 205, 255, 0.075);
  --brick: #e0785e; --brick-2: #c85f45; --brick-soft: rgba(224, 120, 94, 0.18); --brick-ink: #17110f;
  --amber: #f0b650; --amber-soft: rgba(240, 182, 80, 0.22);
  --moss: #5cc494; --moss-soft: rgba(92, 196, 148, 0.16);
  --sky: #6aa4f2; --danger: #ef6b6b; --danger-soft: rgba(239, 107, 107, 0.14);
  --prio-0: #7d8fa8; --prio-1: #5cc494; --prio-2: #6aa4f2; --prio-3: #f39b4a; --prio-4: #ef6b6b;
  --shadow-1: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-2: 0 2px 6px rgba(0,0,0,.4), 0 28px 60px -24px rgba(0,0,0,.7);
  --ring: 0 0 0 3px rgba(224, 120, 94, 0.35);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  font-family: var(--font-body); font-size: 15px; line-height: 1.55; color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px, 28px 28px;
  font-feature-settings: "cv11", "ss01";
}
main { flex: 1; }
::selection { background: var(--amber-soft); }
a { color: var(--brick); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; margin: 0 0 .5rem; color: var(--ink); font-variation-settings: "opsz" 72, "SOFT" 40, "WONK" 1; }
h1 { font-size: 2.2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.15rem; } h4 { font-size: 1rem; }
p { margin: 0 0 .8rem; }
.mono, .time, code, kbd { font-family: var(--font-mono); font-feature-settings: "zero", "ss02"; }
.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.row { display: flex; align-items: center; } .col { display: flex; flex-direction: column; }
.between { justify-content: space-between; } .center { align-items: center; } .end { justify-content: flex-end; }
.center-text { text-align: center; } .wrap { flex-wrap: wrap; } .gap { gap: .6rem; } .grow { flex: 1; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .lead { font-size: 1.15rem; color: var(--ink-2); line-height: 1.5; }
.hidden, [hidden] { display: none !important; } .inline { display: inline; margin: 0; } .wide { width: 100%; } .nowrap { white-space: nowrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; margin: 1.5rem 0; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none !important; }
.logo-mark { color: var(--brick); flex: none; }
.logo-mark .mark-on { fill: #fbf7ee; } .logo-mark .mark-off { fill: #fbf7ee; fill-opacity: .4; }
.logo-word { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.02em; line-height: 1; font-variation-settings: "opsz" 48, "SOFT" 60; }
.logo-word span { font-weight: 400; font-style: italic; color: var(--ink-2); }
.grid-illo .illo-on { fill: var(--brick); } .grid-illo .illo-off { fill: var(--brick); fill-opacity: .22; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: blur(10px); background: color-mix(in srgb, var(--paper) 82%, transparent); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 60px; display: flex; align-items: center; gap: 1rem; }
.app-nav { display: flex; align-items: center; gap: .15rem; margin-left: .5rem; overflow-x: auto; scrollbar-width: none; }
.app-nav::-webkit-scrollbar { display: none; }
.app-nav a { padding: .42rem .8rem; border-radius: 999px; color: var(--ink-2); font-weight: 500; font-size: .92rem; white-space: nowrap; transition: background .15s var(--ease), color .15s; }
.app-nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.app-nav a.active { background: var(--ink); color: var(--paper); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: .4rem; }
.badge { display: inline-flex; align-items: center; padding: .1rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 600; letter-spacing: .01em; line-height: 1.5; }
.badge.count { background: var(--brick); color: var(--brick-ink); margin-left: .35rem; padding: 0 .45rem; font-family: var(--font-mono); }
.app-nav a.active .badge.count { background: var(--paper); color: var(--ink); }
.badge.ok { background: var(--moss-soft); color: var(--moss); } .badge.warn { background: var(--amber-soft); color: #9a6410; } .badge.bad { background: var(--danger-soft); color: var(--danger); }
:root[data-theme="dark"] .badge.warn { color: var(--amber); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.warn { color: var(--amber); } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; font-size: .93rem; cursor: pointer;
  text-decoration: none !important; white-space: nowrap; box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 1px 2px rgba(31,35,48,.06);
  transition: transform .12s var(--ease), background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); transform: translateY(-1px); box-shadow: var(--shadow-1); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn.primary { background: var(--brick); border-color: var(--brick-2); color: var(--brick-ink); box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 6px 16px -8px rgba(196,85,61,.7); }
.btn.primary:hover { background: var(--brick-2); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); border-color: rgba(198,61,61,.4); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.lg { padding: .8rem 1.35rem; font-size: 1.02rem; border-radius: 12px; }
.btn.sm { padding: .32rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn.icon { padding: 0; width: 30px; height: 30px; border-radius: 8px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none !important; }
kbd { display: inline-block; padding: 0 .4rem; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; font-size: .75rem; background: var(--surface); color: var(--ink-2); }

/* ---------- cards & surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.35rem; box-shadow: var(--shadow-1); }
.alert { padding: .8rem 1rem; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); margin-bottom: 1rem; }
.alert.success { border-color: rgba(61,139,104,.4); background: var(--moss-soft); }
.alert.warning { border-color: rgba(226,162,58,.5); background: var(--amber-soft); }
.alert.danger { border-color: rgba(198,61,61,.4); background: var(--danger-soft); }
.flash { margin-top: 1rem; }
.errors { color: var(--danger); font-size: .9rem; margin: .5rem 0; padding-left: 1.1rem; }
.errors:empty { display: none; }
p.errors { padding-left: 0; }

/* ---------- forms ---------- */
label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: .35rem; color: var(--ink-2); }
.field { margin-bottom: 1rem; }
.help { color: var(--muted); font-size: .85rem; margin-top: .3rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; padding: .6rem .75rem; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brick); box-shadow: var(--ring); }
input[disabled] { color: var(--muted); background: var(--surface-2); }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.checkbox { display: flex; align-items: center; gap: .55rem; font-weight: 400; color: var(--ink); }
input[type="checkbox"] { accent-color: var(--brick); width: 16px; height: 16px; }
input[type="file"] { font-size: .9rem; }

/* htmx indicators */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease-in 200ms; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ---------- landing ---------- */
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 3rem; align-items: center; padding: 4.5rem 0 3rem; }
.hero-title { font-size: clamp(2.4rem, 5.2vw, 3.9rem); font-weight: 600; line-height: 1.02; letter-spacing: -0.025em; margin-bottom: 1rem; font-variation-settings: "opsz" 144, "SOFT" 60, "WONK" 1; }
.hero-title .accent { font-style: italic; font-weight: 500; color: var(--brick); }
.hero-sub { font-size: 1.15rem; color: var(--ink-2); max-width: 46ch; }
.hero-cta { margin-top: 1.5rem; display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.hero-note { font-size: .85rem; color: var(--muted); margin-top: .75rem; }
.preview-card { position: relative; transform: rotate(-1.2deg); }
.preview-card .day-grid { pointer-events: none; }
.stamp { position: absolute; right: -14px; top: -18px; transform: rotate(8deg); padding: .35rem .7rem; border: 2.5px solid var(--brick); border-radius: 8px; color: var(--brick); font-family: var(--font-mono); font-weight: 700; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: var(--shadow-1); }
.features { margin: 1.5rem 0 3rem; }
.feature h3 { margin-top: .6rem; }
.feature-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brick-soft); color: var(--brick); }
.feature-icon svg { width: 22px; height: 22px; }
.story { display: grid; grid-template-columns: 1fr 1.4fr; gap: 2rem; align-items: center; margin-bottom: 3.5rem; }
.story blockquote { margin: 0; font-family: var(--font-display); font-size: 1.6rem; font-style: italic; font-weight: 400; line-height: 1.25; color: var(--ink); font-variation-settings: "opsz" 96, "SOFT" 100, "WONK" 1; }
.story cite { display: block; margin-top: .6rem; font-style: normal; font-family: var(--font-body); font-size: .85rem; color: var(--muted); }
.privacy-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 3.5rem; }
.privacy-strip .item { padding: 1rem 1.1rem; border-left: 3px solid var(--brick); background: color-mix(in srgb, var(--surface) 70%, transparent); border-radius: 0 var(--r-md) var(--r-md) 0; }
.privacy-strip strong { display: block; font-family: var(--font-display); font-size: 1.05rem; margin-bottom: .2rem; }

/* ---------- footer ---------- */
.site-footer { padding: 2rem 1.25rem 2.5rem; display: flex; gap: 1.2rem; justify-content: center; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); margin-top: 2rem; }
.site-footer a { color: var(--muted); }

/* ---------- auth ---------- */
.auth-wrap { max-width: 460px; margin: 3.5rem auto; }
.auth-card { padding: 1.75rem; }
.auth-card .logo { margin-bottom: 1.25rem; }
.auth-title { font-size: 1.75rem; margin-bottom: .35rem; }
.auth-sub { color: var(--ink-2); margin-bottom: 1.25rem; }
.recovery-key { font-size: 1.05rem; letter-spacing: .06em; line-height: 1.7; word-break: break-all; padding: 1rem 1.1rem; border-radius: var(--r-md); background: var(--surface-2); border: 1.5px dashed var(--line-strong); user-select: all; color: var(--ink); }
form.deriving button[type="submit"] { opacity: .7; }

/* ---------- page head & toolbar ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin: 1.75rem 0 1rem; }
.page-title { font-size: 2rem; margin: 0; }
.page-sub { color: var(--muted); margin: .15rem 0 0; }
.page-tools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.day-nav { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.day-nav a { padding: .35rem .7rem; color: var(--ink); font-weight: 500; font-size: .88rem; border-right: 1px solid var(--line); }
.day-nav a:last-child { border-right: 0; } .day-nav a:hover { background: var(--surface-2); text-decoration: none; }
.toolbar { margin: 0 0 1rem; display: flex; gap: .75rem; align-items: center; }
.search { position: relative; max-width: 420px; flex: 1; }
.search input { padding-left: 2.2rem; }
.search svg { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.empty { display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: 3rem 1rem; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); margin: .5rem 0 0; }

/* ---------- day grid (timeline) ---------- */
.day-grid { position: relative; padding-bottom: 4rem; }
.slot { display: grid; grid-template-columns: 76px 1fr; min-height: 58px; position: relative; }
.slot-rail { position: relative; padding: .35rem .6rem 0 0; text-align: right; }
.slot-rail::after { content: ""; position: absolute; top: 0; bottom: 0; right: -1px; width: 2px; background: var(--line); }
.slot.hour .slot-rail::after { background: var(--line-strong); }
.slot-time { font-family: var(--font-mono); font-size: .82rem; color: var(--muted); font-weight: 500; }
.slot.hour .slot-time { color: var(--ink-2); font-weight: 600; }
.slot-body { position: relative; padding: .3rem 0 .3rem 1rem; display: flex; flex-direction: column; gap: 4px; border-top: 1px dashed var(--line); }
.slot.hour .slot-body { border-top-style: solid; }
.slot:first-child .slot-body { border-top: 0; }
.slot-add { position: absolute; left: -15px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--brick); display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .15s, transform .15s var(--ease); font-size: 1rem; line-height: 1; padding: 0; }
.slot:hover .slot-add, .slot:focus-within .slot-add { opacity: 1; }
.slot-add:hover { transform: translateY(-50%) scale(1.08); background: var(--brick); color: var(--brick-ink); }
.free-label { color: var(--muted); font-size: .8rem; padding: .45rem 0; opacity: .6; }
.slot.free:hover .free-label { opacity: 1; }
.slot.current .slot-body { background: linear-gradient(90deg, var(--amber-soft), transparent 70%); border-radius: 0 var(--r-md) var(--r-md) 0; }
.slot.current .slot-time { color: var(--ink); font-weight: 700; }
.slot.current .slot-rail::after { background: var(--amber); }
.now-line { position: absolute; left: -1px; right: 0; height: 2px; background: var(--brick); pointer-events: none; z-index: 2; }
.now-line::before { content: ""; position: absolute; left: -6px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brick); box-shadow: 0 0 0 3px var(--paper); }
.offgrid { margin-top: 2rem; padding: 1rem 1.1rem; border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.offgrid h3 { margin-bottom: .6rem; font-size: .95rem; }
.offgrid .task-row { margin-bottom: 4px; }

/* ---------- task rows ---------- */
.task-row, .list-row {
  display: grid; grid-template-columns: 4px 26px 1fr auto auto; align-items: center; gap: .6rem;
  padding: .45rem .6rem .45rem .5rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 1px 2px rgba(31,35,48,.05);
  transition: transform .15s var(--ease), box-shadow .15s, border-color .15s;
}
.task-row:hover, .list-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); transform: translateY(-1px); }
.prio { display: block; width: 4px; align-self: stretch; border-radius: 3px; min-height: 26px; }
.prio-0 { background: var(--prio-0); } .prio-1 { background: var(--prio-1); } .prio-2 { background: var(--prio-2); } .prio-3 { background: var(--prio-3); } .prio-4 { background: var(--prio-4); }
.check { display: grid; place-items: center; margin: 0; cursor: pointer; }
.check input { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin: 0; border-radius: 50%; border: 1.8px solid var(--line-strong); background: var(--surface); cursor: pointer; transition: background .15s, border-color .15s, transform .1s; display: grid; place-items: center; }
.check input:hover { border-color: var(--moss); }
.check input:checked { background: var(--moss); border-color: var(--moss); }
.check input:checked::after { content: ""; width: 10px; height: 6px; border-left: 2.2px solid #fff; border-bottom: 2.2px solid #fff; transform: translateY(-1px) rotate(-45deg); }
.check input:active { transform: scale(.9); }
.task-title { text-align: left; background: none; border: 0; padding: .1rem .1rem; font: inherit; font-weight: 500; color: var(--ink); cursor: pointer; min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.task-title:hover { color: var(--brick); }
.task-title .time { color: var(--muted); font-size: .82rem; margin-right: .35rem; }
.done .task-title { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); font-weight: 400; }
.done .prio { opacity: .4; }
.task-meta { display: inline-flex; gap: .35rem; align-items: center; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .05rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: .74rem; font-weight: 500; }
.chip.time { font-family: var(--font-mono); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.task-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.task-row:hover .task-actions, .list-row:hover .task-actions, .task-actions:focus-within { opacity: 1; }
.icon-btn { width: 28px; height: 28px; border-radius: 7px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; display: grid; place-items: center; padding: 0; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 15px; height: 15px; }

/* ---------- lists ---------- */
.task-list { display: flex; flex-direction: column; gap: 1.4rem; }
.group-head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: .5rem; }
.group-head h3 { margin: 0; font-size: 1.05rem; }
.group-head .line { flex: 1; height: 1px; background: var(--line); }
.group-head .mono { color: var(--muted); font-size: .78rem; }
.group-head.overdue h3 { color: var(--danger); }
.group .list-row { margin-bottom: 4px; grid-template-columns: 4px 26px 64px 1fr auto auto; }
.list-date { font-family: var(--font-mono); font-size: .82rem; color: var(--muted); white-space: nowrap; }
.list-row.overdue .list-date { color: var(--danger); font-weight: 600; }
.pager { margin: 1.5rem 0 2.5rem; }

/* ---------- modal ---------- */
#modal > dialog.modal { border: 1px solid var(--line); border-radius: var(--r-xl); padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); width: min(580px, calc(100vw - 2rem)); animation: pop .18s var(--ease); }
#modal > dialog.modal::backdrop { background: rgba(20, 18, 24, .45); backdrop-filter: blur(3px); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-body { padding: 1.4rem 1.5rem 1.5rem; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .9rem; }
.modal-head h2 { margin: 0; font-size: 1.35rem; }
.modal-actions { margin-top: .75rem; display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.noscript-only { display: none; }
.danger-zone { border-color: rgba(198,61,61,.35); }

/* ---------- settings ---------- */
.settings { margin-top: 1.5rem; }

/* ---------- admin ---------- */
.admin-nav { margin: 1.25rem 0; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.admin-nav a { padding: .3rem .65rem; border-radius: 999px; color: var(--ink-2); font-weight: 500; font-size: .9rem; }
.admin-nav a.active { background: var(--ink); color: var(--paper); }
.admin-nav .muted { margin-left: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: .85rem 1rem; }
.stat-v { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; line-height: 1.1; font-variation-settings: "opsz" 72; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: .5rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.table .bad { color: var(--danger); font-weight: 600; }
.table-wrap { padding: 0; overflow-x: auto; }
.filters { margin-bottom: 1rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.filters input, .filters select { width: auto; }
.badge.kind { background: var(--surface-2); color: var(--ink-2); font-family: var(--font-mono); font-weight: 500; }
tr.kind-login_fail .badge.kind, tr.kind-unlock_fail .badge.kind, tr.kind-csrf_rejected .badge.kind, tr.kind-ratelimit .badge.kind, tr.kind-admin_totp_fail .badge.kind, tr.kind-recovery_fail .badge.kind, tr.kind-turnstile_fail .badge.kind { background: var(--danger-soft); color: var(--danger); }
tr.kind-recovery_used .badge.kind, tr.kind-admin_login .badge.kind, tr.kind-admin_action .badge.kind, tr.kind-password_change .badge.kind { background: var(--amber-soft); color: #9a6410; }
tr.disabled td { opacity: .55; }
.chart { margin: 0 0 1.25rem; }
.chart-scroll { overflow-x: auto; }
.chart .bar { fill: var(--brick); } .chart .axis { stroke: var(--line-strong); }
.qr { display: block; margin: .5rem auto 1rem; border-radius: var(--r-md); background: #fff; padding: 8px; }
code { font-size: .88em; background: var(--surface-2); padding: .1rem .35rem; border-radius: 5px; }
.prose { max-width: 720px; margin: 2.5rem auto 3rem; }
.prose h1 { font-size: 2.4rem; margin-bottom: 1rem; }
.prose h2 { margin-top: 2rem; font-size: 1.4rem; }
.prose li { margin-bottom: .4rem; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; padding-top: 3rem; }
  .preview-card { transform: none; }
  .story { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .header-inner { flex-wrap: wrap; padding: .5rem 0; gap: .5rem; }
  .app-nav { order: 3; width: 100%; margin-left: 0; padding-bottom: .2rem; }
  .header-actions { margin-left: auto; }
}
@media (max-width: 720px) {
  .slot { grid-template-columns: 58px 1fr; }
  .slot-add { opacity: 1; }
  .task-row { grid-template-columns: 4px 26px 1fr auto; }
  .task-row .task-meta { display: none; }
  .group .list-row { grid-template-columns: 4px 26px 1fr auto; }
  .group .list-row .list-date, .group .list-row .task-title { grid-column: 3; }
  .group .list-row .task-meta { display: none; }
  .task-actions { opacity: 1; }
  .page-title { font-size: 1.6rem; }
}
@media print { .site-header, .site-footer, .btn, .checkbox, .toolbar { display: none !important; } body { background: #fff; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } html { scroll-behavior: auto; } }

/* narrow containers (hero preview, phones): keep titles on one line, drop the priority chip */
.day-grid, .task-list { container-type: inline-size; }
@container (max-width: 560px) {
  .task-row .task-meta .chip:not(.time), .list-row .task-meta .chip:not(.time) { display: none; }
  .task-row .task-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
.btn svg { width: 14px; height: 14px; flex: none; }
.slot-add svg { width: 14px; height: 14px; }
.icon-btn svg { width: 15px; height: 15px; }

/* utilities (no inline styles: CSP style-src 'self') */
.mt-1 { margin-top: 1rem; }
.page-head.compact { margin: 0 0 .75rem; }
.page-title.sm { font-size: 1.4rem; }
.day-grid.flush { padding-bottom: 0; }
.logo.tight { gap: .4rem; }
.chip .dot.prio-0 { background: var(--prio-0); } .chip .dot.prio-1 { background: var(--prio-1); } .chip .dot.prio-2 { background: var(--prio-2); }
.chip .dot.prio-3 { background: var(--prio-3); } .chip .dot.prio-4 { background: var(--prio-4); }

/* task form rendered as a page (no JS/HTMX): the dialog sits in flow */
.standalone-form dialog.modal[open] { position: static; margin: 2rem auto; width: min(580px, 100%); border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); padding: 0; }
.standalone-form [data-close-modal] { display: none; }
