/* ============================================================
   SOR-Docs — style.css  |  LIGHT THEME
   Clean white medical interface | Inter font
   ============================================================ */

:root {
  --bg: #f0f4f8;
  --bg2: #ffffff;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --border: rgba(15, 23, 42, 0.09);
  --border-act: rgba(37, 99, 235, 0.45);
  --accent: #2563eb;
  --accent2: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.1);
  --text: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --success: #16a34a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-act: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ════════════════════════════════════════
   APP SHELL (sidebar + main)
   ════════════════════════════════════════ */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 68px;
  flex-shrink: 0;
  background: #1e1e2e;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
}

.sidebar-logo {
  font-size: 1.5rem;
  color: #a78bfa;
  margin-bottom: 1.5rem;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(167, 139, 250, 0.12);
  border-radius: 12px;
  cursor: default;
  user-select: none;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  width: 100%;
  align-items: center;
  padding: 0 8px;
}

.sidebar-bottom {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 8px;
}

.sidebar-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  position: relative;
  flex-shrink: 0;
}

.sidebar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.sidebar-btn--active {
  background: rgba(167, 139, 250, 0.18);
  color: #a78bfa;
}

.sidebar-btn--active:hover {
  background: rgba(167, 139, 250, 0.25);
  color: #a78bfa;
}

/* Tooltip */
.sidebar-btn::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #1e1e2e;
  color: #e2e8f0;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: 7px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 300;
}

.sidebar-btn:hover::after {
  opacity: 1;
}

.sidebar-btn .ai-status-dot {
  position: absolute;
  top: 6px;
  right: 6px;
}

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  min-width: 0;
  margin-left: 68px;
  display: flex;
  flex-direction: column;
}

/* ── AI STATUS DOT ── */
.ai-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid #1e1e2e;
  background: transparent;
  transition: background 0.3s;
}

.ai-status-dot.active {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

/* ════════════════════════════════════════
   HOME HERO
   ════════════════════════════════════════ */

.home-hero {
  padding: 2rem 2rem 1.25rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.home-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
  gap: 1rem;
}

.home-hero-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.home-hero-icon {
  font-size: 1.8rem;
  line-height: 1;
  flex-shrink: 0;
}

.home-hero-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 0.1rem;
}

.home-hero-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.home-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.home-hero-cta:hover {
  background: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

/* ── 3 MODE CARDS ── */
.mode-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.mode-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.mode-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.mode-card:active {
  transform: translateY(0);
}

.mode-card--blue {
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  color: #1e3a8a;
}

.mode-card--blue:hover {
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.18);
}

.mode-card--green {
  background: linear-gradient(135deg, #dcfce7, #f0fdf4);
  color: #14532d;
}

.mode-card--green:hover {
  box-shadow: 0 8px 24px rgba(22, 163, 74, 0.18);
}

.mode-card--purple {
  background: linear-gradient(135deg, #ede9fe, #f5f3ff);
  color: #4c1d95;
}

.mode-card--purple:hover {
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.18);
}

.mode-card--orange {
  background: linear-gradient(135deg, #ffedd5, #fff7ed);
  color: #7c2d12;
}

.mode-card--orange:hover {
  box-shadow: 0 8px 24px rgba(234, 88, 12, 0.18);
}

.mode-card-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.mode-card-body {
  flex: 1;
  min-width: 0;
}

.mode-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  line-height: 1.2;
}

.mode-card-desc {
  font-size: 0.72rem;
  opacity: 0.7;
  line-height: 1.3;
}

.mode-card-arrow {
  font-size: 1.1rem;
  opacity: 0.45;
  transition: transform 0.2s, opacity 0.2s;
  flex-shrink: 0;
}

.mode-card:hover .mode-card-arrow {
  transform: translateX(4px);
  opacity: 0.9;
}

/* ── CALC STRIP ── */
.calc-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.calc-strip-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.18s;
  box-shadow: var(--shadow);
}

.calc-strip-card:hover {
  border-color: #a78bfa;
  background: #faf8ff;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.12);
  transform: translateY(-1px);
}

.calc-strip-icon {
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.calc-strip-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  text-align: left;
}

.calc-strip-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.calc-strip-range {
  font-size: 0.68rem;
  color: #7c3aed;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.calc-strip-arrow {
  color: #a78bfa;
  font-size: 0.9rem;
  transition: transform 0.18s;
  flex-shrink: 0;
}

.calc-strip-card:hover .calc-strip-arrow {
  transform: translateX(3px);
}

/* ── API PANEL ── */
.api-panel {
  background: #eff6ff;
  border-bottom: 1px solid rgba(37, 99, 235, 0.15);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.api-panel.open {
  max-height: 220px;
}

.api-panel-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  justify-content: space-between;
}

.api-panel-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.api-panel-icon {
  font-size: 1.5rem;
}

.api-panel-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.api-panel-desc {
  font-size: 0.73rem;
  color: var(--text-muted);
  max-width: 380px;
  line-height: 1.4;
}

.api-panel-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.api-input-row {
  display: flex;
  gap: 0.5rem;
}

.api-key-input {
  width: 260px;
  background: #fff;
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  padding: 0.5rem 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.api-key-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-act);
}

.api-save-btn {
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.api-save-btn:hover {
  background: var(--accent2);
}

.api-key-status {
  font-size: 0.73rem;
  color: var(--text-dim);
}

.api-key-status.ok {
  color: var(--success);
}

.api-key-status.err {
  color: #dc2626;
}

.api-panel-inner--alt {
  border-top: 1px solid rgba(37, 99, 235, 0.12);
  background: rgba(255, 255, 255, 0.5);
}

.api-panel-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(37, 99, 235, 0.1);
  border-radius: 50px;
  padding: 0.1rem 0.5rem;
  vertical-align: middle;
  margin-left: 0.3rem;
  letter-spacing: 0.03em;
}

.api-panel-badge--free {
  color: var(--success);
  background: rgba(22, 163, 74, 0.1);
}

.api-panel-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.api-panel-link:hover {
  color: var(--accent2);
}

/* ── MAIN WRAPPER ── */
.app-wrapper {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1.5rem 4rem;
  flex: 1;
}

/* ── PROGRESS ── */
.progress-container {
  margin-bottom: 2rem;
  padding: 1.25rem 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.progress-steps {
  display: flex;
  align-items: center;
  justify-content: center;
}

.prog-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
}

.prog-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  transition: all 0.3s;
  background: var(--bg);
}

.prog-step.active .prog-dot {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.prog-step.done .prog-dot {
  border-color: var(--success);
  background: rgba(22, 163, 74, 0.08);
  color: var(--success);
}

.prog-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-align: center;
  white-space: nowrap;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.3s;
}

.prog-step.active .prog-label {
  color: var(--accent);
  font-weight: 600;
}

.prog-step.done .prog-label {
  color: var(--success);
}

.prog-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 0.75rem;
  margin-bottom: 1.5rem;
  transition: background 0.4s;
}

.prog-line.done {
  background: var(--success);
}

/* ── STEP PANELS ── */
.step-panel {
  display: none;
  animation: fadeSlide 0.3s ease;
}

.step-panel.active {
  display: block;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── STEP HEADER ── */
.step-header {
  margin-bottom: 1.5rem;
}

.step-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.step-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.3rem;
}

.step-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ── TEMPLATES BUTTON ── */
.btn-templates-open {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0.65rem 1.15rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-templates-open:hover {
  background: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* ── Two-button row (Skale + Szablony) ── */
.step1-btn-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-scales-open {
  padding: 0.65rem 1.1rem;
  background: #f5f3ff;
  color: #7c3aed;
  border: 1.5px solid #ddd6fe;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-scales-open:hover {
  background: #ede9fe;
  border-color: #a78bfa;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

/* ── Scales modal panel ── */
.scales-panel {
  width: min(560px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.scales-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
  padding: 1.25rem 1.6rem 1.5rem;
}

/* ── Scale card ── */
.scale-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem 1.1rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.scale-card:hover {
  border-color: #a78bfa;
  background: #faf8ff;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.13);
  transform: translateY(-2px);
}

.scale-card:active {
  transform: translateY(0);
}

.scale-card-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.scale-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  border: 1.5px solid #ddd6fe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  line-height: 1;
}

.scale-icon-wrap--dim {
  background: var(--bg);
  border-color: var(--border);
  opacity: 0.5;
}

.scale-info {
  flex: 1;
  min-width: 0;
}

.scale-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 0.15rem;
}

.scale-name--dim {
  color: var(--text-dim);
  font-weight: 500;
}

.scale-range {
  font-size: 0.68rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: #7c3aed;
  background: #f5f3ff;
  border: 1px solid #e9d5ff;
  padding: 0.08rem 0.4rem;
  border-radius: 4px;
  display: inline-block;
}

.scale-range--dim {
  color: var(--text-muted);
  background: var(--bg);
  border-color: var(--border);
}

.scale-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.scale-desc--dim {
  opacity: 0.55;
}

.scale-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}

.scale-tag {
  font-size: 0.68rem;
  font-weight: 600;
  color: #7c3aed;
}

.scale-arrow {
  font-size: 0.95rem;
  color: #a78bfa;
  transition: transform 0.2s;
}

.scale-card:hover .scale-arrow {
  transform: translateX(4px);
}

.scale-card--soon {
  cursor: default;
  opacity: 0.6;
  border-style: dashed;
}

.scale-card--soon:hover {
  transform: none;
  box-shadow: var(--shadow);
  border-color: var(--border);
  background: var(--bg);
}

/* ── ACTIVE TEMPLATE CHIP ── */
.active-template-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem 0.4rem 0.7rem;
  background: #eff6ff;
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: 50px;
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 500;
  animation: fadeSlide 0.25s ease;
}

.chip-icon {
  font-size: 0.95rem;
}

.chip-clear {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0.6;
}

.chip-clear:hover {
  opacity: 1;
}

/* ── FORM GRID ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.vitals-grid {
  grid-template-columns: 1fr 1fr;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.35rem 1.35rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
  box-shadow: var(--shadow);
}

.form-card:has(textarea:focus),
.form-card:has(input:focus) {
  border-color: var(--border-act);
  box-shadow: var(--shadow-act);
}

.form-card.full-width {
  grid-column: 1 / -1;
}

.form-card.half {
  grid-column: span 1;
}

/* ── CARD LABELS ── */
.card-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
}

.card-letter {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

.card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.card-sub {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.card-icon {
  font-size: 1rem;
}

.card-hint {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-bottom: 0.65rem;
  line-height: 1.5;
}

.vital-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── INPUTS ── */
.field-textarea,
.field-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  padding: 0.7rem 0.95rem;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  line-height: 1.6;
}

.field-textarea:focus,
.field-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-act);
  background: #fff;
}

.field-textarea::placeholder,
.field-input::placeholder {
  color: var(--text-dim);
}

.field-input {
  padding-right: 3.5rem;
}

.field-unit {
  position: absolute;
  right: 1.35rem;
  bottom: 1.5rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  pointer-events: none;
}

/* ── GENDER TOGGLE ── */
.toggle-group {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.toggle-btn {
  flex: 1;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.toggle-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ── ARRIVAL OPTIONS ── */
.arrival-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.arrival-card {
  cursor: pointer;
  display: block;
}

.arrival-card input {
  display: none;
}

.arrival-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: all 0.2s;
  text-align: center;
}

.arrival-inner:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: #eff6ff;
}

.arrival-card input:checked+.arrival-inner {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.arrival-icon {
  font-size: 1.6rem;
}

.arrival-label {
  font-size: 0.95rem;
  font-weight: 600;
}

.arrival-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.6rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.01em;
}

.btn-primary:hover {
  background: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.6rem;
  background: #fff;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: rgba(15, 23, 42, 0.2);
  color: var(--text);
  background: var(--bg);
}

.step-actions {
  margin-top: 1.75rem;
  display: flex;
  justify-content: flex-end;
}

.step-actions.split {
  justify-content: space-between;
}

/* ── DOCUMENT CARDS ── */
.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
  transition: border-color 0.2s;
}

.doc-card:has(textarea:focus) {
  border-color: var(--border-act);
}

.doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.doc-title-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.doc-icon {
  font-size: 1.1rem;
}

.doc-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.doc-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  line-height: 1.75;
  padding: 0.9rem 1rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 90px;
}

.doc-textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-act);
  background: #fff;
}

.doc-textarea.doc-loading {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.4s ease infinite;
  color: transparent;
  border-color: var(--border);
  cursor: wait;
  pointer-events: none;
}

@keyframes skeletonPulse {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}


/* ── COPY BUTTONS ── */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.85rem;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--border-act);
  background: var(--accent-glow);
}

.copy-btn.copied {
  color: var(--success);
  border-color: rgba(22, 163, 74, 0.4);
  background: rgba(22, 163, 74, 0.07);
}

/* Button group in doc card header */
.doc-btn-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Improve with AI button */
.improve-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.85rem;
  background: rgba(124, 58, 237, 0.07);
  color: #7c3aed;
  border: 1px solid rgba(124, 58, 237, 0.25);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.improve-btn:hover {
  background: rgba(124, 58, 237, 0.14);
  border-color: rgba(124, 58, 237, 0.5);
}

.improve-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.improve-btn--loading svg {
  animation: spinOnce 1s linear infinite;
}

@keyframes spinOnce {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Microphone / voice button */
.mic-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.85rem;
  background: rgba(22, 163, 74, 0.07);
  color: #15803d;
  border: 1px solid rgba(22, 163, 74, 0.3);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.mic-btn:hover {
  background: rgba(22, 163, 74, 0.14);
  border-color: rgba(22, 163, 74, 0.5);
}

.mic-btn--active {
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.35);
  animation: micPulse 1.2s ease-in-out infinite;
}

.mic-btn--active:hover {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.55);
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.25); }
  50%       { box-shadow: 0 0 0 5px rgba(220, 38, 38, 0); }
}

/* Mic group: mic button + language toggle */
.mic-group {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(22, 163, 74, 0.3);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.mic-group .mic-btn {
  border: none;
  border-radius: 0;
}

.mic-group .mic-btn--active {
  animation: micPulse 1.2s ease-in-out infinite;
}

.mic-lang-toggle {
  padding: 0.42rem 0.6rem;
  background: rgba(22, 163, 74, 0.05);
  color: #15803d;
  border: none;
  border-left: 1px solid rgba(22, 163, 74, 0.3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.05em;
}

.mic-lang-toggle:hover {
  background: rgba(22, 163, 74, 0.14);
}

.mic-lang-toggle--en {
  background: rgba(37, 99, 235, 0.07);
  color: var(--accent);
  border-left-color: rgba(37, 99, 235, 0.25);
}

.mic-lang-toggle--en:hover {
  background: rgba(37, 99, 235, 0.14);
}


.copy-all-row {
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
}

.btn-copy-all {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 2rem;
  background: #fff;
  border: 1px solid var(--border-act);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-copy-all:hover {
  background: var(--accent-glow);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.15);
  transform: translateY(-1px);
}

.btn-copy-all.copied {
  color: var(--success);
  border-color: rgba(22, 163, 74, 0.4);
}

/* ── AI LOADING BAR ── */
.ai-loading-bar {
  display: none;
  flex-direction: column;
  gap: 0.55rem;
  background: #eff6ff;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: var(--radius);
  padding: 0.9rem 1.35rem;
  margin-bottom: 1.2rem;
}

.ai-loading-bar.show {
  display: flex;
}

.ai-loading-inner {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 500;
}

.ai-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.ai-progress-track {
  width: 100%;
  height: 3px;
  background: rgba(37, 99, 235, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.ai-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s ease;
}

/* ── AI BADGE ── */
.ai-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.95rem;
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.25);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.8rem;
  color: #15803d;
  font-weight: 500;
  animation: fadeSlide 0.3s ease;
}

.ai-badge-close {
  background: none;
  border: none;
  color: #15803d;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.6;
}

.ai-badge-close:hover {
  opacity: 1;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(70px);
  background: #1e293b;
  color: #fff;
  font-weight: 500;
  font-size: 0.88rem;
  padding: 0.65rem 1.4rem;
  border-radius: 50px;
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ════════════════════════════════════════
   GUIDELINES MODAL
   ════════════════════════════════════════ */

.guidelines-panel {
  width: min(680px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}

/* Search bar */
.guidelines-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 1.6rem 0.85rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.9rem;
  transition: border-color 0.2s;
}

.guidelines-search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow-act);
}

.guidelines-search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.guidelines-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
}

.guidelines-search-input::placeholder {
  color: var(--text-dim);
}

.guidelines-search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: all 0.15s;
}

.guidelines-search-clear:hover {
  background: var(--border);
  color: var(--text);
}

/* Quick chips */
.guidelines-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0 1.6rem 1rem;
}

.guideline-chip {
  padding: 0.3rem 0.75rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.guideline-chip:hover {
  background: #ede9fe;
  border-color: #a78bfa;
  color: #7c3aed;
}

/* Results area */
.guidelines-results {
  flex: 1;
  overflow-y: auto;
  padding: 0 1.6rem 1.5rem;
}

/* Empty state */
.guidelines-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 3rem 1rem;
  text-align: center;
}

.guidelines-empty-icon {
  font-size: 2.5rem;
}

.guidelines-empty-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.guidelines-empty-text small {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Multi-result list */
.guideline-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.guideline-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  text-align: left;
  transition: all 0.15s;
  border-left: 3px solid var(--g-color, var(--accent));
}

.guideline-list-item:hover {
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateX(2px);
}

.gli-emoji {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.gli-name {
  flex: 1;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}

.gli-icd {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.gli-arrow {
  color: var(--text-dim);
  transition: transform 0.15s;
}

.guideline-list-item:hover .gli-arrow {
  transform: translateX(3px);
}

/* Single guideline card */
.guideline-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.guideline-card-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.2rem;
}

.guideline-card-emoji {
  font-size: 1.75rem;
  flex-shrink: 0;
}

.guideline-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.guideline-card-icd {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* Sections */
.guideline-section {
  border-top: 1px solid var(--border);
  padding: 0.9rem 1.2rem;
  background: var(--surface);
}

.guideline-section:nth-child(even) {
  background: var(--bg);
}

.guideline-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.guideline-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

.guideline-copy-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.guideline-copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.guideline-copy-btn--green:hover {
  border-color: #16a34a;
  color: #16a34a;
}

/* Item list */
.guideline-list-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.guideline-list-items li {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.45;
  padding: 0.25rem 0.5rem 0.25rem 1.3rem;
  border-radius: 5px;
  font-family: 'Inter', sans-serif;
  position: relative;
}

.guideline-list-items li::before {
  content: '•';
  position: absolute;
  left: 0.25rem;
  top: 0.28rem;
  color: var(--accent);
  font-weight: 700;
  line-height: 1;
}

.guideline-list-items--treatment li {
  background: #f0fdf4;
  border-left: 2px solid #86efac;
}

.guideline-list-items--treatment li::before {
  color: #16a34a;
}

.guideline-list-items--treatment li:has(> :is(*[data-indent])) {
  padding-left: 1.5rem;
}

/* Lines starting with spaces are sub-items */
.guideline-list-items li:where([data-sub]) {
  padding-left: 1.5rem;
  font-size: 0.78rem;
}

/* Source + disclaimer */
.guideline-source {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0.65rem 1.2rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
  font-style: italic;
}

.guideline-disclaimer {
  font-size: 0.69rem;
  color: #b45309;
  background: #fffbeb;
  border-top: 1px solid #fde68a;
  padding: 0.5rem 1.2rem;
  font-weight: 500;
}

/* ── FOOTER ── */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.72rem;
}

/* ════════════════════════════════════════
   MODAL OVERLAY (shared)
   ════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1.5rem;
}

.modal-overlay.open {
  display: flex;
}

.modal-panel {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: modalIn 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ── TEMPLATES PANEL ── */
.templates-panel {
  width: min(880px, 100%);
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.modal-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

.templates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
}

.template-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
}

.template-card:hover {
  border-color: var(--accent);
  background: #eff6ff;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.template-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.template-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--border);
}

.template-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.template-icd {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.1rem 0.4rem;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: 4px;
}

.template-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.template-preview {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── GENDER PANEL ── */
.gender-panel {
  width: min(420px, 100%);
  padding: 2rem 2rem 1.5rem;
  text-align: center;
}

.gender-modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.gender-modal-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.gender-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.gender-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s;
}

.gender-card:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.gender-emoji {
  font-size: 2rem;
}

.gender-card-label {
  font-size: 1rem;
  font-weight: 600;
}

.gender-card-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── RESPONSIVE ── */
@media (max-width: 640px) {

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

  .form-card.half {
    grid-column: 1 / -1;
  }

  .arrival-options {
    grid-template-columns: 1fr;
  }

  .app-wrapper {
    padding: 1.25rem 1rem 3rem;
  }

  .step-title {
    font-size: 1.25rem;
  }

  .step-header-row {
    flex-direction: column;
  }

  .btn-templates-open {
    width: 100%;
    justify-content: center;
  }

  .templates-grid {
    grid-template-columns: 1fr;
  }

  .api-panel-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .api-key-input {
    width: 200px;
  }

  .prog-label {
    font-size: 0.58rem;
  }
}

/* ════════════════════════════════════════
   ICD-10 SEARCH
   ════════════════════════════════════════ */
.icd-search-section {
  padding: 0.85rem 1.75rem 0;
  flex-shrink: 0;
}

.icd-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.icd-search-icon {
  position: absolute;
  left: 0.9rem;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.icd-search-input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.72rem 2.6rem 0.72rem 2.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.icd-search-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-act);
  background: #fff;
}

.icd-search-input::placeholder {
  color: var(--text-dim);
}

.icd-search-clear {
  position: absolute;
  right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--text-dim);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s;
}

.icd-search-clear:hover {
  opacity: 1;
}

.icd-results {
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-hover);
  animation: fadeSlide 0.18s ease;
  max-height: 320px;
  overflow-y: auto;
}

.icd-result-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}

.icd-result-row:last-child {
  border-bottom: none;
}

.icd-result-row:hover {
  background: #eff6ff;
}

.icd-code-badge {
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  background: var(--accent-glow);
  color: var(--accent);
  border-radius: 5px;
  min-width: 52px;
  text-align: center;
}

.icd-result-name {
  flex: 1;
  font-size: 0.86rem;
  color: var(--text);
  line-height: 1.3;
}

.icd-result-arrow {
  flex-shrink: 0;
  color: var(--text-dim);
  transition: color 0.15s;
}

.icd-result-row:hover .icd-result-arrow {
  color: var(--accent);
}

.icd-no-results {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.1rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.templates-section-label {
  padding: 0.85rem 1.75rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ── CATEGORY TABS ── */
.cat-tabs {
  display: flex;
  gap: 0.45rem;
  padding: 0.75rem 1.75rem 0.6rem;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}

.cat-tabs::-webkit-scrollbar {
  display: none;
}

.cat-tab {
  flex-shrink: 0;
  padding: 0.38rem 0.9rem;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.cat-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.cat-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}


/* ════════════════════════════════════════
   TRAUMA LOCATION PICKER
   ════════════════════════════════════════ */
.trauma-panel {
  width: min(680px, 100%);
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.trauma-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.6rem 1.1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.trauma-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.trauma-modal-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.trauma-body-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  padding: 1.25rem 1.6rem;
  overflow-y: auto;
  flex: 1;
}

.trauma-loc-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.85rem 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.18s;
  text-align: center;
}

.trauma-loc-btn:hover {
  border-color: var(--accent);
  background: #eff6ff;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.12);
}

.trauma-loc-btn.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.trauma-loc-btn.selected .trauma-loc-label {
  color: var(--accent);
  font-weight: 600;
}

.trauma-loc-emoji {
  font-size: 1.55rem;
  line-height: 1;
}

.trauma-loc-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

/* ── Laterality (L/P) row inside a selected trauma card ── */
.trauma-side-row {
  display: flex;
  gap: 4px;
  margin-top: 0.35rem;
  justify-content: center;
}

.trauma-side-btn {
  flex: 1;
  max-width: 38px;
  padding: 0.22rem 0;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  border: 1.5px solid var(--border-act);
  border-radius: 5px;
  background: #fff;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
}

.trauma-side-btn:hover {
  background: var(--accent-glow);
}

.trauma-side-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}


.trauma-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.6rem 1.35rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.trauma-selection-info {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .trauma-body-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .trauma-modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .icd-search-section {
    padding: 0.75rem 1.1rem 0;
  }

  .templates-section-label {
    padding: 0.75rem 1.1rem 0.3rem;
  }
}

/* ════════════════════════════════════════
   EPIKRYZA / DISCHARGE
   ════════════════════════════════════════ */
.epikryza-section {
  margin-top: 2.5rem;
  padding-top: 2.25rem;
  border-top: 2px dashed var(--border);
}

.epikryza-header {
  margin-bottom: 1.25rem;
}

.epikryza-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.epikryza-icon {
  font-size: 1.3rem;
}

.epikryza-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.epikryza-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

/* ── Discharge option cards ── */
.discharge-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.discharge-card {
  position: relative;
  cursor: pointer;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: all 0.18s;
  overflow: hidden;
}

.discharge-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  background: #fafcff;
}

.discharge-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.discharge-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.discharge-card:has(input:checked) .discharge-label {
  color: var(--accent);
}

.discharge-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
}

.discharge-icon {
  font-size: 1.55rem;
  flex-shrink: 0;
  line-height: 1;
}

.discharge-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.discharge-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  line-height: 1.3;
}

/* ── Destination input ── */
.discharge-dest {
  margin-bottom: 0.75rem;
  animation: fadeSlide 0.2s ease;
}

.discharge-dest-input {
  width: 100%;
}

/* ── CONSULTATION SECTION ── */
.consult-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1.5px dashed var(--border);
  animation: fadeIn 0.2s ease;
}

.consult-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.consult-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.consult-card {
  flex: 1;
  min-width: 160px;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 0.8rem 0.9rem;
  transition: all 0.18s;
  position: relative;
}

.consult-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.consult-card:hover {
  border-color: #34d399;
  background: #f0fdf4;
}

.consult-card:has(input:checked) {
  border-color: #10b981;
  background: #ecfdf5;
  box-shadow: 0 0 0 3px #10b98120;
}

.consult-inner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.consult-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.consult-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.1rem;
}

.consult-sub {
  display: block;
  font-size: 0.71rem;
  color: var(--text-muted);
}

/* Consultation dept + doctor inputs */
.consult-dept-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.consult-detail-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 1rem;
  margin-bottom: 0.2rem;
}

.consult-input {
  width: 100%;
}

#consultDetails {
  animation: fadeIn 0.2s ease;
  margin-top: 0.75rem;
}


.disease-select {
  width: 100%;
  margin-bottom: 0.55rem;
  padding: 0.5rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  appearance: auto;
}

.disease-select:hover {
  border-color: rgba(37, 99, 235, 0.35);
}

.disease-select:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-act);
  color: var(--text);
}

.disease-select--below {
  margin-bottom: 0;
  margin-top: 0.45rem;
}

.history-textarea {
  min-height: 90px;
}

/* Department quick-select pills */
.dept-pills-row,
.disease-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.dept-pill,
.disease-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  background: var(--bg);
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.dept-pill:hover,
.disease-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-1px);
}

.dept-pill--active,
.disease-pill--active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

@media (max-width: 640px) {
  .discharge-options {
    grid-template-columns: 1fr;
  }

  .discharge-inner {
    padding: 0.75rem 0.85rem;
  }
}

/* ════════════════════════════════════════
   BURNS BODY MAP MODAL
   ════════════════════════════════════════ */

.burns-panel {
  width: min(800px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.burns-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.6rem 1.1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: linear-gradient(135deg, #fff8f0 0%, #fff 60%);
}

.burns-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  color: var(--text);
}

.burns-modal-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── Body container: front + back ── */
.burns-body-container {
  display: flex;
  gap: 0;
  padding: 1.25rem 1.6rem 0.75rem;
  flex: 1;
}

.burns-figure {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

.burns-figure-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: center;
}

.burns-figure-divider {
  width: 1px;
  background: var(--border);
  margin: 0 1rem;
  align-self: stretch;
}

/* ── Zone grid buttons ── */
.burn-zones-grid {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.burn-zone-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  transition: all 0.18s;
  text-align: left;
  width: 100%;
}

.burn-zone-btn:hover {
  border-color: #fb923c;
  background: #fff7ed;
  box-shadow: 0 2px 8px rgba(251, 146, 60, 0.15);
  transform: translateX(2px);
}

.burn-zone-btn.selected {
  border-color: #f97316;
  background: linear-gradient(135deg, #fff7ed, #fff3e0);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15), 0 2px 8px rgba(249, 115, 22, 0.12);
}

.burn-zone-btn.selected .burn-zone-label {
  color: #c2410c;
  font-weight: 700;
}

.burn-zone-btn.selected .burn-zone-pct {
  background: #f97316;
  color: #fff;
}

.burn-zone-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
}

.burn-zone-pct {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  background: #f1f5f9;
  color: var(--text-muted);
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  flex-shrink: 0;
  transition: all 0.18s;
}

/* ── TBSA summary bar ── */
.burns-tbsa-section {
  padding: 0.85rem 1.6rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}

.burns-tbsa-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  flex-wrap: wrap;
}

.burns-tbsa-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 180px;
}

.burns-tbsa-badge {
  font-size: 1.1rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: #f97316;
  background: #fff3e0;
  border: 1.5px solid #fed7aa;
  padding: 0.2rem 0.7rem;
  border-radius: 8px;
}

.burns-tbsa-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.burns-tbsa-track {
  height: 10px;
  background: #f1f5f9;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.45rem;
  border: 1px solid var(--border);
}

.burns-tbsa-fill {
  height: 100%;
  background: linear-gradient(90deg, #fbbf24, #f97316, #ef4444);
  border-radius: 99px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.burns-severity {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* ── Parkland calculator card ── */
.burns-parkland-card {
  margin: 0.85rem 1.6rem;
  background: linear-gradient(135deg, #eff6ff, #f0f9ff);
  border: 1.5px solid #bfdbfe;
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
}

.burns-parkland-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.burns-parkland-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.burns-parkland-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.1rem;
}

.burns-parkland-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.burns-weight-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.burns-weight-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}

.burns-weight-input {
  width: 100px;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid #93c5fd;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-align: center;
}

.burns-weight-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-act);
}

.burns-weight-unit {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ── Parkland result area ── */
.parkland-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-style: italic;
  margin: 0;
  text-align: center;
  padding: 0.5rem 0;
}

.parkland-total {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
  text-align: center;
  padding: 0.65rem;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  border: 1px solid #bfdbfe;
}

.parkland-total strong {
  color: var(--accent);
  font-size: 1.2rem;
}

.parkland-phases {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.parkland-phase {
  background: #fff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 0.65rem 0.5rem;
  text-align: center;
}

.parkland-phase-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.parkland-phase-value {
  font-size: 1rem;
  font-weight: 800;
  color: #1d4ed8;
  font-family: 'JetBrains Mono', monospace;
}

.parkland-phase-rate {
  font-size: 0.68rem;
  color: #64748b;
  margin-top: 0.1rem;
  font-family: 'JetBrains Mono', monospace;
}

.parkland-formula {
  font-size: 0.72rem;
  color: #64748b;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Actions ── */
.burns-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.6rem 1.35rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .burns-body-container {
    flex-direction: column;
    gap: 1rem;
  }

  .burns-figure-divider {
    width: 100%;
    height: 1px;
    margin: 0;
  }

  .parkland-phases {
    grid-template-columns: 1fr;
  }

  .burns-modal-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ════════════════════════════════════════
   GLASGOW COMA SCALE MODAL
   ════════════════════════════════════════ */

.glasgow-panel {
  width: min(680px, 100%);
  max-height: 94vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.glasgow-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.6rem 1.1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: linear-gradient(135deg, #f5f3ff 0%, #fff 65%);
}

.glasgow-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
  color: var(--text);
}

.glasgow-modal-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

/* ── GCS Sections ── */
.gcs-sections {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.25rem 0;
  flex: 1;
}

.gcs-section {
  padding: 1rem 1.6rem;
  border-bottom: 1px solid var(--border);
}

.gcs-section-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.gcs-section-letter {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

.gcs-section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.gcs-section-range {
  font-size: 0.72rem;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
}

/* ── Radio button group ── */
.gcs-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.gcs-radio-label {
  flex: 1 1 auto;
  min-width: 130px;
}

.gcs-radio-label input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.gcs-radio-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem 0.55rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
  width: 100%;
  height: 100%;
  min-height: 44px;
  box-sizing: border-box;
}

.gcs-radio-btn:hover {
  border-color: #a78bfa;
  background: #f5f3ff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.1);
}

.gcs-radio-label input:checked+.gcs-radio-btn {
  border-color: #7c3aed;
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12), 0 2px 8px rgba(124, 58, 237, 0.1);
}

.gcs-radio-label input:checked+.gcs-radio-btn .gcs-radio-text {
  color: #6d28d9;
  font-weight: 600;
}

.gcs-radio-label input:checked+.gcs-radio-btn .gcs-radio-score {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
}

.gcs-radio-text {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  line-height: 1.3;
}

.gcs-radio-score {
  font-size: 0.78rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  background: #f1f5f9;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  flex-shrink: 0;
  min-width: 24px;
  text-align: center;
  transition: all 0.18s;
}

/* ── Score result area ── */
.gcs-result-area {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.1rem 1.6rem;
  background: #fafafa;
  border-bottom: 1px solid var(--border);
}

.gcs-score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border: 2.5px solid #cbd5e1;
  flex-shrink: 0;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  gap: 0;
}

.gcs-score-badge--normal {
  background: linear-gradient(135deg, #dcfce7, #d1fae5);
  border-color: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.18);
}

.gcs-score-badge--mild {
  background: linear-gradient(135deg, #d1fae5, #ecfdf5);
  border-color: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.15);
}

.gcs-score-badge--moderate {
  background: linear-gradient(135deg, #fef9c3, #fef3c7);
  border-color: #fbbf24;
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.18);
}

.gcs-score-badge--severe {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border-color: #f87171;
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.18);
}

.gcs-score-label {
  font-size: 0.65rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  line-height: 1;
  margin-bottom: 0.1rem;
  text-transform: uppercase;
}

.gcs-score-value {
  font-size: 2.4rem;
  font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
  line-height: 1;
}

.gcs-score-max {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}

.gcs-result-text {
  flex: 1;
  min-width: 0;
}

.gcs-score-detail {
  font-size: 0.82rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.gcs-severity {
  font-size: 0.9rem;
  font-weight: 600;
}

.gcs-severity--normal {
  color: #16a34a;
}

.gcs-severity--mild {
  color: #059669;
}

.gcs-severity--moderate {
  color: #d97706;
}

.gcs-severity--severe {
  color: #dc2626;
}

/* ── Interpretation legend ── */
.gcs-legend {
  padding: 0.85rem 1.6rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.gcs-legend-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}

.gcs-legend-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 1rem;
}

.gcs-legend-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text);
}

.gcs-legend-range {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  flex-shrink: 0;
  min-width: 48px;
  text-align: center;
}

.gcs-legend-range--severe {
  background: #fee2e2;
  color: #b91c1c;
}

.gcs-legend-range--moderate {
  background: #fef9c3;
  color: #a16207;
}

.gcs-legend-range--mild {
  background: #dcfce7;
  color: #166534;
}

.gcs-legend-range--normal {
  background: #d1fae5;
  color: #065f46;
}

/* ── Calculator badge on template cards ── */
.calc-badge {
  background: #f5f3ff !important;
  color: #7c3aed !important;
  border: 1px solid #e9d5ff !important;
  border-radius: 4px !important;
  padding: 0.1rem 0.45rem !important;
  font-size: 0.68rem !important;
  font-weight: 600 !important;
}

.calc-card:hover {
  border-color: #a78bfa;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.12);
}

/* ── Actions ── */
.glasgow-modal-actions {
  padding: 1rem 1.6rem 1.35rem;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .gcs-radio-group {
    gap: 0.4rem;
  }

  .gcs-radio-label {
    min-width: 100%;
  }

  .gcs-legend-rows {
    grid-template-columns: 1fr;
  }

  .gcs-result-area {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

/* ════════════════════════════════════════
   CALCULATORS & SCALES — HOMEPAGE SECTION
   ════════════════════════════════════════ */

.calculators-home-section {
  margin-top: 2.5rem;
  padding-top: 2.25rem;
  border-top: 2px dashed var(--border);
}

.calculators-home-header {
  margin-bottom: 1.25rem;
}

.calculators-home-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.calculators-home-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.calculators-home-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.15rem;
}

.calculators-home-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

/* ── Card grid ── */
.calculators-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}

/* ── Individual calculator card ── */
.calc-home-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.1rem 1.15rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.calc-home-card:hover {
  border-color: #a78bfa;
  background: #faf8ff;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.12);
  transform: translateY(-2px);
}

.calc-home-card:active {
  transform: translateY(0);
}

.calc-home-card-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.calc-home-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  border: 1.5px solid #ddd6fe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  line-height: 1;
}

.calc-home-icon-wrap--dim {
  background: var(--bg);
  border-color: var(--border);
  opacity: 0.5;
}

.calc-home-info {
  flex: 1;
  min-width: 0;
}

.calc-home-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 0.15rem;
}

.calc-home-name--dim {
  color: var(--text-dim);
  font-weight: 500;
}

.calc-home-range {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: #7c3aed;
  background: #f5f3ff;
  border: 1px solid #e9d5ff;
  padding: 0.1rem 0.45rem;
  border-radius: 5px;
  display: inline-block;
}

.calc-home-range--dim {
  color: var(--text-muted);
  background: var(--bg);
  border-color: var(--border);
}

.calc-home-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.calc-home-desc--dim {
  opacity: 0.6;
}

.calc-home-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}

.calc-home-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: #7c3aed;
  letter-spacing: 0.02em;
}

.calc-home-arrow {
  font-size: 1rem;
  color: #a78bfa;
  transition: transform 0.2s;
}

.calc-home-card:hover .calc-home-arrow {
  transform: translateX(4px);
}

.calc-home-card--soon {
  cursor: default;
  opacity: 0.65;
  border-style: dashed;
}

.calc-home-card--soon:hover {
  transform: none;
  box-shadow: var(--shadow);
  border-color: var(--border);
  background: var(--surface);
}

@media (max-width: 640px) {
  .calculators-home-grid {
    grid-template-columns: 1fr;
  }
}


/* ════════════════════════════════════════
   SCALES MODAL PANEL + GRID
   ════════════════════════════════════════ */
.scales-panel {
  width: min(700px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}

.scales-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 0.5rem 0;
}

.scale-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.1rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: all 0.18s;
}

.scale-card:hover {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow-act);
  transform: translateY(-2px);
}

.scale-card--soon {
  cursor: default;
  opacity: 0.5;
}

.scale-card--soon:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border);
}

.scale-card-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.scale-icon-wrap {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.scale-icon-wrap--dim {
  filter: grayscale(100%);
  opacity: 0.5;
}

.scale-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

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

.scale-range--dim,
.scale-name--dim {
  color: var(--text-dim);
}

.scale-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.scale-desc--dim {
  color: var(--text-dim);
}

.scale-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.scale-tag {
  font-size: 0.7rem;
  font-weight: 600;
  background: #ede9fe;
  color: #7c3aed;
  border-radius: 50px;
  padding: 0.15rem 0.55rem;
}

.scale-arrow {
  color: var(--accent);
  font-size: 1rem;
  transition: transform 0.15s;
}

.scale-card:hover .scale-arrow {
  transform: translateX(4px);
}

/* ═════════════════════════════════════════
   GLASGOW COMA SCALE MODAL
   ═════════════════════════════════════════ */
.glasgow-panel {
  width: min(640px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 0;
}

.glasgow-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.4rem 1.6rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.glasgow-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.25rem;
}

.glasgow-modal-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.gcs-sections {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.gcs-section {
  padding: 1rem 1.6rem;
  border-bottom: 1px solid var(--border);
}

.gcs-section:last-child {
  border-bottom: none;
}

.gcs-section-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.gcs-section-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 800;
  flex-shrink: 0;
}

.gcs-section-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.gcs-section-range {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.gcs-radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.gcs-radio-label {
  display: flex;
  cursor: pointer;
}

.gcs-radio-label input {
  position: absolute;
  opacity: 0;
}

.gcs-radio-btn {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--bg);
  transition: all 0.15s;
}

.gcs-radio-label:hover .gcs-radio-btn {
  border-color: var(--accent);
  background: #f5f3ff;
}

.gcs-radio-label input:checked+.gcs-radio-btn {
  border-color: var(--accent);
  background: #ede9fe;
  font-weight: 600;
}

.gcs-radio-score {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  border-radius: 50px;
  padding: 0.1rem 0.5rem;
}

.gcs-radio-label input:checked+.gcs-radio-btn .gcs-radio-score {
  background: #7c3aed;
}

/* GCS result area */
.gcs-result-area {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.6rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.gcs-score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ede9fe;
  color: #7c3aed;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  min-width: 80px;
  transition: all 0.3s;
  flex-shrink: 0;
}

.gcs-score-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.gcs-score-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.gcs-score-max {
  font-size: 0.72rem;
  color: inherit;
  opacity: 0.6;
}

.gcs-result-text {
  flex: 1;
}

.gcs-score-detail {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.gcs-severity {
  font-size: 0.82rem;
  font-weight: 600;
}

/* GCS legend */
.gcs-legend {
  padding: 1rem 1.6rem;
}

.gcs-legend-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.gcs-legend-rows {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.gcs-legend-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.gcs-legend-range {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 50px;
  min-width: 48px;
  text-align: center;
  flex-shrink: 0;
}

.gcs-legend-range--severe {
  background: #fee2e2;
  color: #991b1b;
}

.gcs-legend-range--moderate {
  background: #fef9c3;
  color: #854d0e;
}

.gcs-legend-range--mild {
  background: #dbeafe;
  color: #1d4ed8;
}

.gcs-legend-range--normal {
  background: #dcfce7;
  color: #166534;
}

.glasgow-modal-actions {
  padding: 1rem 1.6rem;
  border-top: 1px solid var(--border);
}


/* ════════════════════════════════════════
   CURB-65 MODAL
   ════════════════════════════════════════ */
.curb65-panel {
  width: min(580px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 0;
}

/* Criteria list */
.curb65-criteria {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 0 0.5rem;
}

.curb65-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.6rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.curb65-row:last-child {
  border-bottom: none;
}

.curb65-row:hover {
  background: var(--surface);
}

.curb65-row:has(input:checked) {
  background: #f5f3ff;
}

.curb65-row input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.curb65-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 800;
  flex-shrink: 0;
}

.curb65-info {
  flex: 1;
}

.curb65-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.15rem;
}

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

.curb65-row:has(input:checked) .curb65-name {
  color: var(--accent);
}

.curb65-pt {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent);
  background: #ede9fe;
  border-radius: 50px;
  padding: 0.15rem 0.5rem;
  flex-shrink: 0;
}

/* Result area */
.curb65-result-area {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.6rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.curb65-score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #dcfce7;
  color: #166534;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  min-width: 86px;
  transition: all 0.3s;
  flex-shrink: 0;
}

.curb65-score-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.curb65-score-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.curb65-score-max {
  font-size: 0.72rem;
  opacity: 0.6;
}

.curb65-result-text {
  flex: 1;
}

.curb65-interpretation {
  font-size: 0.86rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.curb65-management {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Legend */
.curb65-legend {
  padding: 1rem 1.6rem 0.5rem;
}

.curb65-legend-title {
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.curb65-legend-rows {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.curb65-legend-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.curb65-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: 50px;
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.curb65-badge--green {
  background: #dcfce7;
  color: #166534;
}

.curb65-badge--yellow {
  background: #fef9c3;
  color: #854d0e;
}

.curb65-badge--orange {
  background: #fed7aa;
  color: #9a3412;
}

.curb65-badge--red {
  background: #fee2e2;
  color: #991b1b;
}

/* Source line */
.curb65-source {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-style: italic;
  padding: 0.5rem 1.6rem 0;
}

/* Actions */
.curb65-actions {
  padding: 1rem 1.6rem;
  border-top: 1px solid var(--border);
}

/* ════════════════════════════════════════
   COMPLAINT GRID (Step 1)
   ════════════════════════════════════════ */

.complaint-grid-wrap {
  margin-bottom: 0.5rem;
}

.complaint-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
}

@media (max-width: 700px) {
  .complaint-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 420px) {
  .complaint-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.complaint-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.9rem 0.75rem 0.8rem;
  background: color-mix(in srgb, var(--complaint-color, #f0f4f8) 45%, #fff 55%);
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  text-align: center;
  transition: all 0.18s;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.complaint-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--complaint-color, #e0f2fe);
  opacity: 0;
  transition: opacity 0.18s;
  border-radius: inherit;
}

.complaint-btn:hover {
  border-color: color-mix(in srgb, var(--complaint-color, #3b82f6) 80%, #000 20%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.complaint-btn:hover::before {
  opacity: 0.6;
}

.complaint-btn.active {
  border-color: color-mix(in srgb, var(--complaint-color, #2563eb) 70%, #000 30%);
  background: var(--complaint-color, #dbeafe);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--complaint-color, #2563eb) 30%, transparent 70%), var(--shadow);
  transform: translateY(-1px);
}

.complaint-btn.active::before {
  opacity: 0;
}

.complaint-btn__icon {
  font-size: 1.6rem;
  line-height: 1;
  position: relative;
  z-index: 1;
  transition: transform 0.18s;
}

.complaint-btn:hover .complaint-btn__icon,
.complaint-btn.active .complaint-btn__icon {
  transform: scale(1.12);
}

.complaint-btn__label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  position: relative;
  z-index: 1;
}

/* ── COMPLAINT CHIP (after selection) ── */

.complaint-chip-row {
  margin-bottom: 0.75rem;
}

.complaint-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem 0.5rem 0.65rem;
  background: #e0f2fe;
  border: 1.5px solid #7dd3fc;
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
}

.complaint-chip__icon {
  font-size: 1.1rem;
  line-height: 1;
}

.complaint-chip__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0369a1;
}

.complaint-chip__clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: rgba(3, 105, 161, 0.12);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #0369a1;
  transition: background 0.15s;
  padding: 0;
}

.complaint-chip__clear:hover {
  background: rgba(3, 105, 161, 0.25);
}

/* ── MODIFIER SECTION ── */

.modifier-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  animation: fadeSlide 0.2s ease;
}

.modifier-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.modifier-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modifier-section-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.modifier-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.modifier-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.75rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.modifier-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.modifier-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.modifier-chip__check {
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.15s;
  line-height: 1;
}

.modifier-chip.active .modifier-chip__check {
  opacity: 1;
}

/* ── SAMPLE SECTION DIVIDER ── */

.sample-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0 1rem;
}

.sample-divider::before,
.sample-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.sample-divider span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

/* ════════════════════════════════════════
   STEP 1 — CTA CARD
   ════════════════════════════════════════ */

.step1-cta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1.5px solid rgba(37, 99, 235, 0.18);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  animation: fadeSlide 0.25s ease;
}

.step1-cta-icon {
  font-size: 2.2rem;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
}

.step1-cta-body {
  flex: 1;
  min-width: 0;
}

.step1-cta-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.step1-cta-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.step1-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.step1-cta-btn:hover {
  background: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.3);
}

@media (max-width: 520px) {
  .step1-cta {
    flex-wrap: wrap;
    padding: 1rem 1.1rem;
    gap: 0.75rem;
  }
  .step1-cta-icon {
    font-size: 1.6rem;
  }
  .step1-cta-body {
    flex: 1;
    min-width: 0;
  }
  .step1-cta-title {
    font-size: 0.92rem;
    margin-bottom: 0;
  }
  .step1-cta-desc {
    display: none; /* hidden on mobile — redundant with the button label */
  }
  .step1-cta-btn {
    width: 100%;
    justify-content: center;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
  }
}

/* ════════════════════════════════════════
   MODAL — COMPLAINT QUICK-START SECTION
   ════════════════════════════════════════ */

.modal-complaint-section {
  padding: 1.1rem 1.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-complaint-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

/* 7-column tighter grid in modal */
.complaint-grid--modal {
  grid-template-columns: repeat(7, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

@media (max-width: 780px) {
  .complaint-grid--modal {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 520px) {
  .complaint-grid--modal {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Smaller complaint buttons inside the modal */
.complaint-grid--modal .complaint-btn {
  padding: 0.65rem 0.4rem 0.55rem;
  border-radius: 10px;
}

.complaint-grid--modal .complaint-btn__icon {
  font-size: 1.3rem;
}

.complaint-grid--modal .complaint-btn__label {
  font-size: 0.65rem;
  line-height: 1.2;
}

/* ── MODAL SECTION DIVIDER ── */

.modal-section-divider {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1.4rem;
}

.modal-section-divider::before,
.modal-section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.modal-section-divider span {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ════════════════════════════════════════
   TEMPLATES MODAL — OPCJA B SIDEBAR LAYOUT
   ════════════════════════════════════════ */

/* Widen the panel to fit sidebar + content */
.templates-panel {
  width: min(920px, 96vw) !important;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

/* ── Search bar (top, prominent) ── */
.tpl-search-bar {
  padding: 0.85rem 1.25rem 0.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

/* ── Quick-start collapsible ── */
.tpl-quick-start {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.tpl-qs-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.6rem 1.25rem;
  background: var(--surface);
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tpl-qs-toggle:hover {
  background: #f1f5f9;
  color: var(--accent);
}

.tpl-qs-chevron {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.tpl-qs-body {
  padding: 0.75rem 1.25rem 0.85rem;
}

/* ── Two-pane body ── */
.tpl-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Left sidebar ── */
.tpl-sidebar {
  width: 205px;
  flex-shrink: 0;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 0.6rem 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
}

.tpl-sidebar::-webkit-scrollbar { width: 4px; }
.tpl-sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9px; }

.tpl-cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  margin: 0 0.4rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: background 0.14s, color 0.14s;
}

.tpl-cat-item:hover {
  background: #e0f2fe;
  color: #0369a1;
}

.tpl-cat-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.tpl-cat-name {
  flex: 1;
  line-height: 1.3;
}

.tpl-cat-count {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 50px;
  background: rgba(0,0,0,0.07);
  color: inherit;
  min-width: 20px;
  text-align: center;
}

.tpl-cat-item.active .tpl-cat-count {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

/* ── Right content zone ── */
.tpl-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem;
}

.tpl-content::-webkit-scrollbar { width: 5px; }
.tpl-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9px; }

/* ── Compact template cards grid ── */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.tpl-card {
  display: flex;
  align-items: stretch;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  overflow: hidden;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.tpl-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

/* Left colored accent strip */
.tpl-card-accent {
  width: 5px;
  flex-shrink: 0;
  border-radius: 0;
  opacity: 0.75;
}

.tpl-card-body {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.85rem;
  flex: 1;
  min-width: 0;
}

.tpl-card-emoji {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.tpl-card-info {
  flex: 1;
  min-width: 0;
}

.tpl-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tpl-card-sub {
  font-size: 0.71rem;
  color: var(--text-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.tpl-card-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.08rem 0.4rem;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.tpl-card-badge--calc {
  background: #f3e8ff;
  color: #7c3aed;
}

.tpl-empty {
  grid-column: 1 / -1;
  padding: 2.5rem;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.85rem;
}

/* ── Responsive: single column on small screens ── */
@media (max-width: 640px) {
  .tpl-body { flex-direction: column; }
  .tpl-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); flex-direction: row; flex-wrap: wrap; overflow-x: auto; padding: 0.4rem; }
  .tpl-cat-item { margin: 0; white-space: nowrap; }
  .templates-grid { grid-template-columns: 1fr; }
  .templates-panel { width: 100% !important; max-height: 100vh; border-radius: 0; }
}
/* ════════════════════════════════════════
   CLINICAL DESIGN (OPTION B)
   ════════════════════════════════════════ */

/* ── Sidebar: colored specialty dot ── */
.tpl-cat-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 0.3rem;
}

/* ── Hide emoji from template cards (keep accent strip) ── */
.tpl-card-emoji { display: none; }

/* ── Guideline: color dot replacing emoji ── */
.guideline-card-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 0.5rem;
  margin-top: 3px;
}
.guideline-card-emoji { display: none; }

/* ── Guideline alert boxes ── */
.gl-alert {
  display: block;
  padding: 0.5rem 0.85rem;
  margin: 0.3rem 0;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.45;
  border-left: 4px solid transparent;
}
.gl-alert--danger {
  background: #fef2f2;
  border-color: #dc2626;
  color: #991b1b;
}
.gl-alert--warn {
  background: #fffbeb;
  border-color: #d97706;
  color: #92400e;
}
.gl-alert--severe {
  background: #fff1f2;
  border-color: #e11d48;
  color: #9f1239;
}
.gl-alert--moderate {
  background: #fff7ed;
  border-color: #ea580c;
  color: #9a3412;
}
.gl-alert--mild {
  background: #fefce8;
  border-color: #ca8a04;
  color: #713f12;
}

/* ── Guideline list wrapper ── */
.guideline-list-items {
  padding: 0.35rem 0;
}
.guideline-list-items ul {
  list-style: disc;
  padding-left: 1.4rem;
  margin: 0;
}
.guideline-list-items ul li {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.55;
  padding: 0.2rem 0;
  /* Use native list-style — no ::before conflict */
  position: static;
  padding-left: 0;
}

/* ── Quick-start: remove emoji from toggle button ── */
.tpl-qs-toggle {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── No emoji guideline source / disclaimer ── */
.guideline-source {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0.75rem 1.4rem 0;
}
.guideline-disclaimer {
  font-size: 0.7rem;
  color: var(--text-dim, #9ca3af);
  padding: 0.4rem 1.4rem 1rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

/* ════════════════════════════════════════
   ABG CALCULATOR MODAL
   ════════════════════════════════════════ */
.abg-panel {
  width: 980px;
  max-width: 98vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.abg-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.abg-inputs {
  width: 340px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.abg-results {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem;
  background: #f9fafb;
}
.abg-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
/* Context chips */
.abg-context-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.abg-ctx-chip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.abg-ctx-chip:has(input:checked) {
  background: #dbeafe;
  border-color: #2563eb;
  color: #1d4ed8;
}
.abg-ctx-chip input { margin: 0; accent-color: #2563eb; }
/* ABG fields */
.abg-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.abg-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.abg-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  flex-direction: column;
}
.abg-normal {
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
}
.abg-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  background: var(--surface);
  color: var(--text);
  width: 100%;
  transition: border-color 0.15s;
}
.abg-input:focus { outline: none; border-color: #2563eb; }
.abg-interpret-btn {
  margin-top: 0.75rem;
  width: 100%;
  background: #1e3a5f;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.65rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.15s;
}
.abg-interpret-btn:hover { background: #2563eb; }
/* Results */
.abg-results-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 0.75rem;
  color: var(--text-muted);
}
.abg-placeholder-icon { font-size: 2.5rem; opacity: 0.35; }
.abg-placeholder-text { font-size: 0.85rem; text-align: center; }
.abg-result-inner { display: flex; flex-direction: column; gap: 0.6rem; }
.abg-step {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}
.abg-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1e3a5f;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.abg-step-content { flex: 1; min-width: 0; }
.abg-step-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.abg-step-val {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-left: 0.4rem;
}
.abg-step-result {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  background: #f8fafc;
  border-radius: 5px;
  line-height: 1.5;
}
.abg-guidelines-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.4rem;
}
.abg-guidelines-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1e3a5f;
  margin-bottom: 0.2rem;
}
.abg-error {
  background: #fef2f2;
  border-left: 4px solid #dc2626;
  color: #991b1b;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.82rem;
}

/* ════════════════════════════════════════
   ABG REDESIGN — ER MODE / LEARNING MODE
   ════════════════════════════════════════ */

/* Mode Toggle */
.abg-mode-toggle {
  display: flex;
  gap: 0;
  background: var(--surface-2, #f1f5f9);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 0.5rem;
}
.abg-mode-btn {
  flex: 1;
  padding: 0.45rem 0.5rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.abg-mode-btn.active {
  background: #1e3a5f;
  color: #fff;
}

/* ── ER MODE LAYOUT ───────────────────── */
.abgr-er { display: flex; flex-direction: column; gap: 0.6rem; }

/* Verdict Banner */
.abgr-verdict {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  border-left: 5px solid transparent;
}
.abgr-verdict--critical {
  background: #fef2f2;
  border-color: #dc2626;
}
.abgr-verdict--warning {
  background: #fffbeb;
  border-color: #d97706;
}
.abgr-verdict--normal {
  background: #f0fdf4;
  border-color: #16a34a;
}
.abgr-verdict-icon { font-size: 1.5rem; line-height: 1; flex-shrink: 0; margin-top: 2px; }
.abgr-verdict-body { flex: 1; }
.abgr-verdict-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.4rem;
  line-height: 1.25;
}
.abgr-sum-rows { display: flex; flex-direction: column; gap: 0.15rem; }
.abgr-sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  gap: 0.5rem;
}
.abgr-sum-label { color: var(--text-muted); font-weight: 600; flex-shrink: 0; }
.abgr-sum-val { font-weight: 700; color: var(--text); margin-left: 0.3rem; }
.abgr-sum-tag { font-weight: 700; text-align: right; flex: 1; }

/* Action Bar */
.abgr-action-bar {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: #1e3a5f;
  color: #fff;
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.45;
}
.abgr-action-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.abgr-action-text { flex: 1; }

/* Quick Actions Panel */
.abgr-actions-panel {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem;
}
.abgr-action-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.4;
}
.abgr-action-item--primary { font-weight: 700; }
.abgr-action-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.abgr-escalation {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}
.abgr-escalation-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #dc2626;
  margin-bottom: 0.2rem;
}
.abgr-esc-item { font-size: 0.76rem; font-weight: 600; color: #dc2626; line-height: 1.4; }

/* Core Interpretation (3 panels) */
.abgr-core {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.4rem;
}
.abgr-core-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem;
}
.abgr-core-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #1e3a5f;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}
.abgr-core-list {
  list-style: disc;
  padding-left: 1.1rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.abgr-core-list li { font-size: 0.76rem; color: var(--text); line-height: 1.4; }

/* Advanced collapsible */
.abgr-advanced {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2, #f8fafc);
}
.abgr-advanced-toggle {
  list-style: none;
  padding: 0.55rem 0.8rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.abgr-advanced-toggle::-webkit-details-marker { display: none; }
.abgr-advanced-toggle::before { content: '▶ '; font-size: 0.6rem; }
details[open] .abgr-advanced-toggle::before { content: '▼ '; }
.abgr-advanced-body {
  padding: 0.5rem 0.8rem 0.7rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.abgr-adv-row { font-size: 0.75rem; color: var(--text); line-height: 1.45; }

/* Learning mode badge */
.abg-learn-mode-badge {
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  font-size: 0.74rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* ════════════════════════════════════════════════════════
   ORTHOPAEDICS & IMAGING ASSISTANT
   ════════════════════════════════════════════════════════ */

/* Overlay */
.ortho-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(4px);
  z-index: 3000;
  align-items: stretch;
}
.ortho-modal-overlay.open { display: flex; }

/* Modal box */
.ortho-modal {
  background: #f8fafc;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.ortho-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.2rem;
  background: #1e3a5f;
  color: #fff;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.ortho-header-left { display: flex; flex-direction: column; gap: 2px; }
.ortho-modal-title { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.02em; }
.ortho-modal-subtitle { font-size: 0.72rem; color: #93c5fd; }
.ortho-header-right { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

/* Mode toggle */
.ortho-mode-toggle {
  display: flex;
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.ortho-mode-btn {
  padding: 0.3rem 0.75rem;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.7);
  border-radius: 6px;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.ortho-mode-btn.active {
  background: #fff;
  color: #1e3a5f;
}

/* Search */
.ortho-search-bar { display: flex; gap: 4px; }
.ortho-search-input {
  padding: 0.3rem 0.6rem;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 0.73rem;
  width: 200px;
  outline: none;
}
.ortho-search-input::placeholder { color: rgba(255,255,255,0.5); }
.ortho-search-btn {
  padding: 0.3rem 0.5rem;
  border-radius: 7px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}
.ortho-search-tip { font-size: 0.7rem; color: #fcd34d; }
.ortho-close-btn {
  padding: 0.3rem 0.6rem;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 7px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.ortho-close-btn:hover { background: rgba(255,255,255,0.25); }

/* Body layout */
.ortho-modal-body {
  display: grid;
  grid-template-columns: 230px 1fr;
  flex: 1;
  overflow: hidden;
}

/* Left column – SVG body */
.ortho-body-col {
  background: #fff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0.5rem;
  overflow-y: auto;
}
.ortho-body-hint {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

/* Right column – content panel */
.ortho-panel-col {
  overflow-y: auto;
  padding: 1.2rem;
}

/* Placeholder */
.ortho-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  gap: 0.8rem;
  color: #94a3b8;
}
.ortho-placeholder-icon { font-size: 3rem; }
.ortho-placeholder-text { font-size: 0.85rem; text-align: center; max-width: 280px; line-height: 1.5; }

/* Context Panel */
.ortho-context { display: flex; flex-direction: column; gap: 0.5rem; }
.ortho-context-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.ortho-context-region { font-size: 1.05rem; font-weight: 800; color: #1e3a5f; }
.ortho-compute-btn {
  padding: 0.4rem 0.9rem;
  background: #1e3a5f;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.ortho-compute-btn:hover { background: #1d4ed8; }
.ortho-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.3rem;
}

/* Chip grid */
.ortho-chip-grid { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ortho-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  font-size: 0.75rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  user-select: none;
  transition: all 0.12s;
}
.ortho-chip input { display: none; }
.ortho-chip:hover { border-color: #2563eb; color: #2563eb; background: #eff6ff; }
.ortho-chip.active { border-color: #2563eb; background: #2563eb; color: #fff; font-weight: 700; }
.ortho-mech-chip.active { background: #1d4ed8; border-color: #1d4ed8; }
.ortho-sym-chip.active { background: #0891b2; border-color: #0891b2; }

/* Ottawa box */
.ortho-ottawa-box {
  background: #f0f9ff;
  border: 1.5px solid #0891b2;
  border-radius: 10px;
  padding: 0.75rem;
  margin-top: 0.5rem;
}
.ortho-ottawa-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: #0c4a6e;
  margin-top: 0.35rem;
  cursor: pointer;
  line-height: 1.4;
}
.ortho-ottawa-item input { margin-top: 2px; cursor: pointer; }
.ortho-ottawa-verdict {
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 0.5rem;
}
.ortho-ottawa-verdict--yes { background: #dcfce7; color: #166534; border: 2px solid #16a34a; }
.ortho-ottawa-verdict--no  { background: #f1f5f9; color: #475569; border: 2px solid #94a3b8; }

/* Results */
.ortho-results { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.75rem; }

/* Rules */
.ortho-rules-block { display: flex; flex-direction: column; gap: 0.4rem; }
.ortho-rule-item {
  background: #fffbeb;
  border-left: 3px solid #d97706;
  border-radius: 0 8px 8px 0;
  padding: 0.5rem 0.75rem;
}
.ortho-rule-label { font-size: 0.75rem; font-weight: 700; color: #92400e; margin-bottom: 2px; }
.ortho-rule-text { font-size: 0.77rem; color: #78350f; line-height: 1.45; }

/* Imaging card */
.ortho-imaging-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.ortho-imaging-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: #1e3a5f;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}
.ortho-copy-btn {
  padding: 0.25rem 0.65rem;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.ortho-copy-btn:hover { background: rgba(255,255,255,0.25); }
.ortho-imaging-list { padding: 0.6rem 0.75rem; display: flex; flex-direction: column; gap: 0.35rem; }
.ortho-img-row { display: flex; align-items: flex-start; gap: 0.4rem; font-size: 0.8rem; color: #1e293b; line-height: 1.4; }
.ortho-img-icon { flex-shrink: 0; }
.ortho-img-note { color: #64748b; font-size: 0.72rem; }
.ortho-order-text {
  margin: 0 0.75rem 0.6rem;
  padding: 0.5rem;
  background: #f1f5f9;
  border-radius: 6px;
  font-size: 0.74rem;
  color: #334155;
  font-family: var(--font-mono, monospace);
  line-height: 1.6;
}

/* Warnings */
.ortho-warnings-block { display: flex; flex-direction: column; gap: 0.35rem; }
.ortho-warn-item {
  background: #fef2f2;
  border-left: 3px solid #dc2626;
  border-radius: 0 8px 8px 0;
  padding: 0.45rem 0.7rem;
  font-size: 0.76rem;
  color: #991b1b;
  line-height: 1.4;
}

/* Responsive */
@media (max-width: 640px) {
  .ortho-modal-body { grid-template-columns: 1fr; }
  .ortho-body-col { max-height: 300px; border-right: none; border-bottom: 1px solid #e2e8f0; }
  .ortho-search-input { width: 130px; }
}

/* ════════════════════════════════════════════════════════
   CANADIAN CT HEAD RULE — Modal Styles
   ════════════════════════════════════════════════════════ */
.cct-prereq {
  background: #fff7ed;
  border-left: 4px solid #f97316;
  border-radius: 0 8px 8px 0;
  padding: 0.55rem 0.8rem;
  font-size: 0.8rem;
  color: #9a3412;
  margin-bottom: 1rem;
  line-height: 1.45;
}
.cct-section-title {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-bottom: 0.45rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
}
.cct-high { background: #fee2e2; color: #991b1b; }
.cct-med  { background: #fff7ed; color: #92400e; }
.cct-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.3rem; }
.cct-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  font-size: 0.81rem;
  color: #1e293b;
  line-height: 1.4;
  transition: border-color 0.12s, background 0.12s;
}
.cct-item:hover { border-color: #2563eb; background: #eff6ff; }
.cct-item input[type="checkbox"] { margin-top: 2px; cursor: pointer; flex-shrink: 0; accent-color: #2563eb; }
.cct-item:has(input:checked) { border-color: #2563eb; background: #eff6ff; }
.cct-note { font-size: 0.73rem; color: #64748b; font-style: italic; margin-bottom: 0.4rem; }

/* Result box */
.cct-result {
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
  font-size: 0.82rem;
  line-height: 1.5;
}
.cct-result--none { background: #f1f5f9; color: #64748b; border: 2px dashed #cbd5e1; }
.cct-result--high { background: #fef2f2; border: 2px solid #dc2626; }
.cct-result--med  { background: #fffbeb; border: 2px solid #d97706; }
.cct-result--low  { background: #f0fdf4; border: 2px solid #16a34a; }
.cct-verdict-title { font-size: 1rem; font-weight: 800; margin-bottom: 0.3rem; }
.cct-result--high .cct-verdict-title { color: #991b1b; }
.cct-result--med  .cct-verdict-title { color: #92400e; }
.cct-result--low  .cct-verdict-title { color: #166534; }
.cct-verdict-sub   { font-size: 0.78rem; color: #475569; margin-bottom: 0.35rem; }
.cct-verdict-order { font-size: 0.8rem; color: #334155; }
.cct-context-tip {
  margin-top: 0.9rem;
  padding: 0.6rem 0.8rem;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 0.76rem;
  color: #475569;
  line-height: 1.5;
}

/* ════════════════════════════════════════════════════════
   CANADIAN CT HEAD RULE — MDCalc-style Redesign
   ════════════════════════════════════════════════════════ */

.cct-panel { max-width: 600px; }

.cct-body {
  overflow-y: auto;
  max-height: calc(92vh - 80px);
  padding: 0;
}

/* Section headers (Exclusion / High / Medium) */
.cct-section-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.55rem 1rem;
  border-top: 1px solid #e2e8f0;
}
.cct-excl-header { background: #f8fafc; }
.cct-high-header { background: #fff1f2; }
.cct-med-header  { background: #fffbeb; }
.cct-section-label-text { font-size: 0.82rem; font-weight: 800; letter-spacing: 0.02em; color: #1e293b; }
.cct-excl-header .cct-section-label-text { color: #475569; }
.cct-high-header .cct-section-label-text { color: #991b1b; }
.cct-med-header  .cct-section-label-text { color: #92400e; }
.cct-section-desc { font-size: 0.72rem; color: #64748b; }

/* Rows */
.cct-rows { display: flex; flex-direction: column; }
.cct-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
  transition: background 0.1s;
}
.cct-row:hover { background: #f8fafc; }
.cct-row-label { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cct-row-title { font-size: 0.82rem; font-weight: 500; color: #1e293b; line-height: 1.4; }
.cct-row-sub   { font-size: 0.71rem; color: #64748b; line-height: 1.35; }

/* No / Yes toggle buttons */
.cct-toggle-group {
  display: flex;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid #cbd5e1;
}
.cct-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.35rem 0.75rem;
  border: none;
  background: #f8fafc;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.cct-toggle + .cct-toggle { border-left: 1.5px solid #cbd5e1; }
.cct-toggle--no.active  { background: #0d9488; color: #fff; }
.cct-toggle--yes.active { background: #dc2626; color: #fff; }
.cct-toggle--yes        { color: #64748b; }
.cct-toggle--no:not(.active):hover  { background: #f0fdf4; }
.cct-toggle--yes:not(.active):hover { background: #fff0f0; }
.cct-pts { font-size: 0.68rem; font-weight: 700; opacity: 0.75; }

/* Exclusion warning */
.cct-excl-warning {
  margin: 0 1rem 0.5rem;
  padding: 0.6rem 0.8rem;
  background: #fff7ed;
  border: 1.5px solid #f97316;
  border-radius: 8px;
  font-size: 0.8rem;
  color: #9a3412;
  font-weight: 600;
}

/* Result box — override old styles */
.cct-result {
  margin: 0.75rem 1rem 0;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  line-height: 1.5;
}
.cct-result--excl {
  background: #f8fafc;
  border: 2px solid #94a3b8;
}
.cct-result--excl .cct-verdict-title { color: #475569; }

.cct-context-tip {
  margin: 0.75rem 1rem 1rem;
  padding: 0.6rem 0.8rem;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 0.76rem;
  color: #475569;
  line-height: 1.5;
}

/* ════════════════════════════════════════════════════════
   PATIENT QUICK SUMMARY BAR (PSB)
   ════════════════════════════════════════════════════════ */
.psb {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  height: 44px;
  background: #1e3a5f;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  animation: psbSlideIn 0.25s ease;
  flex-shrink: 0;
}
@keyframes psbSlideIn {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);      opacity: 1; }
}

/* Identity section */
.psb-identity {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.psb-icon { font-size: 0.9rem; }
.psb-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255,255,255,0.12);
  color: #e2e8f0;
  white-space: nowrap;
}
.psb-gender { padding: 0.15rem 0.45rem; }
.psb-gender--m { background: #1d4ed8; color: #bfdbfe; }
.psb-gender--k { background: #be185d; color: #fce7f3; }
.psb-complaint {
  background: rgba(251,191,36,0.2);
  color: #fde68a;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Divider */
.psb-identity::after {
  content: '';
  display: block;
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.12);
  margin-left: 0.25rem;
}

/* Vitals section */
.psb-vitals {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: 1;
  overflow: hidden;
  flex-wrap: nowrap;
}
.psb-vital {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  background: rgba(255,255,255,0.08);
  color: #94a3b8;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.psb-vital--ok   { background: rgba(34,197,94,0.2);  color: #86efac; }
.psb-vital--warn { background: rgba(251,146,60,0.2); color: #fdba74; }
.psb-vital--crit { background: rgba(239,68,68,0.25); color: #fca5a5; animation: psbPulse 1.5s infinite; }
@keyframes psbPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

/* Right section */
.psb-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: auto;
}
.psb-urgency {
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  border: none;
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: all 0.15s;
}
.psb-urgency--standard {
  background: rgba(255,255,255,0.1);
  color: #94a3b8;
}
.psb-urgency--nagle {
  background: #dc2626;
  color: #fff;
  animation: psbPulse 1.2s infinite;
}
.psb-time {
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #94a3b8;
  min-width: 3rem;
  text-align: center;
}
.psb-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  opacity: 0.6;
  transition: opacity 0.15s;
  padding: 0.2rem;
}
.psb-edit-btn:hover { opacity: 1; }

/* Responsive — hide vitals on narrow screens */
@media (max-width: 640px) {
  .psb-vitals { display: none; }
  .psb-complaint { max-width: 80px; }
}

/* ════════════════════════════════════════════════════════
   DIFFERENTIAL DIAGNOSIS QUICK HINTS (Różnicowanie)
   ════════════════════════════════════════════════════════ */
.ddx-panel {
  margin: 0.6rem 0 0.4rem;
  border-radius: 10px;
  overflow: visible;
  border: 1.5px solid #e0e7ff;
  background: #fff;
  position: relative;
}

/* Header / toggle button */
.ddx-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.85rem;
  background: #312e81;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  gap: 0.5rem;
}
.ddx-header:hover { background: #3730a3; }
.ddx-header-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  overflow: hidden;
}
.ddx-lightning { font-size: 0.85rem; }
.ddx-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: #e0e7ff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.ddx-complaint-name {
  font-size: 0.73rem;
  font-weight: 500;
  color: #a5b4fc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ddx-chevron {
  font-size: 0.65rem;
  color: #a5b4fc;
  flex-shrink: 0;
  transition: transform 0.2s;
}

/* Body */
.ddx-body {
  padding: 0.6rem 0.75rem 0.5rem;
  background: #fafafa;
  border-radius: 0 0 8px 8px;
}

/* DDx items list */
.ddx-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.ddx-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.65rem;
  border-radius: 7px;
  border: 1.5px solid transparent;
  background: #fff;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.12s, border-color 0.12s;
}
.ddx-item--crit   { border-color: #fecaca; background: #fff5f5; }
.ddx-item--urgent { border-color: #fed7aa; background: #fffbf5; }
.ddx-item--crit:hover   { background: #fee2e2; border-color: #fca5a5; }
.ddx-item--urgent:hover { background: #ffedd5; border-color: #fdba74; }

.ddx-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ddx-dot--crit   { background: #dc2626; }
.ddx-dot--urgent { background: #ea580c; }

.ddx-label {
  flex: 1;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.3;
}
.ddx-arrow {
  font-size: 0.7rem;
  color: #94a3b8;
  transition: color 0.12s;
}
.ddx-item:hover .ddx-arrow { color: #475569; }

/* Disclaimer */
.ddx-disclaimer {
  margin-top: 0.55rem;
  font-size: 0.65rem;
  color: #94a3b8;
  text-align: center;
  font-style: italic;
}

/* Detail popup */
.ddx-detail {
  margin: 0 0.75rem 0.6rem;
  padding: 0.6rem 0.75rem;
  background: #1e293b;
  border-radius: 8px;
  position: relative;
}
.ddx-detail-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 0.45rem;
}
.ddx-detail-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.ddx-test-chip {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  background: #334155;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #7dd3fc;
  white-space: nowrap;
}
.ddx-detail-close {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  transition: color 0.12s;
}
.ddx-detail-close:hover { color: #e2e8f0; }

/* ════════════════════════════════════════════════════════
   RADIOLOGY ASSISTANT MODAL
   ════════════════════════════════════════════════════════ */

/* Overlay */
.radio-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(5px);
  z-index: 3100;
}
.radio-overlay.open { display: flex; }

/* Modal */
.radio-modal {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  overflow: hidden;
}

/* Header */
.radio-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1.2rem;
  background: linear-gradient(135deg, #0f2744 0%, #1e3a5f 100%);
  color: #fff;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.radio-header-left  { display: flex; flex-direction: column; gap: 2px; }
.radio-header-center { flex: 1; display: flex; justify-content: center; }
.radio-header-right { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.radio-title   { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.02em; }
.radio-subtitle { font-size: 0.7rem; color: #93c5fd; }

/* Mode toggle pill */
.radio-mode-toggle {
  display: flex;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.r-mode-btn {
  padding: 0.35rem 1rem;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.65);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.r-mode-btn.active {
  background: #fff;
  color: #0f2744;
}
.r-mode-btn:not(.active):hover { color: #fff; background: rgba(255,255,255,0.15); }

/* Close */
.radio-close-btn {
  padding: 0.3rem 0.65rem;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 7px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  transition: background 0.15s;
}
.radio-close-btn:hover { background: rgba(255,255,255,0.25); }

/* Body — two columns */
.radio-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  flex: 1;
  overflow: hidden;
}

/* Left panel — steps */
.radio-left {
  overflow-y: auto;
  padding: 1.2rem 1.4rem;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Right panel — order */
.radio-right {
  overflow-y: auto;
  padding: 1.2rem;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Step header ── */
.r-step-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f2744;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}
.r-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0f2744;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  flex-shrink: 0;
}
.r-step-opt { font-weight: 400; font-size: 0.75rem; color: #94a3b8; }

/* ── Complaint grid ── */
.r-complaint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.6rem;
}
.r-complaint-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 0.85rem 1rem;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-left: 4px solid var(--cc, #64748b);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  position: relative;
}
.r-complaint-btn:hover {
  border-color: var(--cc, #64748b);
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.r-complaint-icon { font-size: 1.4rem; }
.r-complaint-label { font-size: 0.8rem; font-weight: 700; color: #0f172a; line-height: 1.3; }
.r-badge { font-size: 0.62rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 4px; }
.r-badge--trauma { background: #fef3c7; color: #92400e; }

/* ── Back row + chip ── */
.r-back-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.2rem;
}
.r-back-btn {
  padding: 0.25rem 0.65rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.12s;
}
.r-back-btn:hover { background: #e2e8f0; color: #1e293b; }
.r-selected-chip {
  padding: 0.25rem 0.75rem;
  background: #f0f9ff;
  border: 1.5px solid var(--cc, #64748b);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cc, #334155);
  white-space: nowrap;
}

/* ── Refinement / projection list ── */
.r-refinement-list,
.r-proj-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.r-ref-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.8rem;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  color: #334155;
  line-height: 1.35;
  transition: all 0.12s;
  user-select: none;
}
.r-ref-item:hover { border-color: #2563eb; background: #eff6ff; color: #1e40af; }
.r-ref-item.checked { border-color: #2563eb; background: #eff6ff; color: #1e293b; font-weight: 600; }
.r-ref-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  font-size: 0.7rem;
  font-weight: 900;
  color: #2563eb;
  flex-shrink: 0;
  transition: all 0.12s;
}
.r-ref-item.checked .r-ref-check { background: #2563eb; border-color: #2563eb; color: #fff; }

/* ── Next button ── */
.r-next-btn {
  align-self: flex-start;
  margin-top: 0.5rem;
  padding: 0.6rem 1.4rem;
  background: #0f2744;
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.r-next-btn:hover { background: #1d4ed8; transform: translateY(-1px); }

/* ── Safety warnings ── */
.r-safety-warn {
  padding: 0.5rem 0.75rem;
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  border-radius: 0 8px 8px 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #78350f;
  line-height: 1.4;
}
.r-safety-warn:first-of-type { border-color: #dc2626; background: #fef2f2; color: #991b1b; }

/* ── Suggestion cards ── */
.r-suggestions { display: flex; flex-direction: column; gap: 0.45rem; }
.r-sug-card {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 2px solid #e2e8f0;
  background: #fdfdff;
  cursor: pointer;
  transition: all 0.15s;
}
.r-sug-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.r-sug--critical { border-color: #fecaca; background: linear-gradient(to right, #fff5f5, #fdfdff); }
.r-sug--primary  { border-color: #fed7aa; background: linear-gradient(to right, #fffbf5, #fdfdff); }
.r-sug--secondary { border-color: #e2e8f0; background: #f8fafc; }
.r-sug--info     { border-color: #e0e7ff; background: #f5f3ff; }

.r-sug-card--checked { box-shadow: 0 0 0 2px #2563eb; }
.r-sug--critical.r-sug-card--checked { box-shadow: 0 0 0 2px #dc2626; }

.r-sug-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 900;
  color: #94a3b8;
  background: #fff;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.12s;
}
.r-sug-card--checked .r-sug-check { background: #2563eb; border-color: #2563eb; color: #fff; }
.r-sug--critical.r-sug-card--checked .r-sug-check { background: #dc2626; border-color: #dc2626; }

.r-sug-body { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.r-sug-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.r-sug-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  background: #1e3a5f;
  color: #e0f2fe;
  font-size: 0.62rem;
  font-weight: 800;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.r-sug-note-text { font-size: 0.73rem; color: #475569; line-height: 1.4; }
.r-sug-priority  { font-size: 0.68rem; font-weight: 700; color: #94a3b8; margin-top: 1px; }

.r-sug-note {
  padding: 0.45rem 0.75rem;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  font-size: 0.78rem;
  color: #4c1d95;
  line-height: 1.4;
}
.r-sug-subnote { color: #6d28d9; }

/* Trauma banner */
.r-trauma-banner {
  margin-top: 0.5rem;
  padding: 0.55rem 0.85rem;
  background: #450a0a;
  color: #fca5a5;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ── Region mode ── */
.r-region-group-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}
.r-region-list { display: flex; flex-direction: column; gap: 0.3rem; }
.r-region-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.9rem;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  transition: all 0.12s;
  text-align: left;
}
.r-region-btn:hover { border-color: #2563eb; background: #eff6ff; color: #1e40af; }
.r-region-icon { font-size: 1rem; }
.r-region-arrow { margin-left: auto; color: #94a3b8; }

.r-region-note {
  padding: 0.5rem 0.75rem;
  background: #f0f9ff;
  border-left: 3px solid #0891b2;
  border-radius: 0 8px 8px 0;
  font-size: 0.75rem;
  color: #0c4a6e;
  line-height: 1.4;
}

/* Side toggle */
.r-side-toggle { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.r-side-btn {
  padding: 0.4rem 0.9rem;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  color: #475569;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.r-side-btn.active { background: #0f2744; border-color: #0f2744; color: #fff; }
.r-side-btn:not(.active):hover { border-color: #2563eb; color: #2563eb; }

/* Region order preview */
.r-region-order-preview {
  padding: 1rem;
  background: #f0f4ff;
  border: 2px solid #c7d2fe;
  border-radius: 10px;
}
.r-order-line-big {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f2744;
  line-height: 1.35;
}
.r-order-projs { font-size: 0.73rem; color: #64748b; margin-top: 4px; }

/* ── Order panel (right) ── */
.r-order-header {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.r-pregnancy-banner {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.74rem;
  color: #92400e;
  line-height: 1.45;
  margin: 0.5rem 0;
}

.r-order-box {
  background: #0f172a;
  border-radius: 10px;
  padding: 1rem;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.r-order-box--empty {
  align-items: center;
  justify-content: center;
}
.r-order-empty {
  font-size: 0.78rem;
  color: #475569;
  text-align: center;
  line-height: 1.6;
}
.r-order-line {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.4;
  font-family: var(--font-mono, 'SF Mono', monospace);
}
.r-order-num { color: #475569; flex-shrink: 0; }

/* Action buttons */
.r-order-actions { display: flex; flex-direction: column; gap: 0.45rem; }
.r-action-btn {
  width: 100%;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.r-action-btn--copy   { background: #1e3a5f; color: #fff; }
.r-action-btn--copy:hover   { background: #2563eb; }
.r-action-btn--insert { background: #136a3f; color: #fff; }
.r-action-btn--insert:hover { background: #15803d; }

/* Toast */
.radio-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.55rem 1.2rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  z-index: 9999;
  pointer-events: none;
  animation: radioToastIn 0.2s ease;
}
@keyframes radioToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
  .radio-body { grid-template-columns: 1fr; }
  .radio-right { border-top: 1px solid #e2e8f0; max-height: 280px; }
  .r-complaint-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ════════════════════════════════════════
   MOBILE RESPONSIVE — CORE SHELL
   Max 768px (phones & small tablets)
   ════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Sidebar becomes bottom nav bar ── */
  .sidebar {
    width: 100%;
    height: 60px;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.5rem;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
    z-index: 300;
  }

  .sidebar-logo {
    display: none; /* hide logo in bottom bar */
  }

  .sidebar-nav {
    flex-direction: row;
    flex: 1;
    justify-content: space-around;
    align-items: center;
    gap: 0;
    padding: 0;
  }

  .sidebar-bottom {
    flex-direction: row;
    width: auto;
    gap: 0;
    padding: 0;
  }

  /* Hide tooltips on mobile */
  .sidebar-btn::after {
    display: none;
  }

  .sidebar-btn {
    width: 48px;
    height: 48px;
  }

  /* ── Main content uses full width, padded above bottom nav ── */
  .main-content {
    margin-left: 0;
    padding-bottom: 80px; /* room for bottom nav */
  }

  /* ── Footer: show above bottom nav, no left padding ── */
  .site-footer {
    padding-bottom: 72px !important;
  }
  .site-footer p {
    padding-left: 0 !important;
    text-align: center;
  }

  /* ── Home hero ── */
  .home-hero {
    padding: 1rem 1rem 0.75rem;
  }

  .home-hero-title {
    font-size: 1.2rem;
  }

  .home-hero-subtitle {
    font-size: 0.75rem;
  }

  .home-hero-cta {
    padding: 0.55rem 1rem;
    font-size: 0.82rem;
  }

  /* ── Mode cards: 1 column on phone ── */
  .mode-cards {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .mode-card {
    padding: 0.9rem 1rem;
  }

  .mode-card-icon {
    font-size: 1.4rem;
  }

  .mode-card-title {
    font-size: 0.88rem;
  }

  .mode-card-desc {
    font-size: 0.7rem;
  }

  /* ── Calc strip: 1 column ── */
  .calc-strip {
    grid-template-columns: 1fr;
  }

  /* ── Step bar ── */
  .step-bar {
    padding: 0.6rem 1rem;
    gap: 0.4rem;
  }

  .step-label {
    font-size: 0.62rem;
  }

  /* ── Content panels ── */
  .tab-content,
  .panel,
  .section-block {
    padding: 1rem;
  }

  /* ── Tables & wide elements ── */
  table {
    font-size: 0.78rem;
  }

  /* ── Modals ── */
  .modal-box,
  .modal-inner {
    width: 95vw;
    max-width: 95vw;
    padding: 1rem;
    border-radius: 12px;
  }

  /* ── Diagnostic output cards ── */
  .diag-card,
  .icd-badge {
    font-size: 0.78rem;
  }

  /* ── Buttons ── */
  .btn-primary,
  .btn-secondary {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }

  /* ── Account panel ── */
  .account-panel {
    width: 90vw;
    right: 5vw;
  }

  /* ── Radiology body ── */
  .radio-body {
    grid-template-columns: 1fr;
  }
}

/* ════════════════════════════════════════
   RADIOLOGY ASSISTANT MODAL
   ════════════════════════════════════════ */
.radio-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}
.radio-modal.open { display: flex; }

.radio-box {
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.22);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.radio-header {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  background: var(--surface2); flex-shrink: 0;
}
.radio-header-left { display: flex; align-items: center; gap: 0.6rem; flex: 1; }
.radio-header-icon { font-size: 1.4rem; }
.radio-header-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.radio-mode-toggle {
  display: flex; gap: 0.35rem;
  background: var(--bg); border-radius: 8px; padding: 3px;
}
.rmt-btn {
  padding: 0.35rem 0.85rem; border: none; border-radius: 6px;
  font-family: 'Inter', sans-serif; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; background: transparent; color: var(--text-muted); transition: all 0.18s;
}
.rmt-btn.active { background: var(--accent); color: #fff; }
.radio-close-btn {
  width: 32px; height: 32px; border: none; border-radius: 8px;
  background: var(--bg); color: var(--text-muted); font-size: 1rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.radio-close-btn:hover { background: #fee2e2; color: #dc2626; }

/* Split body */
.radio-body { display: grid; grid-template-columns: 1fr 320px; flex: 1; overflow: hidden; min-height: 0; }
.radio-left { padding: 1.25rem; overflow-y: auto; border-right: 1px solid var(--border); }
.radio-right { padding: 1rem 1.1rem; overflow-y: auto; background: var(--surface2); }

/* Step header */
.r-step-header { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 0.9rem; color: var(--text); margin-bottom: 0.85rem; }
.r-step-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 0.75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.r-step-opt { font-size: 0.75rem; font-weight: 400; color: var(--text-muted); }

/* Back row */
.r-back-row { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 1rem; }
.r-back-btn {
  padding: 0.35rem 0.75rem; border: 1.5px solid var(--border); border-radius: 7px;
  background: var(--surface); font-family: 'Inter', sans-serif; font-size: 0.78rem; font-weight: 600;
  color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}
.r-back-btn:hover { border-color: var(--accent); color: var(--accent); }
.r-selected-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  background: color-mix(in srgb, var(--cc, #3b82f6) 15%, #fff 85%);
  border: 1.5px solid color-mix(in srgb, var(--cc, #3b82f6) 35%, transparent 65%);
  border-radius: 20px; font-size: 0.8rem; font-weight: 600;
  color: color-mix(in srgb, var(--cc, #1e40af) 80%, #000 20%);
}

/* Complaint grid */
.r-complaint-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.65rem; }
.r-complaint-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem;
  padding: 0.85rem 0.9rem; background: var(--surface2);
  border: 2px solid var(--border); border-radius: 12px; cursor: pointer;
  text-align: left; font-family: 'Inter', sans-serif; transition: all 0.18s;
}
.r-complaint-btn:hover {
  border-color: color-mix(in srgb, var(--cc, #3b82f6) 50%, transparent 50%);
  background: color-mix(in srgb, var(--cc, #dbeafe) 20%, #fff 80%);
  transform: translateY(-2px);
}
.r-complaint-icon { font-size: 1.5rem; }
.r-complaint-label { font-size: 0.8rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.r-badge { font-size: 0.65rem; padding: 2px 6px; border-radius: 4px; font-weight: 700; }
.r-badge--trauma { background: #fef3c7; color: #92400e; }

/* Refinement / Projection list */
.r-refinement-list, .r-proj-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.r-ref-item {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.8rem;
  border: 1.5px solid var(--border); border-radius: 8px; cursor: pointer;
  font-size: 0.83rem; color: var(--text); background: var(--surface); transition: all 0.15s; user-select: none;
}
.r-ref-item:hover { border-color: var(--accent); background: var(--accent-glow); }
.r-ref-item.checked { border-color: var(--accent); background: #eff6ff; color: var(--accent2); font-weight: 600; }
.r-ref-check {
  width: 18px; height: 18px; border-radius: 4px; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 0.7rem;
  font-weight: 700; flex-shrink: 0; color: var(--accent);
}
.r-ref-item.checked .r-ref-check { border-color: var(--accent); background: var(--accent); color: #fff; }

/* Next button */
.r-next-btn {
  display: block; width: 100%; padding: 0.7rem; background: var(--accent); color: #fff;
  border: none; border-radius: 10px; font-family: 'Inter', sans-serif;
  font-size: 0.88rem; font-weight: 700; cursor: pointer; transition: all 0.18s; margin-top: 0.5rem;
}
.r-next-btn:hover { background: var(--accent2); transform: translateY(-1px); }

/* Suggestion cards */
.r-suggestions { display: flex; flex-direction: column; gap: 0.5rem; }
.r-sug-card {
  display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.85rem 1rem;
  border: 2px solid var(--border); border-radius: 12px; cursor: pointer;
  background: var(--surface); transition: all 0.15s;
}
.r-sug-card:hover { border-color: var(--accent); transform: translateX(2px); }
.r-sug-card--checked { border-color: var(--accent); background: #eff6ff; }
.r-sug-card--critical { border-left: 4px solid #dc2626; }
.r-sug-card--primary   { border-left: 4px solid #ea580c; }
.r-sug-card--secondary { border-left: 4px solid #94a3b8; }
.r-sug-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0; color: var(--accent); transition: all 0.15s;
}
.r-sug-card--checked .r-sug-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.r-sug-label { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.r-sug-note-text { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }
.r-sug-priority { font-size: 0.7rem; margin-top: 0.25rem; }
.r-sug-badge { display: inline-block; font-size: 0.65rem; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: #fef3c7; color: #92400e; margin-left: 0.4rem; }
.r-sug-note { font-size: 0.82rem; color: var(--text-muted); padding: 0.5rem; background: var(--surface2); border-radius: 8px; }
.r-safety-warn { padding: 0.6rem 0.85rem; border-radius: 8px; background: #fef2f2; border: 1px solid #fca5a5; font-size: 0.8rem; color: #991b1b; margin-bottom: 0.5rem; }
.r-trauma-banner { margin-top: 0.75rem; padding: 0.6rem 0.85rem; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; font-size: 0.8rem; color: #9a3412; }

/* Order panel */
.r-order-header { font-size: 0.88rem; font-weight: 700; color: var(--text); margin-bottom: 0.75rem; }
.r-pregnancy-banner { padding: 0.6rem 0.75rem; border-radius: 8px; background: #fdf4ff; border: 1px solid #e879f9; font-size: 0.75rem; color: #701a75; margin-bottom: 0.75rem; line-height: 1.4; }
.r-order-box { background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; padding: 0.75rem; min-height: 80px; margin-bottom: 0.75rem; }
.r-order-empty { color: var(--text-dim); font-size: 0.8rem; text-align: center; padding: 1rem 0; }
.r-order-line { font-size: 0.82rem; color: var(--text); padding: 0.25rem 0; border-bottom: 1px solid var(--border); }
.r-order-line:last-child { border-bottom: none; }
.r-order-num { color: var(--accent); font-weight: 700; margin-right: 0.4rem; }
.r-order-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.r-action-btn { display: block; width: 100%; padding: 0.6rem; border: none; border-radius: 8px; cursor: pointer; font-family: 'Inter', sans-serif; font-size: 0.82rem; font-weight: 600; transition: all 0.15s; }
.r-action-btn--copy { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.r-action-btn--copy:hover { border-color: var(--accent); color: var(--accent); }
.r-action-btn--insert { background: var(--accent); color: #fff; }
.r-action-btn--insert:hover { background: var(--accent2); }

/* Region mode */
.r-region-group-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.06em; margin: 1rem 0 0.4rem; }
.r-region-list { display: flex; flex-direction: column; gap: 0.3rem; }
.r-region-btn {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.9rem;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 9px;
  cursor: pointer; font-family: 'Inter', sans-serif; font-size: 0.83rem; color: var(--text); transition: all 0.15s; text-align: left;
}
.r-region-btn:hover { border-color: var(--accent); background: var(--accent-glow); }
.r-region-icon { font-size: 1.1rem; }
.r-region-arrow { margin-left: auto; color: var(--text-dim); }
.r-region-note { padding: 0.5rem 0.75rem; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; font-size: 0.78rem; color: #1e40af; margin-bottom: 0.75rem; }
.r-side-toggle { display: flex; gap: 0.4rem; margin-bottom: 0.75rem; }
.r-side-btn { flex: 1; padding: 0.45rem; border: 1.5px solid var(--border); border-radius: 7px; background: var(--surface); font-family: 'Inter', sans-serif; font-size: 0.8rem; font-weight: 600; cursor: pointer; color: var(--text-muted); transition: all 0.15s; }
.r-side-btn.active { border-color: var(--accent); background: #eff6ff; color: var(--accent); }
.r-region-order-preview { background: #f0f9ff; border: 1.5px solid #bae6fd; border-radius: 12px; padding: 1rem 1.2rem; }
.r-order-line-big { font-size: 1.05rem; font-weight: 700; color: #0c4a6e; margin-bottom: 0.35rem; }
.r-order-projs { font-size: 0.82rem; color: #075985; }

/* Toast */
.radio-toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 0.5rem 1.2rem; border-radius: 20px; font-size: 0.82rem; font-weight: 600; z-index: 9999; pointer-events: none; animation: radioToastIn 0.2s ease; }

/* Mobile */
@media (max-width: 640px) {
  .radio-body { grid-template-columns: 1fr; }
  .radio-right { border-top: 1px solid var(--border); max-height: 250px; }
  .r-complaint-grid { grid-template-columns: repeat(2, 1fr); }
  .radio-box { max-height: 95vh; }
}

@media (max-width: 400px) {
  .home-hero-title {
    font-size: 1.05rem;
  }

  .home-hero-cta span {
    display: none; /* just show arrow icon */
  }

  .sidebar-btn {
    width: 40px;
    height: 40px;
  }
}

