/* ========================================================================
   DEOX Clinical AI — Dashboard CSS v3.0
   2026 Dark Theme · Glassmorphism · Premium Clinical Aesthetic
   Brand: Navy #020617 · Orange #fe8c0d · Teal #00ADB5 · Blue #3b82f6
   ======================================================================== */

/* ── Design Tokens ── */
:root {
  /* Brand */
  --primary:       #fe8c0d;
  --primary-dark:  #ea580c;
  --primary-light: #fff7ed;
  --navy:          #020617;
  --navy-mid:      #0f172a;
  --navy-light:    #1e293b;
  --teal:          #00ADB5;
  --teal-light:    #e0f7fa;
  --blue:          #3b82f6;
  --blue-light:    #dbeafe;

  /* Surfaces — Dark Theme */
  --bg:            #020617;
  --bg-elevated:   #0f172a;
  --card:          rgba(30, 41, 59, 0.8);
  --card-solid:    #1e293b;
  --card-hover:    rgba(30, 41, 59, 0.95);

  /* Text */
  --text:          #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;

  /* Borders */
  --border:        rgba(148, 163, 184, 0.1);
  --border-light:  rgba(148, 163, 184, 0.06);
  --border-active: rgba(254, 140, 13, 0.3);

  /* Semantic */
  --success:       #22c55e;
  --success-light: rgba(34, 197, 94, 0.15);
  --warning:       #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.15);
  --danger:        #ef4444;
  --danger-light:  rgba(239, 68, 68, 0.15);
  --info:          #3b82f6;
  --info-light:    rgba(59, 130, 246, 0.15);
  --critical:      #dc2626;

  /* Shadows */
  --shadow-xs:     0 1px 2px rgba(0,0,0,0.2);
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -2px rgba(0,0,0,0.2);
  --shadow-lg:     0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -4px rgba(0,0,0,0.2);
  --shadow-xl:     0 20px 25px -5px rgba(0,0,0,0.5), 0 8px 10px -6px rgba(0,0,0,0.3);

  /* Glass */
  --glass-bg:      rgba(30, 41, 59, 0.6);
  --glass-border:  rgba(148, 163, 184, 0.08);
  --glass-blur:    blur(12px);

  /* Radii */
  --radius-sm:     6px;
  --radius:        8px;
  --radius-lg:     12px;
  --radius-xl:     16px;

  /* Transitions */
  --transition:    150ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography */
  --font-sans:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Sidebar Navigation Links ── */
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  text-decoration: none;
  transition: all 150ms ease;
  white-space: nowrap;
  position: relative;
}
.nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
}
.nav-link.active {
  background: rgba(254,140,13,0.12);
  color: #fe8c0d;
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: linear-gradient(180deg, #fe8c0d, #ea580c);
  border-radius: 0 3px 3px 0;
}
.nav-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  color: #94a3b8;
}
.nav-badge.badge-warning {
  background: rgba(245,158,11,0.2);
  color: #fbbf24;
}
.nav-badge.badge-danger {
  background: rgba(239,68,68,0.2);
  color: #f87171;
}

/* ── No-scrollbar utility ── */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ── Sidebar nav thin scrollbar ── */
#sidebar.collapsed .sidebar-nav-scroll { height: calc(100vh - 120px); }
.sidebar-nav-scroll { max-height: calc(100vh - 140px); }
#sidebar { max-height: 100vh; height: 100vh; overflow-y: auto; overflow-x: hidden; }
.sidebar-nav-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-nav-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav-scroll::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.2); border-radius: 2px; }
.sidebar-nav-scroll::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.4); }
.sidebar-nav-scroll { scrollbar-width: thin; scrollbar-color: rgba(148,163,184,0.2) transparent; }

/* ── Legacy header/nav (hidden in new layout) ── */
.header, .nav { display: none; }

/* ── Main Content ── */
.main {
  padding: 24px;
  max-width: 1480px;
  margin: 0 auto;
}
.tab-content { display: none; animation: fadeIn 0.25s ease; }
.tab-content.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Cards — Glassmorphism Dark ── */
.deox-card, .card {
  background: var(--card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.deox-card:hover, .card:hover {
  border-color: rgba(148, 163, 184, 0.15);
  box-shadow: var(--shadow-md);
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.5);
}
.card-header h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.1px;
}
.card-body {
  padding: 20px;
}
.card-footer {
  padding: 10px 20px;
  background: rgba(15, 23, 42, 0.3);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Stat Cards — Premium Dark ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-lg);
  padding: 18px 16px 14px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--glass-border);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--teal));
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(148, 163, 184, 0.15);
}
.stat-card.success::before { background: linear-gradient(90deg, #22c55e, #10b981); }
.stat-card.warning::before { background: linear-gradient(90deg, #f59e0b, #d97706); }
.stat-card.danger::before  { background: linear-gradient(90deg, #ef4444, #dc2626); }
.stat-card.teal::before    { background: linear-gradient(90deg, #00ADB5, #0d9488); }
.stat-card.orange::before  { background: linear-gradient(90deg, #fe8c0d, #ea580c); }
.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.stat-label {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}
.stat-change {
  font-size: 10.5px;
  margin-top: 3px;
  font-weight: 500;
}
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Metric Cards (TailAdmin-style) ── */
.metric-card {
  background: var(--card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.metric-card .metric-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.metric-card .metric-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.metric-card .metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-top: 12px;
  letter-spacing: -0.5px;
}
.metric-card .metric-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.metric-card .metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  margin-top: 4px;
}
.metric-trend.up {
  background: var(--success-light);
  color: var(--success);
}
.metric-trend.down {
  background: var(--danger-light);
  color: var(--danger);
}
.metric-trend.neutral {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-secondary);
}

/* ── Tables — Dark Premium ── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
th {
  background: rgba(15, 23, 42, 0.6);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: top;
}
tbody tr {
  cursor: pointer;
  transition: background var(--transition);
}
tbody tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.2);
}
tbody tr:hover td {
  background: rgba(254, 140, 13, 0.06) !important;
}
tbody tr:last-child td {
  border-bottom: none;
}

/* ── Badges — Pill-shaped, no emojis ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 600;
  gap: 4px;
  letter-spacing: 0.1px;
}
.badge-active, .badge-success, .badge-info    { background: var(--success-light); color: var(--success); }
.badge-warning   { background: var(--warning-light); color: var(--warning); }
.badge-danger    { background: var(--danger-light);  color: var(--danger); }
.badge-info      { background: var(--info-light);    color: var(--info); }
.badge-neutral   { background: rgba(148,163,184,0.1); color: var(--text-secondary); }
.badge-critical  { background: rgba(220,38,38,0.2);  color: #fca5a5; }
.badge-orange    { background: rgba(254,140,13,0.15); color: #fe8c0d; }
.badge-teal      { background: rgba(0,173,181,0.15);  color: #00ADB5; }

/* ── Progress Bars — Gradient ── */
.progress-bar {
  height: 20px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 10px;
  font-weight: 700;
  color: white;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-fill.green  { background: linear-gradient(90deg, #22c55e, #16a34a); }
.progress-fill.yellow { background: linear-gradient(90deg, #f59e0b, #d97706); }
.progress-fill.red    { background: linear-gradient(90deg, #ef4444, #dc2626); }
.progress-fill.teal   { background: linear-gradient(90deg, #00ADB5, #0d9488); }
.progress-fill.orange { background: linear-gradient(90deg, #fe8c0d, #ea580c); }
.progress-fill.brand  { background: linear-gradient(90deg, #fe8c0d, #00ADB5); }

/* ── Small Progress (sparkline-style) ── */
.progress-sm {
  height: 6px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 3px;
  overflow: hidden;
}
.progress-sm .progress-fill {
  border-radius: 3px;
  padding-right: 0;
  font-size: 0;
}

/* ── Layout Grids ── */
.two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 960px) {
  .two-col, .three-col { grid-template-columns: 1fr; }
}

/* ── Filter Bar — Dark ── */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-bar input,
.filter-bar select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-sans);
  background: var(--card-solid);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
/* Force dark-mode options for all selects */
select,
select option {
  background-color: #1e293b;
  color: #e2e8f0;
}
.filter-bar input:focus,
.filter-bar select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(254,140,13,0.15);
}
.filter-bar input { flex: 1; min-width: 180px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1.4;
}
.btn-primary {
  background: linear-gradient(135deg, #fe8c0d, #ea580c);
  color: white;
  font-weight: 600;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #ea580c, #dc2626);
  box-shadow: 0 4px 12px rgba(254, 140, 13, 0.3);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover {
  background: rgba(148, 163, 184, 0.1);
  border-color: var(--text-secondary);
  color: var(--text);
}
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}
.btn-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}
.btn-success:hover {
  background: rgba(34, 197, 94, 0.25);
}

/* ── Timeline — Dark ── */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -20px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: var(--navy-mid);
}
.timeline-dot.critical { border-color: var(--danger); background: var(--danger-light); }
.timeline-dot.warning  { border-color: var(--warning); background: var(--warning-light); }
.timeline-dot.success  { border-color: var(--success); background: var(--success-light); }
.timeline-time {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
}
.timeline-text {
  font-size: 12.5px;
  margin-top: 2px;
  color: var(--text);
}
.timeline-detail {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Detail Rows ── */
.detail-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 12.5px;
}
.detail-row .label {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
}

/* ── Severity Indicators ── */
.severity { display: inline-flex; align-items: center; gap: 5px; }
.severity-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.severity-dot.critical { background: var(--danger); box-shadow: 0 0 6px rgba(239,68,68,0.4); }
.severity-dot.high     { background: var(--warning); }
.severity-dot.medium   { background: var(--blue); }
.severity-dot.low      { background: var(--text-muted); }

/* ── Module Grid ── */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.module-card {
  background: var(--card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--glass-border);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #00ADB5, #0d9488);
}
.module-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.module-card h4 { font-size: 13px; margin-bottom: 6px; color: var(--text); }
.module-card p  { font-size: 11.5px; color: var(--text-secondary); margin-bottom: 10px; line-height: 1.5; }
.module-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-muted);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ── Risk Matrix — Dark ── */
.risk-matrix {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  max-width: 350px;
}
.risk-cell {
  padding: 10px 6px;
  text-align: center;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  color: white;
}
.risk-low      { background: #059669; }
.risk-medium   { background: #d97706; }
.risk-high     { background: #dc2626; }
.risk-critical { background: #991b1b; }

/* ── Gauges — Dark ── */
.gauge { text-align: center; padding: 12px; }
.gauge-ring {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
}
.gauge-ring.green  { background: conic-gradient(var(--success) 0%, var(--success) var(--pct), rgba(30,41,59,0.8) var(--pct), rgba(30,41,59,0.8) 100%); }
.gauge-ring.yellow { background: conic-gradient(var(--warning) 0%, var(--warning) var(--pct), rgba(30,41,59,0.8) var(--pct), rgba(30,41,59,0.8) 100%); }
.gauge-ring.red    { background: conic-gradient(var(--danger) 0%, var(--danger) var(--pct), rgba(30,41,59,0.8) var(--pct), rgba(30,41,59,0.8) 100%); }
.gauge-inner {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--navy-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.gauge-label { font-size: 11px; color: var(--text-secondary); }

/* ── CSS-only Charts ── */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 8px; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.bar-chart .bar {
  width: 100%;
  max-width: 40px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #fe8c0d, #ea580c);
  transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  min-height: 4px;
}
.bar-chart .bar.teal { background: linear-gradient(180deg, #00ADB5, #0d9488); }
.bar-chart .bar-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
}
.bar-chart .bar-value {
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

/* Radial Progress */
.radial-progress {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.radial-progress-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--navy-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* Donut Chart */
.donut-chart {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.donut-chart-inner {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--navy-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  z-index: 1;
}

/* ── Heat Map ── */
.heatmap-grid {
  display: grid;
  grid-template-columns: auto repeat(5, 1fr);
  gap: 3px;
  max-width: 420px;
}
.heatmap-label {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}
.heatmap-cell {
  padding: 12px 8px;
  text-align: center;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: white;
  transition: transform 0.15s ease;
  cursor: default;
}
.heatmap-cell:hover {
  transform: scale(1.05);
  z-index: 1;
}

/* ── Section Headers ── */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 2px solid;
  border-image: linear-gradient(90deg, var(--primary), var(--teal)) 1;
}

/* ── Insight Cards (colored left border) ── */
.insight-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 16px;
  border-left: 3px solid;
  margin-bottom: 8px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.insight-card.danger { border-left-color: var(--danger); }
.insight-card.warning { border-left-color: var(--warning); }
.insight-card.success { border-left-color: var(--success); }
.insight-card.info { border-left-color: var(--info); }

/* ── Alert Banner ── */
.alert-banner {
  background: rgba(245, 158, 11, 0.1);
  backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.alert-banner h3 { font-size: 14px; color: var(--warning); margin-bottom: 4px; }
.alert-banner p, .alert-banner div { font-size: 12px; color: var(--text-secondary); }

/* ── Info Banner ── */
.info-banner {
  background: rgba(59, 130, 246, 0.1);
  backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}
.info-banner.green {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.2);
}
.info-banner.purple {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.2);
}
.info-banner.pink {
  background: rgba(236, 72, 153, 0.1);
  border-color: rgba(236, 72, 153, 0.2);
}

/* ── Modal — Dark ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px;
  overflow-y: auto;
}
.modal-overlay.hidden { display: none; }
.modal-overlay.show   { display: flex; }

.modal {
  background: var(--card-solid);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 700px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: rgba(148,163,184,0.1); color: var(--text); }
.modal-body { padding: 24px; max-height: 70vh; overflow-y: auto; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.3);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ── Interactive ── */
.clickable { cursor: pointer; transition: transform var(--transition); }
.clickable:hover { transform: translateY(-1px); }

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(90deg, var(--navy-light) 25%, var(--card-solid) 50%, var(--navy-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 12px; margin-bottom: 8px; }
.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-card { height: 80px; border-radius: var(--radius); }

/* ── Selection ── */
::selection {
  background: rgba(254,140,13,0.25);
  color: var(--text);
}

/* ── Scrollbar — Dark ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }
::-webkit-scrollbar-track { background: transparent; }

/* ── Focus Styles ── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Sidebar Collapse States ── */
#sidebar.collapsed {
  width: 72px;
}
#sidebar.collapsed .sidebar-label,
#sidebar.collapsed .nav-label,
#sidebar.collapsed .nav-badge,
#sidebar.collapsed h3 {
  display: none;
}
#sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 10px;
}
#sidebar.collapsed .nav-icon {
  margin: 0;
}
#sidebar.collapsed .study-badge-text {
  display: none;
}
#sidebar.collapsed + #main-wrapper {
  margin-left: 72px !important;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 9999;
  }
  #sidebar.open {
    transform: translateX(0);
  }
  #main-wrapper {
    margin-left: 0 !important;
  }
  #main-wrapper.main-content-overlay::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
  }
}

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-value { font-size: 22px; }
  .stat-card { padding: 14px 12px; }
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }
  .card-header h3 { font-size: 12.5px; }
  th, td { padding: 8px 10px; font-size: 11.5px; }
  main { padding: 14px !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
}

/* ── Utility Classes ── */
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-info    { color: var(--info)    !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-teal    { color: var(--teal)    !important; }
.text-orange  { color: var(--primary) !important; }

.bg-success-light { background: var(--success-light) !important; }
.bg-warning-light { background: var(--warning-light) !important; }
.bg-danger-light  { background: var(--danger-light)  !important; }

.fw-600 { font-weight: 600; }
.fs-11  { font-size: 11px; }
.fs-12  { font-size: 12px; }
.fs-13  { font-size: 13px; }

/* ── Chat Bubbles (Brain tab) ── */
.chat-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 85%;
  font-size: 12.5px;
  line-height: 1.6;
  margin-bottom: 8px;
}
.chat-bubble.ai {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
  margin-right: auto;
}
.chat-bubble.user {
  background: linear-gradient(135deg, rgba(254,140,13,0.2), rgba(0,173,181,0.2));
  border: 1px solid rgba(254,140,13,0.2);
  color: var(--text);
  border-bottom-right-radius: 4px;
  margin-left: auto;
}

/* ── Stepper (CAPA Chain) ── */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 16px 0;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}
.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--card-solid);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.step-dot.completed {
  background: var(--success);
  border-color: var(--success);
}
.step-dot.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(254,140,13,0.2);
}
.step-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
}
.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border);
}
.step:not(:last-child) .step-dot.completed + .step-label::after,
.step-completed-line {
  background: var(--success);
}

/* ── Rule Condition Chips ── */
.condition-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(59, 130, 246, 0.1);
  color: var(--blue);
  border: 1px solid rgba(59, 130, 246, 0.15);
}
.action-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(254, 140, 13, 0.1);
  color: var(--primary);
  border: 1px solid rgba(254, 140, 13, 0.15);
}

/* ── Upload Drop Zone ── */
.drop-zone {
  border: 2px dashed rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.drop-zone:hover {
  border-color: var(--primary);
  background: rgba(254, 140, 13, 0.05);
}

/* ── Print ── */
@media print {
  #sidebar, header, .modal-overlay, #toast-container { display: none !important; }
  #main-wrapper { margin-left: 0 !important; }
  main { padding: 0 !important; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; background: white !important; color: black !important; }
}

/* -- Sprint 3: Inline CRUD Editing -- */
.inline-edit { cursor: pointer; border-bottom: 1px dashed var(--border); padding: 2px 4px; transition: background 0.15s; }
.inline-edit:hover { background: rgba(148,163,184,0.1); }
.inline-edit.editing { border-bottom: none; }

.edit-input { background: var(--bg-elevated); border: 1px solid var(--accent); color: var(--text); padding: 4px 8px; border-radius: 4px; font-size: 12px; width: 100%; outline: none; }
.edit-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(254,140,13,0.15); }
.edit-select { background: var(--bg-elevated); border: 1px solid var(--accent); color: var(--text); padding: 4px 8px; border-radius: 4px; font-size: 12px; outline: none; }
.edit-textarea { background: var(--bg-elevated); border: 1px solid var(--accent); color: var(--text); padding: 8px; border-radius: 4px; font-size: 12px; width: 100%; min-height: 80px; resize: vertical; outline: none; font-family: var(--font-sans); }
.edit-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(254,140,13,0.15); }

.btn-add { background: rgba(34,197,94,0.15); color: #22c55e; border: 1px solid rgba(34,197,94,0.3); padding: 6px 14px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-add:hover { background: rgba(34,197,94,0.25); border-color: rgba(34,197,94,0.5); }
.btn-add:active { transform: scale(0.97); }

.btn-cancel { background: rgba(148,163,184,0.1); color: var(--text-secondary); border: 1px solid var(--border); padding: 6px 14px; border-radius: 6px; font-size: 12px; cursor: pointer; transition: all 0.2s; }
.btn-cancel:hover { background: rgba(148,163,184,0.2); }

.btn-danger { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); padding: 6px 14px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-danger:hover { background: rgba(239,68,68,0.25); border-color: rgba(239,68,68,0.5); }

.btn-delete { background: none; border: none; color: #ef4444; cursor: pointer; opacity: 0.5; transition: opacity 0.2s; padding: 4px; font-size: 14px; }
.btn-delete:hover { opacity: 1; }

.confirm-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(4px); }
.confirm-modal-content { background: var(--card-solid); border: 1px solid var(--border); border-radius: 12px; padding: 24px; max-width: 400px; width: 90%; box-shadow: var(--shadow-xl); }

.saving-spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: deox-spin 0.6s linear infinite; margin-left: 8px; vertical-align: middle; }

.edit-panel-row td { border-top: 2px solid var(--accent) !important; }

/* ── Copilot Input Fixes ── */
#copilotTabInput, #copilotInput, #chatInput {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border: 1px solid #475569 !important;
  caret-color: #fe8c0d !important;
}
#copilotTabInput::placeholder, #copilotInput::placeholder, #chatInput::placeholder {
  color: #64748b !important;
  opacity: 1 !important;
}
#copilotTabInput:focus, #copilotInput:focus, #chatInput:focus {
  border-color: #fe8c0d !important;
  box-shadow: 0 0 0 2px rgba(254,140,13,0.2) !important;
  outline: none !important;
}

/* Rules Engine Sub-tabs */
.rules-subtab {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.rules-subtab:hover { color: var(--text-secondary); }
.rules-subtab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}