/* base.css — @font-face, reset, layout, timeline spine, components, states.
   Design tokens (colors/type/spacing/radius) live in tokens.css, loaded first. */

/* ---------- self-hosted fonts (offline-first — cached by sw.js) ----------
   Clash Display (display — wordmark, phase headings, the big rollup number)
   and General Sans (UI — labels, task text, controls) are both free for
   commercial use (Fontshare), downloaded once at build time — no runtime CDN
   request, required for an offline-first PWA and for perf. font-display:
   swap avoids a blank-text flash; the metrics-tuned FALLBACK faces right
   below (size-adjust/ascent/descent, estimated from the shipped files' box
   metrics) make the swap itself nearly invisible. */
@font-face {
  font-family: "Clash Display";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/clash-display-medium.woff2") format("woff2");
}
@font-face {
  font-family: "Clash Display";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/clash-display-semibold.woff2") format("woff2");
}
@font-face {
  font-family: "Clash Display Fallback";
  src: local("Georgia"), local("Times New Roman");
  size-adjust: 104%;
  ascent-override: 92%;
  descent-override: 24%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "General Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/general-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "General Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/general-sans-500.woff2") format("woff2");
}
@font-face {
  font-family: "General Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/general-sans-600.woff2") format("woff2");
}
@font-face {
  font-family: "General Sans Fallback";
  src: local("Arial"), local("Helvetica"), local("Segoe UI");
  size-adjust: 102%;
  ascent-override: 95%;
  descent-override: 27%;
  line-gap-override: 0%;
}

/* Allow the progress ring's conic-gradient percentage to transition (modern
   browsers; progressive enhancement — unsupported browsers just show the
   correct end value with no transition, never a broken ring). */
@property --pct {
  syntax: '<percentage>';
  inherits: true;
  initial-value: 0%;
}

/* ---------- reset ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  background: var(--bg);
  color: var(--ink);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--sp-6);
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; line-height: var(--lh-tight); margin: 0; }
p { margin: 0; }
button, input, textarea, select { font-family: inherit; }
img, svg { display: block; }
a { color: var(--accent); }
ul { margin: 0; padding: 0; list-style: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
[data-reduce="1"] *, [data-reduce="1"] *::before, [data-reduce="1"] *::after { animation: none !important; transition: none !important; }

@media (prefers-contrast: more) {
  :root, [data-theme] { --line: var(--ink-soft); }
  .btn, .field, .task-card, .sheet, .task-status-btn, .vendor-card { border-width: 2px; }
}
@media (forced-colors: active) {
  .btn, .field, .task-card, .task-status-btn, .vendor-card { forced-color-adjust: none; border: 1px solid CanvasText; }
}

/* faint warm-paper grain — a tiny baked noise tile (data URI, no extra
   request), off for reduced-motion/contrast. */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  opacity: var(--grain-opacity); mix-blend-mode: overlay;
  background-image: url("data:image/png;base64,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");
  background-size: 48px 48px;
}
@media (prefers-reduced-motion: reduce), (prefers-contrast: more) { body::before { display: none; } }

.skip-link { position: absolute; left: -999px; top: 0; z-index: 100; }
.skip-link:focus { left: var(--sp-3); top: var(--sp-3); background: var(--ink); color: var(--bg); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-xs); }
.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; }

:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.ic { width: 18px; height: 18px; flex: 0 0 auto; }

/* ---------- small-caps section label — the journal voice ---------- */
.label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em; color: var(--ink-soft); margin-bottom: var(--sp-2); }
.label .muted { text-transform: none; letter-spacing: normal; font-weight: 500; }
.muted { color: var(--ink-soft); font-weight: 400; }

/* ---------- masthead ---------- */
.masthead { max-width: var(--maxw); margin: 0 auto; padding: calc(env(safe-area-inset-top) + var(--sp-4)) var(--sp-4) var(--sp-2); position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.wordmark { display: flex; align-items: center; gap: var(--sp-2); font-family: var(--font-display); font-weight: 500; font-size: var(--fs-h1); color: var(--ink); background: none; border: none; padding: 0; cursor: default; }
.wordmark-ic { width: 26px; height: 26px; color: var(--accent); flex: 0 0 auto; }
.masthead-actions { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.date-pill { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.date-pill:hover { border-color: var(--accent); }
.date-pill .ic { color: var(--accent); width: 15px; height: 15px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; transition: transform .1s ease, border-color .15s ease; flex: 0 0 auto; position: relative; }
.icon-btn:active { transform: scale(.92); }
.icon-btn:hover { border-color: var(--accent); }
.count-badge { position: absolute; top: -3px; right: -3px; min-width: 19px; height: 19px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: var(--accent-ink); font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); font-variant-numeric: tabular-nums; }
#filter-btn .count-badge { position: static; margin-left: 2px; border: none; }

/* ---------- primary layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--sp-4); position: relative; z-index: 2; }
.overview-line { color: var(--ink-soft); font-size: var(--fs-sm); max-width: 64ch; margin: var(--sp-1) 0 var(--sp-5); min-height: calc(1em * var(--lh-body)); }
.list-h1 { font-size: var(--fs-display); color: var(--ink); margin: var(--sp-1) 0 0; }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 18px; transition: transform .08s ease, background .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.btn.big { width: 100%; padding: 15px; font-size: 16px; }
.btn.mini { min-height: 44px; padding: 8px 13px; font-size: 13px; border-radius: var(--radius-xs); background: var(--surface-2); }
.btn.mini .ic { width: 14px; height: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.link-btn { background: none; border: none; padding: 0; color: var(--accent); text-decoration: underline; font: inherit; font-weight: 700; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; gap: 4px; }
.link-btn.small { min-height: auto; font-size: 12.5px; font-weight: 600; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: var(--sp-3); }
.mt-18 { margin-top: 18px; }
.hint { color: var(--ink-soft); font-size: var(--fs-xs); line-height: 1.5; margin-top: var(--sp-2); }
.cite { color: var(--ink-soft); font-size: var(--fs-xs); font-style: italic; margin-top: var(--sp-2); line-height: 1.5; }
.row-icon-btn { width: 44px; height: 44px; border-radius: 50%; border: none; background: none; color: var(--ink-soft); cursor: pointer; display: grid; place-items: center; transition: transform .08s ease, color .15s ease, background .15s ease; flex: 0 0 auto; }
.row-icon-btn:hover { color: var(--accent); background: var(--surface-2); }
.row-icon-btn:active { transform: scale(.9); }

/* ---------- empty state (first-run) ---------- */
.empty-state { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: var(--sp-6) var(--sp-4); text-align: center; margin-bottom: var(--sp-6); }
.empty-state h1 { font-size: var(--fs-display); margin-bottom: var(--sp-2); }
.empty-state p { color: var(--ink-soft); max-width: 52ch; margin: 0 auto var(--sp-4); }
.empty-date-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; align-items: flex-end; margin: 0 auto var(--sp-4); max-width: 360px; }
.empty-date-row .field-label { text-align: left; }
.empty-date-field { flex: 1 1 220px; text-align: left; }
.empty-err { color: var(--danger); font-size: var(--fs-xs); margin: -8px auto var(--sp-3); display: none; align-items: center; gap: 6px; justify-content: center; }
.empty-err.show { display: flex; }
.empty-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; }
.empty-actions .btn { flex: 0 1 auto; }
.honesty-note { max-width: 56ch; margin: var(--sp-4) auto 0; padding-top: var(--sp-3); border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-soft); line-height: 1.6; }

/* ---------- ROLLUP BAND — the working hero ---------- */
.rollup-band {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--sp-4); margin-bottom: var(--sp-4);
  box-shadow: 0 20px 48px -30px color-mix(in srgb, var(--accent) 45%, transparent);
}
@media (min-width: 720px) { .rollup-band { padding: var(--sp-5); } }
.rollup-band > .label { margin-bottom: var(--sp-3); }
.rollup-band.settle { animation: settle .9s cubic-bezier(.2,.8,.2,1); }
@keyframes settle {
  0% { box-shadow: 0 20px 48px -30px color-mix(in srgb, var(--accent) 45%, transparent); }
  35% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 38%, transparent), 0 20px 60px -20px color-mix(in srgb, var(--accent) 60%, transparent); }
  100% { box-shadow: 0 20px 48px -30px color-mix(in srgb, var(--accent) 45%, transparent); }
}
.rollup-grid { display: grid; gap: var(--sp-4); grid-template-columns: 1fr; align-items: center; }
@media (min-width: 760px) { .rollup-grid { grid-template-columns: auto 1fr; } }

.progress-ring-wrap { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); text-align: center; }
.progress-ring { position: relative; width: 132px; height: 132px; border-radius: 50%; flex: 0 0 auto;
  background: conic-gradient(var(--accent) var(--pct, 0%), var(--surface-2) 0);
  transition: --pct .7s cubic-bezier(.2,.8,.2,1); }
.progress-ring-inner { position: absolute; inset: 12px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.progress-ring-num { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-hero); line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.progress-ring-num::after { content: '%'; font-size: 0.5em; margin-left: 1px; }
.progress-ring-sub { font-size: 12px; color: var(--ink-soft); font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }

.rollup-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
@media (min-width: 480px) { .rollup-facts { grid-template-columns: repeat(4, 1fr); } }
.rollup-fact { background: var(--surface-2); border-radius: var(--radius-sm); padding: var(--sp-3); border: 1px solid var(--line); }
.rollup-fact-num { font-family: var(--font-display); font-weight: 500; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ink); }
.rollup-fact.is-alert .rollup-fact-num { color: var(--danger); }
.rollup-fact-label { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-soft); font-weight: 600; margin-top: 4px; }
.rollup-fact-label .ic { width: 13px; height: 13px; }
.rollup-fact.is-alert .rollup-fact-label { color: var(--danger); }
.rollup-fact-milestone-title { font-size: 13.5px; font-weight: 700; margin-top: 4px; overflow-wrap: anywhere; }
.rollup-fact-milestone-empty { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; }
@keyframes numRoll { 0% { transform: translateY(-16%); opacity: .25; } 100% { transform: translateY(0); opacity: 1; } }
.roll { animation: numRoll .35s cubic-bezier(.2,.8,.2,1); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-2); }
.search-wrap { position: relative; flex: 1 1 240px; display: flex; align-items: center; }
.search-wrap .ic { position: absolute; left: 13px; color: var(--ink-soft); width: 16px; height: 16px; }
.search-wrap input { width: 100%; font: inherit; font-size: 15px; padding: 11px 14px 11px 38px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); min-height: 44px; }
.sort-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.sort-label select { font: inherit; font-size: 14px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); min-height: 44px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--sp-3); }
.filter-chip { display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: 12.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; color: var(--ink); cursor: pointer; min-height: 44px; }
.filter-chip .ic { width: 12px; height: 12px; }
.filter-chip:hover { border-color: var(--accent); }

/* ---------- TIMELINE — the structural hero (vertical spine + month markers) --
   The rail is a continuous border-left running down the shared container;
   each phase punches a marker dot through it. Rail color is --ink-soft
   (>=4.5:1, comfortably above the 3:1 UI floor a meaning-carrying line needs
   — see tokens.css header comment) so it reads clearly in every theme and on
   the print stylesheet. */
.timeline { position: relative; padding-left: 26px; margin-bottom: var(--sp-5); }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--ink-soft); opacity: .3; }
.timeline-phase { position: relative; margin-bottom: var(--sp-5); }
.timeline-phase:last-child { margin-bottom: 0; }
.phase-marker { position: absolute; left: -26px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--accent); z-index: 1; }
.phase-marker.is-complete { background: var(--accent); }
.phase-marker.is-complete::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; }
.phase-header { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.phase-header h2 { font-size: var(--fs-h2); font-weight: 500; }
.phase-header .phase-count { font-size: 12px; color: var(--ink-soft); font-weight: 600; font-variant-numeric: tabular-nums; }
.phase-toggle { background: none; border: none; color: var(--ink-soft); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 12.5px; font-weight: 600; min-height: 44px; padding: 0 4px; margin-left: auto; }
.phase-toggle .ic { width: 15px; height: 15px; transition: transform .15s ease; }
.phase-toggle[aria-expanded="false"] .ic { transform: rotate(-90deg); }
/* ribbon-tab motif: a small angled flag on the phase header, part of the
   atelier voice. Decorative only — the phase label text carries the meaning. */
.phase-header::before {
  content: ''; width: 10px; height: 14px; flex: 0 0 auto;
  background: var(--accent); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}
.phase-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.phase-list[hidden] { display: none; }
.timeline-phase.sealed .phase-marker { animation: sealPulse .8s cubic-bezier(.2,.8,.2,1); }
@keyframes sealPulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 30%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
}

/* ---------- task rows ---------- */
.task-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: var(--sp-3); display: flex; align-items: flex-start; gap: var(--sp-3);
  box-shadow: 0 8px 20px -20px rgba(0,0,0,.4);
}
.task-card.is-done { opacity: .68; }
.task-card.is-overdue { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.task-status-btn {
  position: relative; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line);
  background: var(--bg); color: transparent; cursor: pointer; display: grid; place-items: center;
  flex: 0 0 auto; margin-top: 2px; transition: border-color .15s ease, background .15s ease, transform .1s ease;
  min-width: 44px; min-height: 44px;
}
.task-status-btn .ic { width: 18px; height: 18px; }
.task-status-btn:active { transform: scale(.92); }
.task-status-btn.status-done { border-color: var(--good); background: var(--good); color: var(--accent-ink); }
.task-status-btn.status-skipped { border-color: var(--ink-soft); color: var(--ink-soft); background: var(--surface-2); }
.task-status-btn.status-skipped .ic { opacity: .8; }
.task-status-btn.just-done::after {
  content: ''; position: absolute; inset: -8px; border-radius: 50%; background: var(--good);
  animation: inkSpread .5s ease-out forwards; pointer-events: none;
}
@keyframes inkSpread { from { transform: scale(.35); opacity: .5; } to { transform: scale(1.7); opacity: 0; } }
.task-status-btn.just-done .ic { animation: checkSettle .42s cubic-bezier(.34,1.56,.64,1); }
@keyframes checkSettle { 0% { transform: scale(1); } 45% { transform: scale(1.25); } 100% { transform: scale(1); } }

.task-body { flex: 1 1 auto; min-width: 0; }
.task-title { font-size: 15.5px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.task-card.is-done .task-title { text-decoration: line-through; text-decoration-color: var(--ink-soft); text-decoration-thickness: 1.5px; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px var(--sp-2); margin-top: 6px; align-items: center; }
.meta-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-soft); background: var(--surface-2); border-radius: 999px; padding: 3px 9px; border: 1px solid var(--line); }
.meta-chip .ic { width: 12px; height: 12px; }
.meta-chip.chip-overdue { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); font-weight: 700; }
.meta-chip.chip-status { font-weight: 600; }
.meta-chip.chip-status.status-done { color: var(--good); }
.meta-chip.chip-status.status-skipped { color: var(--ink-soft); }
.task-note-preview { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; overflow-wrap: anywhere; }
.task-actions { display: flex; gap: 2px; flex: 0 0 auto; }

.list-empty { text-align: center; padding: var(--sp-5); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- forms / fields ---------- */
.field-label { display: block; font-size: var(--fs-sm); font-weight: 700; margin: var(--sp-3) 0 var(--sp-2); color: var(--ink); }
.field {
  width: 100%; font: inherit; font-size: 16px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink);
  min-height: 44px;
}
textarea.field { min-height: 84px; resize: vertical; }
.field:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.field-err { color: var(--danger); font-size: var(--fs-xs); margin-top: 6px; display: flex; gap: 6px; align-items: flex-start; }
.field-err .ic { width: 14px; height: 14px; margin-top: 2px; flex: 0 0 auto; }
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.field-hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

.seg-group { display: flex; flex-wrap: wrap; gap: var(--sp-1); background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px; }
.seg { flex: 1 1 auto; font: inherit; font-size: 13px; font-weight: 700; min-height: 44px; border: none; border-radius: var(--radius-xs); background: transparent; color: var(--ink-soft); cursor: pointer; padding: 8px 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg .ic { width: 15px; height: 15px; }
.seg[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 4px -1px rgba(0,0,0,.18); }

.toggle-row { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) 0; font-size: 15px; min-height: 44px; }
.toggle-row input { width: 22px; height: 22px; accent-color: var(--accent); flex: 0 0 auto; }

.inline-add-form { display: flex; gap: var(--sp-2); margin-top: var(--sp-2); flex-wrap: wrap; }
.inline-add-form .field { flex: 1 1 auto; }

/* ---------- overlay sheets (dialogs) ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--bg) 55%, black 35%);
  display: flex; align-items: center; justify-content: center; padding: var(--sp-3); }
.sheet { position: relative; background: var(--bg); width: 100%; max-width: var(--maxw-narrow); border-radius: 18px;
  max-height: 90vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: var(--sp-4) var(--sp-4) calc(var(--sp-4) + env(safe-area-inset-bottom)); animation: rise .26s cubic-bezier(.2,.8,.2,1); }
.sheet-wide { max-width: 760px; }
@keyframes rise { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet h2 { font-size: 22px; margin: var(--sp-1) 0 6px; padding-right: 40px; }
.sheet .sub { color: var(--ink-soft); font-size: 14px; margin-bottom: var(--sp-2); }
.sheet-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--accent); border: 1px solid var(--line); margin-bottom: var(--sp-2); }
.sheet-ic { width: 24px; height: 24px; }
.sheet-close { position: absolute; top: var(--sp-2); right: var(--sp-2); width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); cursor: pointer;
  display: grid; place-items: center; }
.sheet-close:active { transform: scale(.9); }

/* ---------- overflow menus ---------- */
.menu-list { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }
.menu-item { display: flex; align-items: center; gap: var(--sp-3); width: 100%; text-align: left;
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; padding: 13px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-height: 44px; }
.menu-item:hover { border-color: var(--accent); }
.menu-item:active { transform: scale(.98); }
.menu-ic { width: 20px; height: 20px; flex: 0 0 auto; color: var(--accent); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger .menu-ic { color: var(--danger); }

/* ---------- budget sheet ---------- */
.budget-total-row { display: flex; align-items: flex-end; gap: var(--sp-3); flex-wrap: wrap; }
.budget-total-field { flex: 1 1 180px; }
.budget-allocated-line { flex: 1 1 220px; padding: var(--sp-2) var(--sp-3); background: var(--surface-2); border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; }
.budget-allocated-line.is-over { color: var(--danger); }
.budget-allocated-line .ic { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.budget-cat-list { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }
.budget-cat-row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-3); }
.budget-cat-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-2); }
.budget-cat-label { font-weight: 700; font-size: 14.5px; }
.budget-cat-target { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.budget-cat-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); }
.budget-cat-fields label { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); display: block; margin-bottom: 3px; }
.budget-cat-fields input { width: 100%; font: inherit; font-size: 14.5px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--bg); color: var(--ink); min-height: 44px; }
.budget-cat-remaining { margin-top: 6px; font-size: 12.5px; font-weight: 700; }
.budget-cat-remaining.is-over { color: var(--danger); }
.budget-cat-remaining.is-remaining { color: var(--good); }

/* ---------- vendor cards ---------- */
.vendor-list { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-3); }
.vendor-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-3); display: flex; gap: var(--sp-3); align-items: flex-start; }
.vendor-body { flex: 1 1 auto; min-width: 0; }
.vendor-name { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.vendor-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.vendor-actions { display: flex; gap: 2px; flex: 0 0 auto; }
.status-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-soft); }
.status-chip.status-booked { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.status-chip.status-contacted { color: var(--ink); }
.deposit-chip { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }

/* ---------- settings ---------- */
.setting-group { margin: var(--sp-4) 0; padding-bottom: var(--sp-3); border-bottom: 1px solid var(--line); }
.setting-group h3 { font-size: 16px; margin: 0 0 var(--sp-2); font-weight: 700; font-family: var(--font-ui); }
.theme-picker { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.theme-swatch { display: flex; flex-direction: column; align-items: center; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; min-width: 60px; }
.theme-swatch-dot { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); position: relative; overflow: hidden; }
.theme-swatch[aria-pressed="true"] .theme-swatch-dot { outline: 3px solid var(--ink); outline-offset: 2px; }
.theme-swatch-label { font-size: 11px; color: var(--ink-soft); text-align: center; }
.theme-swatch-dot[data-theme="atelier"] { background: linear-gradient(135deg, #F5EFE3 50%, #A03E50 50%); }
.theme-swatch-dot[data-theme="fern"] { background: linear-gradient(135deg, #EFF3EC 50%, #2E6B45 50%); }
.theme-swatch-dot[data-theme="dusk"] { background: linear-gradient(135deg, #241E2C 50%, #A98FD2 50%); }
.theme-swatch-dot[data-theme="marigold"] { background: linear-gradient(135deg, #F7ECD1 50%, #794D0C 50%); }
.theme-swatch-dot[data-theme="harbor"] { background: linear-gradient(135deg, #E9EEF0 50%, #1C6363 50%); }
.theme-swatch-dot[data-theme="onyx"] { background: linear-gradient(135deg, #211C1A 50%, #D8A08C 50%); }

.category-list { display: flex; flex-direction: column; gap: 6px; margin-top: var(--sp-2); }
.category-row { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 6px 6px 12px; }
.category-row .ic { color: var(--accent); width: 16px; height: 16px; flex: 0 0 auto; }
.category-row .field { flex: 1 1 auto; }
.category-label { flex: 1 1 auto; font-size: 14px; }
.category-row.is-hidden .category-label { color: var(--ink-soft); text-decoration: line-through; }
.category-hide-toggle { font-size: 11px; }

.preset-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }

.steps-guide { margin: var(--sp-2) 0 4px; padding-left: 22px; list-style: decimal; }
.steps-guide li { font-size: 15px; line-height: 1.55; padding: 6px 0; }

.tip-list { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-2); }
.tip-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-3); }
.tip-card h4 { font-family: var(--font-display); font-size: 17px; margin-bottom: 4px; font-weight: 500; }
.tip-card p { font-size: var(--fs-sm); color: var(--ink); margin-bottom: 6px; }
.tip-card .cite { margin-top: 0; }
.about-h { font-size: 15px; margin: var(--sp-4) 0 4px; font-weight: 700; }
.about-p { font-size: 14px; line-height: 1.6; color: var(--ink-soft); margin: 0; }
.about-p a { color: var(--accent); }
.version { color: var(--ink-soft); font-size: 11.5px; text-align: center; margin-top: var(--sp-4); }

/* ---------- footer ---------- */
.site-footer { max-width: var(--maxw); margin: var(--sp-6) auto 0; padding: var(--sp-5) var(--sp-4); border-top: 1px solid var(--line); color: var(--ink-soft); font-size: var(--fs-sm); position: relative; z-index: 2; }
.footer-grid { display: grid; gap: var(--sp-4); }
@media (min-width: 640px) { .footer-grid { grid-template-columns: 1.3fr 1fr; align-items: start; } }
.footer-cite { font-style: italic; line-height: 1.6; max-width: 52ch; }
.footer-cite b { color: var(--ink); font-style: normal; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px;
  font-size: 14px; z-index: 70; max-width: 90%; text-align: center; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); animation: rise .22s ease; }
.toast-btn { margin-left: 8px; background: var(--bg); color: var(--ink); border: none; border-radius: 999px;
  padding: 5px 13px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.toast-btn:active { transform: scale(.94); }

/* install banner — fixed at bottom (CLS): beforeinstallprompt can fire well
   after first paint; out-of-flow means it only ever overlays. */
.banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px);
  background: var(--accent); color: var(--accent-ink); font-size: 14px; text-align: center;
  box-shadow: 0 -6px 18px -8px rgba(0,0,0,.35); }
.banner button { margin-left: 8px; background: var(--accent-ink); color: var(--accent); border: none; border-radius: 8px; padding: 6px 10px; font: inherit; font-weight: 600; cursor: pointer; }
.banner .close { background: transparent; color: var(--accent-ink); float: right; padding: 4px; }

/* print area — never visible on screen; css/print.css (media="print") makes
   it the ONLY visible content when printing. */
#print-root { display: none; }

@media (max-width: 420px) {
  .field-row-2 { grid-template-columns: 1fr; }
  .budget-cat-fields { grid-template-columns: 1fr 1fr; }
}
