/* ═══════════════════════════════════════════════════════════════════════════
   CEHPOINT VPN — Admin & Portal Design System  ·  v4
   One token source · accessible contrast · refined type, elevation & motion.
   Class contract is 100% backward-compatible with the existing templates.
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;450;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── TOKENS ──────────────────────────────────────────────────────────────── */
:root {
  /* Surfaces — deep slate, layered elevation (warmer & softer than pure black) */
  --bg:          #0A0C12;
  --bg-sidebar:  #0C0F17;
  --bg-card:     #12151F;
  --bg-elevated: #171B27;
  --bg-inset:    #080A0F;
  --bg-hover:    rgba(255,255,255,0.035);

  /* Hairlines */
  --border:      rgba(255,255,255,0.075);
  --border-hi:   rgba(255,255,255,0.135);

  /* Brand — indigo-blue with a subtle gradient identity */
  --blue:        #4D82F7;
  --blue-h:      #6E9BFF;
  --blue-dim:    rgba(77,130,247,0.13);
  --blue-glow:   rgba(77,130,247,0.30);
  --brand-grad:  linear-gradient(135deg, #5B84F0 0%, #6366F1 100%);

  /* Semantic */
  --green:       #2FBF71;
  --green-dim:   rgba(47,191,113,0.12);
  --red:         #F0555F;
  --red-dim:     rgba(240,85,95,0.12);
  --amber:       #F5A524;
  --amber-dim:   rgba(245,165,36,0.13);
  --sky:         #38BDF8;
  --sky-dim:     rgba(56,189,248,0.12);

  /* Text — tuned to pass WCAG AA on --bg */
  --t1:          #EAECF3;   /* primary   ~15:1 */
  --t2:          #9BA2B2;   /* secondary ~7:1  */
  --t3:          #656D7E;   /* tertiary  ~4.6:1 */

  /* Layout & shape */
  --sidebar-w:   232px;
  --radius-sm:   7px;
  --radius:      10px;
  --radius-lg:   13px;
  --dur:         0.16s;
  --ease:        cubic-bezier(0.32, 0.72, 0, 1);

  /* Elevation — layered, subtle */
  --shadow-sm:   0 1px 2px rgba(0,0,0,0.40);
  --shadow:      0 10px 34px -8px rgba(0,0,0,0.62);
  --shadow-lg:   0 24px 60px -12px rgba(0,0,0,0.72);
  --ring:        0 0 0 3px var(--blue-glow);

  /* ── Template-compat aliases (older class/var names still in templates) ── */
  --primary: #4D82F7; --primary-h: #6E9BFF; --primary-dim: rgba(77,130,247,0.13); --primary-glow: rgba(77,130,247,0.30);
  --sidebar-bg: #0C0F17; --card-bg: #12151F; --card-hover: #171B27; --surface-2: #171B27;
  --border-light: rgba(255,255,255,0.135);
  --text: #EAECF3; --text-muted: #9BA2B2; --text-dim: #656D7E;
  --success: #2FBF71; --success-bg: rgba(47,191,113,0.12);
  --danger:  #F0555F; --danger-bg:  rgba(240,85,95,0.12);
  --warning: #F5A524; --warning-bg: rgba(245,165,36,0.13);
  --info:    #38BDF8; --info-bg:    rgba(56,189,248,0.12);
  --online:  #2FBF71; --t: 0.16s var(--ease); --mono: 'JetBrains Mono','Consolas',monospace;
  --shadow-alias: var(--shadow);
}

/* ── RESET ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14.5px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background:
    radial-gradient(920px 520px at 8% -10%, rgba(99,102,241,0.11), transparent 55%),
    radial-gradient(1050px 640px at 102% -6%, rgba(77,130,247,0.09), transparent 55%),
    radial-gradient(760px 560px at 50% 118%, rgba(47,191,113,0.045), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--t1);
  line-height: 1.55;
  min-height: 100vh;
  letter-spacing: -0.006em;
  font-feature-settings: 'cv11','ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* Fine grain overlay — kills banding on the gradients, adds a premium texture */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.layout, .login-root { position: relative; z-index: 1; }
a { color: inherit; text-decoration: none; }
input, button, select, textarea { font-family: inherit; }
img, svg { display: block; }
::selection { background: rgba(77,130,247,0.32); color: #fff; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.10); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); background-clip: content-box; }

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

/* ── SIDEBAR ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto; overflow-x: hidden;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.brand-icon {
  width: 34px; height: 34px; background: var(--brand-grad);
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 4px 14px -2px rgba(77,130,247,0.55), inset 0 1px 0 rgba(255,255,255,0.22);
}
.brand-icon svg { color: #fff; width: 17px; height: 17px; }
.brand-name { font-size: 13.5px; font-weight: 700; color: var(--t1); letter-spacing: -0.02em; }
.brand-sub { display: none; }
.brand-text h2 { font-size: 13.5px; font-weight: 700; color: var(--t1); letter-spacing: -0.02em; }
.brand-text span { display: none; }

.sidebar-nav { flex: 1; padding: 8px 10px; overflow-y: auto; }
.nav-section {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--t3); padding: 18px 8px 6px; display: block; user-select: none;
}
.nav-link, .nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  color: var(--t2); border-radius: 8px; margin-bottom: 2px;
  font-size: 13px; font-weight: 500; position: relative; line-height: 1.3;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav-link svg, .nav-item svg { flex-shrink: 0; width: 16px; height: 16px; color: var(--t3); transition: color var(--dur) var(--ease); }
.nav-link span, .nav-item span { flex: 1; }
.nav-link:hover, .nav-item:hover { color: var(--t1); background: var(--bg-hover); }
.nav-link:hover svg, .nav-item:hover svg { color: var(--t2); }
.nav-link.active, .nav-item.active {
  color: #fff; font-weight: 600;
  background: linear-gradient(90deg, rgba(77,130,247,0.20), rgba(77,130,247,0.07));
}
.nav-link.active svg, .nav-item.active svg { color: var(--blue-h); }
.nav-link.active::before, .nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 62%; background: var(--blue); border-radius: 0 3px 3px 0;
}

.sidebar-footer { border-top: 1px solid var(--border); padding: 10px; flex-shrink: 0; }
.sidebar-user {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px;
  border-radius: 8px; cursor: default; transition: background var(--dur) var(--ease);
}
.sidebar-user:hover { background: var(--bg-hover); }
.avatar-sm {
  width: 28px; height: 28px; background: var(--blue-dim);
  border: 1px solid rgba(77,130,247,0.28); border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--blue-h); flex-shrink: 0; text-transform: uppercase;
}

/* ── MAIN ────────────────────────────────────────────────────────────────── */
.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 56px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 28px; gap: 12px; flex-shrink: 0;
  background: rgba(10,12,18,0.72); backdrop-filter: blur(14px) saturate(1.4);
  position: sticky; top: 0; z-index: 50;
}
.topbar-right { display: flex; align-items: center; gap: 16px; margin-left: auto; font-size: 12px; color: var(--t3); }
.conn-status-pill {
  display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--t2);
  padding: 5px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px;
}

.content-area { padding: 28px 32px; flex: 1; max-width: 1500px; width: 100%; }

/* ── PAGE HEADER ─────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 26px; gap: 14px; flex-wrap: wrap; }
.page-header-left h1, .page-title { font-size: 24px; font-weight: 700; color: var(--t1); letter-spacing: -0.03em; line-height: 1.2; }
.page-header-left p, .page-subtitle { color: var(--t2); font-size: 13.5px; margin-top: 4px; }
.page-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── CARDS ───────────────────────────────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.028), rgba(255,255,255,0) 42%), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 18px;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.04);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border); gap: 10px; min-height: 50px;
}
.card-header-left { display: flex; align-items: center; gap: 9px; }
.card-header-left h2 { font-size: 13.5px; font-weight: 650; color: var(--t1); letter-spacing: -0.01em; }
.card-header svg { color: var(--t3); width: 15px; height: 15px; flex-shrink: 0; }
.card-header-actions { display: flex; align-items: center; gap: 7px; }
.card-body { padding: 20px; }
.card-body.p0 { padding: 0; }

/* ── STATS ───────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0) 45%), var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.045);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
/* Soft brand glow that blooms on hover */
.stat-card::after {
  content: ''; position: absolute; top: -40%; right: -20%; width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(77,130,247,0.14), transparent 70%);
  opacity: 0; transition: opacity 0.35s var(--ease); pointer-events: none;
}
.stat-card:hover { border-color: var(--border-hi); transform: translateY(-3px);
  box-shadow: 0 16px 42px -14px rgba(77,130,247,0.28), inset 0 1px 0 rgba(255,255,255,0.06); }
.stat-card:hover::after { opacity: 1; }
.stat-card-accent { display: none; }
.stat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 16px; height: 16px; stroke-width: 1.9; }
.stat-icon.primary { background: var(--blue-dim);  color: var(--blue-h); }
.stat-icon.success { background: var(--green-dim); color: var(--green); }
.stat-icon.warning { background: var(--amber-dim); color: var(--amber); }
.stat-icon.danger  { background: var(--red-dim);   color: var(--red); }
.stat-icon.info    { background: var(--sky-dim);   color: var(--sky); }
.stat-icon.online  { background: var(--green-dim); color: var(--green); }
.stat-label { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.09em; color: var(--t3); }
.stat-value { font-size: 30px; font-weight: 750; color: var(--t1); letter-spacing: -0.035em; line-height: 1.05; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.stat-value.sm { font-size: 21px; letter-spacing: -0.025em; }
.stat-value.xs { font-size: 14px; letter-spacing: -0.01em; font-weight: 600; }
.stat-detail { font-size: 12px; color: var(--t2); }
.stat-bar { height: 5px; background: rgba(255,255,255,0.06); border-radius: 4px; margin-top: 14px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 4px; transition: width 0.7s var(--ease); }
.stat-bar-fill.primary { background: linear-gradient(90deg,#4D82F7,#6366F1); }
.stat-bar-fill.success { background: var(--green); }
.stat-bar-fill.warning { background: var(--amber); }
.stat-bar-fill.danger  { background: var(--red); }
.stat-bar-fill.info    { background: var(--sky); }

/* ── TABLES ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  padding: 11px 18px; text-align: left; font-size: 10.5px; font-weight: 650;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--t3);
  border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--bg-card); position: sticky; top: 0;
}
.table td { padding: 13px 18px; border-bottom: 1px solid rgba(255,255,255,0.045); color: var(--t2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--dur) var(--ease); }
.table tbody tr:hover td { background: rgba(255,255,255,0.025); }
.table td strong { color: var(--t1); font-weight: 600; }

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 0 15px; height: 36px; border-radius: 9px;
  font-size: 12.5px; font-weight: 550; font-family: inherit; cursor: pointer;
  border: 1px solid transparent; text-decoration: none; white-space: nowrap;
  line-height: 1; letter-spacing: -0.005em; outline: none;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease),
              border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur);
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; stroke-width: 2; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: 0 3px 12px -2px rgba(77,130,247,0.5), inset 0 1px 0 rgba(255,255,255,0.18); }
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 5px 18px -3px rgba(77,130,247,0.6); }
.btn-success { background: var(--green); color: #04160C; border-color: var(--green); font-weight: 600; }
.btn-success:hover { filter: brightness(1.08); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); box-shadow: 0 3px 12px -3px rgba(240,85,95,0.5); }
.btn-danger:hover { filter: brightness(1.07); }
.btn-warning { background: var(--amber); color: #1A1204; border-color: var(--amber); font-weight: 650; }
.btn-warning:hover { filter: brightness(1.06); }
.btn-ghost { background: rgba(255,255,255,0.02); color: var(--t2); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-elevated); color: var(--t1); border-color: var(--border-hi); }
.btn-icon { padding: 0; width: 36px; height: 36px; border: 1px solid var(--border); background: rgba(255,255,255,0.02); color: var(--t3); border-radius: 9px; }
.btn-icon:hover { color: var(--t1); background: var(--bg-elevated); border-color: var(--border-hi); }
.btn-icon svg { width: 15px; height: 15px; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { height: 42px; padding: 0 22px; font-size: 14px; font-weight: 600; border-radius: 10px; }
.btn-block { width: 100%; }

/* ── BADGES ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 650; letter-spacing: 0.02em; white-space: nowrap; line-height: 1.5;
}
.badge svg { width: 11px; height: 11px; flex-shrink: 0; }
.badge-success { background: var(--green-dim); color: #57D998; }
.badge-danger  { background: var(--red-dim);   color: #F58890; }
.badge-warning { background: var(--amber-dim); color: #F7BC5C; }
.badge-info    { background: var(--sky-dim);   color: #7DD3FC; }
.badge-primary { background: var(--blue-dim);  color: var(--blue-h); }
.badge-neutral { background: rgba(255,255,255,0.055); color: var(--t2); border: 1px solid rgba(255,255,255,0.08); }

/* ── STATUS DOT ──────────────────────────────────────────────────────────── */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.online  { background: var(--green); }
.status-dot.offline { background: var(--t3); }
.status-dot.warning { background: var(--amber); }
.status-dot.pulse { animation: pulse-ring 2.4s cubic-bezier(0.4,0,0.6,1) infinite; }
@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47,191,113,0.5); }
  50%      { box-shadow: 0 0 0 6px rgba(47,191,113,0); }
}

/* ── FORMS ───────────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 550; color: var(--t2); letter-spacing: 0.005em; }
.form-group small, small, .form-hint { font-size: 11.5px; color: var(--t3); line-height: 1.45; }

.input, .select, .textarea {
  width: 100%; background: var(--bg-inset); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0 13px; height: 40px; color: var(--t1);
  font-size: 13.5px; font-family: inherit; outline: none; -webkit-appearance: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-hi); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue); box-shadow: var(--ring); background: var(--bg-card); }
.input::placeholder { color: var(--t3); }
.select { cursor: pointer; }
.textarea { height: auto; padding: 11px 13px; resize: vertical; min-height: 88px; line-height: 1.5; }
.input-with-icon { position: relative; }
.input-with-icon .input { padding-left: 38px; }
.input-with-icon .input-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--t3); pointer-events: none; display: flex; align-items: center; }
.input-with-icon .input-icon svg { width: 15px; height: 15px; }
.form-actions { display: flex; gap: 8px; padding-top: 6px; }

/* ── ALERTS ──────────────────────────────────────────────────────────────── */
.alert { display: flex; align-items: flex-start; gap: 11px; padding: 12px 15px; border-radius: var(--radius); font-size: 12.5px; line-height: 1.5; border: 1px solid transparent; margin-bottom: 15px; }
.alert svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--green-dim); border-color: rgba(47,191,113,0.22); color: #86EFAC; }
.alert-danger  { background: var(--red-dim);   border-color: rgba(240,85,95,0.22); color: #FCA5A5; }
.alert-warning { background: var(--amber-dim); border-color: rgba(245,165,36,0.22); color: #FCD34D; }
.alert-info    { background: var(--sky-dim);   border-color: rgba(56,189,248,0.22); color: #7DD3FC; }

/* ── TOASTS ──────────────────────────────────────────────────────────────── */
.flash-container { position: fixed; bottom: 22px; right: 22px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; max-width: 380px; pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 15px; border-radius: var(--radius);
  font-size: 12.5px; background: var(--bg-elevated); border: 1px solid var(--border-hi);
  box-shadow: var(--shadow); pointer-events: all; animation: toast-in 0.26s var(--ease);
}
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.toast-close { margin-left: auto; background: none; border: none; color: var(--t3); cursor: pointer; font-size: 17px; line-height: 1; padding: 0 0 0 6px; flex-shrink: 0; transition: color var(--dur); }
.toast-close:hover { color: var(--t1); }
.toast-success { border-color: rgba(47,191,113,0.28); } .toast-success svg { color: var(--green); }
.toast-error   { border-color: rgba(240,85,95,0.28); } .toast-error svg { color: var(--red); }
.toast-warning { border-color: rgba(245,165,36,0.28); } .toast-warning svg { color: var(--amber); }
.toast-info    { border-color: rgba(56,189,248,0.28); } .toast-info svg { color: var(--sky); }

/* ── TABS ────────────────────────────────────────────────────────────────── */
.tabs { display: flex; align-items: center; border-bottom: 1px solid var(--border); margin-bottom: 20px; gap: 0; }
.tab-btn {
  display: flex; align-items: center; gap: 7px; padding: 11px 16px; font-size: 12.5px; font-weight: 550;
  color: var(--t2); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer;
  font-family: inherit; margin-bottom: -1px; white-space: nowrap; transition: color var(--dur) var(--ease);
}
.tab-btn svg { width: 14px; height: 14px; }
.tab-btn:hover { color: var(--t1); }
.tab-btn.active { color: var(--blue-h); border-bottom-color: var(--blue); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade-in 0.24s var(--ease); }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ── SEARCH ──────────────────────────────────────────────────────────────── */
.search-bar { display: flex; gap: 9px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search-input-wrap { position: relative; flex: 1; min-width: 170px; }
.search-input-wrap .input { padding-left: 38px; }
.search-input-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--t3); pointer-events: none; width: 15px; height: 15px; }

/* ── AVATAR ──────────────────────────────────────────────────────────────── */
.avatar { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; text-transform: uppercase; flex-shrink: 0; border-radius: 9px; color: #fff; font-size: 13px; width: 36px; height: 36px; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; border-radius: 7px; }
.avatar-md { width: 36px; height: 36px; font-size: 13px; border-radius: 9px; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; border-radius: 13px; }

/* ── CODE / LOG ──────────────────────────────────────────────────────────── */
.log-viewer {
  font-family: var(--mono); font-size: 12px; line-height: 1.8; padding: 18px 20px;
  background: var(--bg-inset); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: auto; max-height: 56vh; white-space: pre; color: #7C8BB0;
}
.log-line-error { color: #FCA5A5; } .log-line-warn { color: #FCD34D; } .log-line-ok { color: #86EFAC; } .log-line-info { color: #7DD3FC; }
.code-block {
  font-family: var(--mono); font-size: 12.5px; background: var(--bg-inset); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 16px; overflow-x: auto; line-height: 1.7; color: #86EFAC;
  position: relative; white-space: pre;
}
.code-copy-btn {
  position: absolute; top: 9px; right: 9px; padding: 3px 9px; background: rgba(255,255,255,0.07);
  border: 1px solid var(--border); border-radius: 6px; color: var(--t2); font-size: 10.5px; cursor: pointer;
  font-family: inherit; transition: all var(--dur) var(--ease);
}
.code-copy-btn:hover { background: rgba(255,255,255,0.13); color: var(--t1); }

/* ── USER PROFILE ────────────────────────────────────────────────────────── */
.user-profile-header { display: flex; align-items: center; gap: 18px; padding: 22px; border-bottom: 1px solid var(--border); }
.user-profile-info h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.025em; }
.user-profile-info p { color: var(--t2); font-size: 13px; margin-top: 3px; }
.user-meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.user-meta-item { padding: 15px 20px; border-bottom: 1px solid rgba(255,255,255,0.045); border-right: 1px solid rgba(255,255,255,0.045); }
.user-meta-item:nth-child(even) { border-right: none; }
.user-meta-item label { display: block; font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.08em; color: var(--t3); margin-bottom: 4px; }
.user-meta-item span { font-size: 13.5px; color: var(--t2); }
.user-meta-item span.empty { color: var(--t3); font-style: italic; }

/* ── AUDIT TRAIL ─────────────────────────────────────────────────────────── */
.audit-item { display: flex; align-items: flex-start; gap: 13px; padding: 11px 20px; border-bottom: 1px solid rgba(255,255,255,0.045); font-size: 12.5px; transition: background var(--dur) var(--ease); }
.audit-item:hover { background: rgba(255,255,255,0.018); }
.audit-item:last-child { border-bottom: none; }
.audit-ts { font-family: var(--mono); font-size: 11px; color: var(--t3); white-space: nowrap; min-width: 138px; margin-top: 2px; }
.audit-action { display: inline-block; font-size: 10.5px; font-weight: 650; font-family: var(--mono); letter-spacing: 0.02em; }

/* ── MODAL ───────────────────────────────────────────────────────────────── */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(4,6,10,0.72); z-index: 200; align-items: center; justify-content: center; padding: 1rem; backdrop-filter: blur(6px); }
.modal-backdrop.open { display: flex; animation: fade-in 0.2s var(--ease); }
.modal { background: var(--bg-card); border: 1px solid var(--border-hi); border-radius: var(--radius-lg); width: 100%; max-width: 460px; box-shadow: var(--shadow-lg); animation: modal-in 0.24s var(--ease); overflow: hidden; }
@keyframes modal-in { from { transform: scale(0.96) translateY(-8px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 14.5px; font-weight: 650; letter-spacing: -0.015em; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; gap: 9px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); }

/* ── EMPTY STATE ─────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 52px 20px; }
.empty-state-icon { width: 52px; height: 52px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 13px; display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }
.empty-state-icon svg { width: 20px; height: 20px; color: var(--t3); }
.empty-state h3 { font-size: 14px; font-weight: 600; color: var(--t2); margin-bottom: 6px; }
.empty-state p { font-size: 12.5px; color: var(--t3); max-width: 300px; margin: 0 auto 16px; line-height: 1.55; }

/* ── SERVICE CONTROL ─────────────────────────────────────────────────────── */
.control-buttons { display: flex; gap: 9px; flex-wrap: wrap; }

/* ── AUTH PAGES (standalone login / portal) ──────────────────────────────── */
.login-root { display: flex; min-height: 100vh; background: var(--bg); }
.login-left {
  flex: 1; display: none; flex-direction: column; justify-content: center; padding: 4rem;
  border-right: 1px solid var(--border); background: var(--bg-sidebar); position: relative; overflow: hidden;
}
.login-left::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(77,130,247,0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(77,130,247,0.045) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse 80% 70% at 40% 45%, #000 30%, transparent 75%); pointer-events: none;
}
.login-left::after {
  content: ''; position: absolute; top: 38%; left: 40%; width: 760px; height: 760px;
  background:
    radial-gradient(circle at 32% 38%, rgba(99,102,241,0.42), transparent 52%),
    radial-gradient(circle at 70% 60%, rgba(77,130,247,0.34), transparent 52%),
    radial-gradient(circle at 52% 78%, rgba(56,189,248,0.22), transparent 54%),
    radial-gradient(circle at 60% 26%, rgba(47,191,113,0.16), transparent 55%);
  filter: blur(24px); transform: translate(-50%,-50%); pointer-events: none; mix-blend-mode: screen;
  animation: aurora 16s var(--ease) infinite alternate;
}
@keyframes aurora {
  0%   { transform: translate(-52%,-50%) rotate(0deg)   scale(1);    opacity: 0.85; }
  50%  { transform: translate(-44%,-46%) rotate(16deg)  scale(1.18); opacity: 1; }
  100% { transform: translate(-56%,-54%) rotate(-12deg) scale(1.06); opacity: 0.9; }
}
/* ambient orb behind the sign-in card */
.login-root::before {
  content: ''; position: fixed; right: -140px; top: 30%; width: 460px; height: 460px; z-index: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(77,130,247,0.12), transparent 65%);
  filter: blur(10px); animation: aurora 20s var(--ease) infinite alternate-reverse;
}
.login-card-wrap { position: relative; z-index: 1; }
.login-card-wrap { width: 452px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; padding: 2.5rem 2rem; background: var(--bg); }
.login-card { width: 100%; max-width: 372px; }
.login-logo { width: 52px; height: 52px; background: var(--brand-grad); border-radius: 14px; display: flex; align-items: center; justify-content: center; margin-bottom: 26px; box-shadow: 0 8px 24px -4px rgba(77,130,247,0.55), inset 0 1px 0 rgba(255,255,255,0.22); }
.login-logo svg { color: #fff; width: 25px; height: 25px; }
.login-card h1 { font-size: 24px; font-weight: 750; letter-spacing: -0.035em; margin-bottom: 5px; color: var(--t1); }
.login-card > p { color: var(--t2); font-size: 14px; margin-bottom: 30px; line-height: 1.5; }
.login-footer { text-align: center; margin-top: 24px; color: var(--t3); font-size: 11px; line-height: 1.7; }

/* ── SIDEBAR TOGGLE ──────────────────────────────────────────────────────── */
.sidebar-toggle { display: none; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; background: rgba(255,255,255,0.02); border: 1px solid var(--border); color: var(--t2); cursor: pointer; flex-shrink: 0; transition: all var(--dur) var(--ease); }
.sidebar-toggle:hover { border-color: var(--border-hi); color: var(--t1); }
.sidebar-toggle svg { width: 15px; height: 15px; }

/* ── MISC ────────────────────────────────────────────────────────────────── */
.score-ring { display: flex; justify-content: center; }

/* ── UTILITIES ───────────────────────────────────────────────────────────── */
.text-muted { color: var(--t2); }
.text-dim { color: var(--t3); }
.text-success { color: var(--green) !important; }
.text-danger { color: var(--red) !important; }
.text-warning { color: var(--amber) !important; }
.text-info { color: var(--sky) !important; }
.text-primary { color: var(--blue-h) !important; }
.font-mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.font-bold { font-weight: 700; }
.fw-600 { font-weight: 600; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.flex { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.ml-auto { margin-left: auto; }
.inline-form { display: inline; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ══ PREMIUM / MOTION LAYER ══════════════════════════════════════════════════ */

/* Staged entrance — content rises in as the page settles */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.content-area > .stats-grid > .stat-card,
.content-area > .card,
.content-area > .mon-charts > .card,
.content-area > .page-header { animation: rise 0.5s var(--ease) both; }
.content-area > .page-header { animation-delay: 0.02s; }
.stats-grid > .stat-card:nth-child(1) { animation-delay: 0.05s; }
.stats-grid > .stat-card:nth-child(2) { animation-delay: 0.10s; }
.stats-grid > .stat-card:nth-child(3) { animation-delay: 0.15s; }
.stats-grid > .stat-card:nth-child(4) { animation-delay: 0.20s; }
.stats-grid > .stat-card:nth-child(5) { animation-delay: 0.25s; }
.content-area > .card { animation-delay: 0.22s; }
.content-area > .mon-charts > .card:nth-child(2) { animation-delay: 0.30s; }

/* Stat icons get a soft matching glow */
.stat-icon.primary { box-shadow: 0 6px 18px -6px rgba(77,130,247,0.55); }
.stat-icon.success { box-shadow: 0 6px 18px -6px rgba(47,191,113,0.5); }
.stat-icon.warning { box-shadow: 0 6px 18px -6px rgba(245,165,36,0.5); }
.stat-icon.danger  { box-shadow: 0 6px 18px -6px rgba(240,85,95,0.5); }
.stat-icon.info    { box-shadow: 0 6px 18px -6px rgba(56,189,248,0.5); }

/* Primary button: light sweep on hover */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::before {
  content: ''; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.28) 50%, transparent 70%);
  transition: transform 0.6s var(--ease);
}
.btn-primary:hover::before { transform: translateX(120%); }

/* Active nav glows */
.nav-link.active, .nav-item.active { box-shadow: inset 0 0 0 1px rgba(77,130,247,0.12); }
.nav-link.active svg, .nav-item.active svg { filter: drop-shadow(0 0 6px rgba(110,155,255,0.5)); }

/* Brand mark breathes very slowly */
@keyframes brand-glow { 0%,100% { box-shadow: 0 4px 14px -2px rgba(77,130,247,0.45), inset 0 1px 0 rgba(255,255,255,0.22); }
                        50% { box-shadow: 0 6px 22px -2px rgba(99,102,241,0.65), inset 0 1px 0 rgba(255,255,255,0.22); } }
.brand-icon, .login-logo { animation: brand-glow 4.5s ease-in-out infinite; }

/* Rows & nav links ease on hover */
.table tbody tr:hover td { box-shadow: inset 3px 0 0 -1px var(--blue); }
.nav-link, .nav-item { transition: color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease); }
.nav-link:hover, .nav-item:hover { transform: translateX(2px); }

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */
@media (min-width: 900px) {
  .login-left { display: flex; }
  .login-card-wrap { padding: 3rem 2.75rem; }
}
@media (max-width: 768px) {
  .sidebar { position: fixed; left: calc(-1 * var(--sidebar-w)); top: 0; height: 100vh; z-index: 200; transition: left 0.26s var(--ease); box-shadow: var(--shadow-lg); }
  .sidebar.open { left: 0; }
  .sidebar-toggle { display: flex; }
  .content-area { padding: 18px; }
  .topbar { padding: 0 18px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .login-card-wrap { width: 100%; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .page-header-left h1, .page-title { font-size: 20px; }
}
/* ══ CHARTS / MONITORING ═════════════════════════════════════════════════════ */
.mon-charts { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 18px; }
@media (max-width: 1100px) { .mon-charts { grid-template-columns: 1fr; } }
.mon-legend { display: flex; gap: 16px; align-items: center; }
.mon-leg { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--t2); }
.mon-leg i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.viz { --grid: rgba(255,255,255,0.07); }
.viz svg { width: 100%; height: auto; display: block; }
.viz .gl { stroke: var(--grid); stroke-width: 1; }
.viz .ax { fill: var(--t3); font-size: 9.5px; font-family: var(--mono); }
.viz .axv { fill: var(--t3); font-size: 9px; font-family: var(--mono); }
.mon-tip { position: fixed; z-index: 999; pointer-events: none; background: var(--bg-elevated);
  border: 1px solid var(--border-hi); border-radius: 8px; padding: 8px 10px; font-size: 11.5px;
  box-shadow: var(--shadow); opacity: 0; transition: opacity 0.1s; min-width: 120px; }
.mon-tip .tt-d { color: var(--t3); font-size: 10px; margin-bottom: 5px; font-family: var(--mono); }
.mon-tip .tt-r { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 2px; }
.mon-tip .tt-r b { color: var(--t1); font-variant-numeric: tabular-nums; }
.mon-tip .tt-r span { display: flex; align-items: center; gap: 5px; color: var(--t2); }
.mon-tip .dot { width: 8px; height: 8px; border-radius: 2px; }
.ev-row { display: flex; align-items: flex-start; gap: 11px; padding: 11px 18px; border-bottom: 1px solid rgba(255,255,255,0.045); }
.ev-row:last-child { border-bottom: none; }
.ev-ico { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ev-ico svg { width: 14px; height: 14px; }
.ev-good { background: rgba(12,163,12,0.14); } .ev-good svg { stroke: #3DD35B; }
.ev-warning { background: var(--amber-dim); } .ev-warning svg { stroke: #F7BC5C; }
.ev-serious { background: rgba(236,131,90,0.14); } .ev-serious svg { stroke: #EC835A; }
.ev-critical { background: var(--red-dim); } .ev-critical svg { stroke: #F58890; }
.ev-info { background: var(--blue-dim); } .ev-info svg { stroke: var(--blue-h); }
.ev-body { flex: 1; min-width: 0; } .ev-title { font-size: 12.5px; color: var(--t1); font-weight: 550; }
.ev-meta { font-size: 11px; color: var(--t3); margin-top: 2px; font-family: var(--mono); }
.ipbar-row { display: flex; align-items: center; gap: 10px; padding: 8px 18px; }
.ipbar-ip { font-family: var(--mono); font-size: 11.5px; color: var(--t2); width: 110px; flex-shrink: 0; }
.ipbar-track { flex: 1; height: 8px; background: rgba(255,255,255,0.05); border-radius: 4px; overflow: hidden; }
.ipbar-fill { height: 100%; background: linear-gradient(90deg,#4D82F7,#6366F1); border-radius: 4px; }
.ipbar-n { font-size: 11.5px; color: var(--t2); width: 26px; text-align: right; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
