/* ─── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  background: #F1F5F9;
  color: #1E293B;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

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

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px; flex-shrink: 0;
  background: #080E1A;
  border-right: 1px solid #1E3A5F;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
}
.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  letter-spacing: .04em;
}
.brand-v   { font-size: 18px; font-weight: 900; color: white; }
.brand-msp { font-size: 11px; font-weight: 700; color: #EF4444; margin-left: 6px;
             background: rgba(239,68,68,.12); padding: 2px 6px; border-radius: 3px; }

.sidebar-user {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.su-name { font-size: 13px; font-weight: 600; color: white; }
.su-id   { font-size: 11px; color: rgba(255,255,255,.35); margin-top: 2px; font-family: monospace; }

.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; color: rgba(255,255,255,.5);
  font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover  { background: rgba(255,255,255,.04); color: rgba(255,255,255,.85); }
.nav-item.active { background: rgba(239,68,68,.08); color: white; border-left-color: #EF4444; }
.nav-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-external { margin-top: 8px; border-top: 1px solid rgba(255,255,255,.06); padding-top: 14px; }

.sidebar-logout {
  display: block; padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.06);
  color: rgba(255,255,255,.3); font-size: 12px;
  transition: color .15s;
}
.sidebar-logout:hover { color: #EF4444; }

/* ─── Main content ────────────────────────────────────────────────────────── */
.content { margin-left: 220px; flex: 1; padding: 28px 32px; max-width: 1200px; }

.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #E2E8F0;
}
.page-header h1 { font-size: 22px; font-weight: 800; color: #080E1A; }
.page-sub { font-size: 13px; color: #64748B; margin-top: 3px; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: white; border-radius: 8px;
  border: 1px solid #E2E8F0;
  overflow: hidden; margin-bottom: 20px;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid #F1F5F9;
  display: flex; justify-content: space-between; align-items: center;
  background: #FAFAFA;
}
.card-title { font-size: 13px; font-weight: 700; color: #0D1B2A; text-transform: uppercase; letter-spacing: .05em; }
.card-body { padding: 20px; }

/* ─── Stat grid ──────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: white; border: 1px solid #E2E8F0; border-radius: 8px;
  padding: 18px 20px; border-top: 3px solid #E2E8F0;
}
.stat-card.red    { border-top-color: #EF4444; }
.stat-card.blue   { border-top-color: #3B82F6; }
.stat-card.green  { border-top-color: #10B981; }
.stat-card.orange { border-top-color: #F97316; }
.stat-num   { font-size: 28px; font-weight: 900; color: #0D1B2A; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 11px; color: #94A3B8; text-transform: uppercase; letter-spacing: .07em; }

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  background: #0D1B2A; color: white; padding: 10px 14px;
  text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}
.tbl tbody tr { border-bottom: 1px solid #F1F5F9; transition: background .12s; }
.tbl tbody tr:hover { background: #F8FAFC; }
.tbl tbody td { padding: 11px 14px; color: #334155; vertical-align: middle; }
.tbl .mono { font-family: monospace; font-size: 12px; }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.badge-green  { background: #DCFCE7; color: #15803D; }
.badge-red    { background: #FEE2E2; color: #DC2626; }
.badge-orange { background: #FFEDD5; color: #EA580C; }
.badge-blue   { background: #DBEAFE; color: #1D4ED8; }
.badge-gray   { background: #F1F5F9; color: #64748B; }
.badge-yellow { background: #FEF9C3; color: #A16207; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 600; border: none; transition: all .15s;
}
.btn-primary { background: #EF4444; color: white; }
.btn-primary:hover { background: #DC2626; }
.btn-secondary { background: #F1F5F9; color: #475569; border: 1px solid #E2E8F0; }
.btn-secondary:hover { background: #E2E8F0; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-outline { background: transparent; border: 1px solid #E2E8F0; color: #475569; }
.btn-outline:hover { border-color: #CBD5E1; background: #F8FAFC; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 6px; letter-spacing: .02em; }
.form-input {
  width: 100%; padding: 9px 12px; border: 1px solid #D1D5DB; border-radius: 6px;
  font-size: 13px; color: #1E293B; background: white; transition: border .15s;
}
.form-input:focus { outline: none; border-color: #EF4444; box-shadow: 0 0 0 3px rgba(239,68,68,.1); }
.form-hint { font-size: 11px; color: #94A3B8; margin-top: 4px; }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: 6px; font-size: 13px;
  margin-bottom: 18px; border-left: 4px solid;
}
.alert-error   { background: #FEF2F2; border-color: #EF4444; color: #B91C1C; }
.alert-success { background: #F0FDF4; border-color: #10B981; color: #065F46; }
.alert-info    { background: #EFF6FF; border-color: #3B82F6; color: #1D4ED8; }
.alert-warning { background: #FFFBEB; border-color: #F59E0B; color: #92400E; }

/* ─── Login page ─────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #080E1A 0%, #0D1B2A 100%);
}
.login-box {
  background: white; border-radius: 12px; padding: 40px;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-brand { font-size: 22px; font-weight: 900; color: #080E1A; letter-spacing: -.01em; }
.login-brand span { color: #EF4444; }
.login-tag  { font-size: 11px; color: #94A3B8; margin-top: 4px; text-transform: uppercase; letter-spacing: .1em; }
.login-title { font-size: 16px; font-weight: 700; color: #0D1B2A; margin-bottom: 20px; }

/* ─── TOTP setup ────────────────────────────────────────────────────────── */
.qr-wrap { text-align: center; margin: 20px 0; }
.qr-wrap canvas { border: 6px solid white; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,.1); }
.totp-secret { font-family: monospace; font-size: 14px; letter-spacing: .12em;
               background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 6px;
               padding: 10px 14px; text-align: center; margin: 12px 0; word-break: break-all; }

/* ─── Utility ────────────────────────────────────────────────────────────── */
.text-muted { color: #94A3B8; font-size: 12px; }
.text-mono  { font-family: monospace; font-size: 12px; }
.mt-4  { margin-top: 16px; }
.flex  { display: flex; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.update-avail { color: #EA580C; font-weight: 700; font-size: 12px; }
.empty-state { text-align: center; padding: 48px; color: #94A3B8; font-size: 14px; }

@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar .su-name, .sidebar .su-id, .nav-item span:last-child,
  .sidebar-logout, .brand-msp, .sidebar-brand .brand-v { display: none; }
  .content { margin-left: 60px; padding: 20px 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
