/* ═══════════════════════════════════════════════════════════════════════════════
   NV-Sockets Admin Console
   Plus Jakarta Sans · Indigo · Command-grade dashboard
   ═══════════════════════════════════════════════════════════════════════════════ */

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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Tokens ──────────────────────────────────────────────────────────────────── */
:root {
  --bg:         #080f1e;
  --surface:    #0f1729;
  --surface2:   #162036;
  --surface3:   #1c2840;
  --border:     #1e2e42;
  --border2:    #253650;

  --accent:       #6366f1;
  --accent-h:     #818cf8;
  --accent-soft:  #a5b4fc;
  --accent-dim:   rgba(99,102,241,.14);
  --accent-glow:  rgba(99,102,241,.32);
  --accent-line:  rgba(99,102,241,.3);

  --green:        #10b981;  --green-dim:  rgba(16,185,129,.13);
  --red:          #ef4444;  --red-dim:    rgba(239,68,68,.13);
  --yellow:       #f59e0b;  --yellow-dim: rgba(245,158,11,.13);
  --blue:         #3b82f6;  --blue-dim:   rgba(59,130,246,.13);
  --purple:       #a855f7;  --purple-dim: rgba(168,85,247,.13);

  --text:   #dde8f4;
  --text2:  #8baab8;
  --text3:  #4e6b7e;

  --sans: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  --r-sm:  6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,.35);
  --shadow:    0 4px 24px rgba(0,0,0,.5);
  --shadow-lg: 0 12px 48px rgba(0,0,0,.65);
  --glow-accent: 0 0 20px rgba(99,102,241,.25);
  --glow-green:  0 0 16px rgba(16,185,129,.2);

  --sidebar-w: 240px;
  --header-h:  60px;
}

/* ── Base ────────────────────────────────────────────────────────────────────── */
html, body {
  height: 100%;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.hidden   { display: none !important; }
.sr-only  { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.flex     { display: flex; }
.col      { flex-direction: column; }
.items-c  { align-items: center; }
.gap-1    { gap: 4px; }
.gap-2    { gap: 8px; }
.gap-3    { gap: 12px; }
.gap-4    { gap: 16px; }
.muted    { color: var(--text2); }
.mono     { font-family: var(--mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full   { width: 100%; }
.text-xs  { font-size: 11px; }
.text-sm  { font-size: 12px; }
.bold     { font-weight: 600; }
.semibold { font-weight: 500; }
.mt-1     { margin-top: 4px; }
.mt-2     { margin-top: 8px; }
.mt-3     { margin-top: 12px; }
.mb-2     { margin-bottom: 8px; }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 3px 9px;
  border-radius: 99px; font-size: 10px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; white-space: nowrap;
  font-family: var(--sans);
}
.badge-active     { background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(16,185,129,.2); }
.badge-inactive   { background: var(--red-dim);    color: var(--red);    border: 1px solid rgba(239,68,68,.2); }
.badge-free       { background: var(--surface3);   color: var(--text2);  border: 1px solid var(--border2); }
.badge-starter    { background: var(--blue-dim);   color: var(--blue);   border: 1px solid rgba(59,130,246,.2); }
.badge-pro        { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(168,85,247,.2); }
.badge-enterprise { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(245,158,11,.2); }
.badge-public     { background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(16,185,129,.2); }
.badge-private    { background: var(--blue-dim);   color: var(--blue);   border: 1px solid rgba(59,130,246,.2); }
.badge-presence   { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(168,85,247,.2); }
.badge-org        { background: var(--accent-dim); color: var(--accent-soft); border: 1px solid var(--accent-line); }

/* ── Forms ──────────────────────────────────────────────────────────────────── */
label {
  display: block; font-size: 11px; font-weight: 600; color: var(--text2);
  margin-bottom: 6px; letter-spacing: .03em;
}
.form-group { margin-bottom: 16px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

input, select, textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  padding: 9px 13px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--sans);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) {
  border-color: var(--text3);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  background: var(--surface3);
  box-shadow: 0 0 0 3px var(--accent-dim), 0 1px 4px rgba(0,0,0,.3);
}
input::placeholder, textarea::placeholder { color: var(--text3); }
select option { background: var(--surface2); }
textarea { resize: vertical; min-height: 90px; font-family: var(--mono); font-size: 12px; line-height: 1.6; }

.input-group { position: relative; }
.input-group input { padding-right: 42px; }
.input-suffix {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text3); cursor: pointer; font-size: 15px;
  user-select: none; transition: color .15s;
}
.input-suffix:hover { color: var(--text); }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
button {
  cursor: pointer; border: none; border-radius: var(--r-md);
  padding: 9px 18px; font-size: 13px; font-family: var(--sans);
  font-weight: 600; display: inline-flex; align-items: center; gap: 7px;
  transition: all .15s; white-space: nowrap; letter-spacing: .01em;
}
button:active:not(:disabled) { transform: scale(.97); }
button:disabled { opacity: .38; cursor: not-allowed; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99,102,241,.3);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-h) 0%, #8b5cf6 100%);
  box-shadow: 0 6px 20px rgba(99,102,241,.45);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { transform: scale(.97) translateY(0); }

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text2);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent-line); color: var(--accent-soft); background: var(--accent-dim);
}

.btn-ghost { background: transparent; color: var(--text2); padding: 7px 12px; }
.btn-ghost:hover:not(:disabled) { background: var(--surface2); color: var(--text); }

.btn-danger {
  background: var(--red-dim); color: var(--red);
  border: 1px solid rgba(239,68,68,.2);
}
.btn-danger:hover:not(:disabled) {
  background: var(--red); color: #fff; border-color: var(--red);
  box-shadow: 0 4px 14px rgba(239,68,68,.35);
}

.btn-warning {
  background: var(--yellow-dim); color: var(--yellow);
  border: 1px solid rgba(245,158,11,.2);
}
.btn-warning:hover:not(:disabled) {
  background: var(--yellow); color: #000; border-color: var(--yellow);
}

.btn-icon { padding: 8px; border-radius: var(--r-md); }
.btn-sm   { padding: 6px 12px; font-size: 12px; border-radius: var(--r-sm); }
.btn-xs   { padding: 4px 8px;  font-size: 11px; border-radius: 5px; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(99,102,241,.05) 0%, transparent 60%);
}
.card-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px; letter-spacing: -.01em;
}
.card-body  { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.table-wrap { overflow: auto; max-height: 480px; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--surface2);
  color: var(--text3); font-size: 11px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  padding: 11px 16px;
  text-align: left; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(30,46,66,.7);
  vertical-align: middle; transition: background .1s;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td {
  background: rgba(99,102,241,.05);
}
tbody tr:hover td:first-child {
  box-shadow: inset 2px 0 0 var(--accent);
}
.col-actions { width: 1px; white-space: nowrap; }

/* ── Stat cards ─────────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,.5);
}
/* Colored top stripe per card */
.stat-card:nth-child(1) { border-top: 2px solid var(--accent); }
.stat-card:nth-child(2) { border-top: 2px solid var(--green); }
.stat-card:nth-child(3) { border-top: 2px solid var(--blue); }
.stat-card:nth-child(4) { border-top: 2px solid var(--yellow); }

/* Subtle glow behind icon */
.stat-card::before {
  content: '';
  position: absolute; top: -30px; right: -20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  opacity: .08; pointer-events: none;
}
.stat-card:nth-child(1)::before { background: var(--accent); }
.stat-card:nth-child(2)::before { background: var(--green); }
.stat-card:nth-child(3)::before { background: var(--blue); }
.stat-card:nth-child(4)::before { background: var(--yellow); }

.stat-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.stat-icon-wrap {
  width: 42px; height: 42px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.stat-card:nth-child(1) .stat-icon-wrap { background: var(--accent-dim); box-shadow: 0 4px 12px rgba(99,102,241,.2); }
.stat-card:nth-child(2) .stat-icon-wrap { background: var(--green-dim);  box-shadow: 0 4px 12px rgba(16,185,129,.15); }
.stat-card:nth-child(3) .stat-icon-wrap { background: var(--blue-dim);   box-shadow: 0 4px 12px rgba(59,130,246,.15); }
.stat-card:nth-child(4) .stat-icon-wrap { background: var(--yellow-dim); box-shadow: 0 4px 12px rgba(245,158,11,.15); }

.stat-trend {
  font-size: 11px; font-weight: 700; padding: 3px 8px;
  border-radius: 99px; letter-spacing: .02em;
}
.stat-trend-up   { background: var(--green-dim); color: var(--green); border: 1px solid rgba(16,185,129,.2); }
.stat-trend-down { background: var(--red-dim);   color: var(--red);   border: 1px solid rgba(239,68,68,.2); }

.stat-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text3); margin-bottom: 5px;
}
.stat-value {
  font-size: 30px; font-weight: 800; color: var(--text);
  line-height: 1; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: 11px; color: var(--text3); margin-top: 5px; }

/* ── Live dot ────────────────────────────────────────────────────────────────── */
@keyframes pulse-live {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,.55); }
  60%       { box-shadow: 0 0 0 5px rgba(16,185,129,0); }
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  animation: pulse-live 2.2s ease infinite;
  flex-shrink: 0;
}
.live-dot.off { background: var(--red); animation: none; box-shadow: none; }

/* ── Feed ────────────────────────────────────────────────────────────────────── */
#feed-list {
  max-height: 300px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; padding: 4px 0;
}
.feed-entry {
  display: grid; grid-template-columns: 80px 1fr 1fr; gap: 8px; align-items: center;
  padding: 6px 12px; border-radius: var(--r-sm);
  font-size: 12px; font-family: var(--mono);
  border-left: 2px solid transparent; transition: background .1s;
}
.feed-entry:hover { background: var(--surface2); }
.feed-entry.public   { border-left-color: var(--green); }
.feed-entry.private  { border-left-color: var(--blue); }
.feed-entry.presence { border-left-color: var(--purple); }
.feed-ts { color: var(--text3); font-size: 10px; }
.feed-ch { color: var(--accent-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-ev { color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.feed-entry { animation: fadeSlide .2s ease; }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 52px 16px; }
.empty-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text3);
  opacity: .7;
}
.empty-icon svg { display: block; }
.empty-msg { font-size: 13px; color: var(--text3); }

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
  padding: 11px 15px; border-radius: var(--r-md);
  font-size: 13px; border: 1px solid;
  display: flex; align-items: flex-start; gap: 8px;
}
.alert-error   {
  background: var(--red-dim);    border-color: rgba(239,68,68,.25);   color: #fca5a5;
}
.alert-success {
  background: var(--green-dim);  border-color: rgba(16,185,129,.25);  color: #6ee7b7;
}
.alert-warn    {
  background: var(--yellow-dim); border-color: rgba(245,158,11,.25);  color: #fde68a;
}

/* ── Toasts ─────────────────────────────────────────────────────────────────── */
#toast-stack {
  position: fixed; top: 16px; right: 16px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  font-size: 13px; max-width: 320px; min-width: 260px;
  display: flex; align-items: center; gap: 10px;
  pointer-events: all;
  animation: toastIn .22s cubic-bezier(.16,.6,.4,1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
.toast-icon { font-size: 17px; flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--accent); }

/* ── Credentials ─────────────────────────────────────────────────────────────── */
.cred-field {
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  padding: 10px 13px;
  font-family: var(--mono); font-size: 12px; color: var(--accent-soft);
  word-break: break-all;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.cred-field code { flex: 1; }
.cred-copy {
  cursor: pointer; color: var(--text3); font-size: 15px;
  flex-shrink: 0; transition: color .15s, transform .15s;
}
.cred-copy:hover { color: var(--accent-h); transform: scale(1.1); }

/* ── Spinner ─────────────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .55s linear infinite;
}

/* ── Chart ───────────────────────────────────────────────────────────────────── */
#chart-wrap { height: 52px; margin-top: 10px; }

/* ── Login ───────────────────────────────────────────────────────────────────── */
#page-login {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}
#page-login.show { display: flex; }

/* Animated background layer */
.login-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
/* Dot-grid topographic pattern */
.login-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(99,102,241,.13) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 90% 90% at 50% 50%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 90% at 50% 50%, black 30%, transparent 100%);
}
/* Floating orbs */
.login-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.login-orb-1 {
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(99,102,241,.38) 0%, transparent 65%);
  top: -220px; left: -160px;
  animation: loginOrb1 22s ease-in-out infinite;
}
.login-orb-2 {
  width: 560px; height: 560px;
  background: radial-gradient(circle, rgba(168,85,247,.28) 0%, transparent 65%);
  bottom: -180px; right: 320px;
  animation: loginOrb2 28s ease-in-out infinite;
}
.login-orb-3 {
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(59,130,246,.22) 0%, transparent 65%);
  top: 40%; left: 28%;
  animation: loginOrb3 19s ease-in-out infinite;
}
@keyframes loginOrb1 {
  0%,100% { transform: translate(0,0) scale(1); }
  33%      { transform: translate(55px,35px) scale(1.07); }
  66%      { transform: translate(-25px,70px) scale(0.94); }
}
@keyframes loginOrb2 {
  0%,100% { transform: translate(0,0) scale(1); }
  40%      { transform: translate(-65px,-45px) scale(1.1); }
  70%      { transform: translate(35px,-25px) scale(0.91); }
}
@keyframes loginOrb3 {
  0%,100% { transform: translate(0,0) scale(1); opacity: .8; }
  50%      { transform: translate(30px,-40px) scale(1.18); opacity: .45; }
}

/* Login card — centered over animated background */
.login-card {
  position: relative;
  z-index: 1;
  background: rgba(12, 19, 36, 0.82);
  border: 1px solid rgba(99,102,241,.22);
  border-radius: var(--r-xl);
  padding: 42px 38px 36px;
  width: 100%; max-width: 390px;
  box-shadow:
    0 0 0 1px rgba(99,102,241,.06),
    0 12px 48px rgba(0,0,0,.7),
    0 0 80px rgba(99,102,241,.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
}

/* Top shimmer line */
.login-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 35%, var(--purple) 65%, transparent 100%);
}

/* Logo styles */
.login-logo { text-align: center; margin-bottom: 34px; }
.login-logo .logo-mark {
  font-size: 30px; font-weight: 800; color: var(--text);
  letter-spacing: -1.5px; line-height: 1;
}
.login-logo .logo-mark span { color: var(--accent-h); }
.login-logo .logo-sub {
  font-size: 11px; color: var(--text3); margin-top: 6px;
  letter-spacing: .07em; text-transform: uppercase; font-weight: 500;
}

/* ── App shell ───────────────────────────────────────────────────────────────── */
#page-app { display: none; height: 100vh; }
#page-app.show { display: flex; }

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w); height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; z-index: 50;
  overflow: hidden;
}

.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, rgba(99,102,241,.07) 0%, transparent 70%);
}
.sidebar-logo .logo-mark {
  font-size: 19px; font-weight: 800; color: var(--text);
  letter-spacing: -.5px; line-height: 1;
}
.sidebar-logo .logo-mark span { color: var(--accent-h); }
.sidebar-logo .logo-sub {
  font-size: 9px; color: var(--text3); letter-spacing: .1em;
  text-transform: uppercase; font-weight: 600; margin-top: 1px;
}

.sidebar-nav {
  flex: 1; padding: 10px 10px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: var(--text3);
  padding: 10px 12px 4px; margin-top: 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  cursor: pointer; color: var(--text2);
  font-size: 13px; font-weight: 500;
  transition: background .12s, color .12s;
  border: none; background: transparent;
  width: 100%; text-align: left;
  position: relative;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, var(--accent-dim) 0%, rgba(99,102,241,.04) 100%);
  color: var(--accent-soft);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent) 0%, var(--purple) 100%);
  box-shadow: 0 0 8px var(--accent-glow);
}
.nav-item .nav-icon { font-size: 15px; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
  box-shadow: 0 2px 8px rgba(99,102,241,.35);
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  background: linear-gradient(0deg, rgba(99,102,241,.04) 0%, transparent 100%);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99,102,241,.4);
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.sidebar-user-role { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; margin-top: 1px; }

/* ── Main content ────────────────────────────────────────────────────────────── */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(8px);
}
.topbar-title { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.sse-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 11px; font-weight: 600; color: var(--text3);
}

.page-content { flex: 1; padding: 24px 28px; }

.page { display: none; }
.page.active { display: block; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.col-stack { display: flex; flex-direction: column; gap: 16px; }

/* ── Org pill ────────────────────────────────────────────────────────────────── */
.org-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  background: var(--accent-dim); color: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 99px; font-size: 11px; font-weight: 600;
}

/* ── Filter row ──────────────────────────────────────────────────────────────── */
.filter-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.filter-row input, .filter-row select { max-width: 220px; padding: 7px 11px; font-size: 12px; }

/* ── Modals ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(5,9,20,.8);
  z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  backdrop-filter: blur(8px);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r-xl);
  width: 100%; max-width: 460px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(99,102,241,.08);
  animation: modalIn .18s cubic-bezier(.16,.6,.4,1);
  position: relative; overflow: hidden;
}
/* Top accent line on modals */
.modal::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 40%, var(--purple) 70%, transparent 100%);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-head {
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.modal-body { padding: 22px 26px; }
.modal-foot {
  padding: 14px 26px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--surface2);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* ── Publish card ────────────────────────────────────────────────────────────── */
.pub-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#publish-card .card-footer.pub-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#publish-card .card-footer .btn-primary,
#publish-card .card-footer .btn-secondary { width: 100%; justify-content: center; }

/* ── Field hints ─────────────────────────────────────────────────────────────── */
.field-hint { display: block; font-size: 11px; margin-top: 4px; font-weight: 500; }
.field-hint.hint-ok    { color: var(--green); }
.field-hint.hint-err   { color: var(--red); }
.field-hint.hint-check { color: var(--text2); }

/* ── SweetAlert2 ─────────────────────────────────────────────────────────────── */
.swal2-popup {
  background: var(--surface2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border2) !important;
  border-radius: 16px !important;
  font-family: var(--sans) !important;
  box-shadow: var(--shadow-lg) !important;
}
.swal2-title { color: var(--text) !important; font-weight: 700 !important; font-size: 18px !important; }
.swal2-html-container { color: var(--text2) !important; }
.swal2-timer-progress-bar { background: var(--accent) !important; }
.swal2-confirm {
  background: linear-gradient(135deg, var(--accent), #7c3aed) !important;
  color: #fff !important;
  font-family: var(--sans) !important; font-weight: 600 !important;
  border-radius: var(--r-md) !important;
  box-shadow: 0 4px 12px rgba(99,102,241,.4) !important;
}
.swal2-cancel {
  background: var(--surface3) !important; color: var(--text2) !important;
  border: 1px solid var(--border2) !important;
  font-family: var(--sans) !important;
  border-radius: var(--r-md) !important;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 800px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s cubic-bezier(.4,0,.2,1); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 16px; }
}

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

/* ══════════════════════════════════════════════════════════════════════════════
   VISUAL POLISH v2 — depth, glass, SVG icons, transitions
   ══════════════════════════════════════════════════════════════════════════════ */

/* Main content subtle dot grid */
.page-content {
  background-image: radial-gradient(circle, rgba(99,102,241,.022) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Sidebar — richer dark gradient + right edge glow */
.sidebar {
  background: linear-gradient(185deg, #0d1525 0%, #090f1d 100%);
  box-shadow: 4px 0 32px rgba(0,0,0,.4), 1px 0 0 rgba(99,102,241,.08);
  border-right: 1px solid rgba(99,102,241,.1);
}
.sidebar::after {
  content: '';
  position: absolute; top: 18%; right: 0; bottom: 18%;
  width: 1px;
  background: linear-gradient(180deg, transparent 0%, rgba(99,102,241,.28) 50%, transparent 100%);
  pointer-events: none;
}

/* Topbar — glass upgrade */
.topbar {
  background: rgba(9,15,29,.88);
  backdrop-filter: blur(24px) saturate(160%);
  border-bottom: 1px solid rgba(99,102,241,.12);
  box-shadow: 0 1px 0 rgba(255,255,255,.03), 0 4px 24px rgba(0,0,0,.28);
}
.topbar-title {
  font-size: 16px;
  background: linear-gradient(90deg, var(--text) 0%, rgba(221,232,244,.7) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* Stat cards — inner highlight + larger glow orb */
.stat-card {
  background: linear-gradient(145deg, rgba(255,255,255,.024) 0%, transparent 55%), var(--surface);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.04);
}
.stat-card:hover {
  box-shadow: 0 10px 36px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.05);
}
.stat-card::before { width: 130px; height: 130px; top: -45px; right: -30px; opacity: .12; }
/* SVG icon inherits accent color per card */
.stat-card:nth-child(1) .stat-icon-wrap { color: var(--accent-soft); }
.stat-card:nth-child(2) .stat-icon-wrap { color: var(--green); }
.stat-card:nth-child(3) .stat-icon-wrap { color: var(--blue); }
.stat-card:nth-child(4) .stat-icon-wrap { color: #fbbf24; }
.stat-icon-wrap svg { display: block; }
.stat-value { font-size: 32px; }

/* Cards — inner glass sheen + accent header tint */
.card {
  background: linear-gradient(145deg, rgba(255,255,255,.016) 0%, transparent 50%), var(--surface);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.028);
}
.card-header {
  background: linear-gradient(135deg, rgba(99,102,241,.075) 0%, rgba(99,102,241,.02) 55%, transparent 100%);
  border-bottom: 1px solid rgba(99,102,241,.1);
}

/* Card title icon chip */
.ct-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: var(--accent-dim);
  border: 1px solid rgba(99,102,241,.18);
  border-radius: 6px;
  color: var(--accent-soft);
  flex-shrink: 0;
}
.ct-icon svg { display: block; }

/* Table header — gradient + accent underline */
thead th {
  background: linear-gradient(180deg, var(--surface3) 0%, var(--surface2) 100%);
  border-bottom: 1px solid rgba(99,102,241,.18);
}
/* Row hover left bar bolder */
tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
/* Alternating subtle tint */
tbody tr:nth-child(even) td { background: rgba(99,102,241,.012); }
tbody tr:nth-child(even):hover td { background: rgba(99,102,241,.05); }

/* Toasts — glass + colored glow */
.toast {
  background: linear-gradient(135deg, rgba(28,40,64,.97) 0%, rgba(22,32,54,.97) 100%);
  backdrop-filter: blur(24px);
}
.toast.success { box-shadow: var(--shadow), 0 0 24px rgba(16,185,129,.1); }
.toast.error   { box-shadow: var(--shadow), 0 0 24px rgba(239,68,68,.12); }
.toast.info    { box-shadow: var(--shadow), 0 0 24px rgba(99,102,241,.15); }

/* Page fade-in on navigation */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page.active { animation: pageIn .23s cubic-bezier(.16,.6,.4,1); }

/* Modal — inner sheen + deeper glow */
.modal {
  background: linear-gradient(145deg, rgba(255,255,255,.022) 0%, transparent 40%), var(--surface);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(99,102,241,.1), inset 0 1px 0 rgba(255,255,255,.04);
}

/* SSE badge tint */
.sse-badge { border-color: rgba(99,102,241,.18); }

/* Scrollbar — thinner, accent tinted */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,.22); }
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,.45); }

/* btn-success (was missing) */
.btn-success {
  background: var(--green-dim); color: var(--green);
  border: 1px solid rgba(16,185,129,.25);
}
.btn-success:hover:not(:disabled) {
  background: var(--green); color: #fff; border-color: var(--green);
  box-shadow: 0 4px 14px rgba(16,185,129,.3);
}

/* Org pill shimmer */
.org-pill {
  background: linear-gradient(90deg, var(--accent-dim) 0%, rgba(99,102,241,.05) 100%);
}

/* Feed entries — more depth */
.feed-entry { border-radius: var(--r-md); }

/* Login brand icon ────────────────────────────────────────────────────────── */
.login-brand-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.login-brand-svg {
  width: 56px;
  height: 56px;
  filter: drop-shadow(0 0 22px rgba(99,102,241,.55));
}

/* ── SVG nav icons ───────────────────────────────────────────────────────────── */
.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.nav-icon svg {
  width: 15px;
  height: 15px;
  display: block;
  transition: transform .18s ease;
}
.nav-item:hover .nav-icon svg,
.nav-item.active .nav-icon svg {
  transform: scale(1.1);
}

/* ── Password eye toggle ─────────────────────────────────────────────────────── */
.input-suffix {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  cursor: pointer;
  color: var(--text3);
  transition: color .15s;
}
.input-suffix:hover { color: var(--text1); }
.input-suffix svg { display: block; pointer-events: none; }

/* ── Table action icon buttons (.ic-btn) ─────────────────────────────────────── */
.ic-btn {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  transition: background .15s, color .15s, box-shadow .15s, transform .12s;
}
.ic-btn svg {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}
.ic-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.ic-btn:active { transform: translateY(0); }

/* Tone each variant slightly */
.btn-ghost.ic-btn:hover  { background: var(--accent-dim); color: var(--accent-soft); }
.btn-warning.ic-btn      { background: rgba(245,158,11,.1); color: #f59e0b; border: 1px solid rgba(245,158,11,.25); }
.btn-warning.ic-btn:hover{ background: rgba(245,158,11,.2); box-shadow: 0 2px 8px rgba(245,158,11,.2); }
.btn-danger.ic-btn       { background: rgba(239,68,68,.1);  color: #f87171; border: 1px solid rgba(239,68,68,.25); }
.btn-danger.ic-btn:hover { background: rgba(239,68,68,.2);  box-shadow: 0 2px 8px rgba(239,68,68,.2); }
.btn-success.ic-btn      { background: rgba(34,197,94,.1);  color: #4ade80; border: 1px solid rgba(34,197,94,.25); }
.btn-success.ic-btn:hover{ background: rgba(34,197,94,.2);  box-shadow: 0 2px 8px rgba(34,197,94,.2); }

/* ── Logout button SVG refinement ────────────────────────────────────────────── */
#logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  padding: 0;
}
#logout-btn svg { display: block; }
#logout-btn:hover { background: rgba(239,68,68,.12); color: #f87171; }

/* ── SweetAlert2 — console theme ─────────────────────────────────────────────── */
.swal-nv-popup {
  border: 1px solid var(--border2) !important;
  border-radius: var(--r-xl) !important;
  box-shadow: 0 12px 48px rgba(0,0,0,.7), 0 0 60px rgba(99,102,241,.1) !important;
}
.swal-nv-popup .swal2-title {
  font-family: var(--sans) !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  letter-spacing: -.4px !important;
  color: var(--text) !important;
}
.swal-nv-popup .swal2-html-container {
  font-family: var(--sans) !important;
  font-size: 13px !important;
  color: var(--text2) !important;
}
.swal-nv-popup .swal2-icon.swal2-question {
  border-color: var(--accent) !important;
  color: var(--accent-h) !important;
}
.swal-nv-confirm {
  font-family: var(--sans) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  border-radius: var(--r-md) !important;
  padding: 8px 20px !important;
  box-shadow: none !important;
}
.swal-nv-cancel {
  font-family: var(--sans) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  border-radius: var(--r-md) !important;
  padding: 8px 20px !important;
  border: 1px solid var(--border2) !important;
  color: var(--text2) !important;
  box-shadow: none !important;
}
.swal-nv-cancel:hover { background: var(--surface2) !important; color: var(--text) !important; }
