/* SPDX-License-Identifier: AGPL-3.0-only */
/* Balisa console: calm, legible, no external font (no request leaves for a
   font provider). Ivory paper, night ink, one sage accent. */
:root {
  --bg: #f7f4ee; --surface: #fffdf9; --surface-2: #f1ece3; --ink: #1c2420; --ink-2: #4a5550; --muted: #77807b;
  --line: #e4ddd1; --line-2: #d6cdbe; --accent: #2f5d50; --accent-ink: #fff; --accent-soft: #e3ece7;
  --gold: #b88a3b; --warn: #a64232; --warn-soft: #f6e6e1; --ok-soft: #e6efe9;
  --radius: 14px; --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(28, 36, 32, .05), 0 8px 24px -12px rgba(28, 36, 32, .12);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141917; --surface: #1b211e; --surface-2: #232b27; --ink: #ece7dd; --ink-2: #bdb8ae; --muted: #8d948f;
    --line: #2c3530; --line-2: #3a453f; --accent: #8cc2ae; --accent-ink: #10201a; --accent-soft: #22322c;
    --gold: #d6ad62; --warn: #e48a76; --warn-soft: #3a2420; --ok-soft: #1f2d27; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15.5px/1.55 var(--sans); color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.2rem); line-height: 1.15; margin: 0 0 .3em; }
h2 { font-size: 1.28rem; margin: 0; }
h3 { font-size: 1.05rem; margin: 0 0 .4em; }
p { margin: .4em 0; }
code { font: .88em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; word-break: break-all; }
.muted { color: var(--muted); font-size: .92em; }
.small { font-size: .86em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1080px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 1.25rem; font-weight: 600; }
.brand svg { width: 30px; height: 30px; flex: none; }
.top nav { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.top nav a { color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95em; }
.top nav a:hover { background: var(--surface-2); color: var(--ink); }
.who { color: var(--muted); font-size: .86em; padding: 0 4px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Page */
main { max-width: 1080px; margin: 0 auto; padding: 28px 20px 96px; }
main.narrow { max-width: 460px; padding-top: 44px; }
.crumbs { font-size: .9em; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { color: var(--ink-2); margin: 0; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { flex: 1; }
.card.attention { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.split { display: grid; gap: 22px; grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
hr.soft { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* Flash messages */
.flash { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 18px; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.flash.err { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }

/* Controls */
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 9px 12px; min-height: 40px; max-width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input.num { width: 6.5em; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .9em; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field input:not([type=checkbox]), .field select { width: 100%; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 16px; min-height: 38px; font-weight: 500; line-height: 1.2; }
button:hover, .btn:hover { background: var(--surface-2); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover, .btn.primary:hover { filter: brightness(1.08); }
button.danger, .btn.danger { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line-2)); background: transparent; }
button.ghost, .btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
button.small, .btn.small { min-height: 30px; padding: 4px 12px; font-size: .88em; }
.btn.big { padding: 12px 24px; font-size: 1.05em; }
form.inline { display: inline; }

/* Switch: a checkbox drawn as a toggle */
label.switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 6px 0; }
label.switch input { appearance: none; flex: none; width: 40px; height: 24px; border-radius: 999px; background: var(--line-2); position: relative; margin: 0; cursor: pointer; transition: background .15s; }
label.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
label.switch input:checked { background: var(--accent); }
label.switch input:checked::after { transform: translateX(16px); }
label.switch b { font-weight: 600; display: block; }
label.switch small { color: var(--muted); }

/* Chips: checkboxes as pills */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: .93em; background: var(--surface); user-select: none; }
.chip input { accent-color: var(--accent); margin: 0; }
.chip:has(input:checked) { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, var(--line-2)); color: var(--ink); }

/* Segmented control (radios) */
.segmented { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; background: var(--surface-2); flex-wrap: wrap; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: block; padding: 6px 14px; border-radius: 999px; font-size: .92em; color: var(--ink-2); }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

/* "i": explanations kept out of the way */
details.info { position: relative; display: inline-block; }
details.info > summary { list-style: none; cursor: pointer; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-2); color: var(--ink-2);
  display: grid; place-items: center; font: italic 600 13px/1 var(--serif); background: var(--surface); }
details.info > summary::-webkit-details-marker { display: none; }
details.info[open] > summary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
details.info > div { position: absolute; right: -8px; top: 32px; z-index: 30; width: min(360px, 86vw); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: 0 12px 32px -8px rgba(0, 0, 0, .25); font-size: .92em; color: var(--ink-2); }
details.info > div p:first-child { margin-top: 0; }
details.info > div p:last-child { margin-bottom: 0; }
details.more > summary { cursor: pointer; color: var(--accent); font-size: .92em; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1 1 200px; min-width: 0; }
.list .when { color: var(--muted); font-size: .86em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-style: italic; padding: 8px 0; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85em; color: var(--muted); font-weight: 600; }
td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; font-family: var(--sans); font-weight: 500; letter-spacing: 0; vertical-align: middle; font-size: .78em; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

/* Figures */
.figures { display: flex; flex-wrap: wrap; gap: 28px; }
.figures b { display: block; font: 600 1.9em/1.1 var(--serif); }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar { background: var(--accent); height: 10px; border-radius: 999px; min-width: 2px; }

/* Child page: section menu and the save bar */
.toc { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 20px; }
.toc a { text-decoration: none; color: var(--ink-2); border: 1px solid var(--line); background: var(--surface); padding: 5px 12px; border-radius: 999px; font-size: .9em; }
.toc a:hover { border-color: var(--accent); color: var(--accent); }
.savebar { position: sticky; bottom: 16px; z-index: 15; display: flex; justify-content: flex-end; gap: 12px; align-items: center; margin: 8px 0 26px;
  padding: 10px 12px 10px 18px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line-2); backdrop-filter: blur(8px); box-shadow: var(--shadow); }
.anchor { scroll-margin-top: 80px; }
.sub { padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days .chip { padding: 4px 10px; font-size: .86em; }
.slot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.slot:last-child { border-bottom: 0; }

/* Welcome page */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; padding: 34px 0 30px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } .hero-art { order: -1; max-width: 300px; } }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78em; color: var(--gold); font-weight: 700; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.3rem); line-height: 1.05; margin: .25em 0 .35em; }
.hero .lead { font-size: 1.15em; color: var(--ink-2); max-width: 34em; }
.hero .row { margin-top: 22px; }
.hero-art svg { width: 100%; height: auto; }
.features { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin: 26px 0; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.feature .ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px; }
.feature .ico svg { width: 22px; height: 22px; }
.feature p { color: var(--ink-2); font-size: .95em; }
.steps { counter-reset: s; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); list-style: none; padding: 0; }
.steps li { counter-increment: s; padding: 22px 22px 22px 70px; position: relative; border-left: 2px solid var(--line); }
.steps li::before { content: counter(s); position: absolute; left: 20px; top: 20px; font: 600 1.6em/1 var(--serif); color: var(--gold); }
.promise { background: var(--accent); color: var(--accent-ink); border-radius: calc(var(--radius) + 6px); padding: 34px; margin: 34px 0; display: grid; gap: 22px; grid-template-columns: 1fr 1.4fr; }
@media (max-width: 760px) { .promise { grid-template-columns: 1fr; } }
.promise h2 { color: inherit; font-size: 1.6rem; }
.promise ul { margin: 0; padding-left: 1.1em; }
.promise li + li { margin-top: 8px; }
.section-title { margin: 44px 0 6px; font-size: 1.6rem; }
footer.site { border-top: 1px solid var(--line); margin-top: 40px; padding: 22px 0 0; color: var(--muted); font-size: .88em; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* Sign-in */
.auth h1 { text-align: center; }
.auth .lead { text-align: center; color: var(--ink-2); margin-bottom: 22px; }
.auth .card { padding: 26px; }
.auth .btn, .auth button.primary { width: 100%; }
.auth .alt { text-align: center; margin-top: 16px; font-size: .93em; color: var(--ink-2); }
.code-input { letter-spacing: .5em; font-size: 1.4em !important; text-align: center; font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  main { padding: 20px 14px 90px; }
  .card { padding: 18px; }
  .who, .top nav a[href="/"] { display: none; }
  .savebar { border-radius: var(--radius); }
}
