* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); }
body { font-family: var(--font-body); font-size: 1rem; line-height: 1.4; color: var(--ink); background: radial-gradient(ellipse 90% 30% at 50% -6%, rgba(255,201,60,.28), transparent 62%), linear-gradient(180deg, #FFF8F0, #FFF3E4); background-attachment: fixed; min-height: 100dvh; overscroll-behavior-y: contain; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: inherit; }
input, textarea, select { font: inherit; font-size: 16px; color: var(--ink); }
:focus-visible { outline: 3px solid var(--track); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { min-height: 100dvh; padding-left: var(--sal); padding-right: var(--sar); }
.top { height: calc(46px + var(--sat)); padding-top: var(--sat); display: flex; align-items: center; justify-content: center; position: sticky; top: 0; z-index: 5; background: linear-gradient(180deg, #FFF8F0 70%, rgba(255,248,240,0)); }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: -.02em; }
main { width: 100%; max-width: 620px; margin: 0 auto; padding: 4px 16px calc(96px + var(--sab)); }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* type */
.greet { font-family: var(--font-display); font-style: italic; font-weight: 650; font-size: clamp(1.9rem, 8vw, 2.3rem); letter-spacing: -.03em; line-height: 1.05; }
.title { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.7rem, 7vw, 2.1rem); letter-spacing: -.025em; line-height: 1.1; }
.kicker { font-size: .95rem; font-weight: 800; color: var(--ink2); }
.sub { font-size: 1rem; font-weight: 700; color: var(--ink2); }
.p { font-size: 1rem; font-weight: 600; }
.q { color: var(--ink2); font-size: .95rem; font-weight: 600; }
.label { font-size: .95rem; font-weight: 800; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.aux { font-size: .9rem; font-weight: 700; color: var(--ink2); }
.num { font-family: var(--font-display); font-weight: 800; }
.headrow { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 4px 0; }

/* cards */
.card { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-card); padding: 14px 16px; box-shadow: 0 3px 10px rgba(80,40,20,.05); }
.card.meds { background: var(--meds-t); border-color: var(--meds-t2); }
.card.track { background: var(--track-t); border-color: var(--track-t2); }
.card.visit { background: var(--visit-t); border-color: var(--visit-t2); }
.card.priv { background: var(--priv-t); border-color: var(--priv-t2); }
.label.meds { color: var(--meds-deep); } .label.track { color: var(--track-deep); } .label.visit { color: var(--visit-deep); } .label.priv { color: var(--priv-deep); }
.card > * + * { margin-top: 8px; }

/* buttons: all >= 48px, primary 56px */
.btn { min-height: var(--tap); width: 100%; border-radius: var(--r-btn); display: flex; align-items: center; justify-content: center; font-size: 1.07rem; font-weight: 800; text-align: center; padding: 8px 16px; }
.btn.meds { background: var(--meds); color: #fff; box-shadow: 0 5px 14px rgba(212,81,47,.28); }
.btn.track { background: var(--track); color: #fff; box-shadow: 0 5px 14px rgba(63,91,208,.26); }
.btn.visit { background: var(--visit); color: var(--ink); box-shadow: 0 5px 14px rgba(240,176,60,.32); }
.btn.priv { background: var(--priv); color: #fff; }
.btn.ghost { background: var(--card); border: 2px solid var(--line); color: var(--ink); }
.btn.outline-meds { background: var(--card); border: 2px solid var(--meds); color: var(--meds-deep); }
.btn.danger { background: var(--card); border: 2px solid var(--meds); color: var(--meds-deep); }
.btn.solid-danger { background: var(--meds); color: #fff; }
.btn[disabled] { opacity: .45; box-shadow: none; }
.link { min-height: 48px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1rem; width: 100%; }
.link.meds { color: var(--meds-deep); } .link.track { color: var(--track-deep); } .link.visit { color: var(--visit-deep); } .link.priv { color: var(--priv-deep); }
.pillbtn { min-height: 48px; padding: 0 18px; border-radius: 24px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; background: var(--card); border: 2px solid var(--line); }
.pillbtn.on { background: var(--track); border-color: var(--track); color: #fff; }
.pillbtn.on.meds { background: var(--meds); border-color: var(--meds); } .pillbtn.on.visit { background: var(--visit); border-color: var(--visit); color: var(--ink); } .pillbtn.on.priv { background: var(--priv); border-color: var(--priv); }
.round { width: 56px; height: 56px; border-radius: 50%; background: var(--meds); color: #fff; font-size: 2rem; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 5px 14px rgba(212,81,47,.28); }
.stepper { width: 64px; height: 64px; border-radius: 50%; background: var(--track-t); color: var(--track-deep); font-size: 2rem; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* rows */
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 8px 0; border-top: 1.5px solid rgba(80,40,20,.09); width: 100%; }
.row:first-child { border-top: 0; }
.row h3 { font-size: 1.05rem; font-weight: 800; line-height: 1.25; }
.row p { font-size: .92rem; font-weight: 600; color: var(--ink2); }
.chev { color: var(--ink3); font-weight: 800; font-size: 1.4rem; line-height: 1; }
.chip { display: inline-flex; align-items: center; min-height: 32px; padding: 2px 12px; border-radius: 16px; font-weight: 800; font-size: .9rem; background: var(--meds-t); color: var(--meds-deep); white-space: nowrap; }
.chip.low { background: var(--visit-t2); color: var(--visit-deep); }
.chip.priv { background: var(--priv-t2); color: var(--priv-deep); }
.dueTxt { color: var(--meds-deep); font-weight: 800; } .takenTxt { color: var(--priv-deep); font-weight: 800; } .skipTxt { color: var(--ink2); font-weight: 800; }

/* topnav for subpages */
.topnav { display: flex; align-items: center; justify-content: space-between; min-height: 52px; gap: 8px; }
.back { display: inline-flex; align-items: center; min-height: 48px; font-weight: 800; padding-right: 12px; gap: 2px; }
.topnav .mid { text-align: center; flex: 1; }
.topnav .mid .t { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; }
.topnav .end { min-width: 64px; text-align: right; font-weight: 800; }

/* ring (Today hero) */
.herocard { display: flex; align-items: center; gap: 16px; }
.ringbtn { position: relative; width: clamp(150px, 44vw, 210px); aspect-ratio: 1; flex-shrink: 0; border-radius: 50%; display: block; }
.ringbtn svg { width: 100%; height: 100%; display: block; }
.ringcenter { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 22%; font-family: var(--font-display); font-style: italic; font-weight: 800; font-size: clamp(1.4rem, 6.4vw, 1.9rem); line-height: 1.02; color: var(--ink); pointer-events: none; }
.legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.leg { display: flex; align-items: flex-start; gap: 10px; min-height: 52px; padding: 4px 0; width: 100%; }
.leg i { width: 14px; height: 14px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.leg b { display: block; font-size: 1.1rem; font-weight: 800; line-height: 1.15; }
.leg span { display: block; font-size: .95rem; font-weight: 700; color: var(--ink2); line-height: 1.2; }
.leg.focus b { color: var(--meds-deep); }
.dosebtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dosechip { background: var(--card); border: 2px solid var(--meds); border-radius: 18px; padding: 10px 12px; min-height: 56px; }
.dosechip b { display: block; font-size: 1rem; font-weight: 800; line-height: 1.2; } .dosechip span { font-size: .92rem; font-weight: 700; color: var(--meds-deep); }
.checkcard { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.checkcard .go { min-height: 52px; min-width: 96px; border-radius: 26px; background: var(--track); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 20px; }
.datebox { width: 60px; min-height: 64px; border-radius: 16px; background: var(--visit); display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; }
.datebox small { font-size: .85rem; font-weight: 800; } .datebox b { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; line-height: 1; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { border-radius: 20px; padding: 10px 12px; min-height: 68px; display: flex; flex-direction: column; justify-content: center; border: 1.5px solid transparent; text-align: left; width: 100%; }
.tile span { font-size: .88rem; font-weight: 800; } .tile b { font-family: var(--font-display); font-size: 1.15rem; font-weight: 800; line-height: 1.15; }
.tile.track { background: var(--track-t); border-color: var(--track-t2); } .tile.track span { color: var(--track-deep); }
.tile.meds { background: var(--meds-t); border-color: var(--meds-t2); } .tile.meds span { color: var(--meds-deep); }
.tilewrap { position: relative; } .tilewrap .minus { position: absolute; right: 4px; top: 4px; width: 40px; height: 40px; border-radius: 50%; font-weight: 800; font-size: 1.3rem; color: var(--track-deep); display: flex; align-items: center; justify-content: center; }
.donemark { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; }

/* sleep ring */
.sleepcard { display: flex; gap: 16px; align-items: center; }
.sleepring { position: relative; width: clamp(150px, 44vw, 190px); aspect-ratio: 1; flex-shrink: 0; }
.sleepring svg { width: 100%; height: 100%; }
.sleepcenter { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.sleepcenter b { font-family: var(--font-display); font-size: clamp(1.5rem, 6.5vw, 1.9rem); font-weight: 800; line-height: 1; } .sleepcenter span { font-size: .85rem; font-weight: 800; color: var(--track-deep); }
.sleeplegend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .92rem; font-weight: 700; color: var(--ink2); align-items: center; }
.sleeplegend i { display: inline-block; width: 14px; height: 6px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.tickbtn { cursor: pointer; }

/* sheets */
.scrim { position: fixed; inset: 0; background: rgba(43,27,23,.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--paper); width: 100%; max-width: 600px; max-height: 90dvh; border-radius: 28px 28px 0 0; display: flex; flex-direction: column; box-shadow: 0 -10px 40px rgba(43,27,23,.25); }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--meds-t2); margin: 10px auto 0; flex-shrink: 0; }
.sheet .sbody { overflow-y: auto; padding: 12px 20px 8px; display: flex; flex-direction: column; gap: 12px; }
.sheet .sfoot { padding: 8px 20px calc(14px + var(--sab)); display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; background: var(--paper); }
.sheet h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; line-height: 1.12; letter-spacing: -.02em; }
.wordgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.word { min-height: 64px; border-radius: 20px; background: var(--card); border: 2px solid var(--track-t2); color: var(--track-deep); font-weight: 800; font-size: 1.15rem; display: flex; align-items: center; justify-content: center; }
.word.on { background: var(--track); border-color: var(--track); color: #fff; }
.doselist { background: var(--meds-t); border: 1.5px solid var(--meds-t2); border-radius: 20px; padding: 4px 14px; }
.doselist .row { min-height: 56px; }
.dose-actions { display: flex; gap: 8px; }
.dose-actions button { min-height: 48px; min-width: 76px; border-radius: 24px; font-weight: 800; border: 2px solid var(--meds-t2); background: var(--card); padding: 0 14px; }
.dose-actions button.on-taken { background: var(--meds); border-color: var(--meds); color: #fff; }
.dose-actions button.on-skipped { background: var(--paper2); border-color: var(--ink3); }
.radio { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--meds); flex-shrink: 0; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label, .field > .flab { font-weight: 800; font-size: .95rem; color: var(--ink2); }
.input { width: 100%; min-height: 52px; border-radius: 16px; border: 2px solid var(--line); background: #fff; padding: 8px 14px; }
textarea.input { min-height: 110px; resize: vertical; }
.input:focus { border-color: var(--track); outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle { width: 60px; height: 36px; border-radius: 18px; background: #D8C8B8; position: relative; flex-shrink: 0; transition: background .15s; }
.toggle::after { content: ""; position: absolute; top: 4px; left: 4px; width: 28px; height: 28px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.toggle.on { background: var(--track); } .toggle.on::after { transform: translateX(24px); }
.bigdur { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.9rem, 8vw, 2.4rem); text-align: center; flex: 1; }
.strengths { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.strength { min-height: 96px; border-radius: 22px; background: var(--card); border: 2px solid var(--meds-t2); padding: 12px 14px; }
.strength b { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; display: block; line-height: 1.1; } .strength span { font-size: .9rem; font-weight: 700; color: var(--ink2); display: block; }
.strength.on { background: var(--meds); border-color: var(--meds); color: #fff; } .strength.on span { color: #fff; }
.progress { display: flex; gap: 8px; } .progress i { flex: 1; height: 8px; border-radius: 4px; background: var(--meds-t2); } .progress i.on { background: var(--meds); }
.suggest { background: var(--card); border: 2px solid var(--meds-t2); border-radius: 18px; overflow: hidden; }
.suggest button { display: block; width: 100%; min-height: 56px; padding: 8px 16px; border-top: 1.5px solid var(--line); font-weight: 800; }
.suggest button:first-child { border-top: 0; } .suggest span { display: block; font-weight: 600; font-size: .9rem; color: var(--ink2); }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chartnote { display: flex; justify-content: space-between; font-size: .9rem; font-weight: 700; color: var(--ink2); }
.mark { background: var(--visit-t2); border-radius: 6px; padding: 0 4px; }

/* snapshot */
.snap { background: var(--card); border: 1.5px solid var(--visit-t2); border-radius: 20px; overflow: hidden; }
.snap .th { background: var(--visit-t); color: var(--visit-deep); font-weight: 800; padding: 10px 14px; display: flex; justify-content: space-between; gap: 10px; }
.snap table { width: 100%; border-collapse: collapse; } .snap td { padding: 9px 14px; border-top: 1.5px solid var(--line); vertical-align: top; font-size: 1rem; }
.snap td.k { color: var(--ink2); font-weight: 700; width: 38%; } .snap td.v { font-weight: 800; }
.snap .medcols { padding: 8px 14px 10px; columns: 2 220px; column-gap: 20px; font-weight: 700; } .snap .medcols div { break-inside: avoid; padding: 2px 0; }
.sharebar { position: sticky; bottom: calc(80px + var(--sab)); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* privacy */
.pledge { background: var(--priv-deep); color: #fff; border-radius: var(--r-card); padding: 16px 18px; }
.pledge .k { font-size: .95rem; font-weight: 800; color: #BFE0D2; margin-bottom: 6px; }
.pledge p { font-size: 1.2rem; font-weight: 800; line-height: 1.35; }
.pledge .hipaa { color: #FFC93C; margin-top: 10px; font-size: 1.1rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* nav */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; gap: 2px; padding: 6px 8px calc(6px + var(--sab)); background: rgba(255,247,238,.96); border-top: 1.5px solid var(--line); backdrop-filter: blur(6px); }
.nav .t { flex: 1; max-width: 100px; min-height: 62px; border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .78rem; font-weight: 800; color: #7C6258; }
.nav .t svg { width: 26px; height: 26px; }
.nav .t.on.meds { background: var(--meds-t); color: var(--meds-deep); } .nav .t.on.track { background: var(--track-t); color: var(--track-deep); }
.nav .t.on.visits { background: var(--visit-t); color: var(--visit-deep); } .nav .t.on.privacy { background: var(--priv-t); color: var(--priv-deep); }
.nav .t.on.today { background: var(--paper2); color: var(--ink); }

/* toast, bars */
#toast { position: fixed; left: 0; right: 0; bottom: calc(90px + var(--sab)); display: flex; justify-content: center; z-index: 30; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: none; background: var(--ink); color: #fff; border-radius: 20px; padding: 6px 8px 6px 18px; display: flex; align-items: center; gap: 12px; font-weight: 700; min-height: 52px; }
.toast button { pointer-events: auto; color: var(--sun); font-weight: 800; min-height: 48px; padding: 0 14px; }
.infobar { background: var(--track-t); border: 1.5px solid var(--track-t2); border-radius: 18px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; }
.infobar button { min-height: 48px; padding: 0 14px; font-weight: 800; color: var(--track-deep); }
.empty { text-align: center; padding: 18px 10px; color: var(--ink2); font-weight: 700; }
.banner { background: var(--priv-t); border: 1.5px solid var(--priv-t2); }

/* breakpoints: <=359 compact | 360-599 phone | 600-839 unfolded portrait | >=840 wide */
@media (max-width: 359px) {
  main { padding-left: 12px; padding-right: 12px; }
  .herocard { flex-direction: column; align-items: stretch; } .ringbtn { margin: 0 auto; }
  .sleepcard { flex-direction: column; } .tiles { grid-template-columns: 1fr 1fr; }
  .nav .t { font-size: .7rem; } .strengths { grid-template-columns: 1fr; }
}
@media (min-width: 600px) {
  main { max-width: 860px; padding-left: 24px; padding-right: 24px; }
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
  .grid2 > .col { display: flex; flex-direction: column; gap: 12px; }
  .herocard { flex-direction: column; align-items: stretch; } .herocard .ringbtn { margin: 0 auto; width: clamp(180px, 30vw, 240px); }
  .page-narrow { max-width: 620px; margin-left: auto; margin-right: auto; }
  .sheet { border-radius: 28px; margin-bottom: 4vh; }
  .scrim { align-items: center; } .sheet { margin-bottom: 0; }
}
@media (min-width: 840px) {
  #app { display: grid; grid-template-columns: 112px 1fr; grid-template-rows: auto 1fr; }
  .top { grid-column: 2; } main { grid-column: 2; max-width: 1000px; padding-bottom: 40px; }
  .nav { top: 0; bottom: 0; right: auto; width: calc(112px + var(--sal)); flex-direction: column; justify-content: flex-start; padding: calc(24px + var(--sat)) 8px 8px calc(8px + var(--sal)); border-top: 0; border-right: 1.5px solid var(--line); }
  .nav .t { flex: 0 0 auto; width: 100%; max-width: none; }
  #toast { bottom: 24px; } .sharebar { bottom: 16px; }
  .page-narrow { max-width: 720px; }
}
@media (max-height: 460px) and (orientation: landscape) {
  .ringbtn { width: 130px; } .sleepring { width: 130px; } .nav .t { min-height: 52px; } .nav .t span { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .nav, .top, .sharebar, .topnav, #toast, .noprint { display: none !important; }
  body { background: #fff; } main { max-width: none; padding: 0; }
  #app { display: block; } .snap { break-inside: avoid; }
}
