/* ═══════════════════════════════════════════════════════════
   Reworked Panel — Dark Purple Theme
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg-body:      #0f0f14;
  --bg-sidebar:   #13131a;
  --bg-card:      #18181f;
  --bg-card-alt:  #1c1c25;
  --bg-input:     #1c1c25;
  --bg-hover:     #22222d;
  --bg-overlay:   rgba(0, 0, 0, .6);

  --border:       #2a2a38;
  --border-light: #333345;

  --primary:      #7c3aed;
  --primary-hover:#6d28d9;
  --primary-dim:  rgba(124, 58, 237, .12);
  --primary-border:rgba(124, 58, 237, .3);
  --primary-glow: rgba(124, 58, 237, .08);
  --primary-text: #a78bfa;

  --success:      #22c55e;
  --success-dim:  rgba(34, 197, 94, .1);
  --danger:       #ef4444;
  --danger-dim:   rgba(239, 68, 68, .1);
  --danger-hover: #dc2626;
  --warning:      #f59e0b;
  --warning-dim:  rgba(245, 158, 11, .1);
  --info:         #3b82f6;
  --info-dim:     rgba(59, 130, 246, .1);

  --text:         #e4e4eb;
  --text-sec:     #a1a1b5;
  --text-muted:   #6b6b80;
  --text-dim:     #4a4a5c;

  --radius:       6px;
  --radius-lg:    10px;
  --sidebar-w:    250px;
  --font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
  --transition:   .15s ease;
  --shadow:       0 1px 3px rgba(0,0,0,.3);
  --shadow-lg:    0 4px 24px rgba(0,0,0,.4);
}

/* ─── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}
body:not(.app-ready) .dashboard { opacity: 0; }
body.app-ready .dashboard { opacity: 1; transition: opacity .12s ease; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { color: var(--primary); }
::selection { background: var(--primary); color: #fff; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ─── Layout ─────────────────────────────────────────── */
.dashboard { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; overflow-y: auto;
  transition: transform .25s ease;
}
.sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.1rem; font-weight: 700; color: var(--text);
  letter-spacing: -.02em;
}
.sidebar-brand .brand-icon {
  width: 32px; height: 32px;
  background: var(--primary); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: 15px;
}
.sidebar-nav { flex: 1; padding: 12px 10px; }
.nav-section { margin-bottom: 18px; }
.nav-section-title {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); padding: 0 8px; margin-bottom: 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--radius);
  color: var(--text-sec); font-size: .85rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition); text-decoration: none;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--primary-dim); color: var(--primary-text); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .7; }
.nav-item.active svg { opacity: 1; }
.sidebar-footer { padding: 12px 14px; border-top: 1px solid var(--border); }
.sidebar-user {
  display: flex; align-items: center; gap: 10px; padding: 6px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.sidebar-user:hover { background: var(--bg-hover); }
.sidebar-user .user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-dim);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary-text); font-size: 13px; font-weight: 700;
}
.sidebar-user .user-info { overflow: hidden; }
.sidebar-user .user-name { font-size: .82rem; font-weight: 600; color: var(--text); }
.sidebar-user .user-role  { font-size: .7rem; color: var(--text-muted); }
.main-content {
  flex: 1; margin-left: var(--sidebar-w);
  padding: 28px 32px 48px; min-width: 0;
}

/* ─── Page Header ────────────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.page-sub { font-size: .85rem; color: var(--text-muted); margin-top: 2px; }
.page-header-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}

/* ─── Cards ──────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border); gap: 12px;
}
.card-title { font-size: .85rem; font-weight: 600; color: var(--text); }
.card-body { padding: 18px; }

/* ─── Stats Grid ─────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
}
.stat-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 600; margin-bottom: 6px;
}
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.stat-sub { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }

/* ─── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; font-size: .82rem; font-weight: 500; font-family: var(--font);
  border: 1px solid transparent; border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition); white-space: nowrap;
  text-decoration: none; line-height: 1.4;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text-sec); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.btn-danger { background: var(--danger-dim); color: var(--danger); border-color: rgba(239,68,68,.25); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-success { background: var(--success-dim); color: var(--success); border-color: rgba(34,197,94,.25); }
.btn-success:hover:not(:disabled) { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning-dim); color: var(--warning); border-color: rgba(245,158,11,.25); }
.btn-warning:hover:not(:disabled) { background: var(--warning); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: .78rem; }
.btn-xs { padding: 2px 8px; font-size: .72rem; }
.btn-icon {
  padding: 6px; border-radius: var(--radius); background: transparent;
  border: 1px solid var(--border); color: var(--text-sec); cursor: pointer;
  transition: all var(--transition); display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }
.btn-icon svg { width: 15px; height: 15px; }
.btn-group { display: flex; gap: 6px; align-items: center; }

/* ─── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; font-size: .72rem; font-weight: 600;
  border-radius: 999px; white-space: nowrap;
}
.badge-purple { background: var(--primary-dim); color: var(--primary-text); }
.badge-green  { background: var(--success-dim); color: var(--success); }
.badge-red    { background: var(--danger-dim); color: var(--danger); }
.badge-yellow { background: var(--warning-dim); color: var(--warning); }
.badge-blue   { background: var(--info-dim); color: var(--info); }
.badge-muted  { background: rgba(107,107,128,.12); color: var(--text-muted); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.badge-green .dot  { background: var(--success); }
.badge-red .dot    { background: var(--danger); }
.badge-yellow .dot { background: var(--warning); }

/* ─── Forms ──────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: .78rem; font-weight: 500; color: var(--text-sec); margin-bottom: 5px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 8px 12px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: .85rem; font-family: var(--font);
  transition: border-color var(--transition); outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-dim);
}
.form-textarea { min-height: 80px; resize: vertical; }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b80' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px;
}
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }
.form-inline { display: flex; gap: 8px; align-items: end; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--text-sec); cursor: pointer; }
.form-check input[type="checkbox"] {
  appearance: none; width: 16px; height: 16px;
  border: 1px solid var(--border-light); border-radius: 4px;
  background: var(--bg-input); cursor: pointer; position: relative; flex-shrink: 0;
}
.form-check input[type="checkbox"]:checked { background: var(--primary); border-color: var(--primary); }
.form-check input[type="checkbox"]:checked::after {
  content: ''; position: absolute; top: 2px; left: 5px;
  width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* ─── Tables ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 14px; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .06em; font-weight: 600; color: var(--text-muted);
  text-align: left; background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 10px 14px; font-size: .85rem; color: var(--text-sec); border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ─── Tabs ───────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 18px; overflow-x: auto; }
.tab-btn {
  padding: 10px 16px; font-size: .82rem; font-weight: 500; color: var(--text-muted);
  background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; transition: all var(--transition); white-space: nowrap; font-family: var(--font);
}
.tab-btn:hover { color: var(--text-sec); }
.tab-btn.active { color: var(--primary-text); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── Toolbar ────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 18px; flex-wrap: wrap; }
.toolbar-between { justify-content: space-between; }
.search-input {
  flex: 1; min-width: 180px; padding: 7px 12px 7px 34px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: .85rem;
  font-family: var(--font); outline: none; transition: border-color var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b6b80' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center;
}
.search-input:focus { border-color: var(--primary); }

/* ─── Modals ─────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: var(--bg-overlay);
  z-index: 999; align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 520px;
  max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.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: .95rem; font-weight: 600; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 18px; cursor: pointer; padding: 4px; line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--border);
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.editor-field-wide {
  grid-column: 1 / -1;
}
@media (max-width: 900px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }
}

.filter-pills {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-pill {
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-sec);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.filter-pill:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.filter-pill.active {
  background: var(--primary-dim);
  border-color: var(--primary-border);
  color: var(--primary-text);
}

.card-section-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.action-sheet {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.action-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-sec);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
}
.action-row:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  color: var(--text);
}
.action-row-danger { border-color: rgba(239, 68, 68, .18); }
.action-row-warning { border-color: rgba(245, 158, 11, .18); }
.action-row-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(107,107,128,.12);
  color: var(--text-muted);
  flex-shrink: 0;
}
.action-row-danger .action-row-icon {
  background: var(--danger-dim);
  color: var(--danger);
}
.action-row-warning .action-row-icon {
  background: var(--warning-dim);
  color: var(--warning);
}
.action-row-copy {
  flex: 1;
  font-size: .82rem;
  font-weight: 500;
  color: inherit;
}
.action-row-arrow {
  color: var(--text-muted);
  display: inline-flex;
}
.action-row-arrow svg {
  width: 14px;
  height: 14px;
}

/* ─── Toast ──────────────────────────────────────────── */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 16px; border-radius: var(--radius); font-size: .82rem; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: toastIn .25s ease;
  display: flex; align-items: center; gap: 8px; max-width: 360px;
}
.toast-success { background: #0a2815; color: var(--success); border: 1px solid rgba(34,197,94,.2); }
.toast-error   { background: #2a0a0a; color: var(--danger);  border: 1px solid rgba(239,68,68,.2); }
.toast-warning { background: #2a1a00; color: var(--warning); border: 1px solid rgba(245,158,11,.2); }
.toast-info    { background: #0a1a2a; color: var(--info);    border: 1px solid rgba(59,130,246,.2); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ─── Confirm ────────────────────────────────────────── */
.confirm-overlay {
  display: none; position: fixed; inset: 0; background: var(--bg-overlay);
  z-index: 10000; align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
.confirm-overlay.active { display: flex; }
.confirm-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; max-width: 400px; width: 90%;
  text-align: center; box-shadow: var(--shadow-lg);
}
.confirm-box p { font-size: .9rem; color: var(--text-sec); margin-bottom: 20px; }
.confirm-box .btn-group { justify-content: center; }

/* ─── Status Chip ────────────────────────────────────── */
.status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600;
}
.status-chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.status-chip.online  { background: var(--success-dim); color: var(--success); }
.status-chip.online .dot  { background: var(--success); }
.status-chip.offline { background: var(--danger-dim); color: var(--danger); }
.status-chip.offline .dot { background: var(--danger); }

/* ─── Console ────────────────────────────────────────── */
.console-box {
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.08), transparent 32%),
    linear-gradient(180deg, #101118 0%, #0a0b10 100%);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.6;
  padding: 12px 14px;
  max-height: 560px;
  overflow-y: auto;
  color: #cfd3e6;
  white-space: pre-wrap;
  word-break: break-word;
}
.console-line {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.console-line:last-child { border-bottom: none; }
.console-time {
  color: #656b82;
  font-size: .72rem;
  user-select: none;
}
.console-badge {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: .69rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  user-select: none;
}
.console-badge--default {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
}
.console-badge--script {
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.24);
  color: #c4b5fd;
}
.console-badge--system {
  background: rgba(96, 165, 250, 0.12);
  border-color: rgba(96, 165, 250, 0.22);
  color: #93c5fd;
}
.console-badge--cmd {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.22);
  color: #fcd34d;
}
.console-badge--ucp {
  background: rgba(45, 212, 191, 0.12);
  border-color: rgba(45, 212, 191, 0.22);
  color: #5eead4;
}
.console-message {
  min-width: 0;
  color: #cfd3e6;
}
.console-line--muted .console-message { color: #98a2b3; }
.console-line--info .console-message { color: #dbeafe; }
.console-line--warn .console-message { color: #fde68a; }
.console-line--error .console-message { color: #fca5a5; }
.console-line--success .console-message { color: #86efac; }
.console-line--command .console-message { color: #c4b5fd; }
.console-line--command .console-time { color: #7c3aed; }
.console-line--error .console-badge {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}
.console-line--warn .console-badge {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.22);
  color: #fcd34d;
}
.console-message strong {
  font-weight: 700;
  color: inherit;
}
.console-message .console-keyword-error { color: #f87171; font-weight: 700; }
.console-message .console-keyword-warn { color: #fbbf24; font-weight: 700; }
.console-message .console-keyword-ok { color: #4ade80; font-weight: 700; }
.console-message .console-path {
  color: #93c5fd;
  word-break: break-all;
}
.console-message .console-inline {
  color: #e9d5ff;
}
.console-empty {
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
}
.console-input-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: #0c0c10; border-top: 1px solid var(--border);
}
.console-prompt { color: var(--primary-text); font-family: var(--font-mono); font-size: .85rem; font-weight: 600; }
.console-input-row input {
  flex: 1; background: none; border: none; color: var(--text);
  font-family: var(--font-mono); font-size: .82rem; outline: none;
}

/* ─── Grids ──────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.perm-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.staff-cell { display: flex; align-items: center; gap: 10px; }
.staff-link { color: inherit; font-weight: inherit; }
.staff-link:hover { color: var(--primary-text); }
.perm-grid .form-check { padding: 4px 0; }
.user-avatar-inline {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-dim);
  color: var(--primary-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .82rem;
  flex-shrink: 0;
}

/* ─── Empty / Loading ────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 20px; color: var(--text-muted); text-align: center;
}
.empty-state svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: .4; }
.empty-state h3 { font-size: .9rem; font-weight: 600; color: var(--text-sec); margin-bottom: 4px; }
.empty-state p { font-size: .8rem; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; align-items: center; justify-content: center; padding: 40px; }

/* ─── Pagination ─────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 14px 18px; }
.pagination button {
  padding: 4px 10px; font-size: .78rem; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-sec); cursor: pointer; font-family: var(--font); transition: all var(--transition);
}
.pagination button:hover:not(:disabled) { background: var(--bg-hover); }
.pagination button.active { background: var(--primary-dim); color: var(--primary-text); border-color: var(--primary-border); }
.pagination button:disabled { opacity: .3; cursor: not-allowed; }

/* ─── Progress ───────────────────────────────────────── */
.progress { height: 6px; background: var(--bg-card-alt); border-radius: 3px; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 3px; transition: width .3s ease; }

/* ─── KV Row ─────────────────────────────────────────── */
.kv-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: .85rem; }
.kv-row .kv-label { color: var(--text-muted); }
.kv-row .kv-value { color: var(--text); font-weight: 500; }

/* ─── Server Control Bar ─────────────────────────────── */
.server-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 24px;
}
.server-bar .server-status { display: flex; align-items: center; gap: 8px; flex: 1; }
.server-bar .server-name { font-weight: 600; font-size: .9rem; }

/* ─── Helpers ────────────────────────────────────────── */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-6  { gap: 6px; }
.gap-10 { gap: 10px; }
.mb-12  { margin-bottom: 12px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.hidden { display: none !important; }
.mono   { font-family: var(--font-mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted   { color: var(--text-muted); }

/* ─── Login ──────────────────────────────────────────── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg-body); }
.login-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 380px; padding: 36px 32px;
}
.login-header { text-align: center; margin-bottom: 28px; }
.login-header .brand-icon {
  width: 48px; height: 48px; background: var(--primary);
  border-radius: var(--radius-lg); display: inline-flex; align-items: center;
  justify-content: center; font-weight: 800; color: #fff; font-size: 22px; margin-bottom: 14px;
}
.login-header h1 { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.login-header p { font-size: .82rem; color: var(--text-muted); margin-top: 4px; }
.login-error {
  background: var(--danger-dim); color: var(--danger); padding: 8px 12px;
  border-radius: var(--radius); font-size: .82rem; margin-bottom: 16px;
  border: 1px solid rgba(239,68,68,.2); text-align: center;
}
.login-card .btn-primary { width: 100%; padding: 10px; font-size: .9rem; margin-top: 4px; }

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
}
