:root {
  color-scheme: light;
  --bg: #fafafa;
  --panel: #ffffff;
  --panel-2: #f3f7f8;
  --ink: #1a1a2e;
  --muted: #5a6475;
  --line: #dbe3ea;
  --brand: #d4380d;
  --brand-dark: #a92d0b;
  --accent: #007ea7;
  --success: #207d3a;
  --warning: #a86200;
  --danger: #b00020;
  --focus: #00b4d8;
  --shadow: 0 8px 28px rgba(10, 20, 35, 0.08);
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --font: "Atkinson Hyperlegible", "Inter", "Segoe UI", system-ui, sans-serif;
}

body.dark {
  color-scheme: dark;
  --bg: #0f0f1a;
  --panel: #171929;
  --panel-2: #202638;
  --ink: #f5f7fb;
  --muted: #b9c3d4;
  --line: #333c4d;
  --brand: #ff6a3d;
  --brand-dark: #ff8a63;
  --accent: #00b4d8;
  --success: #4dd36d;
  --warning: #f5a623;
  --danger: #ff6b7a;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
}

body.large-text {
  font-size: 18px;
}

body.xlarge-text {
  font-size: 20px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea {
  border-radius: 8px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.noscript,
.center-shell {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 18px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  background: var(--ink);
  color: #ffffff;
  overflow-y: auto;
}

body.dark .side {
  background: #080812;
}

.brand-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 800;
  flex: 0 0 auto;
}

.brand-title {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.15;
}

.brand-tagline {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-button,
.ghost-button,
.primary-button,
.danger-button,
.small-button,
.chip-button {
  min-height: 44px;
  border: 0;
  cursor: pointer;
}

.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.84);
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.nav-icon {
  width: 26px;
  text-align: center;
}

.side-foot {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
  display: grid;
  gap: 10px;
}
.feedback-btn {
  width: 100%;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  padding: 8px 10px;
}
.feedback-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.4);
}
.version-tag {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.18;
}

h1 {
  font-size: clamp(1.65rem, 3vw, 2.45rem);
  overflow-wrap: anywhere;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1rem;
}

p {
  margin: 0;
}

.subtle {
  color: var(--muted);
}

.view {
  display: grid;
  gap: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.span-12 {
  grid-column: span 12;
}

.span-8 {
  grid-column: span 8;
}

.span-6 {
  grid-column: span 6;
}

.span-4 {
  grid-column: span 4;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.panel.flat {
  box-shadow: none;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.stack {
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  min-height: 94px;
  resize: vertical;
}

.full-field {
  grid-column: 1 / -1;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.primary-button,
.danger-button,
.ghost-button,
.small-button,
.chip-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  font-weight: 700;
}

.primary-button {
  background: var(--brand);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.danger-button {
  background: var(--danger);
  color: #ffffff;
}

.ghost-button,
.small-button,
.chip-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.small-button {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 0.88rem;
}

.chip-button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.84rem;
}

.lock-card {
  width: min(100%, 680px);
  margin: 7vh auto 0;
  max-width: 680px;
}

.lock-hero {
  padding: 22px;
  border-left: 6px solid var(--brand);
}

.warning-box {
  border: 1px solid color-mix(in srgb, var(--warning), var(--line) 35%);
  background: color-mix(in srgb, var(--warning), var(--panel) 88%);
  border-radius: 8px;
  padding: 12px;
}

.danger-box {
  border: 1px solid color-mix(in srgb, var(--danger), var(--line) 35%);
  background: color-mix(in srgb, var(--danger), var(--panel) 90%);
  border-radius: 8px;
  padding: 12px;
}

.success-box {
  border: 1px solid color-mix(in srgb, var(--success), var(--line) 35%);
  background: color-mix(in srgb, var(--success), var(--panel) 90%);
  border-radius: 8px;
  padding: 12px;
}

.metric {
  display: grid;
  gap: 5px;
}

.metric-value {
  font-family: var(--mono);
  font-size: 1.65rem;
  font-weight: 800;
}

.list {
  display: grid;
  gap: 10px;
}

.item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}

.item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.item-title {
  font-weight: 800;
}

.item-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 4px 9px;
  background: var(--panel-2);
  color: var(--ink);
  font-size: 0.82rem;
}

.pill.warn {
  border-color: color-mix(in srgb, var(--warning), var(--line) 30%);
  color: var(--warning);
}

.pill.danger {
  border-color: color-mix(in srgb, var(--danger), var(--line) 30%);
  color: var(--danger);
}

.pill.ok {
  border-color: color-mix(in srgb, var(--success), var(--line) 30%);
  color: var(--success);
}

.emergency-card {
  display: grid;
  gap: 14px;
  border-top: 7px solid var(--brand);
}

.emergency-name {
  font-size: clamp(1.6rem, 5vw, 3rem);
  font-weight: 900;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.critical-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.critical-cell {
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 10px;
}

.critical-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.critical-value {
  display: block;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.sparkline {
  width: 160px;
  height: 48px;
}

.print-packet {
  display: grid;
  gap: 18px;
}

.mono {
  font-family: var(--mono);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side {
    position: relative;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main {
    padding: 18px;
  }

  .span-8,
  .span-6,
  .span-4 {
    grid-column: span 12;
  }
}

@media (max-width: 620px) {
  .topbar,
  .section-head,
  .item-head {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .critical-grid {
    grid-template-columns: 1fr;
  }

  .lock-card {
    margin-top: 0;
  }

  .main {
    padding: 14px;
  }
}

/* --- Self-hosted fonts (HAIL-SEC §12.1 — bundled, never a runtime request) --- */
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/atkinson-hyperlegible-400.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/atkinson-hyperlegible-700.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/jetbrains-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/jetbrains-mono-700.woff2") format("woff2");
}

/* --- High contrast accommodation --- */
body.high-contrast {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --ink: #000000;
  --muted: #1a1a1a;
  --line: #000000;
  --brand: #a3270a;
  --brand-dark: #7a1d07;
  --accent: #003a52;
  --success: #0b5d24;
  --warning: #6e4100;
  --danger: #8a0017;
  --shadow: none;
}
body.high-contrast.dark {
  --bg: #000000;
  --panel: #000000;
  --panel-2: #0a0a0a;
  --ink: #ffffff;
  --muted: #ededed;
  --line: #ffffff;
  --brand: #ff8a63;
  --brand-dark: #ffa585;
  --accent: #6fd3f0;
  --success: #5fe07f;
  --warning: #ffc24d;
  --danger: #ff8a96;
}
body.high-contrast .panel,
body.high-contrast .item,
body.high-contrast input,
body.high-contrast select,
body.high-contrast textarea,
body.high-contrast .pill {
  border-width: 2px;
}
body.high-contrast a {
  text-decoration: underline;
}
body.high-contrast .nav-button.active,
body.high-contrast .nav-button:hover {
  background: rgba(255, 255, 255, 0.3);
  outline: 2px solid #ffffff;
}

body.busy {
  cursor: progress;
}

/* --- Passphrase strength meter --- */
.strength {
  display: grid;
  gap: 6px;
}
.strength-track {
  height: 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  width: 0;
  transition: width 0.18s ease;
  background: var(--muted);
}
.strength-fill.vweak,
.strength-fill.weak {
  background: var(--danger);
}
.strength-fill.fair {
  background: var(--warning);
}
.strength-fill.good,
.strength-fill.strong {
  background: var(--success);
}
.strength-label {
  font-size: 0.86rem;
  color: var(--muted);
}

/* --- Lab tracker extras --- */
.lab-note {
  margin-top: 4px;
  font-size: 0.84rem;
  color: var(--muted);
  max-width: 38ch;
}
.trend {
  font-weight: 800;
}
.trend.up {
  color: var(--danger);
}
.trend.down {
  color: var(--accent);
}
.trend.flat {
  color: var(--muted);
}

/* --- Medication interaction + Gantt --- */
.alert-badge {
  border: 1px solid color-mix(in srgb, var(--danger), var(--line) 30%);
  background: color-mix(in srgb, var(--danger), var(--panel) 86%);
  color: var(--danger);
  border-radius: 8px;
  padding: 9px 11px;
  font-weight: 700;
  text-align: left;
}
.item.interaction-major {
  border-left: 5px solid var(--danger);
}
.item.interaction-moderate {
  border-left: 5px solid var(--warning);
}
.item.interaction-minor {
  border-left: 5px solid var(--line);
}
.gantt {
  display: grid;
  gap: 8px;
}
.gantt-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}
.gantt-label {
  font-size: 0.86rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.gantt-track {
  position: relative;
  height: 20px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.gantt-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 999px;
  background: var(--accent);
  min-width: 6px;
}
.gantt-bar.ongoing {
  background: var(--brand);
}
.gantt-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--mono);
  margin-top: 2px;
}
@media (max-width: 620px) {
  .gantt-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* --- Translate glossary --- */
.ask-list {
  margin: 4px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 3px;
}

/* --- QR block --- */
.qr-block {
  display: grid;
  gap: 8px;
  justify-items: start;
}
.qr-frame {
  width: 168px;
  height: 168px;
  display: grid;
  place-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
}
.qr-frame svg {
  width: 100%;
  height: 100%;
}

/* --- Common-medication match card --- */
.quick-actions { padding: 14px 16px; }
.quick-actions .button-row { gap: 8px; }

.med-match-info {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}
.med-match-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.med-match-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.dose-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dose-chip {
  min-height: 30px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.84rem;
  cursor: pointer;
}
.dose-chip:hover {
  background: var(--panel-2);
  border-color: var(--accent);
}

/* --- Symptoms / DVPRS-style severity scale --- */
.severity-scale {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}
.severity-label { display: grid; gap: 2px; }
.severity-buttons {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 4px;
}
.severity-btn {
  min-height: 44px;
  border-radius: 6px;
  border: 2px solid transparent;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  font-family: var(--mono);
  cursor: pointer;
  transition: filter 0.1s ease;
}
.severity-btn.lvl0,
.severity-btn.lvl1,
.severity-btn.lvl2 { background: #c6e6b0; color: #1a4a1a; }
.severity-btn.lvl3,
.severity-btn.lvl4 { background: #f3e08c; color: #4a3c0a; }
.severity-btn.lvl5,
.severity-btn.lvl6 { background: #f5c46b; color: #4a3008; }
.severity-btn.lvl7,
.severity-btn.lvl8 { background: #f08453; color: #ffffff; }
.severity-btn.lvl9,
.severity-btn.lvl10 { background: #c93f3f; color: #ffffff; }
.severity-btn:hover { filter: brightness(0.95); }
.severity-btn.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink);
  transform: scale(1.04);
}
.severity-current {
  padding: 10px 12px;
  background: var(--panel);
  border-radius: 6px;
  font-weight: 600;
  min-height: 1.4em;
  border-left: 5px solid var(--line);
}
.severity-current.lvl-low { border-left-color: #4a8a2e; }
.severity-current.lvl-mid { border-left-color: #c98a16; }
.severity-current.lvl-high { border-left-color: #d4541f; }
.severity-current.lvl-severe { border-left-color: #b53030; }
.severity-help { font-size: 0.92rem; }
.severity-help summary {
  cursor: pointer;
  font-weight: 700;
  padding: 4px 0;
  color: var(--accent);
}
.severity-help-list {
  padding: 0;
  margin: 8px 0;
  display: grid;
  gap: 4px;
  list-style: none;
}
.severity-help-list li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 0;
}

.severity-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  font-weight: 700;
  font-size: 0.82rem;
  margin-left: 6px;
}
.severity-pill.lvl-low { background: #c6e6b0; color: #1a4a1a; }
.severity-pill.lvl-mid { background: #f3e08c; color: #4a3c0a; }
.severity-pill.lvl-high { background: #f08453; color: #ffffff; }
.severity-pill.lvl-severe { background: #c93f3f; color: #ffffff; }

.symptom-trends { display: grid; gap: 8px; }
.symptom-trend-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(0, 2fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.symptom-trend-row:last-child { border-bottom: 0; }
.symptom-spark {
  width: 100%;
  max-width: 280px;
  height: 36px;
  color: var(--ink);
}
.symptom-spark .dot.lvl-low { fill: #4a8a2e; }
.symptom-spark .dot.lvl-mid { fill: #c98a16; }
.symptom-spark .dot.lvl-high { fill: #d4541f; }
.symptom-spark .dot.lvl-severe { fill: #b53030; }

@media (max-width: 700px) {
  .severity-buttons { grid-template-columns: repeat(6, 1fr); }
  .symptom-trend-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* --- Demo CTA on lock + setup screens --- */
.lock-demo-cta {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  text-align: center;
}
.lock-demo-cta p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.lock-demo-hint {
  margin: 4px 0 0;
  text-align: center;
  padding: 8px 10px;
  background: var(--panel-2);
  border-radius: 6px;
  font-size: 0.88rem;
}
.lock-demo-hint strong { color: var(--brand); }

/* --- Zero-server-side claim (lock screens + app footer) --- */
.zero-claim-small {
  padding: 12px 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1a1a2e 0%, #2a2a4a 100%);
  color: #ffffff;
  border-left: 5px solid var(--brand);
  font-size: 0.92rem;
  line-height: 1.5;
}
.zero-claim-small strong {
  display: block;
  margin-bottom: 4px;
  color: #ffd9b9;
  font-family: var(--mono);
  font-size: 0.92rem;
  letter-spacing: 0.03em;
}

/* --- Demo-mode banner --- */
.demo-banner {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(90deg, #d4380d, #f08453);
  color: #ffffff;
  font-weight: 700;
  padding: 10px 16px;
  border-bottom: 2px solid #a92d0b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.demo-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.demo-banner strong {
  font-family: var(--mono);
  letter-spacing: 0.05em;
  font-size: 0.86rem;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 4px;
  margin-right: 8px;
}
.demo-banner-cta {
  color: #ffffff;
  background: rgba(0, 0, 0, 0.22);
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
}
.demo-banner-cta:hover {
  background: rgba(0, 0, 0, 0.36);
}
@media print {
  .demo-banner { display: none !important; }
}

/* --- Provider lookup (NPI Registry snapshot) --- */
.provider-lookup {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  margin-bottom: 12px;
}
.provider-results-list {
  display: grid;
  gap: 4px;
  max-height: 340px;
  overflow-y: auto;
  padding-top: 4px;
}
.provider-result {
  text-align: left;
  padding: 9px 11px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 3px;
  font: inherit;
}
.provider-result:hover {
  background: var(--panel-2);
  border-color: var(--accent);
}
.provider-result-name { font-weight: 700; }
.provider-cred {
  display: inline-block;
  padding: 1px 7px;
  font-size: 0.76rem;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
  margin-left: 4px;
  vertical-align: middle;
}
.provider-result-meta { font-size: 0.86rem; color: var(--muted); }

/* --- Portal walkthroughs + records request letter --- */
.walkthroughs { display: grid; gap: 8px; }
.walkthrough {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--panel);
}
.walkthrough summary {
  cursor: pointer;
  padding: 4px 0;
  font-weight: 600;
}
.walkthrough[open] {
  background: var(--panel-2);
}
.walkthrough[open] summary {
  color: var(--accent);
}
.walkthrough-steps {
  margin: 8px 0 4px;
  padding-left: 22px;
  display: grid;
  gap: 6px;
}
.walkthrough-steps li { line-height: 1.5; }

.records-builder { gap: 12px; }
.records-items-field {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--panel);
}
.records-items-field legend {
  padding: 0 6px;
  font-size: 0.86rem;
  color: var(--muted);
}
.records-items-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}
.records-item-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.92rem;
  color: var(--ink);
}
.records-item-check input {
  width: auto;
  min-height: 0;
  margin-top: 4px;
}
@media (max-width: 720px) {
  .records-items-grid { grid-template-columns: 1fr; }
}

.records-preview-wrap {
  background: var(--bg);
  padding: 14px;
  border-radius: 8px;
  border: 1px dashed var(--line);
}
.records-letter {
  background: #ffffff;
  color: #1a1a2e;
  padding: 28px 30px;
  border-radius: 4px;
  font-family: "Atkinson Hyperlegible", "Inter", sans-serif;
  line-height: 1.5;
  font-size: 0.93rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  max-width: 720px;
  margin: 0 auto;
}
.records-letter p { margin: 0 0 12px; }
.records-letter .records-date { text-align: right; }
.records-letter .records-items {
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  margin: 0 0 12px;
}
.records-letter .records-sig { margin-top: 24px; }
.records-letter .records-sig-line {
  display: inline-block;
  min-width: 280px;
  letter-spacing: 1px;
}
.records-letter .records-contact {
  margin-top: 18px;
  font-size: 0.9rem;
  padding-top: 10px;
  border-top: 1px solid #dddddd;
}
.records-letter .records-footnote {
  margin-top: 20px;
  font-size: 0.76rem;
  color: #666666;
}

@media print {
  body.print-records .side,
  body.print-records .topbar,
  body.print-records .no-print,
  body.print-records .toast,
  body.print-records .modal-overlay { display: none !important; }
  body.print-records .panel:not(.records-builder) { display: none !important; }
  body.print-records .records-builder > *:not(.records-preview-wrap) { display: none !important; }
  body.print-records .records-preview-wrap {
    padding: 0;
    border: 0;
    background: #ffffff;
  }
  body.print-records .records-letter {
    border: 0;
    padding: 0;
    box-shadow: none;
    max-width: none;
  }
  body.print-records .records-footnote { display: none !important; }
}

/* --- Intake review --- */
.intake-list { gap: 8px; }
.intake-item { padding: 10px 12px; }
.intake-row-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.intake-check {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 90px;
  padding-top: 2px;
  font-size: 0.84rem;
  color: var(--muted);
}
.intake-check input { width: auto; min-height: 0; }
.intake-row-body { flex: 1; min-width: 0; }
.intake-notes { margin-top: 4px; font-size: 0.86rem; }
.intake-item:has(input[type="checkbox"]:not(:checked)) { opacity: 0.55; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 12, 22, 0.62);
}
.modal {
  width: min(100%, 480px);
  max-height: 90vh;
  overflow-y: auto;
}

@media print {
  body {
    background: #ffffff;
    color: #000000;
  }

  .side,
  .topbar,
  .button-row,
  .no-print,
  .toast,
  .modal-overlay {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main,
  .panel {
    padding: 0;
    box-shadow: none;
    border: 0;
  }

  .view {
    display: block;
  }

  a {
    color: #000000;
  }

  .emergency-card {
    border: 2px solid #000000;
    border-radius: 8px;
    padding: 14px;
    page-break-inside: avoid;
  }

  .critical-cell {
    border-color: #000000;
  }

  body.print-emergency .panel:not(.emergency-card) {
    display: none !important;
  }
}
