/* Tailboard: soft sage, mist and sky. Rounded type, generous space, nothing loud except the crisis panel. */
@font-face { font-family: "Nunito"; src: url(/fonts/nunito-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(/fonts/nunito-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito Sans"; src: url(/fonts/nunito-sans-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito Sans"; src: url(/fonts/nunito-sans-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Nunito Sans"; src: url(/fonts/nunito-sans-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #eef3f1; --surface: #fbfcfb; --surface-2: #f3f7f5; --ink: #2c3e3a; --muted: #5d6f6a; --line: #d9e3df;
  --primary: #487b6a; --on-primary: #fbfcfb; --primary-soft: #dfeae5;
  --sky: #5f8ea6; --sky-soft: #e2edf3;
  --steady: #3f7a5f; --steady-soft: #e2efe7;
  --honey: #93641f; --honey-soft: #f6ecda;
  --crisis: #a8473d; --crisis-soft: #f7e4e1;
  --shadow: 0 1px 2px rgba(44, 62, 58, .05), 0 8px 24px rgba(44, 62, 58, .06);
  --display: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #162120; --surface: #1d2a28; --surface-2: #233230; --ink: #e3ebe8; --muted: #a2b3ae; --line: #30413d;
    --primary: #8cc3ae; --on-primary: #132020; --primary-soft: #253a33;
    --sky: #9cc3d7; --sky-soft: #203440;
    --steady: #8fd0ad; --steady-soft: #1f3329;
    --honey: #e3b66d; --honey-soft: #392f1e;
    --crisis: #ee9187; --crisis-soft: #3d2523;
    --shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 8px 24px rgba(0, 0, 0, .18);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; text-wrap: balance; letter-spacing: -.005em; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 22px; line-height: 1.25; }
h3 { font-size: 17px; line-height: 1.3; }
p { margin: 0; }
a { color: var(--primary); text-underline-offset: 3px; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.tiny { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* Shell */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px max(20px, env(safe-area-inset-left, 0px)) 8px max(20px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 19px; color: var(--ink); text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 9px; }
main { flex: 1; display: flex; flex-direction: column; gap: 16px;
  padding: 8px max(20px, env(safe-area-inset-left, 0px)) 24px max(20px, env(safe-area-inset-right, 0px)); }
.tabs { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface);
  border-top: 1px solid var(--line); padding: 6px max(6px, env(safe-area-inset-left, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-right, 0px)); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; color: var(--muted);
  text-decoration: none; font-size: 12px; font-weight: 600; }
.tabs a svg { width: 22px; height: 22px; }
.tabs a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
.crisis-line { text-align: center; font-size: 14px; color: var(--muted); padding: 4px 20px 12px; }
.crisis-line a { color: var(--crisis); font-weight: 700; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); min-width: 0; }
.card.soft { background: var(--primary-soft); border-color: transparent; box-shadow: none; }
.card.sky { background: var(--sky-soft); border-color: transparent; box-shadow: none; }
.card.honey { background: var(--honey-soft); border-color: transparent; box-shadow: none; }
.card.crisis { background: var(--crisis-soft); border: 2px solid var(--crisis); box-shadow: none; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* Controls */
.btn { appearance: none; font: 700 16px var(--body); border-radius: 14px; padding: 13px 18px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; text-align: center; text-decoration: none; display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 48px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--primary); padding-inline: 8px; }
.btn.crisis { background: var(--crisis); border-color: var(--crisis); color: #fff; }
.btn.danger { color: var(--crisis); border-color: var(--crisis); background: transparent; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 15px; }
input[type=text], input[type=tel], input[type=date], select, textarea {
  font: 400 17px var(--body); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; width: 100%; }
textarea { min-height: 88px; resize: vertical; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.check input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--primary); flex: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.chip.steady { background: var(--steady-soft); color: var(--steady); }
.chip.honey { background: var(--honey-soft); color: var(--honey); }
.chip.crisis { background: var(--crisis-soft); color: var(--crisis); }
.chip.sky { background: var(--sky-soft); color: var(--sky); }

/* Check-in */
.progress { display: flex; gap: 4px; }
.progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.progress span.on { background: var(--primary); }
.q-intro { color: var(--muted); font-size: 16px; }
.q-stem { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.3; }
.q-tool { align-self: flex-start; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option { text-align: left; font: 600 17px var(--body); color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; cursor: pointer; min-height: 52px; transition: border-color .2s, background .2s; }
.option[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.options.yn { flex-direction: row; }
.options.yn .option { flex: 1; text-align: center; }

/* Results */
.area { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.area:first-child { border-top: 0; padding-top: 0; }
.area .meta { grid-column: 1 / -1; font-size: 15px; color: var(--muted); }
.big988 { font-family: var(--display); font-weight: 700; font-size: 52px; line-height: 1; color: var(--crisis); }
.spark svg { width: 100%; height: auto; display: block; }

/* Breathing */
.breathe { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 8px 0; }
.orb { width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, var(--surface), var(--primary-soft) 55%, var(--sky-soft));
  border: 2px solid var(--primary); transform: scale(.7); transition: transform 4s ease-in-out; }
.orb.in { transform: scale(1); }
.orb-label { font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--primary); min-height: 28px; }

/* Ledger */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) 90px 22px; gap: 10px; align-items: center; font-size: 15px; }
.track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.fill { height: 100%; background: var(--sky); border-radius: 4px; }
.list-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: center; }
.list-item:first-child { border-top: 0; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: 15px; z-index: 20; max-width: calc(100% - 40px); box-shadow: var(--shadow); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.kpi { background: var(--surface-2); border-radius: 14px; padding: 14px; }
.kpi .v { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.1; }
ul.clean { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } .orb { transform: scale(.85) !important; } }

/* Journal, resources, numbers */
.bignum { font-family: var(--display); font-weight: 700; font-size: 28px; }
details.entry { border-top: 1px solid var(--line); padding: 12px 0; }
details.entry:first-of-type { border-top: 0; }
details.entry summary, details.resource summary { cursor: pointer; list-style: none; }
details.entry summary::-webkit-details-marker, details.resource summary::-webkit-details-marker { display: none; }
details.entry[open] summary { margin-bottom: 8px; }
details.resource > summary h2::after { content: " +"; color: var(--muted); font-weight: 600; }
details.resource[open] > summary h2::after { content: " –"; }
.evidence { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
input[type=range] { width: 100%; accent-color: var(--primary); }
input[type=email], input[type=password] { font: 400 17px var(--body); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; width: 100%; }
.orb { transition-property: transform; transition-timing-function: ease-in-out; }
