/* ============================================================
   SecureNet NIDS — Global Stylesheet
   Banking-grade dark cybersecurity theme
   ============================================================ */

/* ── Variables ──────────────────────────────────────────── */
:root {
  --bg:          #050b1f;
  --bg2:         #0a1229;
  --bg3:         #0d1635;
  --card:        rgba(13,22,53,0.7);
  --card-border: rgba(14,165,233,0.15);
  --accent:      #0ea5e9;
  --accent2:     #38bdf8;
  --purple:      #8b5cf6;
  --green:       #10b981;
  --yellow:      #f59e0b;
  --red:         #ef4444;
  --orange:      #f97316;
  --cyan:        #06b6d4;
  --text:        #f1f5f9;
  --text2:       #94a3b8;
  --text3:       #475569;
  --sidebar-w:   260px;
  --sidebar-collapsed-w: 64px;
  --header-h:    64px;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px rgba(14,165,233,0.2);
  --transition:  all 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent2); }
img { max-width: 100%; }
button { cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── Typography ─────────────────────────────────────────── */
h1 { font-size: 1.9rem; font-weight: 700; }
h2 { font-size: 1.45rem; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; }
p  { line-height: 1.65; color: var(--text2); }

/* ── Layout ─────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: linear-gradient(180deg, #07102a 0%, #0a1530 100%);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: width 0.28s cubic-bezier(0.4,0,0.2,1),
              transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}

/* ── Collapse toggle button ── */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text3);
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
  margin-left: auto;
}
.sidebar-collapse-btn:hover { background: rgba(14,165,233,0.15); color: var(--accent); border-color: var(--accent); }
.sidebar-collapse-btn svg { width: 13px; height: 13px; transition: transform 0.28s; }

/* ── Collapsed state ── */
.sidebar.collapsed { width: var(--sidebar-collapsed-w); }

.sidebar.collapsed .logo-text         { display: none; }
.sidebar.collapsed .nav-section-label { display: none; }
.sidebar.collapsed .nav-item-label    { display: none; }
.sidebar.collapsed .nav-badge         { display: none; }
.sidebar.collapsed .live-tag          { display: none; }
.sidebar.collapsed .user-info         { display: none; }
.sidebar.collapsed .logout-btn        { display: none; }

.sidebar.collapsed .sidebar-logo {
  padding: 20px 12px 16px;
  justify-content: center;
}
.sidebar.collapsed .sidebar-collapse-btn {
  margin: 0;
}
.sidebar.collapsed .nav-item {
  padding: 11px;
  justify-content: center;
  gap: 0;
}
.sidebar.collapsed .nav-item.active::before { display: none; }
.sidebar.collapsed .nav-item.active {
  border-radius: 8px;
  margin: 0 8px;
}
.sidebar.collapsed .nav-item:hover { border-radius: 8px; margin: 0 8px; }
.sidebar.collapsed .nav-section { padding: 0 4px; }
.sidebar.collapsed .sidebar-footer {
  padding: 14px 0;
  justify-content: center;
  gap: 0;
}

/* Tooltip on collapsed icons */
.sidebar.collapsed .nav-item {
  position: relative;
}
.sidebar.collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%; transform: translateY(-50%);
  background: #0d1635;
  border: 1px solid var(--card-border);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 200;
  box-shadow: var(--shadow);
}
.sidebar.collapsed .nav-item:hover::after { opacity: 1; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.logo-shield {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}
.logo-text .brand { display: block; font-weight: 800; font-size: 1.05rem; color: var(--text); }
.logo-text .tagline { display: block; font-size: 0.7rem; color: var(--text3); letter-spacing: 0.05em; text-transform: uppercase; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 4px; }

.nav-section { margin-bottom: 8px; }
.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 10px 20px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 20px;
  color: var(--text2);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  position: relative;
}
.nav-item:hover {
  color: var(--text);
  background: rgba(14,165,233,0.08);
}
.nav-item.active {
  color: var(--accent);
  background: rgba(14,165,233,0.12);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}
.nav-item .live-tag {
  margin-left: auto;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--green);
  border: 1px solid var(--green);
  padding: 1px 5px;
  border-radius: 4px;
}

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-email { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { display: block; font-size: 0.68rem; color: var(--text3); }
.logout-btn {
  color: var(--text3);
  background: none; border: none;
  display: flex; align-items: center;
  transition: var(--transition);
  padding: 4px;
  border-radius: 6px;
}
.logout-btn:hover { color: var(--red); background: rgba(239,68,68,0.1); }
.logout-btn svg { width: 16px; height: 16px; }

/* ── Main area ───────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.28s cubic-bezier(0.4,0,0.2,1);
}
.main.collapsed { margin-left: var(--sidebar-collapsed-w); }

/* ── Header ──────────────────────────────────────────────── */
.header {
  height: var(--header-h);
  background: rgba(5,11,31,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.menu-btn {
  display: none;
  background: none; border: none;
  color: var(--text2);
  padding: 6px;
  border-radius: 8px;
  transition: var(--transition);
}
.menu-btn:hover { background: var(--bg3); color: var(--text); }
.menu-btn svg { width: 20px; height: 20px; }
.page-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.breadcrumb { display: flex; align-items: center; gap: 8px; }
.breadcrumb-sep { color: var(--text3); font-size: 0.8rem; }
.breadcrumb-item { font-size: 0.82rem; color: var(--text3); }
.breadcrumb-item.active { color: var(--text); font-weight: 600; }

.header-right { display: flex; align-items: center; gap: 16px; }
.system-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.75rem; color: var(--green); font-weight: 600;
}
.pulse-dot {
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.85); }
}
.header-time { font-size: 0.78rem; color: var(--text3); font-variant-numeric: tabular-nums; }
.notif-btn {
  position: relative; background: none; border: none;
  color: var(--text2); padding: 6px; border-radius: 8px;
  transition: var(--transition);
}
.notif-btn:hover { background: var(--bg3); color: var(--text); }
.notif-btn svg { width: 18px; height: 18px; }
.notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 7px; height: 7px;
  background: var(--red); border-radius: 50%;
  border: 1.5px solid var(--bg);
}

/* ── Content area ────────────────────────────────────────── */
.content {
  flex: 1;
  padding: 28px 28px 40px;
  max-width: 1600px;
  width: 100%;
}

/* ── Flash messages ──────────────────────────────────────── */
.flash-container { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  animation: slideDown 0.3s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.flash-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3); color: #34d399; }
.flash-error   { background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.3);  color: #f87171; }
.flash-otp_demo { background: rgba(14,165,233,0.12); border: 1px solid rgba(14,165,233,0.35); color: var(--accent2); font-family: monospace; font-size: 0.9rem; font-weight: 600; }
.flash-info    { background: rgba(139,92,246,0.12); border: 1px solid rgba(139,92,246,0.3); color: #a78bfa; }
.flash svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.flash-close { margin-left: auto; background: none; border: none; color: inherit; opacity: 0.6; font-size: 1.1rem; padding: 0 2px; }
.flash-close:hover { opacity: 1; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.card:hover { border-color: rgba(14,165,233,0.25); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 0;
  margin-bottom: 16px;
}
.card-title { font-size: 0.9rem; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card-title svg { width: 16px; height: 16px; color: var(--accent); }
.card-body { padding: 0 20px 20px; }
.card-body-full { padding: 20px; }

/* ── Stat cards ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px 20px;
  display: flex; align-items: flex-start; gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.blue::after  { background: linear-gradient(90deg, var(--accent), var(--cyan)); }
.stat-card.green::after { background: linear-gradient(90deg, var(--green), #34d399); }
.stat-card.red::after   { background: linear-gradient(90deg, var(--red), var(--orange)); }
.stat-card.purple::after{ background: linear-gradient(90deg, var(--purple), #a78bfa); }
.stat-card.yellow::after{ background: linear-gradient(90deg, var(--yellow), #fbbf24); }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.5); }

.stat-icon {
  width: 46px; height: 46px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue   { background: rgba(14,165,233,0.15); color: var(--accent); }
.stat-icon.green  { background: rgba(16,185,129,0.15); color: var(--green); }
.stat-icon.red    { background: rgba(239,68,68,0.15);  color: var(--red); }
.stat-icon.purple { background: rgba(139,92,246,0.15); color: var(--purple); }
.stat-icon.yellow { background: rgba(245,158,11,0.15); color: var(--yellow); }
.stat-icon.orange { background: rgba(249,115,22,0.15); color: var(--orange); }

.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.78rem; color: var(--text3); margin-top: 4px; }
.stat-change { font-size: 0.72rem; margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.stat-change.up   { color: var(--green); }
.stat-change.down { color: var(--red); }
.stat-change svg  { width: 12px; height: 12px; }

/* ── Chart grids ─────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.chart-wrapper { position: relative; height: 280px; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.825rem;
}
thead th {
  background: rgba(14,165,233,0.06);
  color: var(--text3);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 11px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--card-border);
}
tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: var(--transition);
}
tbody tr:hover { background: rgba(14,165,233,0.04); }
tbody td { padding: 11px 14px; color: var(--text2); }
tbody td.mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 0.78rem; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; white-space: nowrap;
}
.badge-critical { background: rgba(239,68,68,0.15);  color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.badge-high     { background: rgba(249,115,22,0.15); color: #fb923c; border: 1px solid rgba(249,115,22,0.3); }
.badge-medium   { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-low      { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-benign   { background: rgba(14,165,233,0.1);  color: var(--accent2); border: 1px solid rgba(14,165,233,0.2); }
.badge-open     { background: rgba(239,68,68,0.12);  color: #f87171; }
.badge-resolved { background: rgba(16,185,129,0.12); color: #34d399; }
.badge-info     { background: rgba(139,92,246,0.12); color: #a78bfa; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.825rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0284c7);
  color: #fff;
  box-shadow: 0 4px 14px rgba(14,165,233,0.3);
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(14,165,233,0.4); }
.btn-secondary { background: var(--bg3); color: var(--text2); border: 1px solid var(--card-border); }
.btn-secondary:hover { background: var(--bg2); color: var(--text); }
.btn-danger { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-success { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.btn-success:hover { background: rgba(16,185,129,0.25); }
.btn-sm { padding: 5px 12px; font-size: 0.75rem; }
.btn-icon { padding: 7px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.form-input, .form-select {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  padding: 10px 14px;
  transition: var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  background: rgba(14,165,233,0.06);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}
.form-input::placeholder { color: var(--text3); }
.form-select option { background: var(--bg3); color: var(--text); }

/* ── Search bar ──────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  flex: 1;
}
.search-bar svg { width: 16px; height: 16px; color: var(--text3); flex-shrink: 0; }
.search-bar input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 0.875rem;
  width: 100%; padding: 10px 0;
}
.search-bar input::placeholder { color: var(--text3); }

/* ── Toolbar ─────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px; flex-wrap: wrap;
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 6px;
  justify-content: center;
  margin-top: 20px;
}
.page-btn {
  min-width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 600;
  border: 1px solid var(--card-border);
  background: transparent; color: var(--text2);
  transition: var(--transition);
}
.page-btn:hover, .page-btn.active {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
}

/* ── Progress bars ───────────────────────────────────────── */
.progress { background: rgba(255,255,255,0.06); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; transition: width 0.6s ease; }
.progress-bar.blue   { background: linear-gradient(90deg, var(--accent), var(--cyan)); }
.progress-bar.green  { background: linear-gradient(90deg, var(--green), #34d399); }
.progress-bar.red    { background: linear-gradient(90deg, var(--red), var(--orange)); }
.progress-bar.purple { background: linear-gradient(90deg, var(--purple), #a78bfa); }
.progress-bar.yellow { background: linear-gradient(90deg, var(--yellow), #fbbf24); }

/* ── Live feed ───────────────────────────────────────────── */
.live-feed { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; }
.live-feed::-webkit-scrollbar { width: 4px; }
.live-feed::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 4px; }
.feed-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  border-left: 3px solid transparent;
  transition: var(--transition);
  animation: fadeIn 0.4s ease;
}
.feed-item.benign  { border-left-color: var(--green); }
.feed-item.attack  { border-left-color: var(--red); }
.feed-item.medium  { border-left-color: var(--yellow); }
.feed-ip { font-family: monospace; font-size: 0.78rem; color: var(--text2); min-width: 110px; }
.feed-label { font-size: 0.75rem; font-weight: 700; }
.feed-conf { font-size: 0.72rem; color: var(--text3); margin-left: auto; }
.feed-time { font-size: 0.7rem; color: var(--text3); }

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

/* ── Section header ──────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.section-title { font-size: 1.05rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.section-title svg { width: 18px; height: 18px; color: var(--accent); }

/* ── Model metric cards ──────────────────────────────────── */
.model-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.model-card { padding: 20px; border-radius: var(--radius); }
.model-name { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.model-badge { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.metric-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.metric-label { font-size: 0.8rem; color: var(--text3); }
.metric-value { font-size: 0.88rem; font-weight: 700; color: var(--text); }

/* ── Feature importance bars ─────────────────────────────── */
.fi-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.fi-label { font-size: 0.75rem; color: var(--text2); min-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fi-bar-wrap { flex: 1; }
.fi-value { font-size: 0.72rem; color: var(--text3); min-width: 45px; text-align: right; }

/* ── Login page ──────────────────────────────────────────── */
.auth-bg {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.auth-bg::before {
  content: '';
  position: absolute;
  top: -200px; left: -200px;
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(14,165,233,0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.auth-bg::after {
  content: '';
  position: absolute;
  bottom: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(139,92,246,0.07) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 40px 36px;
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  position: relative;
  z-index: 1;
}
.auth-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 28px;
}
.auth-shield {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  box-shadow: 0 8px 24px rgba(14,165,233,0.35);
}
.auth-brand { font-size: 1.4rem; font-weight: 800; color: var(--text); }
.auth-tagline { font-size: 0.72rem; color: var(--text3); letter-spacing: 0.06em; text-transform: uppercase; }
.auth-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 6px; }
.auth-sub   { font-size: 0.85rem; color: var(--text2); margin-bottom: 28px; }
.auth-submit {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), #0284c7);
  color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 13px;
  font-size: 0.9rem; font-weight: 700;
  cursor: pointer; transition: var(--transition);
  box-shadow: 0 4px 16px rgba(14,165,233,0.3);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.auth-submit:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 6px 24px rgba(14,165,233,0.4); }
.auth-submit svg { width: 16px; height: 16px; }

/* OTP input boxes */
.otp-grid {
  display: grid;
  grid-template-columns: repeat(6, 44px);
  gap: 8px;
  margin-bottom: 24px;
  justify-content: center;
}
.otp-input {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 800;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--text);
  outline: none;
  transition: var(--transition);
  caret-color: var(--accent);
  padding: 0;
}
.otp-input:focus { border-color: var(--accent); background: rgba(14,165,233,0.08); box-shadow: 0 0 0 3px rgba(14,165,233,0.15); }
.otp-input.filled { border-color: var(--accent); color: var(--accent); }
.resend-row { display: flex; align-items: center; justify-content: space-between; font-size: 0.82rem; margin-top: 14px; }
.resend-timer { color: var(--text3); }
.resend-btn {
  background: none; border: none;
  color: var(--accent); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  padding: 0;
}
.resend-btn:hover { color: var(--accent2); }

/* ── Overlay ─────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ── Utility ─────────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }
.mb-4 { margin-bottom: 24px; }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.72rem; }
.text-muted { color: var(--text3); }
.text-accent { color: var(--accent); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-purple { color: var(--purple); }
.mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.rounded { border-radius: var(--radius); }

/* ── Divider ─────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid rgba(255,255,255,0.06); margin: 16px 0; }

/* ── Scrollable areas ────────────────────────────────────── */
.scroll-y { overflow-y: auto; }
.scroll-y::-webkit-scrollbar { width: 4px; }
.scroll-y::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 4px; }

/* ── Tooltip ─────────────────────────────────────────────── */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--bg3); color: var(--text); font-size: 0.72rem; white-space: nowrap;
  padding: 4px 10px; border-radius: 6px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
[data-tip]:hover::after { opacity: 1; }

/* ── Error page ──────────────────────────────────────────── */
.error-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; text-align: center; }
.error-code { font-size: 6rem; font-weight: 900; color: var(--accent); opacity: 0.15; line-height: 1; }
.error-msg  { font-size: 1.5rem; font-weight: 700; margin-top: -20px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .charts-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,0.6);
  }
  .sidebar-overlay.active { display: block; }
  .main { margin-left: 0; }
  .menu-btn { display: flex; }
  .content { padding: 18px 16px 32px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .auth-card { margin: 16px; padding: 28px 20px; }
  .toolbar { flex-wrap: wrap; }
  .system-status { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
  .stat-value { font-size: 1.45rem; }
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spin { animation: spin 1s linear infinite; }

@keyframes glow {
  0%, 100% { box-shadow: 0 0 8px rgba(14,165,233,0.3); }
  50%       { box-shadow: 0 0 20px rgba(14,165,233,0.6); }
}
.glow { animation: glow 2.5s ease-in-out infinite; }

/* ── Scrollbar (global) ──────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Loading skeleton ────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, rgba(255,255,255,0.04) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
