/* Book progress. Layout: one calm column of "leaves" on a paper ground; on a
   laptop, Today's first two leaves sit side by side above the whole book.
   Light mode only, by decision. */

@font-face {
  font-family: "Literata";
  src: url("../fonts/literata-latin.woff2") format("woff2-variations"), url("../fonts/literata-latin.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("../fonts/literata-latin-italic.woff2") format("woff2-variations"), url("../fonts/literata-latin-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-latin.woff2") format("woff2-variations"), url("../fonts/source-sans-3-latin.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  /* color */
  --paper: #f3f4ef;        /* page ground, a faintly green-grey paper */
  --leaf: #fdfdfb;         /* cards ("leaves") and chart surface */
  --ink: #1c2630;          /* primary text */
  --ink-2: #47525d;        /* secondary text */
  --muted: #646e78;        /* labels, axis text (4.9:1 on leaf) */
  --rule: #dfe2da;         /* hairlines, gridlines */
  --rule-2: #c4c9bf;       /* baselines, input borders */
  --accent: #2c5d88;       /* ink-blue: bars in progress, links, focus */
  --accent-2: #234b6f;     /* pressed / hover */
  --accent-track: #dbe4ed; /* the unfilled part of a blue bar */
  --accent-wash: #edf2f7;
  --done: #2b7a48;         /* drafted: bar fill and check */
  --done-track: #d7eadd;
  --done-wash: #ecf5ef;
  --amber: #8e5c0c;        /* gentle attention text: margin, past a date */
  --amber-mark: #d29a2f;   /* amber marks (icons, timeline dot) */
  --amber-wash: #faf2e1;
  --plan: #8d969e;         /* plan line on charts */
  --shadow: 0 1px 0 rgba(28, 38, 48, 0.04), 0 1px 3px rgba(28, 38, 48, 0.06);

  /* type */
  --serif: "Literata", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-xs: 0.8125rem;   /* 13 */
  --fs-s: 0.9375rem;    /* 15 */
  --fs-m: 1.0625rem;    /* 17, body */
  --fs-l: 1.3125rem;    /* 21 */
  --fs-xl: 1.75rem;     /* 28 */
  --fs-hero: 3rem;      /* 48 */

  /* layout */
  --maxw: 66rem;
  --radius: 10px;
  --gap: 1rem;
  --nav-h: 3.5rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-m);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; font-family: var(--serif); font-weight: 600; line-height: 1.2; text-wrap: balance; color: var(--ink); }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 50; background: var(--ink); color: var(--leaf); padding: 0.5rem 0.75rem; border-radius: 6px; }
.skip:focus { top: 0.5rem; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-in {
  max-width: var(--maxw); margin: 0 auto;
  padding-block: 0.6rem;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; align-items: center; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; min-width: 0; flex: 1; }
.brand img { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.brand-title { font-family: var(--serif); font-weight: 600; font-size: var(--fs-l); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.busy-line { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; opacity: 0; transition: opacity 0.15s; }
.busy-line::after { content: ""; position: absolute; inset: 0 60% 0 0; background: var(--accent); animation: slide 1s ease-in-out infinite; }
body.busy .busy-line { opacity: 1; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.tabs { display: flex; gap: 0.25rem; }
.tab {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.8rem; border-radius: 999px;
  color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: var(--fs-s);
}
.tab svg { width: 18px; height: 18px; }
.tab:hover { background: var(--accent-wash); color: var(--ink); }
.tab[aria-current="page"] { background: var(--ink); color: var(--leaf); }

main {
  max-width: var(--maxw); margin: 0 auto;
  padding-block: 1.25rem 2.5rem;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.view { display: grid; gap: var(--gap); }

@media (max-width: 719px) {
  .topbar .tabs { display: none; }
  .bottomnav {
    position: sticky; bottom: 0; z-index: 20;
    background: var(--leaf); border-top: 1px solid var(--rule);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: max(8px, env(safe-area-inset-left, 0px));
    padding-right: max(8px, env(safe-area-inset-right, 0px));
  }
  .bottomnav .tabs { justify-content: space-around; height: var(--nav-h); align-items: center; }
  .bottomnav .tab { flex-direction: column; gap: 0.1rem; padding: 0.3rem 1rem; font-size: var(--fs-xs); border-radius: 10px; }
  .bottomnav .tab[aria-current="page"] { background: var(--accent-wash); color: var(--accent-2); }
}
@media (min-width: 720px) { .bottomnav { display: none; } }

/* ---------- leaves (cards) ---------- */
.leaf {
  background: var(--leaf);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.1rem 1.2rem;
  min-width: 0;
}
@media (min-width: 720px) { .leaf { padding: 1.4rem 1.6rem 1.5rem; } }
.leaf > * + * { margin-top: 0.9rem; }
.eyebrow {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted);
}
.leaf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.leaf h2 { font-size: var(--fs-l); }
.sub { color: var(--ink-2); font-size: var(--fs-s); }
.muted { color: var(--muted); }
.amber { color: var(--amber); }
.done-text { color: var(--done); }

.today-grid { display: grid; gap: var(--gap); }
@media (min-width: 900px) { .today-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; } }

/* ---------- buttons and fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 44px; padding: 0.5rem 1rem; border-radius: 8px;
  border: 1px solid var(--rule-2); background: var(--leaf); color: var(--ink);
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--accent-wash); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--accent); padding-inline: 0.6rem; }
.btn-quiet:hover { background: var(--accent-wash); }
.btn-small { min-height: 36px; padding: 0.3rem 0.7rem; font-size: var(--fs-s); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn svg { width: 18px; height: 18px; flex: none; }

.field { display: grid; gap: 0.3rem; min-width: 0; align-content: start; }
.field > label, .field-label { font-size: var(--fs-s); font-weight: 600; color: var(--ink-2); }
.hint { font-size: var(--fs-xs); color: var(--muted); }
input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="tel"], select, textarea {
  min-height: 44px; width: 100%; padding: 0.5rem 0.7rem;
  border: 1px solid var(--rule-2); border-radius: 8px; background: #fff;
}
input, select { min-width: 0; }
input:focus-visible, select:focus-visible { outline-offset: 0; }
input[type="number"] { font-variant-numeric: tabular-nums; }
.inline-form { display: flex; gap: 0.5rem; align-items: end; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 9rem; }

/* ---------- bars ---------- */
.bar {
  position: relative; height: 10px; border-radius: 999px;
  background: var(--accent-track); overflow: hidden;
}
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--accent); }
.bar.is-done { background: var(--done-track); }
.bar.is-done > i { background: var(--done); }
.bar.big { height: 28px; border-radius: 8px; }
.bar.big > i { border-radius: 8px 4px 4px 8px; }
.bar.big > i[style*="100%"] { border-radius: 8px; }
.bar.mid { height: 14px; }

/* ---------- Today: (a) ---------- */
.goal-line { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.hero-num { font-family: var(--sans); font-size: var(--fs-hero); font-weight: 650; line-height: 1; letter-spacing: -0.01em; }
.hero-unit { font-size: var(--fs-l); color: var(--ink-2); }
.meter-caption { display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; font-size: var(--fs-s); color: var(--ink-2); margin-top: 0.4rem; }
.goal-met { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--done); font-weight: 700; }
.goal-met svg { width: 18px; height: 18px; }

.current {
  border-top: 1px solid var(--rule); padding-top: 1rem;
  display: grid; gap: 0.55rem;
}
.current-title { font-family: var(--serif); font-size: var(--fs-l); font-weight: 600; }
.current-meta { display: flex; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; font-size: var(--fs-s); color: var(--ink-2); }
.log-row { display: flex; gap: 0.5rem; }
.log-row input { flex: 1 1 auto; max-width: 14rem; min-width: 0; }

.hours { border-top: 1px solid var(--rule); padding-top: 0.9rem; display: grid; gap: 0.6rem; }
.hours-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; }
.hours-row .field-label { flex: 0 0 100%; margin-bottom: 0.1rem; font-weight: 600; font-size: var(--fs-s); color: var(--ink-2); }
.chip {
  min-width: 40px; min-height: 36px; padding: 0.2rem 0.55rem; border-radius: 999px;
  border: 1px solid var(--rule-2); background: var(--leaf); color: var(--ink-2); cursor: pointer;
  font-variant-numeric: tabular-nums; font-weight: 600; font-size: var(--fs-s);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.timer { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: var(--fs-s); color: var(--ink-2); }
.timer > svg { width: 18px; height: 18px; color: var(--accent); }
.timer .clock { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.ask {
  background: var(--amber-wash); border-radius: 8px; padding: 0.75rem 0.9rem;
  display: grid; gap: 0.55rem; font-size: var(--fs-s);
}
.ask .row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Today: (b) pace ---------- */
.pace-sentence { font-family: var(--serif); font-size: var(--fs-l); line-height: 1.4; font-weight: 450; }
.pace-sentence b { font-weight: 650; }
.status-pill {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.6rem 0.2rem 0.45rem;
  border-radius: 999px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.02em;
}
.status-pill svg { width: 16px; height: 16px; }
.status-on_pace, .status-done { background: var(--done-wash); color: var(--done); }
.status-using_margin, .status-at_risk { background: var(--amber-wash); color: var(--amber); }
.status-starting { background: var(--accent-wash); color: var(--accent-2); }
.pace-facts { align-items: start; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.fact { display: grid; gap: 0.1rem; align-content: start; }
.fact .v { font-size: var(--fs-l); font-weight: 650; }
.fact .l { font-size: var(--fs-xs); color: var(--muted); }

.timeline { position: relative; height: 64px; margin-top: 0.4rem; }
.timeline svg { display: block; max-width: 100%; overflow: visible; }

/* ---------- Today: (c) whole book ---------- */
.overall { display: grid; gap: 0.55rem; }
.overall-nums { display: flex; justify-content: space-between; align-items: baseline; gap: 0.25rem 1rem; flex-wrap: wrap; }
.overall-words { font-size: var(--fs-xl); font-weight: 650; line-height: 1.1; }
.overall-words small { font-size: var(--fs-m); font-weight: 500; color: var(--ink-2); }
.overall-pct { font-size: var(--fs-l); font-weight: 650; color: var(--ink-2); }
.ticks { display: flex; gap: 3px; height: 14px; }
.ticks i { flex: 1; border-radius: 3px; background: var(--accent-track); position: relative; overflow: hidden; }
.ticks i > b { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.ticks i.d { background: var(--done); }
.ticks-caption { display: flex; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; font-size: var(--fs-s); color: var(--ink-2); }

.part { margin-top: 1.4rem; }
.part-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; flex-wrap: wrap;
  padding-bottom: 0.45rem; border-bottom: 1px solid var(--rule-2);
}
.part-head h3 { font-size: var(--fs-m); font-weight: 650; letter-spacing: 0.01em; }
.part-head .sub { font-size: var(--fs-xs); }
.chapters { list-style: none; margin: 0; padding: 0; }
/* A chapter row: the bar is the main element. Phone: title and words, the
   bar, then date and the quiet stage steps. Laptop: one line of text over a
   bar the full width of the row. */
.ch {
  display: grid; gap: 0.3rem 0.75rem;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "title words" "bar bar" "meta meta";
  align-items: center;
  padding: 0.6rem 0 0.55rem; border-bottom: 1px solid var(--rule);
}
.ch:last-child { border-bottom: 0; }
.ch.editing { grid-template-areas: "title title" "bar bar" "words words" "meta meta"; }
.ch.editing .ch-words { justify-self: start; }
.ch-title { grid-area: title; font-family: var(--serif); font-weight: 600; font-size: var(--fs-m); display: flex; align-items: center; gap: 0.35rem; min-width: 0; line-height: 1.25; }
.ch-title .check { width: 18px; height: 18px; color: var(--done); flex: none; }
.ch-bar { grid-area: bar; min-width: 0; }
.ch-bar .bar { height: 14px; }
.ch-words { grid-area: words; justify-self: end; }
.ch-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 0.75rem; min-width: 0; }
.ch-date { font-size: var(--fs-xs); color: var(--ink-2); }
.ch-date .late { color: var(--amber); font-weight: 600; }
.ch-over { color: var(--ink-2); }

.words-btn {
  display: inline-flex; align-items: center; gap: 0.3rem; min-height: 36px;
  padding: 0.1rem 0.5rem; margin-right: -0.5rem; border-radius: 8px; border: 1px solid transparent;
  background: transparent; cursor: pointer; font-variant-numeric: tabular-nums; font-size: var(--fs-s); color: var(--ink-2); white-space: nowrap;
}
.words-btn b { color: var(--ink); font-weight: 700; }
.words-btn svg { width: 14px; height: 14px; color: var(--accent); }
.words-btn:hover { border-color: var(--rule-2); background: var(--accent-wash); }
.words-edit { display: flex; gap: 0.35rem; align-items: center; }
.words-edit input { width: 7.5rem; min-height: 40px; }

/* Stage steps: quiet text; reached steps softly checked, the next one an
   outlined invitation. Each button keeps a 36px touch height. */
.stages { display: flex; align-items: center; gap: 0.1rem; margin-left: -0.35rem; }
.stage {
  min-height: 36px; padding: 0 0.15rem; border: 0; background: none; cursor: pointer;
  font-size: var(--fs-xs); color: var(--muted); display: inline-flex; align-items: center;
}
.stage .pill { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.2rem 0.5rem; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.stage:hover .pill { background: var(--accent-wash); color: var(--accent-2); }
.stage.reached { color: var(--done); }
.stage.current { color: var(--ink-2); font-weight: 700; }
.stage.current.s-drafted .pill, .stage.current.s-out .pill, .stage.current.s-back .pill { color: var(--done); background: var(--done-wash); }
.stage.next .pill { border-color: var(--rule-2); color: var(--accent); font-weight: 600; background: var(--leaf); }
.stage svg { width: 13px; height: 13px; flex: none; }
.stage .long { display: none; }
@media (min-width: 600px) { .stage .long { display: inline; } .stage .short { display: none; } }

@media (min-width: 900px) {
  .ch {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "title meta words" "bar bar bar";
    gap: 0.15rem 1.25rem;
    padding: 0.55rem 0 0.75rem;
  }
  .ch-meta { flex-wrap: nowrap; gap: 1rem; }
  .ch-date { white-space: nowrap; }
  .ch.editing { grid-template-areas: "title meta meta" "bar bar bar" "words words words"; }
}

/* ---------- toast ---------- */
.toasts {
  position: fixed; z-index: 40; left: 0; right: 0;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  display: grid; justify-items: center; pointer-events: none;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (max-width: 719px) { .toasts { bottom: calc(var(--nav-h) + 0.75rem + env(safe-area-inset-bottom, 0px)); } }
.toast {
  pointer-events: auto; max-width: 34rem; width: 100%;
  display: flex; align-items: center; gap: 0.75rem; justify-content: space-between;
  background: var(--ink); color: #f4f5f1; border-radius: 10px; padding: 0.55rem 0.6rem 0.55rem 1rem;
  box-shadow: 0 6px 24px rgba(28, 38, 48, 0.25); font-size: var(--fs-s);
}
.toast .btn { min-height: 36px; background: transparent; color: #cfe0f0; border-color: #4d5a66; }
.toast .btn:hover { background: #2c3843; }
.toast.error { background: #3a2f22; }
.toast.error::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--amber-mark); }

/* ---------- empty / info ---------- */
.empty { text-align: center; padding: 1.5rem 1rem; color: var(--ink-2); display: grid; gap: 0.75rem; justify-items: center; }
.empty h3 { font-size: var(--fs-l); }
.note { background: var(--accent-wash); border-radius: 8px; padding: 0.7rem 0.9rem; font-size: var(--fs-s); color: var(--ink-2); }
.note.warm { background: var(--amber-wash); }
.error-box { background: var(--amber-wash); color: var(--ink); border-radius: 8px; padding: 0.7rem 0.9rem; font-size: var(--fs-s); }

/* ---------- sign-in ---------- */
.signin { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding-block: 2rem;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.signin .leaf { width: 100%; max-width: 25rem; padding: 1.75rem 1.5rem; }
.signin .leaf > * + * { margin-top: 1.1rem; }
.signin h1 { font-size: var(--fs-xl); }
.signin form { display: grid; gap: 0.9rem; }
.signin .code { font-size: 1.6rem; letter-spacing: 0.35em; text-align: center; font-variant-numeric: tabular-nums; }
.signin-mark { width: 48px; height: 48px; border-radius: 12px; }

/* ---------- progress ---------- */
.chart { position: relative; }
.chart svg { display: block; max-width: 100%; overflow: visible; }
.chart text { font-family: var(--sans); font-size: 12px; fill: var(--muted); }
.chart .tick-label { font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .baseline { stroke: var(--rule-2); stroke-width: 1; }
.chart .deadline-line { stroke: var(--ink-2); stroke-width: 1; }
.chart .target-line { stroke: var(--done); stroke-width: 1; }
.chart .marker-label { font-size: 12px; font-weight: 700; fill: var(--ink-2); }
.chart .crosshair { stroke: var(--ink-2); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; font-size: var(--fs-s); color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend .key-line { width: 18px; height: 0; border-top: 2px solid; }
.legend .key-dash { width: 18px; height: 0; border-top: 2px dashed; }
.legend .key-box { width: 12px; height: 12px; border-radius: 3px; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 9rem;
  background: var(--leaf); border: 1px solid var(--rule-2); border-radius: 8px; box-shadow: 0 4px 16px rgba(28, 38, 48, 0.12);
  padding: 0.45rem 0.6rem; font-size: var(--fs-xs); color: var(--ink-2);
}
.tooltip .t-date { font-weight: 700; color: var(--ink); margin-bottom: 0.15rem; }
.tooltip .t-row { display: flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.tooltip .t-row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tooltip .t-key { width: 12px; border-top: 2px solid; }
.seg { display: inline-flex; border: 1px solid var(--rule-2); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--leaf); padding: 0.3rem 0.7rem; min-height: 34px; cursor: pointer; font-size: var(--fs-s); color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--leaf); }
details.table-view summary { cursor: pointer; color: var(--accent); font-size: var(--fs-s); font-weight: 600; min-height: 32px; display: inline-flex; align-items: center; }
.table-wrap { overflow-x: auto; max-height: 22rem; overflow-y: auto; margin-top: 0.5rem; border: 1px solid var(--rule); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: var(--fs-s); }
th, td { text-align: left; padding: 0.4rem 0.7rem; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th { position: sticky; top: 0; background: var(--leaf); font-size: var(--fs-xs); color: var(--muted); font-weight: 700; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat .v { font-size: var(--fs-xl); font-weight: 650; line-height: 1.1; }
.stat .l { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.stat .s { font-size: var(--fs-xs); color: var(--ink-2); }

.progress-grid { display: grid; gap: var(--gap); }
@media (min-width: 900px) { .progress-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }

.ms-list, .log-list { list-style: none; margin: 0; padding: 0; }
.ms { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 0.6rem; align-items: baseline; padding: 0.55rem 0; border-bottom: 1px solid var(--rule); font-size: var(--fs-s); }
.ms:last-child { border-bottom: 0; }
.ms .ic { width: 18px; height: 18px; align-self: center; }
.ms.done .ic { color: var(--done); }
.ms:not(.done) .ic { color: var(--rule-2); }
.ms.group .label { font-weight: 700; }
.ms .when { color: var(--ink-2); white-space: nowrap; text-align: right; }
.ms-sub { font-size: var(--fs-xs); color: var(--muted); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; margin: 0.9rem 0 0.1rem; }

.log-day { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; padding: 0.9rem 0 0.3rem; border-bottom: 1px solid var(--rule-2); }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--rule); align-items: center; font-size: var(--fs-s); }
.entry .what { min-width: 0; }
.entry .delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.entry .meta { color: var(--muted); font-size: var(--fs-xs); }
.entry .acts { display: flex; gap: 0.25rem; }
.entry .tag { display: inline-block; padding: 0 0.4rem; border-radius: 4px; background: var(--accent-wash); color: var(--accent-2); font-size: var(--fs-xs); font-weight: 700; }
.entry-edit { grid-column: 1 / -1; display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: end; }
.entry-edit .field { flex: 1 1 8rem; }

/* ---------- outline & settings ---------- */
.settings-grid { display: grid; gap: var(--gap); }
@media (min-width: 900px) { .settings-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.form-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.ol-part { border: 1px solid var(--rule); border-radius: 8px; padding: 0.6rem; display: grid; gap: 0.4rem; }
.ol-part + .ol-part { margin-top: 0.75rem; }
.ol-part-head { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.ol-part-head input { flex: 1 1 10rem; font-family: var(--serif); font-weight: 600; }
.ol-ch { border-top: 1px solid var(--rule); }
.ol-ch summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.5rem; align-items: center;
  padding: 0.55rem 0.25rem; min-height: 44px;
}
.ol-ch summary::-webkit-details-marker { display: none; }
.ol-ch summary .chev { width: 16px; height: 16px; color: var(--muted); transition: transform 0.15s; }
.ol-ch[open] summary .chev { transform: rotate(90deg); }
.ol-ch summary .t { font-family: var(--serif); font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.ol-ch summary .m { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; text-align: right; }
.ol-body { padding: 0.4rem 0.25rem 1rem; display: grid; gap: 0.9rem; }
.ol-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.order-list { list-style: none; margin: 0; padding: 0; counter-reset: w; }
.order-list li { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: 0.5rem; align-items: center; padding: 0.3rem 0; border-bottom: 1px solid var(--rule); font-size: var(--fs-s); }
.order-list li::before { counter-increment: w; content: counter(w); color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.order-list .t { min-width: 0; overflow-wrap: anywhere; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover:not([disabled]) { background: var(--accent-wash); color: var(--accent); }
.icon-btn[disabled] { opacity: 0.3; cursor: default; }
.icon-btn svg { width: 18px; height: 18px; }
.weekdays { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.check-row { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; }
.check-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.daysoff { list-style: none; margin: 0; padding: 0; }
.daysoff li { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.25rem 0; border-bottom: 1px solid var(--rule); font-size: var(--fs-s); }
.saved { font-size: var(--fs-xs); color: var(--done); font-weight: 700; min-height: 1em; }
.confirm { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; background: var(--amber-wash); padding: 0.5rem 0.7rem; border-radius: 8px; font-size: var(--fs-s); }
.person { display: grid; gap: 0.6rem; padding: 0.75rem 0; border-bottom: 1px solid var(--rule); }
.person:last-child { border-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
