/* ENDOYAR – Material Design 3 (https://m3.material.io/) light theme, seeded from the brand teal #315C66.
   Layers: 1) colour roles  2) shape / elevation / motion  3) type scale  4) components.
   Old token names (--secondary, --primary-dark, …) stay as aliases so no view needs to change. */
:root {
  /* colour roles */
  --md-primary: #276772;
  --md-on-primary: #ffffff;
  --md-primary-container: #bfeaf3;
  --md-on-primary-container: #001f26;
  --md-secondary: #4a6268;
  --md-secondary-container: #cde7ee;
  --md-on-secondary-container: #051f25;
  --md-tertiary: #8e4b3d;
  --md-tertiary-container: #ffdad2;
  --md-on-tertiary-container: #370b04;
  --md-error: #ba1a1a;
  --md-error-container: #ffdad6;
  --md-on-error-container: #410002;
  --md-surface: #f7fafa;
  --md-surface-container-lowest: #ffffff;
  --md-surface-container-low: #f0f5f6;
  --md-surface-container: #eaf0f1;
  --md-surface-container-high: #e4eaeb;
  --md-surface-container-highest: #dee4e5;
  --md-on-surface: #161d1e;
  --md-on-surface-variant: #40494b;
  --md-outline: #70797b;
  --md-outline-variant: #c0c8ca;
  --md-inverse-surface: #2b3233;
  --md-inverse-on-surface: #edf2f3;
  --md-scrim: rgba(0, 0, 0, 0.32);

  /* symptom heat map (data colours, kept apart from the UI roles) */
  --heat-0: #e6f0f2;
  --heat-1: #f6dcd3;
  --heat-2: #ebb5a6;
  --heat-3: #d98c78;
  --heat-4: #b5483a;

  /* shape */
  --r-xs: 4px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 28px; --r-full: 999px;
  /* motion */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.05, 0.7, 0.1, 1);
  /* elevation (tonal surfaces do most of the work; shadows only where something floats) */
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.14), 0 1px 3px 1px rgba(0, 0, 0, 0.08);
  --elev-2: 0 1px 2px rgba(0, 0, 0, 0.14), 0 2px 6px 2px rgba(0, 0, 0, 0.08);
  --elev-3: 0 4px 8px 3px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.14);

  --font: 'Yekan Bakh', 'Yekan B', 'Vazirmatn', Tahoma, system-ui, sans-serif;

  /* legacy names used by older rules and views */
  --primary: var(--md-primary-container);
  --primary-dark: var(--md-primary);
  --secondary: var(--md-primary);
  --accent: var(--heat-3);
  --accent-deep: var(--heat-4);
  --bg: var(--md-surface);
  --surface: var(--md-surface-container-lowest);
  --text: var(--md-on-surface);
  --text-2: var(--md-on-surface-variant);
  --border: var(--md-outline-variant);
  --warn-bg: var(--md-tertiary-container);
  --radius: var(--r-lg);
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('assets/fonts/Vazirmatn-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--md-surface);
  color: var(--md-on-surface);
  font-family: var(--font);
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--md-primary); }
a.btn { text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--md-primary); outline-offset: 2px; border-radius: var(--r-sm); }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 0 16px 112px; }
#app.full { padding-bottom: 120px; }
#app > main { animation: enter 280ms var(--ease-out); }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
main:focus, [tabindex='-1']:focus { outline: none; }

/* type scale (M3 roles; Vazirmatn is the one family shipped) */
h1 { font-size: 1.5rem; font-weight: 700; margin: 0; line-height: 1.4; letter-spacing: 0; }   /* headline small */
h2 { font-size: 1.125rem; font-weight: 700; margin: 0 0 8px; line-height: 1.5; }               /* title medium+ */
h3 { font-size: 1rem; font-weight: 600; margin: 0 0 8px; }                                       /* title small */
p { margin: 0 0 8px; }
.muted { color: var(--md-on-surface-variant); font-size: 0.9rem; }
.small { font-size: 0.82rem; }
.num { font-feature-settings: 'tnum'; }

/* layout bits */
.topbar { display: flex; align-items: center; gap: 8px; padding: 20px 0 12px; }
.topbar .grow { flex: 1; }
.card { background: var(--md-surface-container-low); border: 0; border-radius: var(--r-lg); padding: 16px; margin: 12px 0; }
.card.soft { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.card.soft .muted { color: var(--md-on-primary-container); opacity: 0.85; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

/* buttons: filled (.primary) · outlined (default) · tonal (.tonal) · text (.ghost). State layers instead of colour swaps. */
.btn, .iconbtn, .chip, .seg button, .range button, .day, .sc, .linkbtn { position: relative; isolation: isolate; transition: background-color 150ms var(--ease), box-shadow 150ms var(--ease), border-color 150ms var(--ease); }
.btn::after, .iconbtn::after, .chip::after, .seg button::after, .range button::after, .day::after, .sc::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; transition: opacity 150ms var(--ease); z-index: -1; pointer-events: none; }
.btn:hover::after, .iconbtn:hover::after, .chip:hover::after, .seg button:hover::after, .range button:hover::after, .day:hover::after, .sc:hover::after { opacity: 0.08; }
.btn:active::after, .iconbtn:active::after, .chip:active::after, .seg button:active::after, .range button:active::after, .day:active::after, .sc:active::after { opacity: 0.12; }
.btn {
  min-height: 48px; padding: 0 24px; border-radius: var(--r-full); border: 1px solid var(--md-outline);
  background: transparent; color: var(--md-primary); font-weight: 600; font-size: 0.95rem; letter-spacing: 0.01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
}
.btn.primary { background: var(--md-primary); border-color: var(--md-primary); color: var(--md-on-primary); }
.btn.primary:hover { box-shadow: var(--elev-1); }
.btn.tonal { background: var(--md-secondary-container); border-color: transparent; color: var(--md-on-secondary-container); }
.btn.block { width: 100%; }
.btn.danger { border-color: var(--md-error); color: var(--md-error); }
.btn.ghost { border-color: transparent; background: transparent; padding: 0 12px; }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 0.88rem; }
.btn[disabled] { opacity: 0.38; cursor: default; box-shadow: none; }
.btn[disabled]::after { display: none; }
.iconbtn { width: 48px; height: 48px; border-radius: var(--r-full); border: 0; background: transparent; display: inline-grid; place-items: center; color: var(--md-on-surface-variant); }
.rtl-flip svg { transform: scaleX(-1); }

/* chips (filter chips: selected = secondary container) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 6px 16px; border-radius: var(--r-md); border: 1px solid var(--md-outline); background: transparent; color: var(--md-on-surface-variant);
  display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: center; text-align: right; line-height: 1.45; font-weight: 500;
}
.chip small { color: var(--md-on-surface-variant); font-size: 0.75rem; font-weight: 400; }
.chip.on { background: var(--md-secondary-container); border-color: transparent; color: var(--md-on-secondary-container); font-weight: 600; padding-inline-start: 34px; }
.chip.on small { color: var(--md-on-secondary-container); opacity: 0.85; }
.chip.on::before { content: ''; position: absolute; inset-inline-start: 11px; top: 50%; width: 18px; height: 18px; margin-top: -9px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center / contain no-repeat; }
.chip.removable { flex-direction: row; gap: 8px; align-items: center; background: var(--md-surface-container-high); border-color: transparent; color: var(--md-on-surface); padding-inline-start: 16px; }

/* 0-10 scale */
.scale10 { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; }
.sc { height: 44px; border-radius: var(--r-md); border: 0; background: var(--md-surface-container); font-weight: 700; padding: 0; font-size: 0.85rem; color: var(--md-on-surface); }
.sc.h0 { background: var(--heat-0); }
.sc.h1 { background: var(--heat-1); }
.sc.h2 { background: var(--heat-2); }
.sc.h3 { background: var(--heat-3); }
.sc.on { outline: 3px solid var(--md-primary); outline-offset: 1px; }
.scale-cap { display: flex; justify-content: space-between; color: var(--md-on-surface-variant); font-size: 0.78rem; margin-top: 4px; }
.scale-readout { font-weight: 700; color: var(--md-primary); min-height: 1.7em; }

/* segmented buttons */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.seg button { min-height: 52px; border: 1px solid var(--md-outline); background: transparent; font-weight: 600; color: var(--md-on-surface); overflow: hidden; }
.seg button:first-child { border-start-start-radius: var(--r-full); border-end-start-radius: var(--r-full); }
.seg button:last-child { border-start-end-radius: var(--r-full); border-end-end-radius: var(--r-full); margin-inline-start: -1px; }
.seg button.on { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.seg button.on.neutral { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }

/* fields (outlined text fields) */
.field { margin: 20px 0; }
.field > h3 { color: var(--md-primary); }
input[type='text'], input[type='number'], input[type='search'], input[type='tel'], textarea {
  width: 100%; min-height: 52px; padding: 12px 16px; border: 1px solid var(--md-outline); border-radius: var(--r-md); background: transparent; color: var(--md-on-surface);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
input:focus, textarea:focus { outline: none; border-color: var(--md-primary); box-shadow: inset 0 0 0 1px var(--md-primary); }
textarea { min-height: 96px; resize: vertical; }
label.lbl { display: block; font-size: 0.85rem; font-weight: 500; color: var(--md-on-surface-variant); margin-bottom: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* notes and banners */
.note { padding: 12px 16px; border-radius: var(--r-md); background: var(--md-surface-container); font-size: 0.9rem; margin: 10px 0; }
.note.warn { background: var(--md-tertiary-container); color: var(--md-on-tertiary-container); }
.banner { background: var(--md-tertiary-container); color: var(--md-on-tertiary-container); border-radius: var(--r-lg); padding: 14px 16px; margin: 12px 0; }
.banner strong { color: var(--md-on-tertiary-container); }
.sample-badge { display: inline-block; background: #ffe9a6; color: #4d3b00; border-radius: var(--r-sm); padding: 0 8px; font-size: 0.78rem; font-weight: 700; }

/* check-in shell */
.progress { display: flex; gap: 4px; margin: 4px 0 16px; }
.progress i { flex: 1; height: 4px; border-radius: var(--r-full); background: var(--md-surface-container-highest); }
.progress i.done { background: var(--md-primary); }
.progress i.cur { background: var(--heat-3); }
.footer-bar {
  position: fixed; inset-inline: 0; bottom: 0; background: var(--md-surface-container); box-shadow: 0 -1px 0 var(--md-outline-variant);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.footer-bar > div { max-width: 480px; margin: 0 auto; display: flex; gap: 12px; }
.footer-bar .btn { flex: 1; }
.footer-bar .btn.primary { flex: 2; }

/* navigation bar: pill indicator behind the active icon */
.nav { position: fixed; inset-inline: 0; bottom: 0; background: var(--md-surface-container); padding-bottom: env(safe-area-inset-bottom); z-index: 5; box-shadow: 0 -1px 0 var(--md-outline-variant); }
.nav > div { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 0 14px; font-size: 0.78rem; font-weight: 500; color: var(--md-on-surface-variant); text-decoration: none; min-height: 72px; position: relative; }
.nav a svg { width: 24px; height: 24px; position: relative; z-index: 1; }
.nav a::before { content: ''; position: absolute; top: 12px; left: 50%; width: 64px; height: 32px; margin-left: -32px; border-radius: var(--r-full); background: var(--md-secondary-container); transform: scaleX(0); opacity: 0; transition: transform 250ms var(--ease-out), opacity 150ms var(--ease); }
.nav a:hover::before { transform: scaleX(1); opacity: 0.5; }
.nav a[aria-current='page'] { color: var(--md-on-surface); font-weight: 700; }
.nav a[aria-current='page'] svg { color: var(--md-on-secondary-container); }
.nav a[aria-current='page']::before { transform: scaleX(1); opacity: 1; }

/* home */
.hero-cta { background: var(--md-primary-container); color: var(--md-on-primary-container); border-radius: var(--r-xl); padding: 24px 20px; margin: 4px 0 12px; }
.hero-cta h2 { font-size: 1.375rem; }
.hero-cta .btn { background: var(--md-primary); color: var(--md-on-primary); border-color: var(--md-primary); margin-top: 14px; padding: 0 28px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--md-outline-variant); }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--md-on-surface-variant); }
.spark { display: flex; align-items: flex-end; gap: 6px; height: 64px; }
.spark button { flex: 1; border: 0; border-radius: var(--r-sm); background: var(--heat-0); min-height: 6px; padding: 0; }
.spark button.h1 { background: var(--heat-1); } .spark button.h2 { background: var(--heat-2); } .spark button.h3 { background: var(--heat-3); }
.spark-lbl { display: flex; gap: 6px; margin-top: 2px; }
.spark-lbl span { flex: 1; text-align: center; font-size: 0.7rem; color: var(--md-on-surface-variant); }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 0.8rem; font-weight: 500; color: var(--md-on-surface-variant); padding: 4px 0; }
.day {
  position: relative; aspect-ratio: 1 / 1.05; border-radius: var(--r-lg); border: 2px solid transparent; background: var(--md-surface-container-low); color: var(--md-on-surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; font-weight: 600; font-size: 0.95rem;
}
.day.h0 { background: var(--heat-0); } .day.h1 { background: var(--heat-1); } .day.h2 { background: var(--heat-2); }
.day.h3 { background: var(--heat-4); color: #fff; }
.day.today { border-color: var(--md-primary); }
.day.future { color: var(--md-on-surface-variant); background: transparent; }
.day.pred { border: 2px dashed var(--heat-3); background: transparent; }
.day .drop { position: absolute; top: 5px; inset-inline-start: 6px; width: 8px; height: 8px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--heat-4); }
.day.h3 .drop { background: #fff; }
.day .spot { position: absolute; bottom: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--heat-4); opacity: 0.6; }
.day.empty { visibility: hidden; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 0.8rem; color: var(--md-on-surface-variant); margin: 12px 0; align-items: center; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: var(--r-xs); vertical-align: -2px; margin-inline-end: 4px; }

/* bottom sheet / dialog */
dialog.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 480px; border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--md-surface-container-low); color: var(--md-on-surface); box-shadow: var(--elev-3); }
dialog.sheet[open] { animation: sheet 300ms var(--ease-out); }
@keyframes sheet { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
dialog.sheet::backdrop { background: var(--md-scrim); }
dialog.sheet .inner { padding: 12px 24px calc(24px + env(safe-area-inset-bottom)); }
dialog.sheet .inner::before { content: ''; display: block; width: 32px; height: 4px; border-radius: var(--r-full); background: var(--md-outline-variant); margin: 0 auto 16px; opacity: 0.8; }

/* report */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 90px; }
.bars b { flex: 1; min-width: 2px; border-radius: 3px 3px 0 0; background: var(--md-surface-container-highest); }
.bars b.h0 { background: var(--md-primary-container); } .bars b.h1 { background: var(--heat-1); } .bars b.h2 { background: var(--heat-2); } .bars b.h3 { background: var(--heat-4); }
.pattern { border-inline-start: 4px solid var(--md-primary); padding: 8px 14px; margin: 10px 0; background: var(--md-surface-container); border-radius: var(--r-sm) var(--r-md) var(--r-md) var(--r-sm); }
.pill { display: inline-block; background: var(--md-secondary-container); color: var(--md-on-secondary-container); border-radius: var(--r-sm); padding: 0 8px; font-size: 0.78rem; }
.range { display: inline-flex; border: 1px solid var(--md-outline); border-radius: var(--r-full); overflow: hidden; }
.range button { border: 0; background: transparent; padding: 8px 16px; min-height: 40px; font-weight: 500; color: var(--md-on-surface); }
.range button + button { border-inline-start: 1px solid var(--md-outline); }
.range button.on { background: var(--md-secondary-container); color: var(--md-on-secondary-container); font-weight: 700; }
.disclaimer { font-size: 0.8rem; color: var(--md-on-surface-variant); border-top: 1px solid var(--md-outline-variant); margin-top: 24px; padding-top: 12px; }

/* snackbar */
#toast { position: fixed; inset-inline: 16px; bottom: 100px; margin: 0 auto; max-width: 420px; background: var(--md-inverse-surface); color: var(--md-inverse-on-surface); padding: 14px 16px; border-radius: var(--r-sm); box-shadow: var(--elev-3); opacity: 0; transform: translateY(8px); transition: opacity 200ms var(--ease), transform 200ms var(--ease); pointer-events: none; z-index: 20; text-align: start; font-size: 0.92rem; }
#toast.show { opacity: 1; transform: none; }

@media print {
  body { background: #fff; }
  .nav, .footer-bar, .no-print, #toast { display: none !important; }
  #app { max-width: none; padding: 0; }
  #app > main { animation: none; }
  .card { break-inside: avoid; border: 1px solid #999; background: #fff; color: #000; }
  .bars b { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── login / account ─────────────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; }
input.ltr { text-align: right; }
.linkbtn { min-height: 44px; padding: 0 12px; background: none; border: 0; border-radius: var(--r-full); color: var(--md-primary); font-weight: 600; }
.linkbtn[disabled] { opacity: 0.38; cursor: default; }
input.otp { text-align: center; font-size: 1.6rem; letter-spacing: 0.35em; padding-inline-start: calc(16px + 0.35em); min-height: 60px; }
.testmode { border-radius: var(--r-lg); background: var(--md-tertiary-container); color: var(--md-on-tertiary-container); padding: 12px 16px; margin: 12px 0; }
.testmode strong { margin-inline-end: 8px; }
.testmode .pill { background: #ffe9a6; color: #4d3b00; font-weight: 700; }
.code-card { border-radius: var(--r-lg); background: var(--md-surface-container-high); padding: 12px 16px; margin: 12px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.code-card .code { font-size: 1.6rem; font-weight: 700; letter-spacing: 0.3em; }
.card.soft .muted, .note .muted, .testmode .muted, .banner .muted, .code-card .muted { color: inherit; opacity: 0.85; }
dialog.confirm .inner { max-width: 480px; margin: 0 auto; }
dialog.confirm .btn { margin-top: 0; }
.err-page { padding-top: 48px; text-align: center; }

/* ── home (expressive layer) ─────────────────────────────────────────────── */
.hero-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 12px 0 16px; padding: 24px 22px; border-radius: 32px;
  background: linear-gradient(140deg, var(--md-primary-container) 0%, #d9f1f5 55%, #ffe6df 130%); color: var(--md-on-primary-container); }
.hero-copy h1 { font-size: 1.75rem; line-height: 1.3; }
.hero-copy p { margin: 2px 0 12px; opacity: 0.8; font-size: 0.92rem; }
.chips-lite { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 10px; border-radius: var(--r-full); background: rgba(255, 255, 255, 0.65); font-size: 0.8rem; font-weight: 600; }
.tag svg { width: 16px; height: 16px; }
.ring { position: relative; flex: none; width: 112px; height: 112px; }
.ring-track { stroke: rgba(255, 255, 255, 0.7); }
.ring-value { stroke: var(--md-primary); transition: stroke-dasharray 600ms var(--ease-out); }
.ring-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.15; }
.ring-text strong { font-size: 2rem; font-weight: 800; }
.ring-text span { font-size: 0.72rem; opacity: 0.85; }
.prompt-card { margin: 0 0 12px; padding: 20px; border-radius: var(--r-xl); background: var(--md-tertiary-container); color: var(--md-on-tertiary-container); }
.prompt-card h2 { font-size: 1.25rem; }
.card.today { background: var(--md-surface-container-low); border-radius: var(--r-xl); padding: 18px; }
.card.cycle { background: var(--md-secondary-container); color: var(--md-on-secondary-container); border-radius: var(--r-xl); }
.card.cycle .muted { color: inherit; opacity: 0.8; }
.card.cycle .kv { border-color: rgba(5, 31, 37, 0.15); }
.big-line { display: flex; align-items: center; gap: 14px; margin: 6px 0 8px; }
.big-line svg { width: 36px; height: 36px; padding: 8px; border-radius: var(--r-full); background: var(--md-surface-container-lowest); color: var(--heat-4); flex: none; }
.big-line > div { display: flex; flex-direction: column; line-height: 1.4; }
.big-line strong { font-size: 1.25rem; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: transparent; padding: 0; color: var(--md-on-surface-variant); }
.wd small { font-size: 0.72rem; }
.wd b { width: 100%; aspect-ratio: 1; max-width: 48px; border-radius: var(--r-full); display: grid; place-items: center; background: var(--md-surface-container-high); color: var(--md-on-surface); font-size: 0.95rem; }
.wd.h0 b { background: var(--heat-0); } .wd.h1 b { background: var(--heat-1); } .wd.h2 b { background: var(--heat-2); } .wd.h3 b { background: var(--heat-4); color: #fff; }
.wd.today b { box-shadow: 0 0 0 3px var(--md-surface-container-low), 0 0 0 5px var(--md-primary); }
.wd.today small { color: var(--md-primary); font-weight: 700; }
.fab { position: fixed; z-index: 6; bottom: calc(88px + env(safe-area-inset-bottom)); inset-inline-end: max(16px, calc((100vw - 480px) / 2 + 16px)); display: inline-flex; align-items: center; gap: 12px; height: 56px; padding: 0 22px 0 20px; border-radius: var(--r-lg);
  background: var(--md-primary); color: var(--md-on-primary); font-weight: 700; text-decoration: none; box-shadow: var(--elev-3); transition: box-shadow 150ms var(--ease), transform 150ms var(--ease); }
.fab.tonal { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.fab:active { transform: scale(0.97); }
.fab svg { width: 24px; height: 24px; }
.home { padding-bottom: 72px; }
@media print { .fab { display: none; } }

/* ═══ soft-UI layer (current look): deep-teal hero, white cards with soft shadows, floating nav, tinted icon badges ═══ */
:root {
  --md-primary: #1f6672;
  --lilac: #ece8fb; --on-lilac: #3b2f78;
  --coral-soft: #ffe7df; --on-coral: #7a2f1f;
  --mint-soft: #dcf3ea;
  --shadow-card: 0 1px 2px rgba(18, 48, 56, 0.05), 0 10px 28px rgba(18, 48, 56, 0.07);
  --shadow-float: 0 6px 18px rgba(18, 48, 56, 0.14), 0 18px 40px rgba(18, 48, 56, 0.12);
}
body { background: radial-gradient(120% 60% at 50% -10%, #e3f2f5 0%, #f7fafa 55%) fixed; }
.ic { display: block; }
.card, .card.today { background: #fff; border: 0; border-radius: 26px; box-shadow: var(--shadow-card); padding: 18px; margin: 14px 0; }
.card.soft { background: var(--md-primary-container); box-shadow: none; }
.card.cycle { background: linear-gradient(150deg, #ece8fb 0%, #e3f1f6 100%); color: #20254a; box-shadow: var(--shadow-card); }
.card.cycle .muted { color: #3b4166; opacity: 0.85; }
.card.cycle .kv { border-color: rgba(32, 37, 74, 0.12); }
.big-line svg { background: #fff; color: #7a49d1; box-shadow: var(--shadow-card); }
h2.with-badge { display: flex; align-items: center; gap: 12px; margin: 0; }
.badge { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 15px; background: var(--md-primary-container); color: var(--md-primary); }
.badge .ic { width: 22px; height: 22px; }
.badge.b-coral { background: var(--coral-soft); color: var(--on-coral); }
.badge.b-lilac { background: var(--lilac); color: var(--on-lilac); }
.badge.b-white { background: rgba(255, 255, 255, 0.75); color: var(--on-coral); width: 52px; height: 52px; border-radius: 18px; }
.badge.b-white .ic { width: 28px; height: 28px; }

/* hero: dark teal gradient, white type, ring in white */
.hero-head { background: linear-gradient(135deg, #14505b 0%, #1f6f7c 55%, #3a9aa5 120%); color: #fff; border-radius: 32px; padding: 26px 22px; box-shadow: 0 14px 34px rgba(20, 80, 91, 0.35); position: relative; overflow: hidden; }
.hero-head::after { content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%; inset-inline-start: -70px; top: -90px; background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 70%); pointer-events: none; }
.hero-copy h1 { color: #fff; font-size: 1.85rem; }
.hero-copy p { color: rgba(255, 255, 255, 0.82); }
.tag { background: rgba(255, 255, 255, 0.18); color: #fff; backdrop-filter: blur(6px); }
.ring-track { stroke: rgba(255, 255, 255, 0.22); }
.ring-value { stroke: #fff; }
.ring-text { color: #fff; }
.prompt-card { background: linear-gradient(140deg, #ffe7df 0%, #ffd3c7 100%); color: var(--on-coral); border-radius: 28px; box-shadow: var(--shadow-card); }

/* buttons: rounded rectangles, filled ones lift */
.btn { border-radius: 18px; border: 0; background: var(--md-surface-container-high); color: var(--md-on-surface); font-weight: 700; }
.btn.primary { background: var(--md-primary); color: #fff; box-shadow: 0 6px 16px rgba(31, 102, 114, 0.35); }
.btn.tonal { background: var(--md-primary-container); color: var(--md-on-primary-container); box-shadow: none; }
.btn.danger { background: #fde8e6; color: #a31616; border: 0; }
.btn.ghost { background: transparent; }
.iconbtn { background: #fff; box-shadow: var(--shadow-card); border-radius: 16px; color: var(--md-on-surface); }
.iconbtn .ic { width: 22px; height: 22px; margin: auto; }
.fab { border-radius: 20px; background: var(--md-primary); box-shadow: var(--shadow-float); height: 58px; }
.fab.tonal { background: #fff; color: var(--md-primary); }

/* chips, scale, segmented: soft fills, strong selected state */
.chip { border: 0; background: #fff; box-shadow: 0 1px 2px rgba(18, 48, 56, 0.06), 0 0 0 1px rgba(18, 48, 56, 0.06); color: var(--md-on-surface); border-radius: 16px; }
.chip.on { background: var(--md-primary); color: #fff; box-shadow: 0 6px 14px rgba(31, 102, 114, 0.28); }
.chip.on small { color: #d7eef2; }
.chip.removable { background: var(--md-primary-container); color: var(--md-on-primary-container); box-shadow: none; }
.sc { border-radius: 16px; box-shadow: 0 0 0 1px rgba(18, 48, 56, 0.06); }
.sc.on { outline: none; box-shadow: 0 0 0 3px var(--md-primary), 0 6px 14px rgba(31, 102, 114, 0.3); transform: translateY(-2px); }
.seg { gap: 10px; }
.seg button, .seg button:first-child, .seg button:last-child { border: 0; border-radius: 18px; margin: 0; background: #fff; box-shadow: var(--shadow-card); }
.seg button.on, .seg button.on.neutral { background: var(--md-primary); color: #fff; }
.range { border: 0; background: var(--md-surface-container-high); border-radius: 16px; padding: 4px; gap: 4px; }
.range button { border-radius: 12px; border: 0 !important; }
.range button.on { background: #fff; color: var(--md-primary); box-shadow: var(--shadow-card); }

/* fields */
input[type='text'], input[type='number'], input[type='search'], input[type='tel'], textarea { border: 0; background: #fff; box-shadow: 0 0 0 1px rgba(18, 48, 56, 0.1); border-radius: 16px; }
input:focus, textarea:focus { box-shadow: 0 0 0 2px var(--md-primary); }

/* floating navigation */
.nav { background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(14px); inset-inline: 14px; bottom: calc(12px + env(safe-area-inset-bottom)); padding: 0; border-radius: 28px; box-shadow: var(--shadow-float); max-width: 452px; margin: 0 auto; }
.nav > div { max-width: none; padding: 6px 8px; }
.nav a { min-height: 64px; padding: 8px 0 8px; gap: 3px; font-size: 0.74rem; font-weight: 600; color: #5a6a6d; }
.nav a svg { width: 24px; height: 24px; }
.nav a::before { top: 8px; width: 56px; height: 34px; margin-left: -28px; border-radius: 14px; background: var(--md-primary); }
.nav a[aria-current='page'] { color: var(--md-primary); font-weight: 800; }
.nav a[aria-current='page'] svg { color: #fff; }
.nav a:hover::before { opacity: 0.12; }
.nav a[aria-current='page']::before { opacity: 1; }
.fab { bottom: calc(100px + env(safe-area-inset-bottom)); }
#app { padding-bottom: 130px; }
.footer-bar { background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(14px); box-shadow: 0 -8px 28px rgba(18, 48, 56, 0.08); border-radius: 28px 28px 0 0; }
.footer-bar .btn:not(.primary) { background: var(--md-surface-container-high); }

/* day cells / week circles / bars */
.day { border-radius: 18px; background: #fff; box-shadow: 0 0 0 1px rgba(18, 48, 56, 0.05); }
.day.today { box-shadow: 0 0 0 2.5px var(--md-primary); border-color: transparent; }
.wd b { box-shadow: 0 0 0 1px rgba(18, 48, 56, 0.05); }
.topbar h1 { font-size: 1.7rem; }
dialog.sheet { background: #fff; border-radius: 32px 32px 0 0; }
.note { border-radius: 18px; }
.banner { border-radius: 24px; }
#toast { border-radius: 16px; bottom: 108px; }
.progress i { height: 6px; }
.pattern { background: #fff; box-shadow: var(--shadow-card); border-radius: 8px 18px 18px 8px; }

/* ═══ 8px grid + centred state layers ═══════════════════════════════════════
   Every size, gap and padding below is a multiple of 8 (4 only for hairline tweaks inside a component).
   State layers (hover/press) are drawn by the element's own box, so they are always centred on the content. */
:root { --u: 8px; }
#app { padding-inline: 16px; padding-bottom: 136px; }
.topbar { padding: 24px 0 16px; gap: 8px; }
.card, .card.today { padding: 24px; margin: 16px 0; border-radius: 24px; }
.card h2 { margin-bottom: 16px; }
h2.with-badge { margin-bottom: 8px; }
.row { gap: 8px; }
.stack > * + * { margin-top: 16px; }
.field { margin: 24px 0; }
.kv { padding: 8px 0; gap: 16px; }
.banner, .note, .testmode, .code-card { padding: 16px; margin: 16px 0; }
.prompt-card { padding: 24px; margin: 0 0 16px; }
.hero-head { padding: 24px; margin: 16px 0; gap: 16px; border-radius: 32px; }
.hero-copy p { margin: 0 0 16px; }
.chips-lite { gap: 8px; }
.tag { padding: 8px 16px; }
.ring, .ring svg { width: 112px; height: 112px; }

/* buttons: one box model, content centred, layer fills the box */
.btn { min-height: 48px; padding: 0 24px; gap: 8px; border-radius: 16px; line-height: 1.2; }
.btn.small { min-height: 40px; padding: 0 16px; }
.btn.ghost { padding: 0 16px; }
.iconbtn { width: 48px; height: 48px; border-radius: 16px; }
.btn::after, .iconbtn::after, .chip::after, .seg button::after, .range button::after, .day::after, .sc::after { inset: 0; border-radius: inherit; margin: 0; }
.btn > *, .chip > * { position: relative; z-index: 1; }
.fab { height: 56px; padding: 0 24px; gap: 8px; border-radius: 16px; }

/* chips / scale / segmented */
.chips { gap: 8px; }
.chip { min-height: 48px; padding: 8px 16px; border-radius: 16px; align-items: center; text-align: center; }
.chip small { align-self: center; }
/* the selected check sits in its own gutter, never on the text */
.chip.on { padding-inline-start: 40px; }
.chip.on::before { inset-inline-start: 16px; width: 16px; height: 16px; margin-top: -8px; }
.scale10 { gap: 4px; }
.sc { height: 48px; border-radius: 16px; }
.seg { gap: 8px; }
.seg button, .seg button:first-child, .seg button:last-child { min-height: 56px; border-radius: 16px; }
.range { padding: 4px; gap: 4px; }
.range button { min-height: 40px; padding: 0 16px; }
input[type='text'], input[type='number'], input[type='search'], input[type='tel'], textarea { min-height: 56px; padding: 16px; border-radius: 16px; }
textarea { min-height: 96px; }
input.otp { min-height: 64px; }
.linkbtn { min-height: 48px; padding: 0 16px; }

/* navigation: the pill belongs to the icon, so it is centred on it at every width */
.nav > div { padding: 8px; gap: 0; }
.nav a { min-height: 72px; padding: 8px 0; gap: 4px; justify-content: center; }
.nav a::before { content: none; }
.nav-ic { position: relative; width: 64px; height: 32px; display: grid; place-items: center; border-radius: 16px; transition: background-color 200ms var(--ease); }
.nav a:hover .nav-ic { background: rgba(31, 102, 114, 0.12); }
.nav a[aria-current='page'] .nav-ic { background: var(--md-primary); }
.nav a[aria-current='page'] .nav-ic svg { color: #fff; }
.nav-label { line-height: 16px; }
.nav { border-radius: 32px; }
.fab { bottom: calc(104px + env(safe-area-inset-bottom)); }

/* badges, week, calendar, bars */
.badge { width: 48px; height: 48px; border-radius: 16px; }
.badge.b-white { width: 56px; height: 56px; border-radius: 16px; }
.week { gap: 8px; margin-top: 16px; }
.wd { gap: 8px; }
.wd b { max-width: 48px; }
.cal-grid { gap: 8px; }
.day { border-radius: 16px; }
.legend { gap: 8px 16px; margin: 16px 0; }
.progress { gap: 8px; margin: 8px 0 24px; }
.footer-bar { padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.footer-bar > div { gap: 16px; }
dialog.sheet .inner { padding: 16px 24px calc(24px + env(safe-area-inset-bottom)); }
#toast { bottom: 112px; padding: 16px; }
.pill { padding: 0 8px; }
.pattern { padding: 8px 16px; margin: 16px 0; }
.big-line { gap: 16px; margin: 8px 0 16px; }
.big-line svg { width: 48px; height: 48px; padding: 12px; }

/* ── Intro slides (before login / sign-up) ── */
.intro { min-height: 100dvh; display: flex; flex-direction: column; padding: 16px 0 24px; gap: 24px; }
.intro-top { display: flex; justify-content: flex-start; min-height: 40px; align-items: center; }
.intro-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; }
.intro-art { width: min(100%, 288px); }
.intro-art svg { width: 100%; height: auto; display: block; animation: intro-in .35s var(--ease-out, ease-out); }
@keyframes intro-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .intro-art svg { animation: none; } }
.intro-body h1 { margin: 0; }
.intro-body p { margin: 0; max-width: 32ch; }
.intro-dots { display: flex; justify-content: center; gap: 8px; }
.intro-dots span { width: 8px; height: 8px; border-radius: 4px; background: var(--md-outline-variant, #cfdada); transition: width .2s, background .2s; }
.intro-dots span.on { width: 24px; background: var(--md-primary); }

/* ── Login / sign-up (one screen) and legal pages ── */
.login-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 32px 0 8px; }
.login-mark { width: 64px; height: 64px; border-radius: 24px; display: grid; place-items: center; background: var(--md-primary-container); color: var(--md-primary); }
.login-brand { margin: 0; letter-spacing: .16em; font-weight: 700; color: var(--md-primary); }
.login-hero h1 { margin: 0; }
.login-lead { text-align: center; margin: 0 0 8px; }
.login-consent { text-align: center; margin-top: 16px; }
.login-consent a, .legal a { color: var(--md-primary); font-weight: 600; }
.legal section h2 { margin: 16px 0 4px; font-size: 1.05rem; }
.legal section p { margin: 0; }

/* ── Public site: landing, why us, contact ── */
#app.site-page { max-width: 1040px; padding: 0 16px 48px; }
.site { display: block; }
.site-head { display: flex; align-items: center; gap: 16px; padding: 16px 0; position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--md-surface) 92%, transparent); backdrop-filter: blur(10px); }
.site-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .12em; color: var(--md-primary); text-decoration: none; }
.login-mark.sm { width: 32px; height: 32px; border-radius: 12px; }
.site-nav { display: flex; gap: 8px; margin-inline-start: auto; }
.site-link { padding: 8px 12px; border-radius: 999px; color: var(--md-on-surface-variant); text-decoration: none; font-weight: 600; font-size: .92rem; }
.site-link:hover, .site-link[aria-current=page] { background: var(--md-primary-container); color: var(--md-primary); }
.btn.sm { min-height: 40px; padding: 0 16px; font-size: .9rem; }
@media (max-width: 640px) { .site-head { flex-wrap: wrap; gap: 8px; } .site-nav { order: 3; width: 100%; justify-content: center; margin: 0; } .site-brand span:last-child { display: inline; } }
.site-hero { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: center; padding: 24px 0 40px; }
@media (min-width: 820px) { .site-hero { grid-template-columns: 1.1fr .9fr; gap: 48px; padding: 48px 0 64px; } }
.kicker { margin: 0 0 8px; color: var(--md-primary); font-weight: 700; }
.site-hero h1 { font-size: clamp(1.7rem, 4.4vw, 2.6rem); line-height: 1.5; margin: 0 0 16px; }
.lead { font-size: 1.05rem; line-height: 2; color: var(--md-on-surface-variant); margin: 0 0 24px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.site-sec { padding: 40px 0 0; }
.site-sec h2 { margin: 0 0 24px; font-size: 1.4rem; }
.site-sec.head { text-align: center; padding-top: 24px; }
.site-sec.head h1 { margin: 0 0 8px; font-size: clamp(1.6rem, 4vw, 2.2rem); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(256px, 1fr)); gap: 16px; }
.step { text-align: center; }
.step h3 { margin: 8px 0; }
.step-art svg { width: 100%; max-width: 200px; height: auto; }
.site-cta { margin-top: 48px; text-align: center; padding: 32px 16px; background: linear-gradient(135deg, #1f6672, #2d8190); color: #fff; }
.site-cta h2 { margin: 0 0 8px; color: #fff; }
.site-cta p { margin: 0 0 16px; opacity: .92; }
.site-cta .btn.primary { background: #fff; color: var(--md-primary); }
.site-foot { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--md-outline-variant); text-align: center; }
.site-foot a { color: var(--md-primary); text-decoration: none; font-weight: 600; }
.centered { text-align: center; }
.why-list { display: grid; gap: 24px; padding-top: 24px; }
.why-item { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: center; background: var(--md-surface-container-lowest); border-radius: var(--r-xl); padding: 24px; box-shadow: var(--shadow-card); }
@media (min-width: 720px) { .why-item { grid-template-columns: 240px 1fr; gap: 32px; } .why-item.alt { grid-template-columns: 1fr 240px; } .why-item.alt .why-art { order: 2; } }
.why-art svg { width: 100%; max-width: 240px; height: auto; display: block; margin: 0 auto; }
.why-text h2 { margin: 0 0 8px; font-size: 1.2rem; }
.why-text p { margin: 0; line-height: 2; }
.contact-grid { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; padding-top: 24px; }
@media (min-width: 820px) { .contact-grid { grid-template-columns: 280px 1fr; } }
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { margin: 8px 0 0; }
textarea { width: 100%; font: inherit; padding: 12px 16px; border-radius: var(--r-lg); border: 1.5px solid var(--md-outline-variant); background: var(--md-surface-container-lowest); resize: vertical; }

/* the interactive hero */
.demo { padding: 24px; }
.demo-title { margin: 0 0 8px; font-weight: 700; color: var(--md-primary); text-align: center; }
.demo-stage { display: grid; place-items: center; padding: 8px 0; --orb: var(--heat-1); --halo: var(--heat-0); touch-action: pan-y; }
.demo-stage.lv0 { --orb: var(--md-primary-container); --halo: #e6f4f7; }
.demo-stage.lv1 { --orb: #f6dcd3; --halo: #fbeee9; }
.demo-stage.lv2 { --orb: var(--heat-2); --halo: var(--heat-1); }
.demo-stage.lv3 { --orb: var(--heat-3); --halo: var(--heat-2); }
.demo-stage.lv4 { --orb: var(--heat-4); --halo: var(--heat-3); }
.face { width: min(220px, 60%); height: auto; transform: translate(var(--tx, 0px), var(--ty, 0px)); transition: transform .2s var(--ease-out, ease-out); }
.face-halo { fill: var(--halo); transition: fill .3s; }
.face-orb { fill: var(--orb); transition: fill .3s; }
.face-eye { fill: #26333a; }
.face-mouth, .face-brow { stroke: #26333a; transition: d .25s; }
.face-cheek { fill: #fff; opacity: .35; }
.demo-caption { text-align: center; min-height: 3em; margin: 8px 0 16px; font-weight: 600; }
.demo input[type=range] { width: 100%; accent-color: var(--md-primary); margin: 8px 0; }
.demo-chips { margin-bottom: 8px; }
.demo-sum { padding: 12px 16px; border-radius: var(--r-lg); background: var(--md-primary-container); color: var(--md-on-primary-container); font-weight: 600; margin: 16px 0 8px; }
@media (prefers-reduced-motion: reduce) { .face { transition: none; } }

/* ── v1.1: body map, quick attack, PBAC, weekly summary ── */
.bodymap { display: grid; place-items: center; padding: 8px 0; }
.bodymap-svg { width: min(100%, 320px); height: auto; display: block; }
.bm-body { fill: var(--md-surface-container-high); }
.bm-cap { fill: var(--md-on-surface-variant); font-size: 10px; font-family: var(--font); }
.bm-zone { cursor: pointer; fill: rgba(217, 140, 120, .22); stroke: var(--heat-3); stroke-width: 1.4; transition: fill .15s; outline: none; }
.bm-zone:hover { fill: rgba(217, 140, 120, .42); }
.bm-zone:focus-visible { stroke: var(--md-primary); stroke-width: 3; }
.bm-zone.on { fill: var(--heat-4); stroke: var(--heat-4); }
.attack-btn { display: flex; align-items: center; gap: 8px; width: 100%; }
.pbac { display: grid; gap: 8px; }
.pbac-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; background: var(--md-surface-container-lowest); border-radius: 16px; padding: 8px 16px; box-shadow: var(--shadow-card); }
.pbac-row small { display: block; color: var(--md-on-surface-variant); font-size: .75rem; }
.stepper { display: inline-flex; align-items: center; gap: 8px; direction: ltr; }
.stepper button { width: 40px; height: 40px; border-radius: 14px; border: 0; background: var(--md-primary-container); color: var(--md-primary); font: 700 1.2rem var(--font); }
.stepper output { min-width: 32px; text-align: center; font-weight: 700; }
.pbac-total { background: var(--md-primary-container); color: var(--md-on-primary-container); border-radius: 16px; padding: 12px 16px; font-weight: 600; }
.week-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 8px 0; }
.week-grid > div { background: var(--md-surface-container-low); border-radius: 16px; padding: 8px 12px; display: grid; }
.week-grid b { font-size: 1.3rem; } .week-grid span { font-size: .78rem; color: var(--md-on-surface-variant); }
.reminder-bar { display: flex; gap: 8px; align-items: center; justify-content: space-between; background: var(--md-primary-container); color: var(--md-on-primary-container); border-radius: 16px; padding: 12px 16px; }

/* ── v1.1 beta: denser, web-sized UI ──────────────────────────────────────────────────────────────────────────
   Last layer. Phone: smaller type and controls. Wide screens: a wider column and two columns of cards, so more data is visible. */
html { font-size: 14px; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.02rem; margin-bottom: 6px; }
.muted { font-size: 0.86rem; }
body .card, body .card.today, body .card.cycle { padding: 14px; margin: 10px 0; border-radius: 18px; }
body .prompt-card { padding: 14px 16px; border-radius: 18px; margin: 8px 0; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
body .prompt-card .badge { grid-row: span 2; width: 44px; height: 44px; }
body .prompt-card h2 { margin: 0 !important; }
body .prompt-card p { margin: 0 !important; }
body .badge { width: 34px; height: 34px; }
body .ring { width: 84px; height: 84px; }
body .ring-text strong { font-size: 1.5rem; }
.btn { min-height: 40px; padding: 0 18px; font-size: 0.92rem; }
.btn.small { min-height: 34px; padding: 0 12px; }
.iconbtn { width: 40px; height: 40px; }
.chip { min-height: 36px; padding: 4px 12px; }
.seg button { min-height: 42px; }
.sc { height: 36px; }
.topbar { padding: 14px 0 8px; }
.kv { padding: 6px 0; }
.stack > * + * { margin-top: 8px; }
.hero-head, body .hero-head { padding: 14px 18px; border-radius: 22px; margin: 8px 0 10px; }
.hero-copy h1 { font-size: 1.4rem; }
.hero-cta { padding: 18px 16px; }
.hero-cta h2 { font-size: 1.15rem; }
.nav a { min-height: 54px; padding: 6px 0; font-size: 0.72rem; }
.nav-ic { width: 52px; height: 28px; border-radius: 14px; }
.nav a svg { width: 22px; height: 22px; }
.nav { border-radius: 26px; }
.fab { height: 46px; bottom: calc(80px + env(safe-area-inset-bottom)); }
.fab svg { width: 20px; height: 20px; }
.pbac-row { padding: 6px 12px; }
.stepper button { width: 34px; height: 34px; }
.cols > .topbar, .cols > .banner, .cols > .disclaimer, .cols > .no-print, .cols > .sample-badge, .cols > p { grid-column: 1 / -1; }
@media screen and (min-width: 860px) {
  #app { max-width: 1040px; padding: 0 24px 110px; }
  .nav { max-width: 420px; }
  .fab { inset-inline-end: max(24px, calc((100vw - 1040px) / 2 + 24px)); }
  .home, .cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }
  .home > .hero-head, .home > .disclaimer, .home > .reminder-bar, .home > .attack-btn, .home > .hero-cta, .home > .banner, .home > .note, .home > hr { grid-column: 1 / -1; }
  dialog.sheet, dialog.confirm .inner { max-width: 520px; }
}
body .ring svg { width: 100%; height: 100%; }

/* login: compact phone field, one small box per code digit */
body input[type='text'], body input[type='number'], body input[type='search'], body input[type='tel'], body textarea { min-height: 44px; padding: 8px 12px; border-radius: 12px; }
.otp-wrap { position: relative; display: flex; gap: 8px; justify-content: center; direction: ltr; margin: 8px 0; }
.otp-box { width: 40px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: #fff; box-shadow: 0 0 0 1px rgba(18, 48, 56, 0.16); font-size: 1.25rem; font-weight: 700; }
.otp-wrap:focus-within .otp-box.cur { box-shadow: 0 0 0 2px var(--md-primary); }
body .otp-wrap input.otp { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; opacity: 0; letter-spacing: 0; font-size: 16px; }
.otp-wrap input.otp:disabled ~ .otp-box, .otp-wrap:has(input:disabled) .otp-box { opacity: 0.5; }
/* 8px rhythm: the nav sits 8px above the bottom edge and the floating button 16px above the nav */
:root { --nav-h: 68px; }
body .nav { bottom: calc(8px + env(safe-area-inset-bottom)); inset-inline: 16px; }
body .nav > div { padding: 6px 8px; }
body .nav a { min-height: 52px; padding: 4px 0; }
body .fab { bottom: calc(8px + var(--nav-h) + 16px + env(safe-area-inset-bottom)); }
#app { padding-bottom: 136px; }
