:root {
  color-scheme: light;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #16161c;
  background: #f2f2f7;
  --accent: #0066ce;
  --muted: #595964;
  --line: #dfdfe7;
  --white: #fff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button, nav a { min-height: 48px; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:active, nav a:active { filter: brightness(.94); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.app { max-width: 1060px; margin: auto; padding: 24px 32px max(48px, env(safe-area-inset-bottom)); }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; font-weight: 750; line-height: 1.22; text-decoration: none; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .875rem; }
.brand-mark { width: 42px; height: 42px; border-radius: 11px; }
nav { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 14px; background: #e6e6ed; }
nav a { display: grid; place-items: center; min-height: 44px; padding: 0 14px; border-radius: 11px; color: #494953; text-decoration: none; font-weight: 630; font-size: .9375rem; }
nav a[aria-current="page"] { color: #15151b; background: #fff; box-shadow: 0 1px 3px #1313281e; }
main { margin-top: 32px; }
main[data-page="today"] { max-width: 590px; margin-inline: auto; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2.15rem, 5vw, 2.9rem); letter-spacing: -.045em; line-height: 1.05; margin-bottom: 8px; }
h2 { font-size: 1.35rem; line-height: 1.25; letter-spacing: -.025em; margin-bottom: 12px; }
.subtle, .date { color: var(--muted); }
.date { margin-bottom: 20px; }
.date::first-letter { text-transform: uppercase; }
.grid { display: grid; grid-template-columns: minmax(0, 1.48fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }
.card { background: var(--white); border: 1px solid #eaeaef; border-radius: 24px; padding: clamp(18px, 4vw, 28px); min-width: 0; }
.card summary { cursor: pointer; font-weight: 680; }
.card[open] summary { margin-bottom: 12px; }
.bottle { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 30px; font-size: .875rem; font-weight: 650; }
.bottle.blue { background: #dceefd; color: #213d68; }
.bottle.purple { background: #eee3fc; color: #472871; }
.today-stack { display: grid; gap: 12px; }
.intake-card { text-align: center; }
.intake-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; text-align: left; }
.intake-header h2 { margin: 0; }
.intake-card label { text-align: left; }
.intake-actions { display: grid; gap: 7px; margin-top: 14px; }
.dose-amount { display: grid; gap: 8px; justify-items: center; padding: 22px 0 16px; }
.number { display: block; font-size: clamp(3.4rem, 11vw, 5rem); letter-spacing: -.055em; font-weight: 690; line-height: 1; font-variant-numeric: tabular-nums; }
.card > :last-child { margin-bottom: 0; }
.timer-ring { --remaining: 100%; display: grid; place-items: center; width: min(100%, 270px); aspect-ratio: 1; border-radius: 50%; padding: 8px; margin: 22px auto 18px; background: conic-gradient(var(--accent) var(--remaining), #e7effc 0); }
.timer-ring.timer-finished { background: #d3eedf; }
.timer-face { display: grid; align-content: center; gap: 12px; width: 100%; height: 100%; border-radius: 50%; background: #fff; }
.timer { margin: 0; }
.food-time { font-size: 2.6rem; margin: 14px 0 8px; }
#timer-caption { color: var(--muted); font-weight: 550; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions { margin-top: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 11px 16px; border-radius: 12px; border: 1px solid transparent; background: var(--accent); color: white; text-decoration: none; font-weight: 680; }
.btn.secondary { background: #eaf3ff; color: #075ab7; }
.btn.ghost { background: transparent; color: #075ab7; font-weight: 530; }
.btn.primary-action { width: 100%; min-height: 64px; border-radius: 16px; font-size: 1.2rem; }
label { display: grid; gap: 6px; font-weight: 650; }
input, textarea, select { width: 100%; min-height: 46px; padding: 9px 11px; border: 1px solid #d2d2db; border-radius: 10px; background: #f7f7fa; color: inherit; min-width: 0; }
textarea { min-height: 110px; resize: vertical; font-weight: 400; }
form { display: grid; gap: 13px; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit,minmax(min(100%, 145px),1fr)); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; vertical-align: top; border-bottom: 1px solid var(--line); }
td.note { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 130px; }
td .btn { white-space: nowrap; }
#notice { position: fixed; z-index: 2; bottom: 20px; left: 50%; transform: translateX(-50%); max-width: min(92vw, 600px); padding: 12px 17px; border-radius: 14px; background: #262632; color: white; box-shadow: 0 8px 24px #16161c30; }
dialog { border: 1px solid var(--line); border-radius: 20px; color: inherit; padding: 24px; width: min(90vw, 520px); }
dialog::backdrop { background: #17172275; }
#print-document { display: none; }
@media (max-width: 720px) {
  .app { padding: 18px 16px 52px; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  main { margin-top: 26px; }
  nav { width: 100%; gap: 1px; }
  nav a { flex: 1; padding: 0 6px; }
}
@page { size: A4 portrait; margin: 0; }
@media print {
  :root, body { background: white; }
  body { color: black; font: 10pt/1.15 "Times New Roman", serif; }
  .app, dialog, noscript { display: none !important; }
  #print-document { display: block; }
  .form-sheet { width: 210mm; height: 296mm; position: relative; padding-left: 12mm; }
  .form-sheet + section { break-before: page; }
  .form-first { padding-top: 24mm; }
  .form-continuation { padding-top: 8mm; }
  .form-heading { position: absolute; top: 10.4mm; left: 14mm; width: 180mm; font-size: 11pt; line-height: 1.14; }
  .form-title { display: flex; justify-content: space-between; column-gap: 1mm; white-space: nowrap; }
  .form-name { display: inline-block; vertical-align: baseline; min-width: 50mm; max-width: 112mm; border-bottom: .18mm solid black; padding: 0 .6mm; overflow-wrap: anywhere; }
  .form-doctor { margin-left: 4mm; }
  .form-table { width: 192.5mm; table-layout: fixed; font-size: 10pt; }
  .form-table .vial-width { width: 22.5mm; }
  .form-table .strength-width { width: 22mm; }
  .form-table .day-width { width: 15.5mm; }
  .form-table .presses-width { width: 22mm; }
  .form-table .date-width { width: 17.5mm; }
  .form-continuation .vial-width { width: 20.5mm; }
  .form-continuation .strength-width { width: 22.5mm; }
  .form-continuation .day-width { width: 17mm; }
  .form-table th, .form-table td { border: .18mm solid black; padding: 0 .6mm; text-align: center; vertical-align: middle; }
  .form-table th { font-weight: normal; height: 13mm; line-height: 1.03; }
  .form-continuation th { height: 9.5mm; }
  .form-table tbody tr { height: 4.92mm; }
  .form-table tbody tr.form-initial { height: 7.2mm; }
  .form-table tbody tr.form-initial:first-child { height: 9.5mm; }
  .form-continuation tbody tr { height: 4.78mm; }
  .form-table .form-day { font-size: 8pt; }
  .form-table .form-presses { font-size: 11pt; font-weight: bold; }
  .form-table .form-date { font-size: 9pt; }
  .form-table .form-vial { position: relative; padding: 0; }
  .form-vial div { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-90deg); font-size: 20pt; line-height: 1.05; white-space: nowrap; }
  .form-vial .purple-cap { display: flex; gap: 8mm; }
  .form-table .form-strength { font-size: 15pt; line-height: 1.15; font-weight: bold; }
  .form-continuation .form-strength { font-weight: normal; }
  .form-table .form-notes { text-align: left; }
  .form-table .form-notes div { overflow: hidden; white-space: nowrap; }
  .form-table .clinic-only { text-align: center; }
  .form-appendix { padding: 12mm; overflow-wrap: anywhere; }
  .form-appendix h1 { font: bold 15pt "Times New Roman", serif; }
  .form-appendix p { white-space: pre-wrap; break-inside: avoid; }
}
