/* ╔═══════════════════════════════════════════════════════════════════════╗
   ║  RedLab Dashboard — Futuristic ops-center layout                     ║
   ║  Loaded after theme.css — structural overrides, not just colors      ║
   ╚═══════════════════════════════════════════════════════════════════════╝ */

/* ── Root variables ──────────────────────────────────────────────────────── */
:root {
  --dash-sidebar-w: 220px;
  --dash-topbar-h: 48px;
  --orange:        #f97316;
  --orange-dim:    rgba(249,115,22,0.08);
  --orange-bright: rgba(249,115,22,0.6);
  --border:        rgba(249,115,22,0.10);
  --border-light:  rgba(249,115,22,0.22);
  --bg:            #04060f;
  --bg-card:       #080c18;
  --bg-alt:        #060910;
  --text:          #e8eaf0;
  --text-subtle:   #94a3b8;
  --text-muted:    #475569;
  --font-mono:     'JetBrains Mono', monospace;
  --sev-critical:  #ef4444;
  --sev-high:      #f97316;
  --sev-medium:    #f59e0b;
  --sev-low:       #22c55e;
  --sev-info:      #3b82f6;
}

/* ── Full viewport grid ───────────────────────────────────────────────────── */
.dash-layout {
  display: grid;
  grid-template-columns: var(--dash-sidebar-w) 1fr;
  grid-template-rows: 1fr;
  min-height: 100vh;
  background: var(--bg);
  /* Subtle dot-grid over entire viewport */
  background-image:
    radial-gradient(circle, rgba(249,115,22,0.04) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.dash-sidebar {
  width: var(--dash-sidebar-w);
  min-height: 100vh;
  height: 100%;
  position: sticky;
  top: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  /* Hard dark background, NO card feel — it's an OS sidebar */
  background: #020408;
  border-right: 1px solid var(--border);
  /* Subtle right-edge glow */
  box-shadow: 1px 0 16px rgba(249,115,22,0.04);
  scrollbar-width: thin;
  scrollbar-color: rgba(249,115,22,0.15) transparent;
  z-index: 40;
}

/* Sidebar scrollbar */
.dash-sidebar::-webkit-scrollbar { width: 3px; }
.dash-sidebar::-webkit-scrollbar-track { background: transparent; }
.dash-sidebar::-webkit-scrollbar-thumb { background: rgba(249,115,22,0.2); border-radius: 2px; }

/* Sidebar nav links */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
  text-decoration: none;
  transition: color 0.12s, background 0.12s;
  position: relative;
  letter-spacing: 0.01em;
  cursor: pointer;
}
.sidebar-link:hover {
  color: var(--orange);
  background: rgba(249,115,22,0.06);
}
/* Active: left border line + orange text + faint inset */
.sidebar-link.active {
  color: var(--orange);
  background: rgba(249,115,22,0.08);
  border-left: 2px solid var(--orange);
  padding-left: 12px;
  box-shadow: inset 0 0 16px rgba(249,115,22,0.06);
  text-shadow: 0 0 10px rgba(249,115,22,0.35);
}
.sidebar-link-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.7;
}
.sidebar-link.active .sidebar-link-icon,
.sidebar-link:hover  .sidebar-link-icon { opacity: 1; }

/* ── Main content area ───────────────────────────────────────────────────── */
.dash-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  background: transparent;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.dash-topbar {
  height: var(--dash-topbar-h);
  min-height: var(--dash-topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(2,4,8,0.97);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(12px);
  /* Bottom scan-line accent */
  box-shadow: 0 1px 0 rgba(249,115,22,0.08), 0 2px 16px rgba(0,0,0,0.3);
}
.dash-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--orange);
  text-shadow: 0 0 16px rgba(249,115,22,0.4);
}
/* Topbar left: breadcrumb separator */
.dash-title::before {
  content: '//';
  opacity: 0.35;
  margin-right: 8px;
  font-weight: 400;
}

/* ── Scrollable body ─────────────────────────────────────────────────────── */
.dash-body {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  /* Scan-line top border */
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(249,115,22,0.5) 35%,
    rgba(249,115,22,0.7) 50%,
    rgba(249,115,22,0.5) 65%,
    transparent 100%);
}
/* Subtle corner accents */
.card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 8px; height: 8px;
  border-top: 1px solid rgba(249,115,22,0.4);
  border-right: 1px solid rgba(249,115,22,0.4);
}
.card-header {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.card-title {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--orange);
  text-shadow: 0 0 8px rgba(249,115,22,0.2);
}

/* ── Stats row ───────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(249,115,22,0.4), transparent);
}
.stat-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 0 20px rgba(249,115,22,0.06);
}
.stat-card-label {
  font-family: var(--font-mono);
  font-size: 0.575rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.stat-card-value {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  color: var(--orange);
  text-shadow: 0 0 24px rgba(249,115,22,0.35);
  letter-spacing: -0.02em;
}
.stat-card-sub {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.stat-card--red .stat-card-value  { color: var(--sev-critical); text-shadow: 0 0 24px rgba(239,68,68,0.35); }
.stat-card--red::before            { background: linear-gradient(90deg, transparent, rgba(239,68,68,0.5), transparent); }
.stat-card--yellow .stat-card-value { color: var(--sev-medium);  text-shadow: 0 0 24px rgba(245,158,11,0.35); }
.stat-card--yellow::before          { background: linear-gradient(90deg, transparent, rgba(245,158,11,0.5), transparent); }

/* ── Table ───────────────────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table thead tr {
  background: rgba(249,115,22,0.03);
}
.table th {
  font-family: var(--font-mono);
  font-size: 0.575rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 10px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid rgba(249,115,22,0.04);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td {
  background: rgba(249,115,22,0.025);
}
.text-main { color: var(--text); font-weight: 500; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.575rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  border: 1px solid;
  white-space: nowrap;
  line-height: 1.6;
}
.badge--critical { background: rgba(239,68,68,0.12);  color: #fca5a5; border-color: rgba(239,68,68,0.35);  box-shadow: 0 0 8px rgba(239,68,68,0.15); }
.badge--high     { background: rgba(249,115,22,0.12); color: #fdba74; border-color: rgba(249,115,22,0.35); box-shadow: 0 0 8px rgba(249,115,22,0.15); }
.badge--medium   { background: rgba(245,158,11,0.12); color: #fcd34d; border-color: rgba(245,158,11,0.35); }
.badge--low      { background: rgba(34,197,94,0.10);  color: #86efac; border-color: rgba(34,197,94,0.30);  }
.badge--info     { background: rgba(59,130,246,0.10); color: #93c5fd; border-color: rgba(59,130,246,0.30); }
.badge--open          { background: rgba(249,115,22,0.10); color: #fdba74;  border-color: rgba(249,115,22,0.30); }
.badge--in-review     { background: rgba(245,158,11,0.10); color: #fcd34d;  border-color: rgba(245,158,11,0.30); }
.badge--remediated    { background: rgba(34,197,94,0.10);  color: #86efac;  border-color: rgba(34,197,94,0.30);  }
.badge--wont-fix      { background: rgba(71,85,105,0.15);  color: #94a3b8;  border-color: rgba(71,85,105,0.35);  }
.badge--false-positive{ background: rgba(71,85,105,0.15);  color: #94a3b8;  border-color: rgba(71,85,105,0.35);  }
.badge--green  { background: rgba(34,197,94,0.10);  color: #86efac;  border-color: rgba(34,197,94,0.30);  }
.badge--red    { background: rgba(239,68,68,0.12);  color: #fca5a5;  border-color: rgba(239,68,68,0.35);  }
.badge--yellow { background: rgba(245,158,11,0.10); color: #fcd34d;  border-color: rgba(245,158,11,0.30); }
.badge--gray   { background: rgba(71,85,105,0.12);  color: #94a3b8;  border-color: rgba(71,85,105,0.25);  }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.12s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn--primary {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
  box-shadow: 0 0 14px rgba(249,115,22,0.3);
}
.btn--primary:hover {
  background: #ea6c0a;
  box-shadow: 0 0 20px rgba(249,115,22,0.45);
}
.btn--outline {
  background: transparent;
  color: var(--orange);
  border-color: rgba(249,115,22,0.4);
}
.btn--outline:hover {
  background: var(--orange-dim);
  border-color: var(--orange);
}
.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn--ghost:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
  border-color: var(--border-light);
}
.btn--danger {
  background: rgba(239,68,68,0.12);
  color: #fca5a5;
  border-color: rgba(239,68,68,0.35);
}
.btn--danger:hover {
  background: rgba(239,68,68,0.2);
}
.btn--sm { padding: 6px 12px; font-size: 0.6875rem; }
.btn--lg { padding: 12px 24px; font-size: 0.8125rem; }

/* ── Form elements ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 12px;
  background: rgba(4,6,15,0.8);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  transition: border-color 0.12s, box-shadow 0.12s;
  appearance: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: rgba(249,115,22,0.5);
  box-shadow: 0 0 0 2px rgba(249,115,22,0.08), 0 0 14px rgba(249,115,22,0.1);
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); opacity: 0.55; }
.form-textarea { min-height: 88px; resize: vertical; }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23f97316' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; cursor: pointer; }
.form-select option { background: #080c18; }

/* ── Modal ───────────────────────────────────────────────────────────────── */

/* Full-screen fixed backdrop — used by both .modal-backdrop and .modal-overlay */
.modal-backdrop,
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2,4,8,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  padding: 1rem;
}
/* legacy toggle helper — keep for backward compat */
.modal-overlay { display: none; }
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0;
  width: 100%;
  max-width: 520px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(249,115,22,0.12), 0 0 0 1px rgba(249,115,22,0.05);
}
.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
  z-index: 1;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
}
.modal-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: 0;
  text-transform: none;
  font-family: inherit;
}
.modal-body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .875rem;
  max-height: 70vh;
  overflow-y: auto;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0 4px;
  margin-left: auto;
  flex-shrink: 0;
  transition: color .15s;
}
.modal-close:hover { color: var(--text); }
.modal-sub {
  font-size: 0.875rem;
  color: var(--text-subtle);
  line-height: 1.6;
  margin-bottom: 20px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s ease;
  max-width: 320px;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
}
.toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0; width: 3px;
}
.toast--show { opacity: 1; transform: translateY(0); }
.toast--info    { border-color: var(--border-light); }
.toast--info::before    { background: var(--orange); }
.toast--success { border-color: rgba(34,197,94,0.35);  color: #86efac; }
.toast--success::before { background: #22c55e; }
.toast--error   { border-color: rgba(239,68,68,0.35);  color: #fca5a5; }
.toast--error::before   { background: #ef4444; }
.toast--warning { border-color: rgba(245,158,11,0.35); color: #fcd34d; }
.toast--warning::before { background: #f59e0b; }

/* ── Skeleton loader ─────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(249,115,22,0.04) 0%,
    rgba(249,115,22,0.08) 40%,
    rgba(249,115,22,0.04) 80%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ── View transitions ────────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);    }
}
@keyframes viewExit {
  from { opacity: 1; transform: translateY(0);    }
  to   { opacity: 0; transform: translateY(-6px); }
}
.view-enter { animation: fadeInUp 0.18s ease forwards; }
.view-exit  { animation: viewExit 0.14s ease forwards; }

/* ── Posture ring ────────────────────────────────────────────────────────── */
.posture-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: conic-gradient(
    var(--orange) calc(var(--pct, 0) * 1%),
    rgba(249,115,22,0.1) 0
  );
  box-shadow: 0 0 24px rgba(249,115,22,0.18);
}
.posture-ring::before {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--bg-card);
}
.posture-ring--danger {
  background: conic-gradient(#ef4444 calc(var(--pct) * 1%), rgba(239,68,68,0.1) 0);
  box-shadow: 0 0 24px rgba(239,68,68,0.2);
}
.posture-ring--warning {
  background: conic-gradient(#f59e0b calc(var(--pct) * 1%), rgba(245,158,11,0.1) 0);
  box-shadow: 0 0 24px rgba(245,158,11,0.2);
}
.posture-score-num {
  position: relative;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--orange);
  z-index: 1;
}

/* ── Severity bar chart ──────────────────────────────────────────────────── */
.severity-chart { display: flex; flex-direction: column; gap: 8px; }
.severity-bar-row { display: flex; align-items: center; gap: 10px; }
.severity-bar-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  width: 56px;
  flex-shrink: 0;
}
.severity-bar-track {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}
.severity-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}
.severity-bar-fill--critical { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.severity-bar-fill--high     { background: #f97316; box-shadow: 0 0 6px rgba(249,115,22,0.5); }
.severity-bar-fill--medium   { background: #f59e0b; }
.severity-bar-fill--low      { background: #22c55e; }
.severity-bar-fill--info     { background: #3b82f6; }
.severity-bar-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-subtle);
  width: 24px;
  text-align: right;
  flex-shrink: 0;
}

/* ── MITRE ATT&CK heatmap ────────────────────────────────────────────────── */
.mitre-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.mitre-cell {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 5px 3px;
  text-align: center;
  cursor: default;
  transition: border-color 0.12s;
  background: rgba(4,6,15,0.6);
}
.mitre-cell:hover { border-color: var(--border-light); }
.mitre-cell--1 { background: rgba(249,115,22,0.12); border-color: rgba(249,115,22,0.25); }
.mitre-cell--2 { background: rgba(249,115,22,0.22); border-color: rgba(249,115,22,0.40); }
.mitre-cell--3 { background: rgba(249,115,22,0.38); border-color: rgba(249,115,22,0.60); box-shadow: 0 0 8px rgba(249,115,22,0.2); }
.mitre-tactic-name {
  font-family: var(--font-mono);
  font-size: 0.45rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.2;
}
.mitre-cell--1 .mitre-tactic-name,
.mitre-cell--2 .mitre-tactic-name,
.mitre-cell--3 .mitre-tactic-name { color: var(--orange); }
.mitre-cell-count {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  margin-top: 2px;
  color: var(--orange);
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 5px;
  font-size: 0.875rem;
  margin-bottom: 16px;
  border: 1px solid;
}
.alert--error   { background: rgba(239,68,68,0.08);  border-color: rgba(239,68,68,0.3);  color: #fca5a5; }
.alert--success { background: rgba(34,197,94,0.08);  border-color: rgba(34,197,94,0.3);  color: #86efac; }
.alert--info    { background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.3); color: #93c5fd; }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes pulse-glow {
  0%,100% { box-shadow: 0 0 4px rgba(249,115,22,0.4); }
  50%      { box-shadow: 0 0 12px rgba(249,115,22,0.7); }
}

/* ── Print styles (for reports) ──────────────────────────────────────────── */
@media print {
  .dash-sidebar, .dash-topbar, #toast-container, #modal-container { display: none !important; }
  .dash-layout { display: block; }
  .dash-main   { margin: 0; }
  .dash-body   { padding: 0; }
  .card { break-inside: avoid; border: 1px solid #ddd; box-shadow: none; }
  .card::before, .card::after { display: none; }
  body { background: #fff !important; color: #111 !important; }
  .table td, .table th { border-color: #ddd; color: #111; }
  .badge { border: 1px solid #ccc; }
  .btn { display: none; }
}

/* ── Sidebar structure ───────────────────────────────────────────────────── */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo { display: flex; align-items: center; gap: 9px; }
.sidebar-logo-icon { width: 26px; height: 26px; flex-shrink: 0; }
.sidebar-logo-text {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
}
.sidebar-nav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar-section { margin-bottom: 6px; }
.sidebar-section-label {
  font-family: var(--font-mono);
  font-size: 0.525rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 8px 4px;
  opacity: 0.65;
}
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user { display: flex; align-items: center; gap: 9px; }
.sidebar-user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(249,115,22,0.12);
  border: 1px solid rgba(249,115,22,0.25);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.65rem; font-weight: 700;
  color: var(--orange); flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name {
  font-size: 0.75rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-family: var(--font-mono); font-size: 0.55rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--orange); opacity: 0.7; margin-top: 1px;
}

/* ── View headers ────────────────────────────────────────────────────────── */
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.view-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.2;
}
.view-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.5;
}

/* ── Input aliases (app.js uses .input, CSS has .form-input) ─────────────── */
.input {
  width: 100%;
  padding: 8px 12px;
  background: rgba(4,6,15,0.8);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  transition: border-color 0.12s, box-shadow 0.12s;
  appearance: none;
  -webkit-appearance: none;
}
.input:focus {
  outline: none;
  border-color: rgba(249,115,22,0.5);
  box-shadow: 0 0 0 2px rgba(249,115,22,0.08), 0 0 14px rgba(249,115,22,0.1);
}
.input::placeholder { color: var(--text-muted); opacity: 0.55; }
.input--sm { padding: 5px 9px; font-size: 0.75rem; }
.input--textarea { min-height: 80px; resize: vertical; }
.select {
  width: 100%; padding: 8px 32px 8px 12px;
  background: rgba(4,6,15,0.8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23f97316' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  border: 1px solid var(--border); border-radius: 4px;
  color: var(--text); font-family: var(--font-mono); font-size: 0.8125rem;
  appearance: none; -webkit-appearance: none; cursor: pointer;
}
.select:focus { outline: none; border-color: rgba(249,115,22,0.5); box-shadow: 0 0 0 2px rgba(249,115,22,0.08); }
.select option { background: #080c18; }

/* ── Utilities ───────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted) !important; }
.link { color: var(--orange); text-decoration: none; transition: opacity .12s; }
.link:hover { opacity: 0.8; text-decoration: underline; }
.required { color: var(--sev-critical); margin-left: 2px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; }

/* ── Toolbar / filters ───────────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.filter-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 0.7rem;
  color: var(--text-muted); margin-bottom: 14px;
}
.breadcrumb-sep { opacity: 0.35; }

/* ── Code block ──────────────────────────────────────────────────────────── */
.code-block {
  background: rgba(4,6,15,0.95);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-subtle);
  overflow-x: auto;
  white-space: pre;
  position: relative;
}

/* ── Empty / error states ────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty-state-sm {
  text-align: center; padding: 24px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty-state h3, .empty-state-sm h3 {
  font-family: var(--font-mono); font-size: 0.875rem;
  font-weight: 600; color: var(--text-subtle); margin: 0;
}
.empty-state p, .empty-state-sm p {
  font-size: 0.8rem; color: var(--text-muted); margin: 0; max-width: 320px;
}
.error-state { text-align: center; padding: 32px; color: #fca5a5; }

/* ── Skeleton loaders ────────────────────────────────────────────────────── */
.skeleton-wrap { display: flex; flex-direction: column; gap: 12px; }
.skeleton-card {
  background: linear-gradient(90deg, rgba(249,115,22,0.04) 0%, rgba(249,115,22,0.07) 40%, rgba(249,115,22,0.04) 80%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border: 1px solid var(--border); border-radius: 6px; height: 80px;
}
.skeleton-row {
  background: linear-gradient(90deg, rgba(249,115,22,0.04) 0%, rgba(249,115,22,0.07) 40%, rgba(249,115,22,0.04) 80%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: 3px; height: 14px;
}
.skeleton-bar {
  background: linear-gradient(90deg, rgba(249,115,22,0.04) 0%, rgba(249,115,22,0.07) 40%, rgba(249,115,22,0.04) 80%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: 3px; height: 8px;
}

/* ── Live capture feed ───────────────────────────────────────────────────── */
.live-feed-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden;
}
.live-indicator {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 0.65rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--orange);
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--orange); box-shadow: 0 0 6px var(--orange);
  animation: pulse-glow 2s ease infinite; flex-shrink: 0;
}
.live-feed-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid rgba(249,115,22,0.04);
  transition: background 0.12s;
}
.live-feed-item:last-child { border-bottom: none; }
.live-feed-item:hover { background: rgba(249,115,22,0.025); }
.live-feed-icon {
  width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0;
  background: rgba(249,115,22,0.08); border: 1px solid rgba(249,115,22,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; color: var(--orange);
}
.live-feed-content { flex: 1; min-width: 0; }
.live-feed-creds {
  font-family: var(--font-mono); font-size: 0.8rem;
  color: var(--text); margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.live-feed-meta {
  font-size: 0.7rem; color: var(--text-muted);
  display: flex; gap: 12px; flex-wrap: wrap;
}
.live-feed-campaign { font-family: var(--font-mono); font-size: 0.65rem; color: var(--orange); }
.live-feed-empty {
  padding: 32px 16px; text-align: center;
  font-size: 0.8rem; color: var(--text-muted);
}

/* ── Finding detail layout ───────────────────────────────────────────────── */
.finding-detail-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 16px;
  align-items: start;
}
.finding-detail-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.finding-detail-sidebar { display: flex; flex-direction: column; gap: 12px; }
.finding-title-row {
  display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.finding-title {
  font-size: 1.05rem; font-weight: 700; color: var(--text);
  line-height: 1.3; flex: 1; margin: 0;
}
.finding-meta-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 0.75rem; color: var(--text-muted);
  margin-bottom: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.meta-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.meta-item { display: flex; flex-direction: column; gap: 3px; }
.meta-label {
  font-family: var(--font-mono); font-size: 0.55rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted);
}
.meta-value { font-size: 0.8rem; font-weight: 500; color: var(--text); }
.section-block { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.section-block-title {
  font-family: var(--font-mono); font-size: 0.6rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-muted); padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(249,115,22,0.02);
}
.section-block-content { padding: 14px 16px; font-size: 0.875rem; line-height: 1.7; color: var(--text-subtle); }
.action-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Remediation status ──────────────────────────────────────────────────── */
.remediation-status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.remediation-status-item {
  background: rgba(249,115,22,0.04); border: 1px solid var(--border);
  border-radius: 5px; padding: 10px 12px; text-align: center;
}
.remediation-status-bar {
  height: 3px; border-radius: 2px; background: var(--orange);
  margin: 6px 0; transition: width .6s ease;
}
.remediation-status-label { font-family: var(--font-mono); font-size: 0.55rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.remediation-status-count { font-family: var(--font-mono); font-size: 1.1rem; font-weight: 700; color: var(--orange); }
.retest-status { font-size: 0.75rem; color: var(--text-muted); }

/* ── Comments ────────────────────────────────────────────────────────────── */
.comments-list { display: flex; flex-direction: column; gap: 10px; }
.comment-item {
  background: rgba(249,115,22,0.03); border: 1px solid var(--border);
  border-radius: 6px; padding: 12px 14px;
}
.comment-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.comment-author { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.comment-date { font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-muted); margin-left: auto; }
.comment-body { font-size: 0.875rem; color: var(--text-subtle); line-height: 1.65; }
.comment-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

/* ── API Keys ────────────────────────────────────────────────────────────── */
.api-key-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.api-key-row:last-child { border-bottom: none; }
.api-key-display {
  font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--text-subtle); background: rgba(4,6,15,0.8);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 5px 10px; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Schedule ────────────────────────────────────────────────────────────── */
.schedule-month-group { margin-bottom: 20px; }
.schedule-month-header {
  font-family: var(--font-mono); font-size: 0.65rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--orange); margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.schedule-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid rgba(249,115,22,0.04);
}
.schedule-item:last-child { border-bottom: none; }
.schedule-type-icon {
  width: 32px; height: 32px; border-radius: 6px; flex-shrink: 0;
  background: rgba(249,115,22,0.08); border: 1px solid rgba(249,115,22,0.15);
  display: flex; align-items: center; justify-content: center;
}
.schedule-item-content { flex: 1; min-width: 0; }
.schedule-item-title { font-size: 0.875rem; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.schedule-item-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Upcoming items ──────────────────────────────────────────────────────── */
.upcoming-list { display: flex; flex-direction: column; gap: 0; }
.upcoming-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid rgba(249,115,22,0.04);
}
.upcoming-item:last-child { border-bottom: none; }
.upcoming-icon {
  width: 28px; height: 28px; border-radius: 5px; flex-shrink: 0;
  background: rgba(249,115,22,0.07); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.upcoming-content { flex: 1; min-width: 0; }
.upcoming-title { font-size: 0.8125rem; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.upcoming-meta { font-size: 0.7rem; color: var(--text-muted); }

/* ── Profile page ────────────────────────────────────────────────────────── */
.profile-layout { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.profile-avatar-large {
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(249,115,22,0.1); border: 2px solid rgba(249,115,22,0.3);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 1.75rem; font-weight: 700;
  color: var(--orange); margin-bottom: 12px;
}
.profile-name { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.profile-email { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.profile-company { font-size: 0.8rem; color: var(--text-subtle); }
.profile-meta { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }

/* ── Report document ─────────────────────────────────────────────────────── */
.report-document {
  background: #0a0d1a; border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
  box-shadow: 0 0 40px rgba(0,0,0,0.5);
  max-width: 900px; margin: 0 auto;
}
.report-cover {
  background: linear-gradient(135deg, #04060f 0%, #0d1020 100%);
  padding: 48px 40px; border-bottom: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.report-cover::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
}
.report-logo { margin-bottom: 32px; }
.report-type-label {
  font-family: var(--font-mono); font-size: 0.65rem;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--orange); margin-bottom: 8px;
}
.report-meta { display: flex; flex-direction: column; gap: 6px; margin-top: 20px; }
.report-section { padding: 32px 40px; border-bottom: 1px solid var(--border); }
.report-section:last-child { border-bottom: none; }
.report-section-title {
  font-family: var(--font-mono); font-size: 0.65rem;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--orange); margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(249,115,22,0.2);
}
.report-key-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.report-stat { background: rgba(249,115,22,0.04); border: 1px solid var(--border); border-radius: 5px; padding: 12px 14px; }
.report-stat-label { font-family: var(--font-mono); font-size: 0.55rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.report-stat-num { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; color: var(--orange); }
.report-posture { display: flex; align-items: center; gap: 24px; }
.report-campaign-name { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.report-summary-row { display: flex; gap: 16px; flex-wrap: wrap; }

/* ── Home layout ─────────────────────────────────────────────────────────── */
.home-top-row { display: grid; grid-template-columns: auto 1fr; gap: 20px; margin-bottom: 20px; align-items: start; }
.home-mid-row { display: grid; grid-template-columns: 1fr 320px; gap: 16px; margin-bottom: 16px; align-items: start; }
.home-right-col { display: flex; flex-direction: column; gap: 14px; }
.home-bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat-label { font-family: var(--font-mono); font-size: 0.575rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.stat-value { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 700; color: var(--orange); }

/* ── Template picker ─────────────────────────────────────────────────────── */
.template-results { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.template-item {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 12px; border-radius: 5px; cursor: pointer;
  border: 1px solid var(--border); transition: all .12s;
  background: rgba(249,115,22,0.02);
}
.template-item:hover { border-color: var(--border-light); background: rgba(249,115,22,0.05); }
.template-item-title { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.template-item-meta { font-size: 0.7rem; color: var(--text-muted); }

/* ── Checkbox grid (template picker) ────────────────────────────────────── */
.checkbox-grid { display: flex; flex-direction: column; gap: 6px; }
.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8125rem; color: var(--text); cursor: pointer;
}
.checkbox-label input[type=checkbox] { accent-color: var(--orange); width: 14px; height: 14px; }

/* ── Empty cell (table) ──────────────────────────────────────────────────── */
.empty-cell { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.75rem; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-sidebar { display: none; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .finding-detail-layout { grid-template-columns: 1fr; }
  .home-mid-row { grid-template-columns: 1fr; }
  .home-bottom-row { grid-template-columns: 1fr; }
  .profile-layout { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr; }
  .dash-body { padding: 16px; }
  .home-top-row { grid-template-columns: 1fr; }
}
