/* Nona calls – Notion dark, minimal (same look as Monk). */
:root {
  --bg: #191919; --card: #202020; --sheet: #252525; --line: #2f2f2f; --hover: rgba(255,255,255,.055);
  --text: #d4d4d4; --dim: #9b9b9b; --faint: #5a5a5a;
  --accent: #2383e2; --warn-bg: #3a2f1a; --warn: #dfab01; --bad: #e6847c; --good: #6fb07a;
  --tag-bg: #1c2b36; --tag: #6aa8d6;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 var(--font); font-variant-numeric: tabular-nums;
  padding: env(safe-area-inset-top) 0 calc(64px + env(safe-area-inset-bottom));
  -webkit-text-size-adjust: 100%;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
button:disabled { opacity: .25; cursor: default; }
small { font-size: 13px; color: var(--dim); }

#view { max-width: 560px; margin: 0 auto; padding: 4px 16px 32px; }
#status { display: block; margin: 0 auto; padding: 6px 16px 0; max-width: 560px; width: 100%; text-align: right; font-size: 12px; color: var(--faint); min-height: 6px; }
#status.bad, .bad { color: var(--bad); }
.good { color: var(--good); }
.faint { color: var(--faint); }

/* date bar */
.datebar { display: flex; align-items: center; height: 48px; margin-bottom: 4px; }
.datebar button { height: 44px; min-width: 44px; display: grid; place-items: center; font-size: 22px; color: var(--dim); border-radius: 6px; }
.datebar .date { display: block; flex: 1; font-size: 17px; font-weight: 400; color: var(--text); text-align: center; }
.datebar .date b { font-weight: 600; }
.datebar button:active { background: var(--hover); }

/* section labels */
.label { display: flex; align-items: center; gap: 8px; margin: 24px 2px 6px; font-size: 13px; font-weight: 600; color: var(--dim); }
.label .meta { margin-left: auto; font-weight: 400; }
.meta.warn { color: var(--warn); }
.label-d { margin-top: 24px; }
.label-d summary { font-size: 13px; font-weight: 600; color: var(--dim); padding: 0 2px 6px; list-style: none; cursor: pointer; }
.label-d summary::-webkit-details-marker { display: none; }
.label-d summary::after { content: " ›"; }
.label-d[open] summary::after { content: " ⌄"; }
.mini { margin-left: auto; font-size: 13px; font-weight: 500; color: var(--accent); padding: 4px 2px; }

/* cards + rows */
.card { background: var(--card); border-radius: 8px; padding: 0 12px; }
.card.closed { display: block; width: 100%; padding: 12px; color: var(--dim); font-size: 15px; line-height: 1.5; }
.card.closed:active { background: var(--hover); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row > span:first-child { flex: 1; min-width: 0; }
.row small { display: block; margin-top: -2px; }
.row.col { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 0; }
.ro { color: var(--dim); text-align: right; }
.row.list { gap: 4px; }
.row.list .tt { flex: 1; padding: 8px 0; }
.row.list.paused .tt { opacity: .45; }
.mv { width: 36px; height: 36px; color: var(--faint); border-radius: 6px; }

/* inputs: right aligned, no chrome until touched */
.in {
  background: transparent; border: 0; border-radius: 6px; color: var(--text); font-size: 16px;
  text-align: right; padding: 8px; min-height: 40px; width: 140px; max-width: 55%;
}
.in::placeholder { color: var(--faint); }
.in:focus { outline: none; background: var(--hover); }
input[type="time"].in { width: auto; min-width: 92px; }
input[type="time"].in.blank { color: var(--faint); }
input[type="time"].in::-webkit-calendar-picker-indicator { filter: invert(.6); }
select.in { appearance: none; -webkit-appearance: none; text-align-last: right; }

/* segmented controls (yes/no, 1–10, choices) */
.seg { display: flex; gap: 2px; background: var(--sheet); border-radius: 6px; padding: 2px; }
.seg button, .seg label span { flex: 1; min-width: 0; height: 36px; display: grid; place-items: center; border-radius: 4px; font-size: 15px; color: var(--dim); }
.row:not(.col) .seg { flex: none; }
.row:not(.col) .seg button { width: 56px; }
.seg button.on, .seg input:checked + span { background: var(--accent); color: #fff; font-weight: 600; }
.seg.multi label { flex: 1; display: flex; }
.seg.multi input { position: absolute; opacity: 0; pointer-events: none; }

/* to-dos */
.todo { display: flex; align-items: flex-start; gap: 10px; width: 100%; min-height: 48px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.card > .todo:last-of-type { border-bottom: 0; }
.card .add { border-top: 1px solid var(--line); }
.card > .todo + .add, .card > .add:first-child { border-top-color: var(--line); }
.card > .add:first-child { border-top: 0; }
.box {
  flex: none; width: 18px; height: 18px; margin-top: 3px; border-radius: 3px;
  border: 1.5px solid var(--faint); display: block; position: relative;
}
.done .box { background: var(--accent); border-color: var(--accent); }
.done .box::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 4px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.todo .tt, .todo > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.done .tt, .done > span { color: var(--faint); text-decoration: line-through; }
.tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; background: var(--tag-bg); color: var(--tag); font-size: 13px; line-height: 20px; vertical-align: 1px; text-decoration: none; }
.add input { width: 100%; background: transparent; border: 0; padding: 12px 0; min-height: 48px; font-size: 16px; color: var(--text); }
.add input::placeholder { color: var(--faint); }
.add input:focus { outline: none; }

/* banners + links */
.banner { margin: 8px 0; padding: 10px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); font-size: 15px; }
.link { display: block; margin: 28px auto 0; padding: 10px; font-size: 14px; color: var(--faint); }
.addrow { display: block; width: 100%; padding: 14px 0; color: var(--faint); }
.empty { margin: 4px 2px; font-size: 14px; color: var(--faint); }

/* buttons */
.btns { display: flex; gap: 8px; margin-top: 8px; }
.btns.end { justify-content: flex-end; margin-top: 20px; }
.btn { padding: 10px 16px; border-radius: 6px; background: var(--card); color: var(--text); font-size: 15px; }
.btn:active { background: var(--line); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: var(--dim); }
.btn.danger { background: transparent; color: var(--bad); padding-left: 0; }

/* charts */
.chart { display: block; width: 100%; height: auto; background: var(--card); border-radius: 8px; padding: 8px 4px; }
.chart .ln { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--text); }
.chart .band { fill: rgba(255,255,255,.05); }
.chart .bar { fill: #3a3a3a; }
.chart .over { fill: var(--warn); }
.chart .ref { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .ax { fill: var(--dim); font: 11px var(--font); }

/* tabs */
.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 5; display: flex; justify-content: center; gap: 8px;
  background: rgba(25,25,25,.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 16px calc(6px + env(safe-area-inset-bottom));
}
.tabs button { flex: 1; max-width: 140px; height: 40px; border-radius: 6px; text-align: center; font-size: 15px; color: var(--faint); }
.tabs button.on { color: var(--text); font-weight: 600; }

/* bottom sheet */
#sheet { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
#sheet[hidden] { display: none; }
.scrim { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.panel {
  position: relative; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  background: var(--sheet); border-radius: 12px 12px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.big { width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 8px 0 12px; font-size: 20px; font-weight: 600; color: var(--text); }
.big:focus { outline: none; border-bottom-color: var(--accent); }
.field { display: block; margin-top: 18px; font-size: 13px; font-weight: 600; color: var(--dim); }
.field .seg, .field .in { margin-top: 8px; }
.field .in { display: block; width: 100%; max-width: none; text-align: left; background: var(--card); }
.check { display: flex; align-items: center; gap: 10px; margin-top: 18px; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* day header + timeline */
.dmeta { margin: -6px 0 8px; text-align: center; font-size: 13px; color: var(--faint); }
.dmeta.warn { color: var(--warn); }
.tl { padding-right: 0; }
.blk { display: flex; align-items: center; gap: 10px; min-height: 52px; border-bottom: 1px solid var(--line); background: var(--card); position: relative; transition: transform .15s; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.blk .box { margin-top: 0; }
.blk.lift { z-index: 3; transition: none; box-shadow: 0 8px 24px rgba(0,0,0,.5); border-radius: 6px; background: #2a2a2a; }
.blk.deep { box-shadow: inset 2px 0 0 var(--tag); margin-left: -12px; padding-left: 10px; }
.blk.cur .btime { color: var(--accent); }
.blk.done .btitle { color: var(--faint); text-decoration: line-through; }
.bmain { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; padding: 10px 0; }
.btime { flex: none; font-size: 13px; color: var(--dim); min-width: 84px; }
.btitle { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.blk .tag { flex: none; margin-left: 0; }
.plus { flex: none; padding: 6px 8px; font-size: 13px; color: var(--accent); }
.grip { flex: none; width: 44px; align-self: stretch; display: grid; place-items: center; color: var(--faint); font-size: 18px; touch-action: none; cursor: grab; }
.note { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px 8px 0; font-size: 14px; color: var(--dim); border-bottom: 1px solid var(--line); }
.note span { flex: none; min-width: 84px; font-size: 12px; color: var(--faint); padding-left: 28px; }
.note .x { margin-left: auto; color: var(--faint); padding: 0 4px; }
.tl .add { border-top: 0; padding-right: 12px; }
.endday { margin: 10px 2px 0; text-align: center; font-size: 13px; color: var(--faint); }

/* note bar, fixed above the tabs on Today */
#notebar { display: none; position: fixed; left: 0; right: 0; bottom: calc(53px + env(safe-area-inset-bottom)); z-index: 5; padding: 8px 16px; background: rgba(25,25,25,.94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
#notebar input { width: 100%; max-width: 528px; display: block; margin: 0 auto; background: var(--card); border: 0; border-radius: 8px; padding: 10px 12px; font-size: 16px; color: var(--text); }
#notebar input:focus { outline: 1px solid var(--accent); }
body.on-today #notebar { display: block; }
body.on-today { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }

/* tappable rows that open a wheel */
button.row { width: 100%; text-align: left; }
button.row:active { background: var(--hover); }
.val { flex: none; color: var(--text); font-size: 17px; }
.val.blank { color: var(--accent); font-size: 15px; }
.val.bad { color: var(--bad); }
.label .hint { font-weight: 400; color: var(--faint); }
.hint-p { margin: -2px 2px 8px; font-size: 13px; line-height: 1.4; color: var(--faint); }
.label-d .hint-p { margin-top: 0; }

/* Apple-style scroll wheel */
.wpanel { padding-top: 0; }
.whead { display: flex; align-items: center; justify-content: space-between; height: 52px; border-bottom: 1px solid var(--line); margin: 0 -16px; padding: 0 8px; }
.whead b { font-size: 16px; font-weight: 600; }
.wbtn { padding: 10px; font-size: 16px; color: var(--accent); }
.wbtn.strong { font-weight: 600; }
.wheels { position: relative; display: flex; justify-content: center; align-items: center; gap: 2px; height: 220px; margin: 8px 0; }
.wband { position: absolute; left: 0; right: 0; top: 90px; height: 40px; border-radius: 8px; background: rgba(255,255,255,.08); pointer-events: none; }
.wheel {
  position: relative; height: 220px; width: 76px; overflow-y: scroll; overscroll-behavior: contain;
  scroll-snap-type: y mandatory; padding: 90px 0; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent);
          mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent);
}
.wheel::-webkit-scrollbar { display: none; }
.wheel.wide { width: 240px; }
.wi { height: 40px; line-height: 40px; text-align: center; scroll-snap-align: center; font-size: 23px; color: var(--dim); transition: color .1s, transform .1s; }
.wi.sel { color: var(--text); font-weight: 500; }
.wsep { position: relative; font-size: 23px; color: var(--text); padding: 0 2px; }
.wsep.small { font-size: 16px; color: var(--dim); min-width: 44px; }
.wclear { display: block; width: 100%; padding: 14px; color: var(--bad); font-size: 16px; text-align: center; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none; transition: .2s;
  background: #333; color: var(--text); padding: 8px 14px; border-radius: 8px; font-size: 14px; white-space: nowrap;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ================= Nona calls ================= */
.top { display: flex; align-items: center; gap: 8px; min-height: 48px; margin-bottom: 4px; }
.top h1 { flex: 1; min-width: 0; margin: 0; font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.top .back { height: 44px; min-width: 36px; font-size: 26px; color: var(--dim); }
.sub { margin: -4px 2px 10px; font-size: 14px; color: var(--dim); }

/* today counters */
.counters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 6px; }
.counters div { background: var(--card); border-radius: 8px; padding: 8px 6px; text-align: center; }
.counters b { display: block; font-size: 20px; font-weight: 600; }
.counters span { font-size: 11px; color: var(--dim); }
.window { margin: 0 2px 4px; font-size: 13px; color: var(--faint); }
.window.on { color: var(--good); }

.search { width: 100%; margin-top: 10px; background: var(--card); border: 0; border-radius: 8px; padding: 10px 12px; font-size: 16px; color: var(--text); }
.search:focus { outline: 1px solid var(--accent); }
.search::placeholder { color: var(--faint); }

/* clinic rows */
.crow { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 9px 0; border-bottom: 1px solid var(--line); text-align: left; }
.card > .crow:last-child { border-bottom: 0; }
.crow:active { background: var(--hover); }
.crow .cn { flex: 1; min-width: 0; }
.crow .nm { display: block; overflow-wrap: anywhere; }
.crow small { display: block; margin-top: 1px; }
.crow .when { flex: none; font-size: 13px; color: var(--dim); text-align: right; }
.crow .when.due { color: var(--warn); font-weight: 600; }
.crow .chev { flex: none; color: var(--faint); }
.num { flex: none; width: 22px; font-size: 13px; color: var(--faint); text-align: right; }

/* stage tags (same colours as in Notion) */
.st { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 12px; line-height: 20px; white-space: nowrap; background: #2c2c2c; color: var(--dim); }
.st.yellow { background: #3a3218; color: #e2b34b; }
.st.blue { background: #1c2b36; color: #6aa8d6; }
.st.purple { background: #2e2338; color: #b38ad8; }
.st.green { background: #1e2e22; color: #6fb07a; }
.st.orange { background: #3a2a1a; color: #e09b55; }
.st.red { background: #3a1f1e; color: #e6847c; }
.st.brown { background: #33281f; color: #b9946e; }

/* clinic page */
.callbtn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 54px; margin-top: 8px; border-radius: 10px; background: var(--good); color: #0f1a12; font-size: 18px; font-weight: 600; text-decoration: none; }
.callbtn:active { opacity: .85; }
.callalt { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.callalt a { padding: 8px 12px; border-radius: 8px; background: var(--card); color: var(--text); font-size: 15px; text-decoration: none; }
.logbtn { display: block; width: 100%; height: 54px; margin-top: 10px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 18px; font-weight: 600; text-align: center; }
.logbtn:active { opacity: .85; }
.locked { margin-top: 8px; padding: 14px 12px; border-radius: 10px; background: #3a1f1e; color: var(--bad); font-size: 15px; text-align: center; }

.insight { padding: 12px; }
.insight .hook { font-size: 17px; line-height: 1.45; color: var(--text); }
.insight p { margin: 8px 0 0; font-size: 14px; line-height: 1.45; color: var(--dim); }
.insight p.wo { color: var(--warn); }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.quick button { height: 44px; border-radius: 8px; background: var(--card); font-size: 14px; text-align: center; color: var(--text); }
.quick button:active { background: var(--line); }

.kv { display: flex; gap: 12px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.card > .kv:last-child { border-bottom: 0; }
.kv > span:first-child { flex: none; width: 112px; color: var(--dim); font-size: 14px; }
.kv > span:last-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.kv a { color: var(--tag); text-decoration: none; }

.notes { display: block; width: 100%; min-height: 84px; margin: 0; background: var(--card); border: 0; border-radius: 8px; padding: 10px 12px; font: 16px/1.45 var(--font); color: var(--text); resize: vertical; }
.notes:focus { outline: 1px solid var(--accent); }
.notes::placeholder { color: var(--faint); }

.hist { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.card > .hist:last-child { border-bottom: 0; }
.hist .h1 { display: flex; gap: 8px; align-items: center; color: var(--dim); font-size: 13px; }
.hist .h2 { margin-top: 4px; color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; }
.waiting { color: var(--warn); }

/* outcome sheet */
.panel h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.panel .ph { margin: 0 0 12px; font-size: 14px; color: var(--dim); }
.outs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.outs button { min-height: 48px; padding: 8px 10px; border-radius: 8px; background: var(--card); font-size: 15px; text-align: left; color: var(--text); border: 1px solid transparent; }
.outs button.star { border-color: #2a4a66; }
.outs button.on { background: var(--accent); color: #fff; font-weight: 600; border-color: var(--accent); }
.outs button.wide { grid-column: span 2; }
.field textarea.in { display: block; width: 100%; max-width: none; min-height: 84px; margin-top: 8px; text-align: left; background: var(--card); font: 16px/1.45 var(--font); resize: vertical; }
.field input[type="datetime-local"].in { -webkit-appearance: none; appearance: none; text-align: left; }
.panel .seg button { height: 40px; }
.req { color: var(--warn); font-weight: 400; }

/* info tab */
.sec { margin-top: 10px; background: var(--card); border-radius: 8px; }
.sec summary { display: flex; align-items: center; gap: 8px; padding: 14px 12px; font-size: 16px; font-weight: 600; list-style: none; cursor: pointer; }
.sec summary::-webkit-details-marker { display: none; }
.sec summary::after { content: "›"; margin-left: auto; color: var(--faint); font-weight: 400; }
.sec[open] summary::after { content: "⌄"; }
.sec summary small { font-weight: 400; color: var(--faint); }
.item { padding: 12px; border-top: 1px solid var(--line); }
.item .it { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--dim); }
.item .hy { margin-top: 6px; font-size: 17px; line-height: 1.55; color: var(--text); white-space: pre-wrap; }
.item .hy.en { font-size: 15px; line-height: 1.5; }
.panel .item { padding: 14px 0; }
.panel .item:first-of-type { border-top: 0; }
.panel .item .hy { font-size: 19px; }
.mark { background: rgba(35,131,226,.35); color: inherit; border-radius: 2px; }

/* passcode screen */
.gate { max-width: 360px; margin: 18vh auto 0; text-align: center; }
.gate h1 { font-size: 24px; font-weight: 600; margin: 0 0 6px; }
.gate p { color: var(--dim); margin: 0 0 20px; }
.gate input { width: 100%; background: var(--card); border: 0; border-radius: 8px; padding: 14px; font-size: 18px; color: var(--text); text-align: center; }
.gate input:focus { outline: 1px solid var(--accent); }
.gate .btn { width: 100%; margin-top: 10px; padding: 14px; font-size: 17px; }
