/* ═══════════════════════════════════════════════════════════
   NICU Antibiogram — Modern Dark Clinical UI
   ═══════════════════════════════════════════════════════════ */

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

:root {
  --bg:          #080c14;
  --bg2:         #0d1220;
  --surface:     #111827;
  --surface2:    #1a2235;
  --border:      #1e2d45;
  --border2:     #253550;
  --text:        #e2e8f0;
  --text-muted:  #64748b;
  --text-dim:    #94a3b8;
  --blue:        #3b82f6;
  --blue-glow:   rgba(59,130,246,0.25);
  --cyan:        #06b6d4;
  --green:       #10b981;
  --green-glow:  rgba(16,185,129,0.2);
  --red:         #ef4444;
  --orange:      #f97316;
  --purple:      #8b5cf6;
  --yellow:      #f59e0b;
  --sidebar-w:   230px;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --chart-1: #3b82f6;
  --chart-2: #06b6d4;
  --chart-3: #10b981;
  --chart-4: #8b5cf6;
  --chart-5: #f59e0b;
  --chart-6: #ef4444;
  --chart-7: #f97316;
  --chart-8: #ec4899;
  --chart-9: #14b8a6;
  --chart-10: #a3e635;
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
}

/* ── Animated Background Canvas ─────────────────────────── */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── App Shell ───────────────────────────────────────────── */
#app {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: rgba(13,18,32,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  transition: width .25s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #1d4ed8, #06b6d4);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(59,130,246,0.4);
}

.logo-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .02em;
}

.logo-sub {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s ease;
  text-align: left;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--blue);
  border-radius: 0 2px 2px 0;
  transform: scaleY(0);
  transition: transform .18s ease;
}

.nav-item:hover {
  background: rgba(59,130,246,0.08);
  color: var(--text);
}

.nav-item.active {
  background: rgba(59,130,246,0.12);
  color: var(--blue);
}

.nav-item.active::before {
  transform: scaleY(1);
}

.nav-item svg {
  flex-shrink: 0;
  transition: transform .18s ease;
}

.nav-item:hover svg { transform: scale(1.1); }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-muted);
}

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

.status-dot.connected    { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse-green 2s infinite; }
.status-dot.connecting   { background: var(--yellow); animation: pulse-yellow 1s infinite; }
.status-dot.disconnected { background: var(--red); }

@keyframes pulse-green  { 0%,100%{opacity:1} 50%{opacity:.4} }
@keyframes pulse-yellow { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Main Content ────────────────────────────────────────── */
#main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

#main::-webkit-scrollbar { width: 6px; }
#main::-webkit-scrollbar-track { background: transparent; }
#main::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Pages ───────────────────────────────────────────────── */
.page {
  display: none;
  padding: 28px 32px;
  min-height: 100vh;
  animation: fade-in .25s ease;
}

.page.active { display: block; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}

.page-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Filters ─────────────────────────────────────────────── */
.filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color .18s;
}

.filter-select:hover  { border-color: var(--border2); }
.filter-select:focus  { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.filter-select option { background: var(--surface2); }

/* ── KPI Grid ────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}

.kpi-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity .18s;
}

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

.kpi-blue   { background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(59,130,246,0.03)); border-color: rgba(59,130,246,0.2); }
.kpi-red    { background: linear-gradient(135deg, rgba(239,68,68,0.08),  rgba(239,68,68,0.03));  border-color: rgba(239,68,68,0.2); }
.kpi-green  { background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(16,185,129,0.03)); border-color: rgba(16,185,129,0.2); }
.kpi-purple { background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(139,92,246,0.03)); border-color: rgba(139,92,246,0.2); }
.kpi-orange { background: linear-gradient(135deg, rgba(249,115,22,0.08), rgba(249,115,22,0.03)); border-color: rgba(249,115,22,0.2); }

.kpi-icon {
  flex-shrink: 0;
  opacity: .8;
}

.kpi-body { min-width: 0; }

.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -.02em;
}

/* ── Charts Grid ─────────────────────────────────────────── */
.charts-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.chart-card {
  background: rgba(17,24,39,0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color .18s;
}

.chart-card:hover { border-color: var(--border2); }

.chart-card.span-2 { grid-column: span 2; }

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.chart-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 20px;
}

.chart-wrap {
  position: relative;
  height: 220px;
}

.chart-wrap.chart-tall { height: 300px; }

/* ── Generic Card ────────────────────────────────────────── */
.card {
  background: rgba(17,24,39,0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

/* ── Form ─────────────────────────────────────────────────── */
.form-wrapper {
  max-width: 760px;
}

form .form-section {
  background: rgba(17,24,39,0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}

.form-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 16px;
}

.form-section-header .form-section-title { margin-bottom: 0; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: span 2; }

.form-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
}

.required { color: var(--red); }
.optional  { color: var(--text-muted); font-weight: 400; }

.form-input {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

.form-input::placeholder { color: var(--text-muted); }
.form-input:hover  { border-color: var(--border2); }
.form-input:focus  { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.form-input.error  { border-color: var(--red); }
.form-input option { background: var(--surface2); }

/* ── Antibiotic rows ─────────────────────────────────────── */
.ab-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ab-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  animation: slide-in .15s ease;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

.ab-row select { background: var(--surface); }

.sus-btns {
  display: flex;
  gap: 5px;
}

.sus-btn {
  width: 34px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}

.sus-btn:hover         { background: var(--surface2); color: var(--text); }
.sus-btn.active-S      { background: rgba(16,185,129,0.2);  border-color: var(--green);  color: var(--green); }
.sus-btn.active-I      { background: rgba(245,158,11,0.2);  border-color: var(--yellow); color: var(--yellow); }
.sus-btn.active-R      { background: rgba(239,68,68,0.18);  border-color: var(--red);    color: var(--red); }

.btn-remove-row {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .15s;
}

.btn-remove-row:hover { background: rgba(239,68,68,0.1); border-color: var(--red); color: var(--red); }

/* ── Form Actions ────────────────────────────────────────── */
.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 4px;
}

.form-success {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 13px;
  font-weight: 500;
  margin-right: auto;
}

.form-error {
  color: var(--red);
  font-size: 13px;
  margin-right: auto;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 0 20px rgba(59,130,246,0.3);
}

.btn-primary:hover { background: #2563eb; box-shadow: 0 0 28px rgba(59,130,246,0.5); transform: translateY(-1px); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all .18s;
}

.btn-outline:hover { border-color: var(--border2); color: var(--text); background: var(--surface2); }

.btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(59,130,246,0.1);
  color: var(--blue);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}

.btn-ghost-sm:hover { background: rgba(59,130,246,0.2); }

.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .18s;
}

.btn-danger:hover { background: #dc2626; }

/* ── Tables ──────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  vertical-align: middle;
}

.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.data-table tr:last-child td { border-bottom: none; }

/* Antibiogram specific table */
.ab-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ab-table th {
  padding: 8px 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
  text-align: center;
}

.ab-table th:first-child { text-align: left; position: sticky; left: 0; z-index: 2; min-width: 180px; }

.ab-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid rgba(30,45,69,0.5);
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

.ab-table td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; font-family: inherit; font-size: 12.5px; color: var(--text); white-space: nowrap; }

.ab-table tr:hover td { background: rgba(255,255,255,0.025); }
.ab-table tr:hover td:first-child { background: var(--surface2); }

.pct-cell {
  border-radius: 4px;
  padding: 2px 6px;
  font-weight: 600;
  font-size: 12px;
}

.pct-high   { background: rgba(16,185,129,0.2);  color: #34d399; }
.pct-mid    { background: rgba(245,158,11,0.2);  color: #fbbf24; }
.pct-low    { background: rgba(239,68,68,0.18);  color: #f87171; }
.pct-na     { color: var(--text-muted); font-size: 11px; }

.org-count { font-size: 10px; color: var(--text-muted); font-family:inherit; }

/* ── Badges ──────────────────────────────────────────────── */
.badge-mdr {
  display: inline-block;
  background: rgba(239,68,68,0.15);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.badge-ok {
  color: var(--text-muted);
  font-size: 11px;
}

/* ── Empty States ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-state svg { opacity: .3; }
.empty-state p { font-size: 13px; max-width: 320px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: grid;
  place-items: center;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  animation: modal-in .2s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(.95); }
  to   { opacity: 1; transform: scale(1); }
}

.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.modal p  { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── View modal ──────────────────────────────────────────── */
.modal-view { max-width: 540px; }
.modal-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-view-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-view-body { overflow-y: auto; max-height: 60vh; padding-right: 4px; margin-bottom: 16px; }
.btn-icon-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  line-height: 1;
}
.btn-icon-close:hover { color: var(--text); background: var(--border); }
.view-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.view-field { display: flex; flex-direction: column; gap: 3px; }
.view-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.view-val   { font-size: 13px; color: var(--text); }
.view-ab-section { margin-top: 16px; }

/* ── Scrollbar for main ──────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 800px) {
  #sidebar { width: 54px; }
  .logo-text, .nav-item span, .sidebar-footer span { display: none; }
  .logo-icon { margin: 0; }
  .sidebar-logo { justify-content: center; padding: 16px 8px; }
  .nav-item { justify-content: center; padding: 10px; }
  .charts-grid-2 { grid-template-columns: 1fr; }
  .chart-card.span-2 { grid-column: span 1; }
  .page { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: span 1; }
  .ab-row { grid-template-columns: 1fr 1fr auto; }
}

@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; }
  .header-actions { width: 100%; flex-wrap: wrap; }
  .filter-select { flex: 1 1 120px; }
}

/* ── Insights tidbits ─────────────────────────────────── */
#tidbits-list strong { color: var(--text); }
#tidbits-list em { font-style: italic; color: var(--text-dim); }

/* ── Guidelines protocol cards ──────────────────────────── */
.gl-threshold-info {
  margin-bottom: 18px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-dim);
  background: linear-gradient(180deg, rgba(59,130,246,0.1), rgba(59,130,246,0.03));
  border-color: rgba(59,130,246,0.24);
}

.gl-proto-card {
  margin-bottom: 14px;
  transition: border-color .18s, transform .18s ease, box-shadow .18s ease;
  background: linear-gradient(180deg, rgba(17,24,39,0.88), rgba(17,24,39,0.72));
}

.gl-proto-card:hover {
  border-color: var(--border2);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

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

.gl-proto-main { flex: 1; min-width: 200px; }

.gl-proto-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.gl-proto-pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.gl-proto-target { font-size: 13px; color: var(--text-dim); }
.gl-proto-target strong { color: var(--text); font-weight: 600; }

.gl-proto-lines { display: grid; gap: 6px; }
.gl-line-row { font-size: 13px; color: var(--text); }
.gl-line-label {
  min-width: 68px;
  display: inline-block;
  font-weight: 700;
}
.gl-line-1 { color: var(--green); }
.gl-line-2 { color: var(--yellow); }
.gl-line-3 { color: var(--orange); }

.gl-proto-note {
  margin-top: 4px;
  border-left: 2px solid var(--border2);
  padding-left: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.gl-proto-alert {
  margin-top: 10px;
  border: 1px solid rgba(249,115,22,0.35);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--orange);
  background: rgba(249,115,22,0.1);
}

.gl-proto-actions {
  display: flex;
  gap: 7px;
  flex-shrink: 0;
}

.gl-proto-actions .btn-outline,
.gl-proto-actions .btn-danger {
  padding: 5px 10px;
  font-size: 12px;
}

/* ── PWA install banner (optional, keep minimal) ─────────── */
/* ── Sidebar install button ─────────────────────────────── */
.sidebar-install-btn {
  width: 100%;
  margin-bottom: 8px;
  color: var(--blue) !important;
  border: 1px solid rgba(59,130,246,0.35);
  border-radius: 8px;
  background: rgba(59,130,246,0.08);
}
.sidebar-install-btn:hover {
  background: rgba(59,130,246,0.16) !important;
}

/* ── Guideline coverage analysis panel ───────────────────── */
.gl-analysis-card {
  margin-bottom: 20px;
  border-color: rgba(59,130,246,0.3);
}
.gl-analysis-proto {
  border-top: 1px solid var(--border);
  padding: 14px 0 10px;
}
.gl-analysis-proto:first-of-type {
  border-top: none;
  padding-top: 0;
}
.gl-analysis-proto-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.gl-analysis-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.gl-analysis-line-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}
.gl-analysis-drugs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.gl-analysis-drug-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  background: rgba(255,255,255,0.03);
}
.gl-analysis-suggestions {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(52,211,153,0.06);
  border: 1px solid rgba(52,211,153,0.2);
  border-radius: 8px;
}
.gl-analysis-suggest-label {
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
  flex-shrink: 0;
}
.gl-analysis-alt-chip {
  border-color: rgba(52,211,153,0.3);
  background: rgba(52,211,153,0.06);
}
.gl-analysis-nodata {
  font-size: 12px;
  color: var(--text-muted);
  margin: 6px 0 0;
}

#pwa-install-banner {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17,24,39,0.95);
  border: 1px solid rgba(59,130,246,0.35);
  border-radius: 999px;
  padding: 8px 10px 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  z-index: 300;
  font-size: 12.5px;
  color: var(--text);
  max-width: 90vw;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  flex-wrap: wrap;
}

#pwa-install-text {
  color: var(--text-dim);
  margin-right: 2px;
}

#pwa-install-banner .btn-primary,
#pwa-install-banner .btn-outline {
  padding: 6px 12px;
  font-size: 12px;
}

/* ── 2026 polish: executive dashboard surfaces ─────────────── */
body {
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 24%),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.14), transparent 20%),
    linear-gradient(180deg, #060a12 0%, #0b1220 100%);
}

.page-header {
  position: relative;
  padding-bottom: 10px;
}

.page-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(59,130,246,0.28), rgba(59,130,246,0));
}

.kpi-card,
.chart-card,
.card,
form .form-section,
.modal {
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(10, 15, 28, 0.88));
  border-color: rgba(96, 165, 250, 0.14);
  box-shadow: 0 18px 50px rgba(2, 6, 23, 0.28);
}

.kpi-card,
.chart-card,
.card,
.gl-proto-card,
.gl-ward-card,
.evidence-card,
.hero-card,
.insight-brief-card {
  position: relative;
  overflow: hidden;
}

.kpi-card::before,
.chart-card::before,
.card::before,
.gl-ward-card::before,
.hero-card::before,
.evidence-card::before,
.insight-brief-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), transparent 32%, transparent 68%, rgba(59,130,246,0.08));
  opacity: 0;
  transition: opacity .28s ease;
  pointer-events: none;
}

.kpi-card:hover::before,
.chart-card:hover::before,
.card:hover::before,
.gl-ward-card:hover::before,
.hero-card:hover::before,
.evidence-card:hover::before,
.insight-brief-card:hover::before {
  opacity: 1;
}

.kpi-card:hover,
.chart-card:hover,
.card:hover,
.gl-ward-card:hover,
.evidence-card:hover,
.hero-card:hover,
.insight-brief-card:hover {
  transform: translateY(-4px);
  border-color: rgba(96, 165, 250, 0.26);
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.38);
}

.nav-item {
  transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
  border: 1px solid transparent;
}

.nav-item:hover,
.nav-item.active {
  transform: translateX(3px);
  border-color: rgba(59,130,246,0.16);
}

.btn-primary,
.btn-outline,
.btn-ghost-sm,
.btn-danger,
.gl-ward-card {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}

.btn-primary:hover,
.btn-outline:hover,
.btn-ghost-sm:hover,
.btn-danger:hover {
  transform: translateY(-2px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, .9fr);
  gap: 18px;
  margin-bottom: 22px;
}

.hero-card {
  border: 1px solid rgba(96, 165, 250, 0.16);
  border-radius: 20px;
  padding: 24px;
}

.hero-primary {
  background:
    radial-gradient(circle at top right, rgba(14,165,233,0.18), transparent 24%),
    linear-gradient(135deg, rgba(37,99,235,0.24), rgba(15,23,42,0.92) 50%, rgba(8,12,20,0.94));
}

.hero-secondary {
  background:
    radial-gradient(circle at top left, rgba(99,102,241,0.18), transparent 28%),
    linear-gradient(180deg, rgba(15,23,42,0.96), rgba(8,12,20,0.92));
}

.hero-badge,
.evidence-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid rgba(96,165,250,0.24);
  background: rgba(15, 23, 42, 0.52);
  color: #bfdbfe;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(1.75rem, 2.4vw, 2.4rem);
  line-height: 1.1;
  margin: 16px 0 10px;
  max-width: 14ch;
}

.hero-copy {
  max-width: 60ch;
  color: var(--text-dim);
  font-size: 14px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.mini-stat-grid {
  display: grid;
  gap: 12px;
}

.mini-stat-card {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(96,165,250,0.14);
  background: rgba(8, 15, 31, 0.74);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mini-stat-label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}

.mini-stat-value {
  font-size: 20px;
  color: var(--text);
}

.mini-stat-note {
  color: var(--text-dim);
  font-size: 12px;
}

.evidence-grid,
.insights-brief-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.evidence-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(96,165,250,0.14);
  background: linear-gradient(180deg, rgba(15,23,42,0.92), rgba(10,15,28,0.88));
}

.evidence-card h3 {
  margin: 14px 0 8px;
  font-size: 16px;
}

.evidence-card p,
.insights-evidence-item,
.gl-research-note p {
  color: var(--text-dim);
  font-size: 13px;
}

.insights-brief-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
}

.insights-briefing-list,
.insights-evidence-list {
  display: grid;
  gap: 10px;
}

.insights-brief-item,
.insights-evidence-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(8,15,31,0.72);
  border: 1px solid rgba(96,165,250,0.12);
  color: var(--text-dim);
  font-size: 13px;
}

.insights-brief-icon {
  font-size: 15px;
  line-height: 1.2;
}

.insights-brief-warn { border-color: rgba(249,115,22,0.22); }
.insights-brief-good { border-color: rgba(16,185,129,0.22); }

.gl-research-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.gl-research-note strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.gl-ward-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.gl-ward-card {
  width: 100%;
  border: 1px solid rgba(96,165,250,0.14);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(15,23,42,0.92), rgba(10,15,28,0.86));
  color: var(--text);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gl-ward-card.active {
  border-color: rgba(59,130,246,0.44);
  box-shadow: 0 0 0 1px rgba(59,130,246,0.18), 0 18px 50px rgba(2,6,23,0.36);
}

.gl-ward-card-title {
  font-size: 15px;
  font-weight: 700;
}

.gl-ward-card-meta,
.gl-ward-card-state {
  font-size: 12px;
  color: var(--text-dim);
}

.gl-ward-card-empty {
  cursor: default;
}

.gl-empty-card {
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px dashed rgba(96,165,250,0.22);
  background: rgba(10, 15, 28, 0.7);
}

.gl-empty-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
}

.gl-empty-card p {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 14px;
}

.gl-proto-card {
  border-radius: 18px;
}

#pwa-install-banner {
  border-radius: 18px;
  padding: 12px 14px;
  min-width: min(580px, 92vw);
  justify-content: space-between;
}

@media (max-width: 1100px) {
  .hero-grid,
  .insights-brief-grid,
  .evidence-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  .hero-card,
  .evidence-card,
  .insight-brief-card,
  .gl-ward-card {
    border-radius: 16px;
  }

  .hero-title {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .hero-actions,
  .modal-actions {
    flex-direction: column;
  }

  .hero-actions > *,
  .modal-actions > * {
    width: 100%;
    justify-content: center;
  }

  .gl-ward-grid,
  .mini-stat-grid {
    grid-template-columns: 1fr;
  }

  #pwa-install-banner {
    left: 12px;
    right: 12px;
    bottom: 12px;
    transform: none;
    min-width: 0;
  }
}
