/* Hallmark · checked: 2026-11-23 · genre: editorial (inferred) · shape: app screen · built: the project · redesign: full · v2.0.0 */
/* Quiet and low-glare: people open this during a migraine. Flat surfaces, one accent,
   44px targets. Layout: one column of ruled sections, the attack action first. */
@font-face { font-family: "Vazirmatn"; src: url("fonts/vazirmatn.woff2") format("woff2"); font-weight: 400; font-display: swap; }
:root, #doctor-report {
  --ground: #f3f2f6; --sheet: #fdfcff; --paper: #fefeff; --ink: #26223a; --dim: #5f5a72; --line: #dcd9e4; --edge: #7d7892;
  --accent: #55459a; --accent-down: #42357c; --accent-wash: #e6e2f3; --mild: #b9aedb;
  --med: #b86a12; --water: #3f7391;
  --wait: #8a4b00; --wait-wash: #fff1dc; --ok: #1f6a4a; --ok-wash: #e2f2ea; --bad: #a32626; --bad-wash: #fbe9e9;
  --scrim: rgba(38, 34, 58, 0.5);
  --text: "Vazirmatn", system-ui, Tahoma, sans-serif;
}
/* night: for a dark room. migraine: darker, warm, low contrast but still readable (4.5:1) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #16151d; --sheet: #1f1d29; --paper: #1f1d29; --ink: #dcd8e8; --dim: #a39db5; --line: #35323f; --edge: #77718a;
  --accent: #a99be0; --accent-down: #c0b5ea; --accent-wash: #2c2842; --mild: #544a80; --med: #d08a3a; --water: #6fa3c0;
  --wait: #e0b070; --wait-wash: #332814; --ok: #7fc4a0; --ok-wash: #1a2f26; --bad: #e89090; --bad-wash: #361d1f; --scrim: rgba(0, 0, 0, 0.6);
}
:root[data-theme="migraine"] {
  color-scheme: dark;
  --ground: #0d0b0a; --sheet: #161311; --paper: #161311; --ink: #b5a99c; --dim: #8f8478; --line: #282320; --edge: #675e55;
  --accent: #a3866a; --accent-down: #b5987b; --accent-wash: #241d17; --mild: #4a3c2f; --med: #a8753c; --water: #7d8a7c;
  --wait: #b5925f; --wait-wash: #221a0f; --ok: #87a07f; --ok-wash: #171e15; --bad: #bd8078; --bad-wash: #241513; --scrim: rgba(0, 0, 0, 0.7);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow-x: clip; }
body { background: var(--ground); color: var(--ink); font: 1rem/1.75 var(--text); }
h1, h2, h3 { margin: 0; line-height: 1.5; text-wrap: balance; }
p { margin: 0; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
.muted-text { color: var(--dim); font-size: 0.875rem; }
.bottom-nav, .calendar-day, .sleep-summary-row, .analytics-kpi-num, .analytics-highlight-num, .hydration-ring-count { font-variant-numeric: tabular-nums; }

/* boot */
.app-boot-loading { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; background: var(--ground); }
.app-boot-loading--out { opacity: 0; visibility: hidden; }
.app-boot-loading-inner { text-align: center; color: var(--dim); }
.app-boot-spinner, .app-boot-loading-time { display: none; }

/* frame */
.app-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 560px; margin: 0 auto; position: relative; }
.app-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 2px 20px; border-bottom: 1px solid var(--line); }
#app-title { font-size: 1rem; }
.header-btn, .link-btn { min-height: 44px; padding: 0; border: 0; background: none; color: var(--accent); }
.app-main { flex: 1; overflow-y: auto; padding: 20px 20px 96px; }
.screen { display: none; }
.screen.active { display: block; }
.screen-title { font-size: 1.375rem; margin-bottom: 12px; }
.screen-description { color: var(--dim); margin-bottom: 12px; }
.bottom-nav { position: absolute; inset: auto 0 0; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--sheet); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 20; }
.bottom-nav-item { min-height: 56px; border: 0; border-top: 3px solid transparent; background: none; color: var(--dim); font-size: 0.9375rem; }
.bottom-nav-item.active { color: var(--accent); border-top-color: var(--accent); font-weight: 700; }

/* sections: ruled, not boxed */
.card { padding: 16px 0; border-top: 1px solid var(--line); }
.screen > .card:first-of-type, .screen-title + .card { border-top: 0; }
.card:empty { display: none; }
.card-title { font-size: 1rem; margin-bottom: 4px; }
.actions { display: grid; gap: 8px; margin-top: 12px; }
.overuse-card { border: 0; border-radius: 6px; padding: 16px; margin-bottom: 16px; background: var(--wait-wash); color: var(--wait); }
.overuse-card--over { background: var(--bad-wash); color: var(--bad); }
.notice { padding: 16px; border-radius: 6px; background: var(--accent-wash); }

/* month strip */
.month-figure { margin: 0 0 20px; }
.month-figure svg { display: block; width: 100%; height: auto; }
.month-figure figcaption { color: var(--dim); font-size: 0.8125rem; margin-top: 4px; }
.month-day { fill: var(--mild); } .month-attack { fill: var(--accent); } .month-med { fill: var(--med); }
.month-key { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--med); }

/* controls */
.btn-primary, .btn-secondary, .modal-dialog-btn-secondary { min-height: 48px; padding: 8px 20px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: var(--sheet); }
.btn-secondary, .modal-dialog-btn-secondary { background: none; color: var(--accent); }
.btn-primary:active { background: var(--accent-down); }
.btn-secondary:active, .modal-dialog-btn-secondary:active { background: var(--accent-wash); }
@media (hover: hover) { .btn-primary:hover { background: var(--accent-down); } .btn-secondary:hover, .modal-dialog-btn-secondary:hover { background: var(--accent-wash); } }
button:disabled { cursor: not-allowed; }
.btn-danger { border-color: var(--bad); color: var(--bad); }
.btn-large { min-height: 60px; font-size: 1.125rem; }
.icon-button { min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--accent); }
.text-input-wrapper input, .text-input-wrapper textarea, .select-wrapper select, .qa-followup-input, #recovery-code { width: 100%; min-height: 48px; padding: 8px 12px; border: 1px solid var(--edge); border-radius: 6px; background: var(--sheet); }
textarea { resize: vertical; }
.text-input-wrapper { margin-top: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { min-height: 44px; padding: 4px 16px; border: 1px solid var(--edge); border-radius: 6px; background: var(--sheet); }
.chip-filled, .chip.selected { background: var(--accent); border-color: var(--accent); color: var(--sheet); }
.segments { display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 8px; border: 1px solid var(--edge); border-radius: 6px; overflow: hidden; background: var(--sheet); }
.segments button { min-height: 48px; min-width: 0; padding: 4px; border: 0; background: none; font-size: 0.9375rem; }
.segments button + button { border-inline-start: 1px solid var(--line); }
.segments button[aria-pressed="true"], .segments .sleep-quick-btn--selected { background: var(--accent); color: var(--sheet); }
.segments :focus-visible { outline-offset: -3px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0 16px; }
.checkbox-pill { display: flex; align-items: center; gap: 12px; min-height: 48px; border-bottom: 1px solid var(--line); cursor: pointer; }
.checkbox-pill input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.slider-row { display: flex; align-items: center; gap: 16px; }
.slider-row input { flex: 1; height: 44px; accent-color: var(--accent); }
.slider-value { min-width: 2ch; font-size: 1.75rem; text-align: center; }
.toast { position: fixed; inset: auto 0 80px; width: fit-content; max-width: min(90%, 400px); margin: 0 auto; padding: 12px 20px; border-radius: 6px; background: var(--ink); color: var(--sheet); font-size: 0.9375rem; z-index: 2500; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.toast.visible { opacity: 1; }

/* today */
.today-line { display: flex; flex-wrap: wrap; gap: 0 20px; color: var(--dim); font-size: 0.875rem; padding-bottom: 12px; }
.today-line b { font-weight: 400; color: var(--ink); }
.collapsible-header { display: flex; justify-content: space-between; align-items: center; }
.collapsible-arrow { color: var(--dim); display: none; }
.card.collapsed { cursor: pointer; }
.collapsed .collapsible-arrow { display: inline; }
.collapsed .segments, .collapsed .sleep-quick-hint { display: none; }
.done-text { color: var(--ok); }
.question-options-grid { display: grid; gap: 8px; margin-top: 12px; }
.question-option-btn { position: relative; isolation: isolate; overflow: hidden; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; padding: 8px 16px; border: 1px solid var(--edge); border-radius: 6px; background: var(--sheet); text-align: start; }
.question-option-btn::before { content: ""; position: absolute; z-index: -1; inset: 0 0 0 auto; width: var(--pct, 0); background: var(--accent-wash); }
.question-option-btn.mine { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.question-option-btn small { display: block; color: var(--dim); }
.question-option-btn:disabled { color: inherit; }
.question-feedback { margin-top: 12px; }
.sleep-summary-row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--line); }
.sleep-summary-row strong { font-weight: 400; }
.water-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; margin-top: 4px; }
.hydration-ring { height: 8px; background: linear-gradient(var(--water), var(--water)) right / var(--ring-progress, 0%) 100% no-repeat var(--line); }
.hydration-ring-count { font-size: 1.125rem; }

/* calendar */
.calendar-today-line { color: var(--dim); font-size: 0.875rem; }
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin: 8px 0; }
.calendar-month-label { font-size: 1.125rem; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 12px; color: var(--dim); font-size: 0.875rem; }
.legend-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: 8px; vertical-align: -1px; }
.legend-red { background: var(--accent); } .legend-yellow { background: var(--mild); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendar-day { min-height: 44px; border: 0; border-radius: 4px; background: none; text-align: center; padding: 0; }
.calendar-day-header { min-height: 32px; color: var(--dim); font-size: 0.875rem; }
.calendar-day-status-dot { display: none; }
.calendar-day.status-attack { background: var(--accent); color: var(--sheet); }
.calendar-day.status-prodrome { background: var(--mild); }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--ink); }
.calendar-details { margin-top: 16px; }

/* analytics */
.analytics-period-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.analytics-period-btn { min-height: 44px; padding: 4px 16px; border: 1px solid var(--edge); border-radius: 6px; background: var(--sheet); }
.analytics-period-btn.active { background: var(--accent); border-color: var(--accent); color: var(--sheet); }
.analytics-kpi-title { font-size: 1rem; }
.analytics-kpi-grid { margin: 8px 0 0; }
.analytics-kpi-tile { display: grid; grid-template-columns: 1fr auto; gap: 0 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.analytics-kpi-lbl { color: var(--dim); } .analytics-kpi-sublbl { color: var(--ink); } .analytics-kpi-num { order: 1; }
.analytics-highlight-grid { display: flex; gap: 40px; }
.analytics-highlight-num { font-size: 1.75rem; line-height: 1.3; } .analytics-highlight-lbl { color: var(--dim); font-size: 0.875rem; }
.analytics-section-title { display: block; padding-top: 24px; font-size: 1.125rem; font-weight: 700; }
.analytics-bar-row { padding: 4px 0; } .analytics-bar-label { display: flex; justify-content: space-between; }
.analytics-bar-track { height: 8px; background: var(--line); } .analytics-bar-fill { height: 100%; background: var(--accent); }
.chart-card-header { display: flex; justify-content: space-between; align-items: center; }
.chart-card-title { font-weight: 700; }
.chart-maximize-btn, .chart-fullscreen-close { min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--accent); }
.chart-card canvas { max-width: 100%; } .canvas-scroll { overflow-x: auto; }
.insight-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.chart-fullscreen-modal { position: fixed; inset: 0; z-index: 2200; background: var(--sheet); padding: 16px; overflow: auto; }
.chart-fullscreen-header { display: flex; justify-content: space-between; align-items: center; }

/* questions */
.qa-thread-item { padding: 16px 0; border-top: 1px solid var(--line); }
.qa-thread-meta { color: var(--dim); font-size: 0.8125rem; }
.qa-thread-chat { display: grid; gap: 8px; margin: 8px 0; }
.qa-chat-bubble { padding: 12px 16px; border-radius: 6px; background: var(--sheet); overflow-wrap: anywhere; }
.qa-chat-bubble--specialist { background: var(--accent-wash); margin-inline-start: 24px; }
.qa-chat-bubble-label { color: var(--dim); font-size: 0.8125rem; }
.qa-thread-pending { color: var(--wait); font-size: 0.875rem; }
.qa-thread-pending-dot { display: none; }
.qa-followup-row { display: grid; gap: 8px; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; }
.faq-body { padding-bottom: 12px; color: var(--dim); }

/* dialogs */
.modal-overlay { position: fixed; inset: 0; z-index: 2100; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--scrim); }
.modal-dialog { width: 100%; max-width: 400px; max-height: 100%; overflow: auto; padding: 24px; border-radius: 6px; background: var(--sheet); }
.modal-dialog-title { font-size: 1.125rem; margin-bottom: 8px; }
.modal-dialog-body { white-space: pre-line; }
.modal-dialog-actions, .scientific-truth-actions { display: grid; gap: 8px; margin-top: 20px; }
.scientific-truth-actions { grid-template-columns: 1fr 1fr; }
.fact-vote-btn { min-height: 48px; border: 1px solid var(--edge); border-radius: 6px; background: none; }
.fact-vote-btn.voted { background: var(--accent-wash); border-color: var(--accent); }

/* rows, forms, reports, profile */
.pref-hidden { display: none !important; }
.plain-list { margin: 0; padding-inline-start: 20px; }
.row-btn { display: flex; justify-content: space-between; align-items: center; gap: 16px; width: 100%; min-height: 56px; padding: 8px 0; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: start; }
.row-btn > span:first-child { min-width: 0; overflow-wrap: anywhere; } .row-btn > span + span { flex: none; color: var(--dim); }
.row-btn small, .f-toggle small { display: block; color: var(--dim); }
.task-done { color: var(--ok); }
.list-month { margin-top: 20px; padding-bottom: 4px; color: var(--dim); font-size: 0.9375rem; border-bottom: 1px solid var(--line); }
.journey-bar { height: 8px; margin: 8px 0; background: var(--line); } .journey-bar span { display: block; height: 100%; background: var(--accent); }
.report-tabs { grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
.report-tabs [aria-selected="true"] { background: var(--accent); color: var(--sheet); }
.f-field { display: grid; gap: 4px; margin-top: 16px; } .f-field > span:first-child { color: var(--dim); font-size: 0.875rem; }
.f-field input:not([type="range"]), .f-field select, .f-field textarea, .time-list input { width: 100%; min-height: 48px; padding: 8px 12px; border: 1px solid var(--edge); border-radius: 6px; background: var(--sheet); }
.f-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.jdate { display: grid; grid-template-columns: 1fr 1.5fr 1.3fr; gap: 8px; }
.time-list { display: grid; gap: 8px; } .time-list > div { display: flex; gap: 8px; }
.f-toggle { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 52px; border-bottom: 1px solid var(--line); cursor: pointer; }
.f-toggle input { flex: none; appearance: none; width: 48px; height: 28px; margin: 0; border: 1px solid var(--edge); border-radius: 14px; background: radial-gradient(circle, var(--edge) 9px, transparent 10px) right 0 center / 26px 26px no-repeat var(--sheet); }
.f-toggle input:checked { border-color: var(--accent); background: radial-gradient(circle, var(--sheet) 9px, transparent 10px) left 0 center / 26px 26px no-repeat var(--accent); }
details.card > summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }

/* intro */
#intro { position: fixed; inset: 0; z-index: 2600; display: flex; flex-direction: column; padding: 8px 0 20px; background: var(--ground); }
#btn-intro-skip { align-self: flex-start; padding: 0 20px; }
#intro-track { flex: 1; min-height: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
#intro-track::-webkit-scrollbar { display: none; }
.intro-slide { flex: 0 0 100%; scroll-snap-align: center; overflow-y: auto; padding: 8px 24px; display: flex; flex-direction: column; justify-content: safe center; align-items: center; gap: 12px; text-align: center; }
.intro-slide h2 { font-size: 1.5rem; margin-top: 12px; } .intro-slide > p { max-width: 36ch; color: var(--dim); }
.intro-mock { width: 100%; max-width: 360px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--sheet); text-align: start; }
.intro-mock .chip { display: inline-flex; align-items: center; } .intro-mock svg { display: block; width: 100%; margin: 8px 0; } .intro-mock .qa-chat-bubble { background: var(--accent-wash); margin: 12px 0 0; }
#intro-dots { display: flex; justify-content: center; gap: 8px; margin: 12px 0; } #intro-dots span { width: 8px; height: 8px; border-radius: 4px; background: var(--mild); } #intro-dots .on { width: 24px; background: var(--accent); }
#btn-intro-next { margin: 0 20px; }
@media (min-width: 600px) { #btn-intro-next { width: 360px; align-self: center; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none; transition: none; } }

/* doctor report */
#doctor-report { position: fixed; inset: 0; z-index: 2000; overflow: auto; background: var(--paper); color: var(--ink); padding: 16px; }
#doctor-report.hidden { display: none; }
#doctor-report-body { max-width: 820px; margin: 0 auto; font-size: 14px; line-height: 1.8; }
#doctor-report h1 { font-size: 1.3rem; } #doctor-report h2 { font-size: 1.05rem; margin: 20px 0 4px; }
#doctor-report table { width: 100%; border-collapse: collapse; }
#doctor-report th, #doctor-report td { border: 1px solid var(--line); padding: 4px 8px; text-align: right; vertical-align: top; overflow-wrap: anywhere; }
#doctor-report th { background: var(--ground); }
.report-attacks { font-size: 11px; }
#doctor-report .report-toolbar > * { flex: 1; margin: 0; }
.report-toolbar { position: sticky; top: -16px; background: var(--paper); padding: 12px 0; display: flex; gap: 8px; max-width: 820px; margin: 0 auto; }
.report-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.report-kpis div { border: 1px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; font-size: 12px; }
.report-kpis b { display: block; font-size: 1.2rem; }
.report-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.report-note { font-size: 12px; color: var(--dim); }
body.report-open { overflow: hidden; }
@media print {
  @page { size: A4; margin: 12mm; }
  html { height: auto; }
  body.report-open { display: block; height: auto; min-height: 0; margin: 0; padding: 0; overflow: visible; background: var(--paper); }
  body.report-open > *:not(#doctor-report) { display: none !important; }
  body.report-open #doctor-report { position: static; overflow: visible; padding: 0 2px; }
  .report-toolbar { display: none; }
  #doctor-report tr, .report-kpis div { break-inside: avoid; }
  #doctor-report thead { display: table-header-group; }
  #doctor-report * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

