/* ═══════════════════════════════════════════════
   NIHSS Clinical Tool – style.css
   ═══════════════════════════════════════════════ */

/* ── GOOGLE FONTS ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── DESIGN TOKENS ── */
:root {
  --font: 'Inter', system-ui, sans-serif;

  /* Dark theme (default) */
  --bg:           #0d1117;
  --bg-card:      #161b22;
  --bg-card-hover:#1c2333;
  --bg-input:     #21262d;
  --border:       rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.18);
  --text:         #e6edf3;
  --text-muted:   #8b949e;
  --text-subtle:  #484f58;

  /* Brand gradient */
  --indigo:  #818cf8;
  --sky:     #38bdf8;
  --grad:    linear-gradient(135deg, var(--indigo), var(--sky));

  /* Severity palette */
  --c-none:       #22c55e;
  --c-minor:      #84cc16;
  --c-moderate:   #f59e0b;
  --c-mod-severe: #f97316;
  --c-severe:     #ef4444;

  /* UI */
  --radius:    14px;
  --radius-sm: 8px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);

  /* Ring */
  --ring-stroke: var(--indigo);
}

/* ── LIGHT THEME ── */
/* Gắn class .light trên thẻ <html> (không phải <body>) để có thể áp
   giao diện ngay trong <head>, trước khi <body> được tạo ra — tránh chớp đen. */
.light {
  --bg:           #f0f4f8;
  --bg-card:      #ffffff;
  --bg-card-hover:#f8fafc;
  --bg-input:     #eef2f7;
  --border:       rgba(0,0,0,0.08);
  --border-hover: rgba(0,0,0,0.18);
  --text:         #1a202c;
  --text-muted:   #4a5568;
  --text-subtle:  #a0aec0;
  --shadow:       0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 48px rgba(0,0,0,0.12);
  --ring-stroke:  var(--indigo);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* ── BACKGROUND BLOBS ── */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
  animation: float 12s ease-in-out infinite;
}
.blob-1 {
  width: 600px; height: 600px;
  background: var(--indigo);
  top: -200px; left: -200px;
  animation-delay: 0s;
}
.blob-2 {
  width: 500px; height: 500px;
  background: var(--sky);
  top: 40%; right: -150px;
  animation-delay: 4s;
}
.blob-3 {
  width: 400px; height: 400px;
  background: #f472b6;
  bottom: 10%; left: 30%;
  animation-delay: 8s;
}
@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-30px) scale(1.05); }
}

/* ── PAGE WRAPPER ── */
.page-wrapper {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px 60px;
}

/* ══════════════════════════════════════
   HEADER
══════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(13,17,23,0.85);
  border-bottom: 1px solid var(--border);
  margin: 0 -16px;
  padding: 0 16px;
  transition: background 0.3s;
}
.light .site-header {
  background: rgba(240,244,248,0.9);
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 12px;
}
.header-logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { width: 42px; height: 42px; flex-shrink: 0; }
.logo-icon svg { width: 100%; height: 100%; }
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-title {
  font-size: 1.25rem;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}
.logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── BUTTONS ── */
button { cursor: pointer; border: none; font-family: var(--font); }

.btn-icon {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.btn-icon:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.btn-icon svg { width: 18px; height: 18px; }

.btn-secondary {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--indigo); color: var(--indigo); }
.btn-secondary svg { width: 15px; height: 15px; }

.btn-danger {
  display: flex; align-items: center; gap: 6px;
  background: rgba(239,68,68,0.12);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-danger:hover { background: rgba(239,68,68,0.2); border-color: #ef4444; }
.btn-danger svg { width: 15px; height: 15px; }

/* ══════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════ */
.main-content { padding-top: 28px; display: flex; flex-direction: column; gap: 20px; }

/* ── CARD ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}


/* ══════════════════════════════════════
   SCORE DASHBOARD
══════════════════════════════════════ */
.score-dashboard {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 28px;
  align-items: center;
  position: sticky;
  top: 73px;
  z-index: 90;
  backdrop-filter: blur(16px);
  flex-wrap: wrap;
}
.score-main { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }

/* Ring */
.score-ring-wrap { position: relative; width: 110px; height: 110px; flex-shrink: 0; }
.score-ring { width: 110px; height: 110px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--bg-input); stroke-width: 8; }
.ring-fill {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4,0,0.2,1);
}
.score-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-number {
  font-size: 1.9rem;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.score-max { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }

/* Score info */
.score-info { display: flex; flex-direction: column; gap: 8px; }
.score-label { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.score-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: fit-content;
}
.score-badge[data-severity="none"]       { background: rgba(34,197,94,0.15);  color: var(--c-none); }
.score-badge[data-severity="minor"]      { background: rgba(132,204,22,0.15); color: var(--c-minor); }
.score-badge[data-severity="moderate"]   { background: rgba(245,158,11,0.15); color: var(--c-moderate); }
.score-badge[data-severity="mod-severe"] { background: rgba(249,115,22,0.15); color: var(--c-mod-severe); }
.score-badge[data-severity="severe"]     { background: rgba(239,68,68,0.15);  color: var(--c-severe); }

.score-progress-bar {
  width: 180px;
  height: 5px;
  background: var(--bg-input);
  border-radius: 10px;
  overflow: hidden;
}
.score-progress-fill {
  height: 100%;
  border-radius: 10px;
  background: var(--grad);
  width: 0%;
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}

.items-completed { font-size: 0.75rem; color: var(--text-muted); }

/* Score breakdown mini badges */
.score-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.breakdown-chip {
  display: flex; align-items: center; gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: all 0.2s;
}
.breakdown-chip.answered { border-color: rgba(129,140,248,0.4); color: var(--text); }
.breakdown-chip .chip-id { font-weight: 700; color: var(--indigo); }
.breakdown-chip .chip-val { font-weight: 600; }

/* ══════════════════════════════════════
   SECTION TITLES
══════════════════════════════════════ */
.section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 0 2px;
}
.section-number {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--grad);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.section-title h3 { font-size: 1rem; font-weight: 700; }
.section-title p  { font-size: 0.78rem; color: var(--text-muted); }

/* ══════════════════════════════════════
   NIHSS ITEMS
══════════════════════════════════════ */
.nihss-form { display: flex; flex-direction: column; gap: 10px; }

.nihss-item {
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.nihss-item.answered {
  border-color: rgba(129,140,248,0.35);
  background: var(--bg-card);
}
.nihss-item.answered.score-0 { border-left: 3px solid var(--c-none); }
.nihss-item.answered:not(.score-0) { border-left: 3px solid var(--indigo); }

/* Item header */
.item-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.item-badge {
  min-width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  padding: 0 6px;
}
.item-badge.side-left  { background: rgba(99,179,237,0.1); color: #63b3ed; border-color: rgba(99,179,237,0.3); }
.item-badge.side-right { background: rgba(252,129,74,0.1); color: #fc814a; border-color: rgba(252,129,74,0.3); }

.item-title { flex: 1; min-width: 0; }
.item-title h4 { font-size: 0.92rem; font-weight: 700; margin-bottom: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-title p  { font-size: 0.78rem; color: var(--text-muted); }
.item-title p em { color: var(--sky); font-style: normal; }

.side-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.side-tag.left  { background: rgba(99,179,237,0.12); color: #63b3ed; }
.side-tag.right { background: rgba(252,129,74,0.12); color: #fc814a; }

.item-score-badge {
  min-width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  font-size: 1rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
  color: var(--text-muted);
  flex-shrink: 0;
}
.item-score-badge.scored {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 12px rgba(129,140,248,0.4);
}
.item-score-badge.scored-zero {
  background: rgba(34,197,94,0.15);
  border-color: rgba(34,197,94,0.4);
  color: var(--c-none);
}

/* ── OPTIONS GRID ── */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.option-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
}
.option-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}
.option-card input[type="radio"] { display: none; }
.option-card.selected {
  border-color: var(--indigo);
  background: rgba(129,140,248,0.1);
  box-shadow: 0 0 0 3px rgba(129,140,248,0.12);
}
.option-card.selected .option-score {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
}

.option-score {
  min-width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.18s;
}
.option-text {
  font-size: 0.84rem;
  color: var(--text);
  flex: 1;
  line-height: 1.45;
}

/* Item note */
.item-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.checkbox-note {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.checkbox-note input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--indigo);
}

/* ══════════════════════════════════════
   RESULT PANEL
══════════════════════════════════════ */
.result-panel { display: flex; flex-direction: column; gap: 20px; }

.result-header {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.result-header svg { width: 20px; height: 20px; color: var(--indigo); }
.result-header h2 { font-size: 1rem; font-weight: 600; }

.result-score-block {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.result-score-number {
  font-size: 4rem;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  transition: all 0.4s;
}
.result-score-label { font-size: 0.9rem; color: var(--text-muted); font-weight: 500; }

/* Severity bar */
.severity-bar-wrap { display: flex; flex-direction: column; gap: 6px; }
.severity-bar {
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 28px;
}
.sev-seg {
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700;
  color: rgba(255,255,255,0.8);
  transition: flex 0.5s;
}
.seg-none       { background: var(--c-none);       flex: 0.5; }
.seg-minor      { background: var(--c-minor);      flex: 1; }
.seg-moderate   { background: var(--c-moderate);   flex: 2.5; }
.seg-mod-severe { background: var(--c-mod-severe); flex: 1; }
.seg-severe     { background: var(--c-severe);     flex: 4.5; }

.sev-marker-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
  padding: 0 2px;
}

/* Severity legend */
.severity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 0.72rem;
  font-weight: 500;
}
.leg-item { display: flex; align-items: center; gap: 4px; }
.leg-none       { color: var(--c-none); }
.leg-minor      { color: var(--c-minor); }
.leg-moderate   { color: var(--c-moderate); }
.leg-mod-severe { color: var(--c-mod-severe); }
.leg-severe     { color: var(--c-severe); }

/* Interpretation card */
.result-interpretation {}
.interp-card {
  padding: 18px 20px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  border-left-width: 4px;
  background: var(--bg-input);
  transition: all 0.35s;
}
.interp-card[data-severity="none"]       { border-left-color: var(--c-none);       background: rgba(34,197,94,0.06); }
.interp-card[data-severity="minor"]      { border-left-color: var(--c-minor);      background: rgba(132,204,22,0.06); }
.interp-card[data-severity="moderate"]   { border-left-color: var(--c-moderate);   background: rgba(245,158,11,0.06); }
.interp-card[data-severity="mod-severe"] { border-left-color: var(--c-mod-severe); background: rgba(249,115,22,0.06); }
.interp-card[data-severity="severe"]     { border-left-color: var(--c-severe);     background: rgba(239,68,68,0.06); }

.interp-content { flex: 1; }
.interp-severity {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.interp-card[data-severity="none"]       .interp-severity { color: var(--c-none); }
.interp-card[data-severity="minor"]      .interp-severity { color: var(--c-minor); }
.interp-card[data-severity="moderate"]   .interp-severity { color: var(--c-moderate); }
.interp-card[data-severity="mod-severe"] .interp-severity { color: var(--c-mod-severe); }
.interp-card[data-severity="severe"]     .interp-severity { color: var(--c-severe); }

.interp-desc { font-size: 0.83rem; color: var(--text-muted); line-height: 1.6; }

/* Items table */
.result-items-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  padding: 4px 0 10px;
  text-align: left;
}
.result-items-table h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.result-items-chevron {
  width: 16px; height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.25s ease;
}
.result-items-toggle[aria-expanded="true"] .result-items-chevron { transform: rotate(180deg); color: var(--indigo); }
.result-items-body { padding-top: 8px; }
.result-items-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.result-items-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.result-items-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.result-items-table tr:last-child td { border-bottom: none; }
.result-items-table tr:hover td { background: var(--bg-input); }
.td-id {
  font-weight: 700;
  color: var(--indigo);
  width: 42px;
}
.td-score {
  font-weight: 800;
  font-size: 0.95rem;
  text-align: center;
  width: 48px;
}
.td-max {
  color: var(--text-muted);
  text-align: center;
  width: 48px;
}
.td-score.score-0 { color: var(--c-none); }
.td-score.score-high { color: var(--c-severe); }
.td-score.score-mid  { color: var(--c-moderate); }
.td-score.not-scored { color: var(--text-subtle); }

/* Result note */
.result-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(129,140,248,0.07);
  border: 1px solid rgba(129,140,248,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.result-note svg { width: 16px; height: 16px; color: var(--indigo); flex-shrink: 0; margin-top: 1px; }
.result-note p { font-size: 0.78rem; color: var(--text-muted); line-height: 1.6; }

/* ══════════════════════════════════════
   INDICATION / CONTRAINDICATION / CAUTION PANEL
══════════════════════════════════════ */
.indication-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}
.indication-tab {
  flex: 1;
  min-width: 110px;
  padding: 9px 10px;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  transition: all 0.18s;
}
.indication-tab:hover { color: var(--text); }
.indication-tab.active {
  background: var(--bg-card);
  color: var(--indigo);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.indication-panel-body h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  margin: 18px 0 8px;
}
.indication-panel-body h4:first-child { margin-top: 0; }

.indication-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.indication-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.55;
}
.indication-dot {
  flex-shrink: 0;
  width: 7px; height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--indigo);
}
/* Màu chấm theo từng tab: xanh lá = chỉ định, đỏ = chống chỉ định, cam = thận trọng */
.indication-tab-content[data-tab-content="indication"] .indication-dot { background: var(--c-none, #22c55e); }
.indication-tab-content[data-tab-content="contraindication"] .indication-dot { background: var(--c-severe, #ef4444); }
.indication-tab-content[data-tab-content="caution"] .indication-dot { background: var(--c-mod-severe, #f97316); }

.indication-group {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
}
.indication-group-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--indigo);
  margin-bottom: 10px;
}

.caution-callout {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.3);
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.65;
}
.caution-callout strong { color: var(--text); }

/* ══════════════════════════════════════
   DOSE CALCULATOR (Alteplase / Tenecteplase)
══════════════════════════════════════ */
.dose-calc { padding: 0; overflow: hidden; }

.dose-calc-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  padding: 20px 24px;
  text-align: left;
  transition: background 0.2s;
}
.dose-calc-toggle:hover { background: var(--bg-card-hover); }

.dose-calc-toggle-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.dose-calc-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(129,140,248,0.12);
  color: var(--indigo);
}
.dose-calc-icon svg { width: 20px; height: 20px; }
.dose-calc-toggle-left h2 { font-size: 1rem; font-weight: 700; color: var(--text); }
.dose-calc-toggle-left p { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.dose-calc-chevron {
  width: 20px; height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.25s ease;
}
.dose-calc-toggle[aria-expanded="true"] .dose-calc-chevron { transform: rotate(180deg); color: var(--indigo); }

.dose-calc-body {
  padding: 0 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
/* Thuộc tính [hidden] phải thắng display:flex ở trên, nếu không khối sẽ luôn hiển thị */
.dose-calc-body[hidden] { display: none; }

.dose-field { display: flex; flex-direction: column; gap: 8px; }
.dose-field > label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dose-weight-input-wrap {
  position: relative;
  max-width: 220px;
}
.dose-weight-input-wrap input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 44px 10px 14px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.2s;
}
.dose-weight-input-wrap input:focus {
  outline: none;
  border-color: var(--indigo);
}
.dose-weight-unit {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

.dose-regimen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.dose-regimen-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
}
.dose-regimen-card:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.dose-regimen-card input[type="radio"] { display: none; }
.dose-regimen-card.selected {
  border-color: var(--indigo);
  background: rgba(129,140,248,0.1);
  box-shadow: 0 0 0 3px rgba(129,140,248,0.12);
}
.dose-regimen-title { font-size: 0.86rem; font-weight: 700; color: var(--text); }
.dose-regimen-card.selected .dose-regimen-title { color: var(--indigo); }
.dose-regimen-sub { font-size: 0.74rem; color: var(--text-muted); line-height: 1.5; }

.dose-result {
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  padding: 18px 20px;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.dose-placeholder { font-size: 0.85rem; color: var(--text-muted); }

.dose-total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px dashed var(--border);
}
.dose-total-number {
  font-size: 2.1rem;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.15;
  white-space: nowrap;
}
.dose-total-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

.dose-warning {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.8rem;
  color: var(--c-mod-severe);
  background: rgba(249,115,22,0.1);
  border: 1px solid rgba(249,115,22,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.dose-steps { display: flex; flex-direction: column; gap: 12px; }
.dose-step { display: flex; gap: 12px; align-items: flex-start; }
.dose-step-num {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.dose-step-text { font-size: 0.86rem; color: var(--text); line-height: 1.55; overflow-wrap: break-word; }
.dose-step-text strong { color: var(--text); }

@media (max-width: 480px) {
  .dose-calc-toggle { padding: 16px 18px; }
  .dose-calc-body { padding: 18px 18px 20px; }
  .dose-result { padding: 14px 16px; }
  .dose-total-number { font-size: 1.7rem; }
}

/* ══════════════════════════════════════
   FOOTER
══════════════════════════════════════ */
.site-footer {
  text-align: center;
  padding: 28px 0 0;
  border-top: 1px solid var(--border);
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.site-footer p { font-size: 0.75rem; color: var(--text-muted); }
.site-footer .footer-ref { color: var(--text-subtle); }

/* ══════════════════════════════════════
   PRINT STYLES
══════════════════════════════════════ */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
  }
  .bg-blob, .site-header .header-actions, #themeToggle { display: none !important; }
  .site-header { position: static; border-bottom: 2px solid #000; }
  .score-dashboard { position: static; box-shadow: none; border: 1px solid #ccc; }
  .nihss-form, .nihss-item { page-break-inside: avoid; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .option-card { border: 1px solid #ccc; }
  .option-card.selected { background: #e8f0fe !important; border-color: #4f46e5 !important; }
  .bg-blob { display: none; }
  .btn-secondary, .btn-danger { display: none; }
  .result-panel { page-break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; gap: 10px; }
  .header-actions { width: 100%; justify-content: flex-end; }
  .score-dashboard { flex-direction: column; align-items: flex-start; position: static; }
  .score-main { width: 100%; }
  .score-breakdown { width: 100%; }
  .patient-grid { grid-template-columns: 1fr 1fr; }
  .result-score-number { font-size: 3rem; }
  .severity-legend { gap: 6px 10px; }
}

@media (max-width: 420px) {
  .patient-grid { grid-template-columns: 1fr; }
  .item-header { flex-wrap: wrap; }
}

/* ── SVG GRADIENT DEF FOR RING ── */
body::after {
  content: '';
  display: none;
}
