/* Care Log by Noxe. The meter: one very large number, a fine day ruler, lots of air.
   Forest in light mode, Night in dark mode. Geist for words, Geist Mono for times. */
@font-face { font-family: 'Geist'; font-weight: 400 700; font-style: normal; font-display: swap; src: url(../fonts/geist.woff2) format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-weight: 400 600; font-style: normal; font-display: swap; src: url(../fonts/geist-mono.woff2) format('woff2'); }

/* Palette tokens as in the meter study: forest (light), night (dark). Helper tokens below them. */
:root {
  --bg: #F1F3EE; --ink: #14261C; --mut: #56685C; --line: #DCE3D8; --tick: #BFCCBF; --acc: #1F5C3A; --accInk: #FFFFFF;
  --safe: #F6E3B8; --safeInk: #7A5410; --card: #FFFFFF; --warn: #A0431F;
  --well: #E4EAE0; --edge: #74857A; --shadow: 0 18px 36px -26px rgba(20, 38, 28, .45); --scrim: rgba(20, 38, 28, .45);
  --undo-bg: #14261C; --undo-ink: #F1F3EE; --undo-btn: #F6E3B8; --undo-btn-ink: #14261C;
  --mono: 'Geist Mono', ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171A; --ink: #F1ECE6; --mut: #A39C96; --line: #2A2D31; --tick: #43474D; --acc: #F2A7BE; --accInk: #2A0F19;
    --safe: #22382A; --safeInk: #A9DDB4; --card: #1D2024; --warn: #F2B08A;
    --well: #24272B; --edge: #7A7570; --shadow: none; --scrim: rgba(0, 0, 0, .65);
    --undo-bg: #2A2D31; --undo-ink: #F1ECE6; --undo-btn: #F2A7BE; --undo-btn-ink: #2A0F19;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171A; --ink: #F1ECE6; --mut: #A39C96; --line: #2A2D31; --tick: #43474D; --acc: #F2A7BE; --accInk: #2A0F19;
  --safe: #22382A; --safeInk: #A9DDB4; --card: #1D2024; --warn: #F2B08A;
  --well: #24272B; --edge: #7A7570; --shadow: none; --scrim: rgba(0, 0, 0, .65);
  --undo-bg: #2A2D31; --undo-ink: #F1ECE6; --undo-btn: #F2A7BE; --undo-btn-ink: #2A0F19;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 18px/1.5 'Geist', system-ui, sans-serif; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 20px; }
p { margin: 0 0 12px; }
a { color: var(--acc); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--acc); color: var(--accInk); padding: 10px 14px; border-radius: 12px; z-index: 50; }
.skip:focus { top: 8px; }
.mono, .tm, time { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- app frame ---------- */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 10px 16px; border-bottom: 1px solid var(--line); }
.top-in { max-width: 680px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.brand { font-weight: 700; font-size: 20px; letter-spacing: -0.02em; flex: none; }
.who { flex: 1; min-width: 0; }
.who select, .field select { width: 100%; min-height: 52px; padding: 0 14px; border: 1.5px solid var(--edge); border-radius: 14px; background: var(--card); font-weight: 600; font-size: 20px; }
#main { max-width: 680px; margin: 0 auto; padding: 16px 16px 150px; }
.has-dock #main { padding-bottom: calc(var(--tabs-h, 90px) + var(--dock-h, 140px) + 24px); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); z-index: 10; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.tabs-in { max-width: 680px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.tab { min-height: 56px; border: 0; background: transparent; border-radius: 14px; font-size: 18px; font-weight: 500; color: var(--mut); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 6px 2px 4px; line-height: 1.15; gap: 2px; }
.tab[aria-current="page"] { background: var(--well); color: var(--ink); font-weight: 600; }
.tab[aria-current="page"] svg { color: var(--acc); }
.tab svg { width: 24px; height: 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card h2 { margin-bottom: 8px; }
.plain { box-shadow: none; }
.muted { color: var(--mut); }
.page-title { margin: 8px 0 14px; font-size: 34px; letter-spacing: -0.03em; }
.stack > * + * { margin-top: 12px; }

/* ---------- buttons ---------- */
.btn { min-height: 52px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--accInk); }
.btn.danger { color: var(--warn); border-color: var(--warn); background: transparent; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 18px; }
.btn.block { width: 100%; }
.btn.link { border-color: transparent; background: transparent; color: var(--acc); text-decoration: underline; text-underline-offset: 3px; }
.btn svg { width: 24px; height: 24px; flex: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .grow { flex: 1; }

/* ---------- Today: the meter ---------- */
.meter { padding: 18px 0 4px; }
.meter .k { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--mut); margin: 0; }
.mnum { font-weight: 600; font-size: clamp(68px, 23vw, 112px); line-height: .9; letter-spacing: -0.06em; margin: 12px 0 0; font-variant-numeric: tabular-nums; display: flex; flex-wrap: wrap; align-items: flex-start; }
.mnum small { font-size: 18px; font-weight: 500; letter-spacing: 0; color: var(--mut); margin: 12px 14px 0 5px; line-height: 1; }
.mnum small:last-child { margin-right: 0; }
.mnum.words { font-size: clamp(52px, 17vw, 84px); }
.meter .k .date { flex: none; }
@media (max-width: 359px) { .meter .k .date { display: none; } }
.meter .what { margin: 14px 0 0; font-size: 20px; }
.meter .what b { font-weight: 600; }
.meter .what .tm { font-size: 18px; }
.empty-hero { padding: 22px 0 6px; }
.empty-hero h2 { font-size: 34px; letter-spacing: -0.03em; margin-bottom: 10px; max-width: 18ch; }
.empty-hero p { color: var(--mut); max-width: 34ch; }
.allow { margin-top: 18px; background: var(--safe); color: var(--safeInk); border-radius: 16px; padding: 14px 16px; }
.allow .line { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.allow b { font-weight: 600; }
.allow .tm { font-weight: 600; }
.allow .why { margin: 4px 0 0; font-size: 18px; }

/* day ruler, 06:00 to 24:00. Positions are set from JS through CSSOM. */
.ruler { position: relative; margin: 26px 6px 0; height: 76px; }
.rl-track { position: absolute; left: 0; right: 0; bottom: 26px; height: 44px; }
.rl-track .tk { position: absolute; bottom: 0; width: 1px; height: 10px; background: var(--tick); }
.rl-track .tk.hr { height: 16px; background: var(--edge); }
.rl-track .tk.big { height: 24px; width: 1.5px; background: var(--mut); }
.rl-track .zone { position: absolute; bottom: 0; height: 16px; background: var(--safe); border-top: 3px solid var(--safeInk); border-radius: 3px 3px 0 0; }
.rl-track .mark { position: absolute; bottom: 0; width: 3px; height: 38px; margin-left: -1.5px; border-radius: 2px; background: var(--mut); }
.rl-track .mark.med { background: var(--acc); height: 44px; width: 4px; margin-left: -2px; }
.rl-track .now { position: absolute; bottom: -6px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px var(--bg); }
.rl-axis { position: absolute; left: 0; right: 0; bottom: 0; height: 20px; font: 400 16px/20px var(--mono); color: var(--mut); }
.rl-axis span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.rl-axis span:first-child { transform: none; }
.rl-axis span:last-child { transform: translateX(-100%); }
.ruler-note { color: var(--mut); margin: 10px 0 0; }

/* sections under the meter */
.block { margin-top: 28px; }
.block > h2 { margin-bottom: 4px; }
.block > .muted { margin-bottom: 4px; }
.worry { color: var(--mut); margin: 22px 0 0; }

/* entries as rows: time, what, a status word */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { border-top: 1px solid var(--line); }
.tl li:last-child { border-bottom: 1px solid var(--line); }
.tl button { width: 100%; display: grid; grid-template-columns: 62px 1fr auto; gap: 10px; align-items: baseline; text-align: left; border: 0; background: transparent; padding: 14px 0; min-height: 56px; }
.tl .tm { font-size: 16px; color: var(--mut); }
.tl .what b { display: block; font-size: 19px; font-weight: 600; }
.tl .what span { color: var(--mut); overflow-wrap: anywhere; }
.tl .st { font-size: 18px; font-weight: 600; color: var(--mut); }
.tl .st.med { color: var(--acc); }
.daytitle { margin: 16px 0 6px; font-size: 18px; color: var(--mut); font-weight: 600; }

.medrow { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: transparent; padding: 14px 0; min-height: 56px; }
.medrow:last-of-type { border-bottom: 1px solid var(--line); }
.medrow b { font-size: 19px; font-weight: 600; }
.medrow .st { color: var(--acc); font-weight: 600; align-self: start; }
.medrow .sub { grid-column: 1 / -1; color: var(--mut); }
.medrow .sub.go { color: var(--ink); }
.next { font-weight: 600; }

.also { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; margin-top: 10px; }
.also .btn { min-height: 56px; padding: 6px 12px; justify-content: flex-start; text-align: left; line-height: 1.2; }
.also .btn svg { color: var(--acc); }

/* main action at the bottom, in thumb reach */
.dock { position: fixed; left: 0; right: 0; bottom: var(--tabs-h, 90px); z-index: 9; background: var(--bg); border-top: 1px solid var(--line); padding: 10px 12px; }
.dock-in { max-width: 656px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dock .main { grid-column: 1 / -1; min-height: 60px; border: 0; border-radius: 16px; background: var(--acc); color: var(--accInk); font-weight: 600; font-size: 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 18px; text-align: left; }
.dock .main .tm, .dock .main .pick1 { font-size: 17px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dock .sec { min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 18px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 8px; }
.dock .sec svg { width: 22px; height: 22px; color: var(--acc); flex: none; }

.banner { background: var(--well); border-radius: 16px; padding: 14px; margin: 4px 0 8px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner p { margin: 0; flex: 1 1 200px; }
.foot { color: var(--mut); font-size: 18px; margin: 28px 0 0; }

/* ---------- forms and sheets ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span, legend { display: block; font-weight: 600; margin-bottom: 6px; padding: 0; }
.help { color: var(--mut); font-size: 18px; margin: 6px 0 0; }
input[type=text], input[type=number], input[type=datetime-local], textarea { width: 100%; min-height: 52px; padding: 10px 14px; border: 1.5px solid var(--edge); border-radius: 14px; background: var(--card); font-size: 20px; }
input[type=datetime-local] { font-family: var(--mono); font-size: 18px; }
textarea { min-height: 110px; resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--well); padding: 4px; border-radius: 16px; }
.seg label { position: relative; display: block; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 12px; font-weight: 600; text-align: center; padding: 0 8px; }
.seg input:checked + span { background: var(--acc); color: var(--accInk); }
.seg input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }
.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pick { position: relative; display: block; }
.pick input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pick span { display: flex; align-items: center; min-height: 56px; padding: 6px 12px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); font-weight: 600; line-height: 1.2; }
.pick input:checked + span { background: var(--acc); border-color: var(--acc); color: var(--accInk); }
.pick input:focus-visible + span { outline: 3px solid var(--acc); outline-offset: 2px; }
.pain { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.pain label { position: relative; display: block; }
.pain input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pain span { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); font: 500 20px var(--mono); }
.pain input:checked + span { background: var(--acc); border-color: var(--acc); color: var(--accInk); }
.pain input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }
@media (min-width: 560px) { .pain { grid-template-columns: repeat(11, 1fr); } }
.bigtemp { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.bigtemp input { font-size: 56px; font-weight: 600; letter-spacing: -0.04em; text-align: center; min-height: 92px; font-variant-numeric: tabular-nums; }
.bigtemp .unit { font-size: 26px; font-weight: 500; color: var(--mut); flex: none; }
.error { color: var(--warn); font-weight: 600; margin: 0 0 12px; }
.sheet-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.sheet-actions .btn.primary { flex: 1 1 160px; }

dialog { border: 0; padding: 0; background: var(--bg); color: var(--ink); width: 100%; max-width: 100%; margin: auto 0 0; max-height: 94vh; border-radius: 24px 24px 0 0; overflow: auto; }
dialog::backdrop { background: var(--scrim); }
@media (min-width: 700px) { dialog { max-width: 580px; margin: auto; border-radius: 24px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 10px; position: sticky; top: 0; background: var(--bg); z-index: 2; border-bottom: 1px solid var(--line); }
.sheet-body { padding: 14px 18px 24px; }
.medcard { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; margin-bottom: 12px; }
.medcard h3 { margin-bottom: 2px; }
.medcard p { margin-bottom: 6px; }

.undo { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabs-h, 90px) + 12px); max-width: 656px; margin: 0 auto; background: var(--undo-bg); color: var(--undo-ink); border-radius: 16px; padding: 8px 8px 8px 16px; display: flex; align-items: center; gap: 12px; z-index: 40; box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .5); }
.has-dock .undo { bottom: calc(var(--tabs-h, 90px) + var(--dock-h, 140px) + 10px); }
.undo span { flex: 1; }
.undo button { min-height: 48px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--undo-btn); color: var(--undo-btn-ink); font-weight: 600; }
dialog[open] ~ .undo { z-index: 30; }

/* ---------- hand over, doctor ---------- */
.paper { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; font: 400 18px/1.55 'Geist', system-ui, sans-serif; margin: 0 0 16px; }
.status { min-height: 28px; font-weight: 600; color: var(--acc); }
.qrow, .arow { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.qrow:first-of-type, .arow:first-of-type { border-top: 0; }
.qrow label { flex: 1; display: flex; gap: 12px; align-items: center; min-height: 48px; }
.qrow input[type=checkbox] { width: 28px; height: 28px; flex: none; accent-color: var(--acc); }
.arow { align-items: flex-start; flex-wrap: wrap; }
.arow .info { flex: 1 1 220px; }
.report h2 { font-size: 26px; }
.report h3 { margin: 22px 0 8px; }
.report table { width: 100%; border-collapse: collapse; font-size: 18px; }
.report th, .report td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.report th { font-weight: 600; color: var(--mut); }
.chart { width: 100%; height: auto; display: block; color: var(--ink); }
.chart .ax { stroke: var(--line); stroke-width: 1; }
.chart .ln { stroke: var(--acc); stroke-width: 2.5; fill: none; }
.chart .pt { fill: var(--acc); }
.chart text { fill: var(--mut); font-size: 24px; font-family: var(--mono); }
details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.listrow { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.listrow:first-of-type { border-top: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.welcome { padding-top: 28px; }
.welcome h1 { font-size: 36px; letter-spacing: -0.03em; margin-bottom: 12px; }
.welcome > p { color: var(--mut); }

/* ---------- print: only the doctor's page ---------- */
@media print {
  :root, :root[data-theme="dark"] { --bg: #fff; --card: #fff; --ink: #000; --mut: #222; --line: #999; --acc: #000; --shadow: none; color-scheme: light; }
  body { background: #fff; color: #000; font-size: 13pt; }
  .top, .tabs, .undo, .dock, .no-print, dialog { display: none !important; }
  #main { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .report h3 { break-after: avoid; }
  .report table, .chart { break-inside: avoid; }
  .chart .pt { fill: #000; } .chart .ln { stroke: #000; }
}

/* ---------- website pages ---------- */
.site { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.site header { display: flex; justify-content: space-between; align-items: center; padding: 18px 0; gap: 12px; flex-wrap: wrap; }
.hero { display: grid; gap: 32px; padding: 24px 0 48px; align-items: center; }
.hero h1 { font-size: clamp(36px, 6vw, 62px); letter-spacing: -0.04em; line-height: 1.02; margin-bottom: 16px; }
.hero p.lead { font-size: 22px; color: var(--mut); max-width: 36ch; }
.shots { display: flex; gap: 16px; justify-content: center; }
.shots img { width: 46%; max-width: 280px; height: auto; border-radius: 22px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.sec { padding: 32px 0; border-top: 1px solid var(--line); }
.sec h2 { margin-bottom: 14px; font-size: 30px; letter-spacing: -0.03em; }
.cols { display: grid; gap: 20px; }
.prose { max-width: 70ch; }
.prose li { margin-bottom: 8px; }
.faq details { border-top: 1px solid var(--line); padding: 4px 0; }
.faq p { max-width: 70ch; }
.sitefoot { border-top: 1px solid var(--line); padding: 28px 0 48px; color: var(--mut); }
.sitefoot p { margin-bottom: 8px; }
.tbl { width: 100%; border-collapse: collapse; margin: 12px 0; }
.tbl th, .tbl td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
@media (min-width: 900px) {
  .hero { grid-template-columns: 1.1fr 1fr; }
  .cols { grid-template-columns: repeat(3, 1fr); }
}
.medcard .row .btn.primary { flex: 1 1 100%; }

/* every-screen set on the website */
.screenset { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; list-style: none; margin: 16px 0 0; padding: 0 0 12px; }
.screenset li { flex: none; width: 200px; scroll-snap-align: start; }
.screenset img { display: block; width: 100%; height: auto; border-radius: 22px; border: 1px solid var(--line); }
.screenset p { margin: 10px 0 0; font-size: 16px; color: var(--mut); }
.screenset b { color: var(--ink); }
@media (min-width: 900px) {
  .screenset { display: grid; grid-template-columns: repeat(6, 1fr); overflow: visible; }
  .screenset li { width: auto; }
}
