/* ============================================================
   PILEUS — personal forecast journal
   Cloud-suite aesthetic: atmospheric themes + frosted glass
   ============================================================ */

/* ---------- Theme tokens ---------- */
:root {
  /* Night (default tokens) — balloons glowing over a sleeping valley */
  --bg-0: #070b16;
  --ink: #f1f5f9;
  --ink-soft: #cbd5e1;
  --ink-faint: #94a3b8;

  --glass: rgba(10, 16, 32, 0.52);
  --glass-strong: rgba(10, 16, 32, 0.86);
  --glass-hi: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-strong: rgba(255, 255, 255, 0.22);
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.8);

  --accent: #7dd3fc;
  --accent-line: rgba(125, 211, 252, 0.5);
  --accent-cool: #38bdf8;
  --needle: #fbbf24;
  --beacon: #10b981;
  --beacon-bright: #34d399;
  --beacon-ink: #04140d;

  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --danger: #f87171;
  --ok-wash: rgba(52, 211, 153, 0.13);
  --warn-wash: rgba(251, 191, 36, 0.13);
  --bad-wash: rgba(248, 113, 113, 0.13);
  --info-wash: rgba(125, 211, 252, 0.12);
  --amber-wash: rgba(16, 185, 129, 0.12);
  --amber-border: rgba(52, 211, 153, 0.4);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --panel: rgba(255, 255, 255, 0.04);
  --hover: rgba(255, 255, 255, 0.05);
  --input: rgba(2, 6, 23, 0.4);
  --seg-active: rgba(255, 255, 255, 0.13);
  --primary-bg: #f1f5f9;
  --primary-ink: #0f172a;
  --track: rgba(255, 255, 255, 0.12);

  /* Scene */
  --sky-top: #04070f;
  --sky-mid: #0b1424;
  --sky-horizon: #1f2f52;
  --sun: #fff6d6;
  --sun-glow: #ffd9a0;
  --sun-opacity: 0;
  --sun-disc-opacity: 0;
  --haze: #1c2a4a;
  --cloud-lit: #5b6b8f;
  --cloud-mid: #2f3b5a;
  --cloud-shadow: #182036;
  --cloud-base: #0b101f;
  --cap-lit: #7384a8;
  --cap-mid: #46547a;
  --cap-shade: #1b2440;
  --ridge-far: #101b30;
  --ridge-mid: #0a1424;
  --field-a: #0f1f17;
  --field-b: #132a1b;
  --field-c: #1b2b1a;
  --field-d: #26231a;
  --river: #26406c;
  --river-lit: #5d84c0;
  --tree: #0a1a10;
  --tree-dark: #050d08;
  --barn: #3a1d1d;
  --barn-roof: #1a1214;
  --silo: #3b4256;
  --house-wall: #3a3f50;
  --house-roof: #1a1c26;
  --basket: #5b4630;
  --basket-dark: #2a2118;
  --burner: #ffb347;
  --glow-opacity: 0.55;
  --flame-opacity: 1;
  --star-opacity: 0.85;
  --moon-opacity: 0.6;

  --emblem-cap: #cbd5e1;
  --emblem-body: #94a3b8;
  --emblem-base: #64748b;

  --radius: 12px;
  --radius-sm: 8px;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Twilight — low gold light, balloons catching the last sun */
html.twilight {
  --bg-0: #1d2142;
  --ink: #fbf7ff;
  --ink-soft: #e2dcf0;
  --ink-faint: #b4abc9;

  --glass: rgba(34, 28, 62, 0.46);
  --glass-strong: rgba(34, 28, 62, 0.84);
  --glass-hi: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-border-strong: rgba(255, 255, 255, 0.28);
  --shadow: 0 18px 50px -22px rgba(26, 12, 46, 0.7);

  --accent: #ffc58a;
  --accent-line: rgba(255, 197, 138, 0.5);
  --needle: #ffd27a;
  --input: rgba(24, 18, 46, 0.45);

  --sky-top: #2a2f5e;
  --sky-mid: #a1608f;
  --sky-horizon: #ffb77d;
  --sun: #fff0c4;
  --sun-glow: #ffb36b;
  --sun-opacity: 1;
  --sun-disc-opacity: 1;
  --haze: #ffb68a;
  --cloud-lit: #ffd7b0;
  --cloud-mid: #e8a3a0;
  --cloud-shadow: #8a5a86;
  --cloud-base: #55406f;
  --cap-lit: #ffe6cb;
  --cap-mid: #f4b9a4;
  --cap-shade: #a26a86;
  --ridge-far: #9a6f98;
  --ridge-mid: #5e5578;
  --field-a: #5f7a42;
  --field-b: #78904a;
  --field-c: #a89655;
  --field-d: #9c7a4d;
  --river: #f0a98e;
  --river-lit: #ffd9b8;
  --tree: #3a5636;
  --tree-dark: #24402c;
  --barn: #9a4a3e;
  --barn-roof: #4a3340;
  --silo: #c9b4b0;
  --house-wall: #e4cbb8;
  --house-roof: #5a4150;
  --basket: #7a5a3a;
  --basket-dark: #3d2c20;
  --burner: #ffd27a;
  --glow-opacity: 0.18;
  --flame-opacity: 0.8;
  --star-opacity: 0.2;
  --moon-opacity: 0;

  --emblem-cap: #ffe6cb;
  --emblem-body: #f4b9a4;
  --emblem-base: #a26a86;
}

/* Day — bright summer cumulus over green fields */
html.day {
  --bg-0: #cfe3f3;
  --ink: #17233b;
  --ink-soft: #2f3f5c;
  --ink-faint: #5d6e8a;

  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --glass-hi: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(255, 255, 255, 0.8);
  --glass-border-strong: rgba(120, 140, 170, 0.5);
  --shadow: 0 18px 50px -24px rgba(23, 35, 59, 0.45);

  --accent: #1d5fd6;
  --accent-line: rgba(29, 95, 214, 0.38);
  --accent-cool: #0369a1;
  --needle: #c2410c;
  --beacon: #059669;
  --beacon-bright: #10b981;
  --beacon-ink: #ffffff;

  --ok: #047857;
  --warn: #b45309;
  --bad: #b91c1c;
  --danger: #dc2626;
  --ok-wash: rgba(4, 120, 87, 0.11);
  --warn-wash: rgba(217, 119, 6, 0.13);
  --bad-wash: rgba(185, 28, 28, 0.09);
  --info-wash: rgba(29, 95, 214, 0.09);
  --line: rgba(23, 35, 59, 0.09);
  --line-strong: rgba(23, 35, 59, 0.2);
  --panel: rgba(255, 255, 255, 0.5);
  --hover: rgba(23, 35, 59, 0.04);
  --input: rgba(255, 255, 255, 0.85);
  --seg-active: #ffffff;
  --primary-bg: #17233b;
  --primary-ink: #ffffff;
  --track: rgba(23, 35, 59, 0.12);

  --sky-top: #3f86d4;
  --sky-mid: #86bbea;
  --sky-horizon: #dcefff;
  --sun: #fff8cf;
  --sun-glow: #fff1a8;
  --sun-opacity: 0.7;
  --sun-disc-opacity: 1;
  --haze: #e8f4ff;
  --cloud-lit: #ffffff;
  --cloud-mid: #eef4fb;
  --cloud-shadow: #b4c5da;
  --cloud-base: #8aa0bb;
  --cap-lit: #ffffff;
  --cap-mid: #f1f6fc;
  --cap-shade: #a7b9d0;
  --ridge-far: #a9c8e2;
  --ridge-mid: #7fae9a;
  --field-a: #7fb84a;
  --field-b: #9bcb5e;
  --field-c: #d4cf62;
  --field-d: #c9a566;
  --river: #6fbbe6;
  --river-lit: #d8f1ff;
  --tree: #2f7d3d;
  --tree-dark: #1d5a2b;
  --barn: #b5382b;
  --barn-roof: #5a4a44;
  --silo: #dfe5ea;
  --house-wall: #f3ede2;
  --house-roof: #6b5a52;
  --basket: #a77a47;
  --basket-dark: #5a4128;
  --burner: #ffbe55;
  --glow-opacity: 0;
  --flame-opacity: 0.55;
  --star-opacity: 0;
  --moon-opacity: 0;

  --emblem-cap: #ffffff;
  --emblem-body: #dbe7f5;
  --emblem-base: #8aa0bb;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg-0);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font-family: inherit; }
a { color: inherit; }

/* ---------- Scenic backdrop ---------- */
.scenic-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.scenic-sky {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-mid) 34%, var(--sky-horizon) 62%, var(--sky-horizon) 100%);
  transition: background 0.6s ease;
}
.scenic-scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.scenic-scene path, .scenic-scene ellipse, .scenic-scene circle, .scenic-scene rect, .scenic-scene polygon { transition: fill 0.6s ease; }
.scene-sun { opacity: var(--sun-disc-opacity); transition: opacity 0.6s ease; }
.scene-sunglow { opacity: var(--sun-opacity); transition: opacity 0.6s ease; }
html.day .scene-sun { transform: translate(-60px, -400px); }
html.day .scene-sunglow { transform: translate(-60px, -400px); }
.balloon-glow { opacity: var(--glow-opacity); transition: opacity 0.6s ease; }
.balloon-flame { opacity: var(--flame-opacity); transition: opacity 0.6s ease; animation: flicker 1.7s ease-in-out infinite alternate; }
@keyframes flicker { from { transform: scaleY(0.82); } to { transform: scaleY(1.12); } }

.bob { animation: bob 9s ease-in-out infinite alternate; }
.bob--a { animation-duration: 11s; }
.bob--b { animation-duration: 8s; animation-delay: -3s; }
.bob--c { animation-duration: 13s; animation-delay: -6s; }
.bob--d { animation-duration: 10s; animation-delay: -1.5s; }
@keyframes bob { from { transform: translate(-6px, 10px); } to { transform: translate(8px, -14px); } }
.pileus { animation: capdrift 18s ease-in-out infinite alternate; transform-origin: 1136px 100px; }
@keyframes capdrift { from { transform: translateY(2px) scale(1); } to { transform: translateY(-3px) scale(1.012); } }
@media (prefers-reduced-motion: reduce) { .bob, .pileus, .balloon-flame, .scenic-stars { animation: none; } }

.scenic-stars {
  position: absolute; top: 0; left: 0; right: 0; height: 38%;
  opacity: var(--star-opacity);
  transition: opacity 0.6s ease;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 40%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 28% 62%, #fff, transparent),
    radial-gradient(1.6px 1.6px at 44% 30%, #fff, transparent),
    radial-gradient(1px 1px at 58% 56%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 72% 36%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 86% 60%, #fff, transparent),
    radial-gradient(1px 1px at 94% 24%, #fff, transparent),
    radial-gradient(1px 1px at 5% 18%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 36% 12%, #fff, transparent);
  animation: twinkle 5s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: calc(var(--star-opacity) * 0.55); } to { opacity: var(--star-opacity); } }
.celestial { position: absolute; top: 5%; left: 10%; width: 120px; height: 120px; display: grid; place-items: center; transition: opacity 0.6s ease; }
.celestial--moon { opacity: var(--moon-opacity); }
.celestial__glow { position: absolute; width: 200px; height: 200px; border-radius: 50%; filter: blur(26px); background: radial-gradient(circle, rgba(226, 232, 240, 0.4), transparent 70%); }
.celestial__disc { position: relative; width: 62px; height: 62px; border-radius: 50%; background: radial-gradient(circle at 36% 32%, #ffffff, #dbe4f0 55%, #aab6c9); box-shadow: 0 0 34px rgba(203, 213, 236, 0.5); }

/* ---------- Shell ---------- */
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 1180px; margin: 0 auto; padding: 0 14px 14px; }
.topbar { flex: none; display: flex; align-items: center; gap: 14px; padding: 12px 2px 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; flex: none; }
.brand__emblem { width: 42px; height: 37px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25)); }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase; font-size: 0.98rem; }
.brand__tag { font-size: 0.68rem; color: var(--ink-soft); margin-top: 2px; }
html:not(.day) .brand__name, html:not(.day) .brand__tag { text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5); }

.tabs {
  display: flex; gap: 2px; padding: 3px; margin: 0 auto;
  border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  font-size: 0.84rem; font-weight: 600; color: var(--ink-soft); text-decoration: none; white-space: nowrap;
}
.tab:hover { color: var(--ink); background: var(--glass-hi); }
.tab.is-active { background: var(--seg-active); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
.tab__badge { min-width: 18px; padding: 0 6px; border-radius: 999px; font-size: 0.68rem; font-weight: 800; text-align: center; line-height: 17px; background: var(--bad); color: #fff; }
.topbar__actions { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border); background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: var(--ink-soft); cursor: pointer; transition: color 0.15s ease, border-color 0.15s ease;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--ink); border-color: var(--glass-border-strong); }

.canvas {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
  background: var(--glass); backdrop-filter: blur(20px) saturate(1.25); -webkit-backdrop-filter: blur(20px) saturate(1.25);
  border: 1px solid var(--glass-border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; outline: none;
}
.view { display: flex; flex-direction: column; gap: 18px; animation: view-in 0.25s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Shared bits ---------- */
.eyebrow, .group-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-faint); }
.view__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.view__title { margin: 0; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; }
.view__sub { margin: 4px 0 0; font-size: 0.86rem; color: var(--ink-soft); line-height: 1.5; max-width: 60ch; }
.section { display: flex; flex-direction: column; gap: 10px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.muted { color: var(--ink-faint); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 600; border: 1px solid var(--line-strong); color: var(--ink-soft); white-space: nowrap; }
.chip--ok { color: var(--ok); background: var(--ok-wash); border-color: transparent; }
.chip--bad { color: var(--bad); background: var(--bad-wash); border-color: transparent; }
.chip--warn { color: var(--warn); background: var(--warn-wash); border-color: transparent; }
.chip--info { color: var(--accent); background: var(--info-wash); border-color: transparent; }
.mono { font-family: var(--font-mono); }

/* ---------- Stat strip ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--line-strong); background: var(--hover); }
.stat__label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.stat__value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat__note { font-size: 0.76rem; color: var(--ink-soft); }
.stat--ok .stat__value { color: var(--ok); }
.stat--bad .stat__value { color: var(--bad); }
.stat--warn .stat__value { color: var(--warn); }

/* ---------- Composer ---------- */
.composer { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line-strong); }
.composer__more { display: flex; flex-direction: column; gap: 14px; }
.composer:not(.is-open) { gap: 10px; }
.composer:not(.is-open) .composer__more { display: none; }
.composer:not(.is-open) .composer__claim { min-height: 0; height: 44px; resize: none; }
.composer__title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.composer__title h2 { margin: 0; font-size: 1.02rem; font-weight: 800; }
.composer__claim { width: 100%; resize: vertical; min-height: 58px; padding: 11px 13px; font-size: 1rem; line-height: 1.45; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--input); color: var(--ink); }
.composer__claim:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }
.composer__grid { display: grid; grid-template-columns: minmax(200px, 250px) minmax(0, 1fr); gap: 18px; align-items: center; }
.composer__dial { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.composer__right { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.p-readout { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.p-readout__num { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.p-readout__band { font-size: 0.9rem; font-weight: 600; color: var(--ink-soft); }
.range { width: 100%; accent-color: var(--needle); height: 26px; cursor: pointer; }
.quickp { display: flex; flex-wrap: wrap; gap: 6px; }
.quickp button { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--glass-hi); color: var(--ink-soft); font-size: 0.76rem; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; }
.quickp button:hover { color: var(--ink); border-color: var(--ink-faint); }
.hint { margin: 0; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 0.82rem; line-height: 1.45; background: var(--info-wash); color: var(--ink); border: 1px solid transparent; }
.hint--warn { background: var(--warn-wash); }
.hint--ok { background: var(--ok-wash); }
.hint:empty { display: none; }
.composer__meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.datechips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.datechips button { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--ink-faint); font-size: 0.7rem; font-weight: 600; cursor: pointer; }
.datechips button:hover { color: var(--ink); border-color: var(--line-strong); }
.composer details { border-top: 1px solid var(--line); padding-top: 10px; }
.composer summary { cursor: pointer; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); }
.composer details[open] summary { margin-bottom: 10px; }
.composer__actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.composer__actions .form__error { margin-right: auto; }

/* ---------- Gauge ---------- */
.gauge { width: 100%; max-width: 250px; height: auto; display: block; overflow: visible; }
.gauge__track { fill: none; stroke: var(--track); stroke-width: 11; stroke-linecap: round; }
.gauge__fill { fill: none; stroke: var(--needle); stroke-width: 11; stroke-linecap: round; transition: d 0.15s ease; }
.gauge__tick { stroke: var(--ink-faint); stroke-width: 1.5; opacity: 0.7; }
.gauge__tick--major { stroke-width: 2.2; opacity: 1; }
.gauge__needle { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; transition: transform 0.15s ease; }
.gauge__hub { fill: var(--ink); }
.gauge__label { fill: var(--ink-faint); font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; }
.gauge__num { fill: var(--ink); font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gauge--sm { max-width: 150px; }

/* ---------- Forecast rows ---------- */
.fc-list { display: flex; flex-direction: column; gap: 8px; }
.fc { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 11px 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.fc:hover, .fc:focus-visible { border-color: var(--line-strong); background: var(--hover); outline: none; }
.fc--due { box-shadow: inset 3px 0 0 var(--warn); }
.fc--overdue { box-shadow: inset 3px 0 0 var(--bad); }
.fc__p { display: flex; flex-direction: column; gap: 5px; align-items: stretch; }
.fc__pnum { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; text-align: left; }
.fc__bar { height: 5px; border-radius: 3px; background: var(--track); overflow: hidden; display: block; }
.fc__bar i { display: block; height: 100%; background: var(--needle); border-radius: 3px; }
.fc__claim { margin: 0; font-size: 0.95rem; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.fc__meta { margin: 4px 0 0; font-size: 0.76rem; color: var(--ink-faint); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.fc__actions { display: flex; gap: 6px; }
.fc--done .fc__bar i { background: var(--ink-faint); }
.fc--hit { box-shadow: inset 3px 0 0 var(--ok); }
.fc--miss { box-shadow: inset 3px 0 0 var(--bad); }
.fc__score { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 96px; }
.scorebar { width: 96px; height: 5px; border-radius: 3px; background: var(--track); overflow: hidden; }
.scorebar i { display: block; height: 100%; border-radius: 3px; background: var(--ok); }
.scorebar--bad i { background: var(--bad); }
.scorebar--mid i { background: var(--warn); }
.empty { text-align: center; padding: 34px 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty__title { margin: 0; font-size: 1.1rem; font-weight: 800; }
.empty__text { margin: 0; max-width: 52ch; color: var(--ink-soft); line-height: 1.55; font-size: 0.9rem; }
.empty__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ---------- Record ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.hero__verdict { margin: 0; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.hero__text { margin: 6px 0 0; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.55; max-width: 62ch; }
.hero__meters { display: grid; grid-template-columns: repeat(3, auto); gap: 8px 22px; }
.meter { display: flex; flex-direction: column; gap: 2px; }
.meter__value { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.meter__label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.meter__note { font-size: 0.72rem; color: var(--ink-faint); }
.charts { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.chart { display: flex; flex-direction: column; gap: 8px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart__title { margin: 0; font-size: 0.95rem; font-weight: 800; }
.chart__sub { margin: 0; font-size: 0.78rem; color: var(--ink-faint); line-height: 1.45; }
.ch-grid { stroke: var(--line-strong); stroke-width: 1; opacity: 0.6; }
.ch-axis { stroke: var(--ink-faint); stroke-width: 1.2; }
.ch-diag { stroke: var(--ink-soft); stroke-width: 1.5; stroke-dasharray: 5 5; opacity: 0.8; }
.ch-text { fill: var(--ink-faint); font-size: 11px; font-weight: 600; }
.ch-zone { fill: var(--ink-faint); font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.75; }
.ch-line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.ch-area { fill: var(--accent); opacity: 0.1; }
.ch-whisker { stroke-width: 2; stroke-linecap: round; opacity: 0.8; }
.ch-pt { stroke: var(--bg-0); stroke-width: 1.5; }
.ch-pt--ok { fill: var(--ok); } .ch-whisker--ok { stroke: var(--ok); }
.ch-pt--over { fill: var(--warn); } .ch-whisker--over { stroke: var(--warn); }
.ch-pt--under { fill: var(--accent); } .ch-whisker--under { stroke: var(--accent); }
.ch-base { stroke: var(--bad); stroke-width: 1.2; stroke-dasharray: 4 4; opacity: 0.7; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.74rem; color: var(--ink-soft); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: baseline; }
.insights { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.insight { padding: 12px 14px; border-radius: var(--radius); border: 1px solid transparent; background: var(--info-wash); }
.insight--warn { background: var(--warn-wash); }
.insight--ok { background: var(--ok-wash); }
.insight__title { margin: 0 0 3px; font-size: 0.9rem; font-weight: 800; }
.insight__body { margin: 0; font-size: 0.82rem; color: var(--ink-soft); line-height: 1.5; }
.table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.table th { text-align: left; font-size: 0.68rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-faint); font-weight: 700; padding: 6px 10px; border-bottom: 1px solid var(--line-strong); }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th { white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; }
.table th.num { text-align: right; }
.table-wrap { overflow-x: auto; }

.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: var(--glass-hi); border: 1px solid var(--line); }
.seg__btn { padding: 5px 12px; border-radius: 6px; border: none; background: none; color: var(--ink-soft); font-size: 0.8rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.seg__btn:hover { color: var(--ink); }
.seg__btn.is-active { background: var(--seg-active); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }

/* ---------- Archive filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters .field__input { width: auto; min-width: 140px; }
.filters .search { flex: 1 1 200px; }

/* ---------- Warm-up ---------- */
.warm { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.warm__card { padding: 22px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line-strong); display: flex; flex-direction: column; gap: 16px; }
.warm__progress { display: flex; align-items: center; gap: 10px; font-size: 0.78rem; font-weight: 700; color: var(--ink-faint); letter-spacing: 0.06em; text-transform: uppercase; }
.warm__progress .scorebar { flex: 1; width: auto; }
.warm__progress .scorebar i { background: var(--accent); }
.warm__claim { margin: 0; font-size: 1.3rem; font-weight: 700; line-height: 1.4; letter-spacing: -0.01em; }
.warm__ask { display: grid; grid-template-columns: minmax(180px, 230px) minmax(0, 1fr); gap: 18px; align-items: center; }
.reveal { display: flex; flex-direction: column; gap: 10px; }
.reveal__verdict { margin: 0; font-size: 1.25rem; font-weight: 800; }
.reveal__verdict--ok { color: var(--ok); }
.reveal__verdict--bad { color: var(--bad); }
.reveal__why { margin: 0; color: var(--ink-soft); line-height: 1.55; font-size: 0.92rem; }
.warm__row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.round-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--track); }
.dot--ok { background: var(--ok); }
.dot--bad { background: var(--bad); }

/* ---------- Forecast sheet ---------- */
.sheet { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.sheet__claim { margin: 0; font-size: 1.2rem; font-weight: 800; line-height: 1.35; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.sheet__top { display: grid; grid-template-columns: minmax(160px, 200px) minmax(0, 1fr); gap: 16px; align-items: center; }
.sheet__facts { display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; color: var(--ink-soft); min-width: 0; }
.sheet__facts strong { color: var(--ink); }
.sheet__block { display: flex; flex-direction: column; gap: 6px; }
.sheet__text { margin: 0; font-size: 0.88rem; line-height: 1.55; color: var(--ink-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 10px; padding: 7px 0 7px 16px; font-size: 0.82rem; color: var(--ink-soft); }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--needle); }
.timeline li::after { content: ""; position: absolute; left: 6.5px; top: 21px; bottom: -7px; width: 1px; background: var(--line-strong); }
.timeline li:last-child::after { display: none; }
.timeline__p { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.timeline__note { color: var(--ink-faint); }
.resolve { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.resolve__buttons { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.btn--yes { background: var(--ok-wash); color: var(--ok); border-color: transparent; }
.btn--no { background: var(--bad-wash); color: var(--bad); border-color: transparent; }
.btn--yes:hover, .btn--no:hover { filter: brightness(1.08); border-color: currentColor; }
.scorecard { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius); }
.scorecard--ok { background: var(--ok-wash); }
.scorecard--bad { background: var(--bad-wash); }
.scorecard--warn { background: var(--warn-wash); }
.scorecard__big { font-size: 1.15rem; font-weight: 800; }
.revise { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.sheet__foot { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid var(--line); }

/* ---------- Forms ---------- */
.form { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.form__actions { display: flex; justify-content: flex-end; gap: 8px; }
.form__actions--stack { flex-direction: column; align-items: stretch; }
.form__error { margin: 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--bad-wash); color: var(--bad); font-size: 0.84rem; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field__label { font-size: 0.76rem; font-weight: 600; color: var(--ink-soft); }
.field__label em { font-style: normal; font-weight: 400; color: var(--ink-faint); margin-left: 4px; }
.field__input { width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--input); color: var(--ink); font-size: 0.88rem; }
.field__input:focus { outline: 2px solid var(--accent-line); outline-offset: 0; border-color: var(--accent); }
.field__input--area { resize: vertical; min-height: 60px; line-height: 1.45; }
html:not(.day) select.field__input option { background: #1e293b; color: #f8fafc; }
.choice__text p { margin: 0 0 8px; line-height: 1.5; color: var(--ink-soft); }
.choice__text strong { color: var(--ink); }
.choice__note { font-size: 0.82rem; color: var(--ink-faint) !important; }

/* ---------- Buttons ---------- */
.btn { font-size: 0.82rem; font-weight: 600; padding: 7px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--glass-hi); color: var(--ink); cursor: pointer; transition: all 0.15s ease; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn:hover { border-color: var(--ink-faint); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn--ghost { background: var(--glass-hi); }
.btn--primary { background: var(--primary-bg); color: var(--primary-ink); border-color: transparent; }
.btn--primary:hover { border-color: transparent; filter: brightness(0.94); }
.btn--sm { padding: 4px 10px; font-size: 0.76rem; }
.btn--quiet { background: none; border-color: transparent; color: var(--ink-soft); }
.btn--quiet:hover { color: var(--ink); border-color: var(--line-strong); }
.btn--danger { color: var(--bad); border-color: var(--bad-wash); }
.btn--danger:hover { background: var(--bad-wash); }

/* ---------- Modals ---------- */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(5, 9, 18, 0.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal__card { position: relative; width: 100%; max-width: 440px; background: var(--glass-strong); backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3); border: 1px solid var(--glass-border-strong); border-radius: var(--radius); box-shadow: var(--shadow); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto; }
.modal__card--wide { max-width: 640px; }
.modal__header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--glass-border); position: sticky; top: 0; background: inherit; z-index: 1; }
.modal__title { margin: 0; font-size: 1.02rem; font-weight: 700; letter-spacing: 0.02em; }
.modal__close { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; line-height: 1; border: 1px solid var(--glass-border); border-radius: var(--radius-sm); background: var(--glass-hi); color: var(--ink); cursor: pointer; }
.modal__close:hover { border-color: var(--glass-border-strong); }

.settings-content { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.settings-group { display: flex; flex-direction: column; gap: 8px; }
.settings-divider { height: 1px; background: var(--glass-border); }
.settings-row__label { font-weight: 700; font-size: 0.9rem; }
.settings-row__desc { font-size: 0.78rem; color: var(--ink-faint); line-height: 1.4; }
.settings-privacy { margin: 0; font-size: 0.75rem; color: var(--ink-faint); line-height: 1.4; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-actions .btn { flex: 1 1 auto; }
.settings-actions--compact .btn { flex: 1 1 130px; }

.cloud-data-field { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; }
.cloud-data-field__label { font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); }
.cloud-phrase-entry { display: flex; gap: 6px; }
.cloud-data-field__input { flex: 1 1 auto; min-width: 0; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--glass-border-strong); background: var(--input); color: var(--ink); font-family: var(--font-mono); font-size: 0.82rem; }
.cloud-data-field__input:focus { outline: none; border-color: var(--accent); }
.cloud-phrase-entry__toggle { flex: none; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--glass-border-strong); background: var(--glass-hi); color: var(--ink-soft); font-size: 0.76rem; font-weight: 600; cursor: pointer; }
.cloud-phrase-entry__toggle:hover { color: var(--ink); }
.cloud-phrase-output { margin: 0; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px dashed var(--amber-border); background: var(--amber-wash); font-size: 0.76rem; line-height: 1.45; color: var(--ink-soft); }
.cloud-remember-option { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--ink-soft); cursor: pointer; }
.cloud-data-status { margin: 2px 0 0; min-height: 1em; font-size: 0.78rem; line-height: 1.4; color: var(--ink-faint); }
.cloud-data-status--info { color: var(--accent-cool); }
.cloud-data-status--success { color: var(--beacon-bright); }
html.day .cloud-data-status--success { color: var(--beacon); }
.cloud-data-status--error { color: var(--danger); }

.theme-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 4px; }
.theme-chip { padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--glass-border-strong); background: var(--glass-hi); color: var(--ink); font-weight: 600; font-size: 0.82rem; cursor: pointer; transition: all 0.15s ease; }
.theme-chip:hover { border-color: var(--ink-faint); transform: translateY(-1px); }
.theme-chip.is-active { border-color: var(--beacon); background: var(--amber-wash); color: var(--beacon-bright); box-shadow: 0 0 0 1px var(--beacon) inset; }
html.day .theme-chip.is-active { color: var(--beacon); }

.about-content { padding: 18px; text-align: center; }
.about-content__name { margin: 4px 0 2px; font-size: 1.3rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.about-content__version { margin: 0 0 12px; font-family: var(--font-mono); font-size: 0.8rem; color: var(--beacon-bright); }
html.day .about-content__version { color: var(--beacon); }
.about-content__description { margin: 0; font-size: 0.85rem; color: var(--ink-soft); line-height: 1.55; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 400; padding: 12px 20px; max-width: min(92vw, 560px); border-radius: var(--radius-sm); background: var(--glass-strong); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--glass-border-strong); color: var(--ink); font-size: 0.88rem; font-weight: 600; box-shadow: var(--shadow); animation: toast-in 0.25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .tabs { order: 3; width: 100%; margin: 0; justify-content: space-between; }
  .tab { flex: 1 1 auto; justify-content: center; padding: 6px 10px; }
  .topbar__actions { margin-left: auto; }
  .charts { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .shell { padding: 0 8px 8px; }
  .canvas { padding: 14px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .composer__grid, .warm__ask, .sheet__top { grid-template-columns: 1fr; }
  .composer__dial { max-width: 230px; margin: 0 auto; }
  .fc { grid-template-columns: 58px minmax(0, 1fr); }
  .fc__actions, .fc__score { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: flex-end; }
  .hero__meters { grid-template-columns: repeat(2, auto); }
  .resolve__buttons { grid-template-columns: 1fr 1fr; }
  .resolve__buttons .btn:last-child { grid-column: 1 / -1; }
  .brand__tag { display: none; }
  .hide-sm { display: none; }
  .warm__claim { font-size: 1.12rem; }
}
