:root {
  color-scheme: dark;
  --bg: #101827;
  --nav: #111a2d;
  --paper: #182438;
  --field: #101b2e;
  --stroke: #374960;
  --ink: #fbfcff;
  --muted: #b4c3d7;
  --orange: #ffad68;
  --strong: #f79043;
  --green: #a8e4bc;
  --danger: #ffb0a8;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, sans-serif; }
a { color: var(--orange); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, .rating input:focus-visible + span {
  outline: 3px solid #ffd2a9; outline-offset: 3px;
}
a, button, input, textarea { -webkit-tap-highlight-color: transparent; }
.top { border-bottom: 1px solid var(--stroke); background: var(--nav); }
.bar { max-width: 760px; margin: auto; padding: 13px max(18px, env(safe-area-inset-left)); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.brand { text-decoration: none; display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 1rem; font-weight: 750; }
.brand img { border-radius: 11px; }
nav { display: flex; flex: 1 0 100%; gap: 6px; order: 3; }
nav a { min-height: 44px; justify-content: center; text-align: center; display: flex; align-items: center; flex: 1 1 auto; padding: 5px; color: var(--muted); text-decoration: none; font-weight: 650; font-size: .87rem; border-radius: 8px; }
nav a[aria-current] { color: var(--orange); background: #2d2730; }
.logout { margin-left: auto; }
.logout button, .plain { background: none; color: var(--muted); border: 0; padding: 8px 0; min-height: 44px; font-size: .86rem; }
main { max-width: 730px; margin: auto; padding: 22px max(16px, env(safe-area-inset-left)) 26px; }
.hero { padding: clamp(25px, 7vw, 48px) clamp(20px, 5vw, 42px); border: 1px solid #41495b; border-radius: 18px; margin-bottom: 16px;
  background: radial-gradient(circle at 108% 80%, transparent 0 20%, #965b3c80 20.3% 20.7%, transparent 21% 30%, #965b3c4d 30.3% 30.7%, transparent 31%), linear-gradient(120deg, #1d2c45 35%, #352b35);
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.1rem, 7.1vw, 3.4rem); line-height: 1.03; letter-spacing: -.045em; max-width: 12em; }
h2 { font-size: 1.15rem; line-height: 1.25; letter-spacing: -.02em; }
.hero time, .hero > p:not(.kicker) { display: block; margin-top: 13px; color: #e4eaf3; }
.kicker { color: var(--orange); text-transform: uppercase; letter-spacing: .12em; font-size: .69rem; font-weight: 760; margin-bottom: 9px; }
.card { padding: clamp(16px, 4vw, 27px); background: var(--paper); border: 1px solid var(--stroke); border-radius: 16px; margin-bottom: 13px; }
.card > :not(:first-child) { margin-top: 12px; }
.field { border: 0; margin: 0; padding: 0 0 15px; min-width: 0; border-bottom: 1px solid var(--stroke); }
label, legend { color: var(--ink); font-weight: 680; margin-bottom: 7px; padding: 0; }
label { display: block; }
input:not([type=radio]), textarea { display: block; width: 100%; padding: 11px 13px; min-height: 47px; border: 1px solid #54677f; border-radius: 9px; color: var(--ink); background: var(--field); font: inherit; }
input[inputmode=numeric] { width: 108px; font-variant-numeric: tabular-nums; }
textarea { resize: vertical; }
.rating { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.rating label { position: relative; margin: 0; cursor: pointer; }
.rating input { position: absolute; opacity: 0; height: 1px; width: 1px; }
.rating label > span { display: flex; min-height: 64px; flex-direction: column; align-items: center; justify-content: center; background: var(--field); border: 1px solid #586c85; border-radius: 9px; }
.rating b { font-size: 1.3rem; line-height: 1.15; }
.rating small { font-size: .68rem; font-weight: 650; }
.rating input:checked + span { background: var(--orange); border-color: var(--orange); color: #23170e; }
button, .button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; cursor: pointer; border: 1px solid transparent; border-radius: 8px; font: inherit; font-weight: 680; padding: 9px 13px; text-decoration: none; }
.primary { background: var(--strong); color: #20160f; width: 100%; min-height: 52px; }
.secondary { background: var(--field); border-color: #586c85; color: var(--ink); }
.selected { background: var(--orange); color: #20160f; }
button:disabled { opacity: .65; cursor: progress; }
.muted, footer { color: var(--muted); font-size: .9rem; }
.helper { margin-top: 0; }
.draft-label:empty { display: none; }
.login form label { margin-top: 15px; }
.login .primary { margin-top: 17px; }
.status, .problem { background: var(--field); color: var(--muted); border-radius: 8px; padding: 12px; border-left: 3px solid var(--orange); }
.status p { margin-top: 3px; }
.status.sent { color: var(--green); border-color: var(--green); }
.problem, .status.failed, .status.uncertain { color: var(--danger); border-color: var(--danger); }
.problem { margin-bottom: 12px; }
.heading-row, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.heading-row { justify-content: space-between; }
.answers { margin: 0; }
.answers dt { margin: 11px 0 2px; font-size: .86rem; color: var(--muted); }
.answers dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.history { list-style: none; margin: 0 0 13px; padding: 0; }
.history li a { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; text-decoration: none; background: var(--paper); padding: 13px; border: 1px solid var(--stroke); border-radius: 10px; min-height: 50px; color: var(--ink); }
.history time { flex: 1; }
.tag { color: var(--orange); }
.date-jump input { width: auto; max-width: 100%; }
.period { padding: 8px 3px 17px; }
.period p { margin: 10px 0; }
.mean { color: var(--orange); font-weight: 750; }
.mean small { color: var(--muted); font-weight: 500; }
.chart { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 4px; padding-top: 8px; }
.chart.monthly { gap: 2px; }
.slot { text-align: center; min-width: 0; }
.track { display: flex; align-items: end; height: 75px; border-bottom: 1px solid #67758a; }
meter { width: 100%; height: 100%; writing-mode: vertical-lr; direction: rtl; appearance: none; display: block; }
meter::-webkit-meter-bar { background: transparent; border: 0; }
meter::-webkit-meter-optimum-value { background: var(--strong); border-radius: 2px 2px 0 0; }
meter::-moz-meter-bar { background: var(--strong); }
.slot.zero .track { border-bottom: 3px solid var(--orange); }
.slot.missing .track { border-bottom-style: dotted; }
.tick { color: var(--muted); font-size: .67rem; }
.monthly .slot:not(:first-child):not(:nth-child(5n)) .tick { visibility: hidden; }
summary { color: var(--orange); padding: 8px 0; min-height: 44px; cursor: pointer; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .85rem; }
td, th { padding: 6px 3px; border-bottom: 1px solid var(--stroke); }
footer { max-width: 730px; margin: auto; padding: 0 16px calc(22px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) {
  nav { order: 0; flex: 1 0 auto; }
  .brand { font-size: 1.04rem; }
}
