/* ============================================================
   Revlink — Design System CSS
   Exact match to admin-panel-for-microservice design tokens
   ============================================================ */

/* ── Design tokens ──────────────────────────────────────────── */
:root {
  --bg-0: #0a0a0b;
  --bg-1: #111113;
  --bg-2: #16161a;
  --bg-3: #1c1c21;
  --bg-hover: #1f1f25;
  --border-1: #26262b;
  --border-2: #1d1d22;
  --border-3: #2e2e35;

  --text-1: #ededee;
  --text-2: #a1a1a8;
  --text-3: #6c6c74;
  --text-4: #4a4a52;

  --accent: #3ecf8e;
  --accent-hover: #4ad99a;
  --accent-dim: #3ecf8e22;
  --accent-line: #3ecf8e44;

  --green: #3ecf8e;
  --green-bg: rgba(62,207,142,.12);
  --green-line: rgba(62,207,142,.28);

  --amber: #f5b544;
  --amber-bg: rgba(245,181,68,.12);
  --amber-line: rgba(245,181,68,.28);

  --red: #f06b6b;
  --red-bg: rgba(240,107,107,.12);
  --red-line: rgba(240,107,107,.32);

  --blue: #6ea8ff;
  --blue-bg: rgba(110,168,255,.12);
  --blue-line: rgba(110,168,255,.28);

  --violet: #b08cff;
  --violet-bg: rgba(176,140,255,.12);
  --violet-line: rgba(176,140,255,.28);

  --shadow-1: 0 1px 2px rgba(0,0,0,.4),0 1px 3px rgba(0,0,0,.3);
  --shadow-2: 0 4px 12px rgba(0,0,0,.4),0 1px 3px rgba(0,0,0,.4);
  --shadow-3: 0 12px 32px rgba(0,0,0,.5),0 4px 12px rgba(0,0,0,.4);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Menlo', monospace;

  --row-h: 52px;
  --row-pad-y: 14px;
  --gutter: 20px;
  --card-pad: 22px;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg-0);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11','ss01','ss03';
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
input, textarea, select { outline: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
::selection { background: var(--accent-dim); color: var(--text-1); }

/* ── Scrollbar ───────────────────────────────────────────────── */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #2a2a30; border-radius: 8px; border: 2px solid var(--bg-0); }
*::-webkit-scrollbar-thumb:hover { background: #3a3a42; }

/* ── App shell ───────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
  background: var(--bg-0);
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  background: var(--bg-0);
  border-right: 1px solid var(--border-2);
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 18px;
  border-bottom: 1px solid var(--border-2);
  margin-bottom: 12px;
}
.sidebar-brand-mark {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--accent), #2a9b6a);
  border-radius: 7px;
  display: grid; place-items: center;
  color: #06170e;
  font-weight: 700; font-size: 13px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 1px 4px rgba(62,207,142,.3);
  flex-shrink: 0;
}
.sidebar-brand-name { font-weight: 600; font-size: 14px; letter-spacing: -.01em; }
.sidebar-brand-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.sidebar-section-label {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-3);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500; font-size: 13.5px;
  position: relative;
  transition: background .12s, color .12s;
  text-decoration: none;
}
.nav-item:hover  { background: var(--bg-2); color: var(--text-1); }
.nav-item.active { background: var(--bg-2); color: var(--text-1); }
.nav-item.active::before {
  content: '';
  position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 2px; background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.nav-item .icon { width: 16px; height: 16px; flex: 0 0 16px; color: var(--text-3); }
.nav-item.active .icon, .nav-item:hover .icon { color: var(--text-2); }
.nav-item .badge-mini {
  margin-left: auto;
  background: var(--bg-3); border: 1px solid var(--border-1);
  font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 10px;
  color: var(--text-2); font-variant-numeric: tabular-nums;
}
.nav-item .badge-mini.alert { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-2); }

/* ── Main area ───────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; }

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  height: 56px; border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; padding: 0 28px; gap: 16px;
  background: var(--bg-0);
  position: sticky; top: 0; z-index: 50;
}
.search-box {
  flex: 1; max-width: 480px; height: 34px;
  border: 1px solid var(--border-1); border-radius: var(--radius);
  background: var(--bg-1);
  display: flex; align-items: center; padding: 0 12px; gap: 8px;
  color: var(--text-3); transition: border .12s;
}
.search-box:focus-within { border-color: var(--border-3); background: var(--bg-2); }
.search-box input { border: 0; background: transparent; flex: 1; color: var(--text-1); font-size: 13px; }
.search-box input::placeholder { color: var(--text-3); }
.search-kbd {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3);
  padding: 2px 6px; background: var(--bg-2); border: 1px solid var(--border-1); border-radius: 4px;
}
.topbar-spacer { flex: 1; }
.topbar-icon-btn {
  width: 34px; height: 34px; border-radius: var(--radius);
  display: grid; place-items: center;
  color: var(--text-2); transition: background .12s, color .12s;
  position: relative;
}
.topbar-icon-btn:hover { background: var(--bg-2); color: var(--text-1); }
.topbar-icon-btn .dot {
  position: absolute; top: 8px; right: 9px;
  width: 6px; height: 6px; background: var(--red);
  border-radius: 50%; border: 2px solid var(--bg-0);
}
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 20px; border: 1px solid var(--border-1);
  background: var(--bg-1); transition: background .12s; position: relative;
}
.user-chip:hover { background: var(--bg-2); }
.user-chip .name { font-size: 12.5px; font-weight: 500; color: var(--text-1); }
.user-chip .chevron { color: var(--text-3); }
.user-dropdown {
  position: absolute; top: 44px; right: 0;
  background: var(--bg-2); border: 1px solid var(--border-1);
  border-radius: 10px; padding: 6px; min-width: 200px;
  box-shadow: var(--shadow-3); z-index: 100;
  animation: slideInUp .14s ease;
}
.user-dropdown-header { display: flex; align-items: center; gap: 12px; padding: 8px 10px 12px; }

/* ── Page layout ─────────────────────────────────────────────── */
.content-area { overflow-y: auto; }
.page { padding: 28px 32px 60px; max-width: 1480px; }
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px;
}
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 4px; }
.page-subtitle { color: var(--text-3); font-size: 13.5px; margin: 0; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border-radius: var(--radius); font-size: 13px; font-weight: 500;
  color: var(--text-1); background: var(--bg-2); border: 1px solid var(--border-1);
  transition: background .12s, border .12s, transform .06s; white-space: nowrap;
}
.btn:hover { background: var(--bg-3); border-color: var(--border-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary {
  background: var(--accent); color: #06170e; border-color: transparent; font-weight: 600;
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 1px 2px rgba(62,207,142,.3);
}
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-2); color: var(--text-1); }
.btn.danger { color: var(--red); border-color: var(--red-line); background: transparent; }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.btn.icon-only { width: 32px; padding: 0; }
.btn.icon-only.sm { width: 28px; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-1); border: 1px solid var(--border-2);
  border-radius: var(--radius-md); overflow: hidden;
}
.card-pad { padding: var(--card-pad); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-2);
}
.card-title { font-size: 14px; font-weight: 600; margin: 0; }
.card-sub { font-size: 12.5px; color: var(--text-3); margin: 2px 0 0; }

/* ── Stat grid ───────────────────────────────────────────────── */
.stat-grid {
  display: grid; grid-template-columns: repeat(5,1fr);
  gap: 12px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-1); border: 1px solid var(--border-2);
  border-radius: var(--radius-md); padding: 18px 20px; position: relative;
  overflow: hidden;
}
.stat-label {
  font-size: 12px; color: var(--text-3); font-weight: 500; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.stat-value {
  font-size: 26px; font-weight: 600; letter-spacing: -.025em;
  font-variant-numeric: tabular-nums; margin-bottom: 6px;
}
.stat-delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums;
}
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--red); }
.stat-spark-canvas { position: absolute; right: 14px; top: 14px; width: 64px; height: 28px; opacity: .85; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 11.5px; font-weight: 500; font-variant-numeric: tabular-nums;
  border: 1px solid; white-space: nowrap; line-height: 1.5;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px; }
.badge.green  { background: var(--green-bg);  border-color: var(--green-line);  color: var(--green);  }
.badge.green .dot  { background: var(--green);  box-shadow: 0 0 0 2px rgba(62,207,142,.18); }
.badge.amber  { background: var(--amber-bg);  border-color: var(--amber-line);  color: var(--amber);  }
.badge.amber .dot  { background: var(--amber); }
.badge.red    { background: var(--red-bg);    border-color: var(--red-line);    color: var(--red);    }
.badge.red .dot    { background: var(--red); }
.badge.blue   { background: var(--blue-bg);   border-color: var(--blue-line);   color: var(--blue);   }
.badge.blue .dot   { background: var(--blue); }
.badge.violet { background: var(--violet-bg); border-color: var(--violet-line); color: var(--violet); }
.badge.violet .dot { background: var(--violet); }
.badge.gray   { background: var(--bg-3); border-color: var(--border-1); color: var(--text-2); }
.badge.gray .dot   { background: var(--text-3); }

/* ── Inputs ──────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.field-label .req { color: var(--red); }
.field-help { font-size: 12px; color: var(--text-3); }
.field-error { font-size: 12px; color: var(--red); display: flex; align-items: center; gap: 4px; }
.input, .select {
  height: 36px; border: 1px solid var(--border-1);
  background: var(--bg-1); border-radius: var(--radius);
  padding: 0 12px; color: var(--text-1); font-size: 13.5px; width: 100%;
  transition: border .12s, box-shadow .12s;
}
.input::placeholder { color: var(--text-3); }
.input:hover, .select:hover { border-color: var(--border-3); }
.input:focus, .select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(62,207,142,.15);
  background: var(--bg-1);
}
.input.error { border-color: var(--red); }
.input.error:focus { box-shadow: 0 0 0 3px rgba(240,107,107,.18); }
.input.mono { font-family: var(--font-mono); font-size: 12.5px; }
.select { -webkit-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='%236c6c74' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.input-group {
  display: flex; align-items: center;
  border: 1px solid var(--border-1); background: var(--bg-1);
  border-radius: var(--radius); height: 36px; padding: 0 4px 0 12px;
  transition: border .12s, box-shadow .12s;
}
.input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(62,207,142,.15); }
.input-group input { border: 0; background: transparent; flex: 1; height: 100%; color: var(--text-1); font-size: 13.5px; }
.input-group input::placeholder { color: var(--text-3); }
.input-group input.mono { font-family: var(--font-mono); font-size: 12.5px; }

/* ── Toggle ──────────────────────────────────────────────────── */
.toggle {
  width: 34px; height: 20px; border-radius: 11px;
  background: var(--bg-3); border: 1px solid var(--border-1);
  position: relative; transition: background .15s; flex: 0 0 34px;
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-2); transition: all .18s;
}
.toggle.on { background: var(--accent); border-color: transparent; }
.toggle.on::after { left: 16px; background: #06170e; }

/* ── Checkbox ────────────────────────────────────────────────── */
.cb {
  width: 16px; height: 16px; border: 1px solid var(--border-3);
  border-radius: 4px; background: var(--bg-1);
  display: inline-grid; place-items: center; flex: 0 0 16px;
  transition: all .12s;
}
.cb.on { background: var(--accent); border-color: var(--accent); }
.cb.on::after { content: ''; width: 9px; height: 5px; border-left: 2px solid #06170e; border-bottom: 2px solid #06170e; transform: rotate(-45deg) translateY(-1px); display: block; }

/* ── Chips ───────────────────────────────────────────────────── */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border-1); background: var(--bg-1);
  font-size: 12.5px; color: var(--text-2); transition: all .12s;
}
.chip:hover { border-color: var(--border-3); color: var(--text-1); }
.chip.active { background: var(--accent-dim); border-color: var(--accent-line); color: var(--accent); font-weight: 500; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { background: var(--bg-1); border: 1px solid var(--border-2); border-radius: var(--radius-md); overflow: hidden; }
.table-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--border-2); background: var(--bg-1);
}
.table-toolbar .search-box { height: 32px; max-width: 280px; background: var(--bg-2); }
.table-toolbar-spacer { flex: 1; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 500; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-3);
  padding: 10px 14px; background: var(--bg-1); border-bottom: 1px solid var(--border-2);
  white-space: nowrap; user-select: none;
}
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--text-1); }
.table th .sort-icon { display: inline-block; margin-left: 4px; opacity: .5; }
.table th.sorted .sort-icon { opacity: 1; color: var(--accent); }
.table td {
  padding: var(--row-pad-y) 14px; border-bottom: 1px solid var(--border-2);
  vertical-align: middle; color: var(--text-1);
}
.table tbody tr { transition: background .08s; }
.table tbody tr:hover { background: var(--bg-2); }
.table tbody tr.selected { background: rgba(62,207,142,.05); }
.table tbody tr:last-child td { border-bottom: none; }
.table .col-checkbox { width: 36px; padding-right: 0; }
.table .col-actions { width: 40px; text-align: right; }
.cell-secondary { color: var(--text-3); font-size: 12.5px; }
.cell-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.table-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-top: 1px solid var(--border-2);
  font-size: 12.5px; color: var(--text-3);
}
.pagination { display: flex; align-items: center; gap: 4px; }
.pagination .page-btn {
  min-width: 28px; height: 28px; padding: 0 8px;
  border-radius: 6px; font-size: 12.5px; color: var(--text-2);
  font-variant-numeric: tabular-nums; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.pagination .page-btn:hover { background: var(--bg-2); color: var(--text-1); }
.pagination .page-btn.active { background: var(--bg-3); color: var(--text-1); border: 1px solid var(--border-1); }
.bulk-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--bg-2);
  border-bottom: 1px solid var(--border-2); font-size: 13px;
}
.bulk-bar .count { color: var(--accent); font-weight: 500; }

/* ── Avatar ──────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%; display: grid; place-items: center;
  font-weight: 600; font-size: 11px; color: #fff;
  flex: 0 0 auto; letter-spacing: .02em;
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.md { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.avatar.anon { background: var(--bg-3); color: var(--text-3); border: 1px dashed var(--border-3); }

/* ── Stars ───────────────────────────────────────────────────── */
.stars { display: inline-flex; gap: 1px; color: var(--amber); }
.stars .star { display: block; }
.stars .star.empty { color: var(--text-4); }

/* ── Drawer ──────────────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px); z-index: 100;
  animation: fadeIn .16s ease;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 560px; max-width: 100vw;
  background: var(--bg-1); border-left: 1px solid var(--border-2);
  z-index: 101; display: flex; flex-direction: column;
  box-shadow: -16px 0 48px rgba(0,0,0,.5);
  animation: slideInRight .22s cubic-bezier(.2,.7,.2,1);
}
.drawer.wide { width: 720px; }
.drawer-header {
  padding: 18px 22px; border-bottom: 1px solid var(--border-2);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.drawer-title { font-size: 16px; font-weight: 600; margin: 0; }
.drawer-sub { font-size: 12.5px; color: var(--text-3); margin: 2px 0 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px; }
.drawer-footer {
  padding: 14px 22px; border-top: 1px solid var(--border-2);
  display: flex; justify-content: flex-end; gap: 8px; background: var(--bg-1);
  flex-shrink: 0;
}

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-2); margin-bottom: 24px; }
.tab {
  padding: 10px 14px; font-size: 13px; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-weight: 500; transition: color .12s, border .12s; text-decoration: none;
}
.tab:hover { color: var(--text-1); }
.tab.active { color: var(--text-1); border-color: var(--accent); }

/* ── Toast ───────────────────────────────────────────────────── */
.toast-stack {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 200;
}
.toast {
  background: var(--bg-2); border: 1px solid var(--border-1);
  border-radius: var(--radius); padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 280px; max-width: 360px;
  box-shadow: var(--shadow-3);
  animation: slideInUp .22s cubic-bezier(.2,.7,.2,1);
}
.toast .icon { flex: 0 0 16px; margin-top: 1px; }
.toast.success .icon { color: var(--green); }
.toast.error .icon { color: var(--red); }
.toast.info .icon { color: var(--blue); }
.toast.warn .icon { color: var(--amber); }
.toast-title { font-size: 13px; font-weight: 500; margin: 0; }
.toast-msg { font-size: 12.5px; color: var(--text-3); margin: 2px 0 0; }

/* ── Modals / Confirm ────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px); z-index: 150;
  display: grid; place-items: center;
  animation: fadeIn .16s ease;
}
.modal-box {
  background: var(--bg-1); border: 1px solid var(--border-2);
  border-radius: var(--radius-lg); padding: 28px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-3);
  animation: slideInUp .2s cubic-bezier(.2,.7,.2,1);
}
.modal-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--amber-bg); border: 1px solid var(--amber-line);
  color: var(--amber); display: grid; place-items: center; margin: 0 auto 18px;
}
.modal-title { font-size: 16px; font-weight: 600; text-align: center; margin: 0 0 10px; }
.modal-msg { font-size: 13.5px; color: var(--text-2); text-align: center; margin: 0 0 24px; line-height: 1.6; }
.modal-actions { display: flex; gap: 8px; justify-content: center; }
.modal-actions .btn { min-width: 100px; height: 36px; }

/* ── Menus ───────────────────────────────────────────────────── */
.menu {
  position: fixed;
  background: var(--bg-2); border: 1px solid var(--border-1);
  border-radius: 8px; padding: 4px; min-width: 200px;
  box-shadow: var(--shadow-3); z-index: 1000;
  animation: slideInUp .14s ease;
}
.menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 7px 10px;
  font-size: 13px; color: var(--text-1);
  border-radius: 5px; text-align: left;
  transition: background .1s; text-decoration: none;
}
.menu-item:hover { background: var(--bg-3); }
.menu-item.danger { color: var(--red); }
.menu-item.danger:hover { background: var(--red-bg); }
.menu-divider { height: 1px; background: var(--border-1); margin: 4px 0; }

/* ── Activity ────────────────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid var(--border-2);
}
.activity-item:last-child { border-bottom: 0; }
.activity-icon {
  width: 28px; height: 28px; border-radius: 7px;
  display: grid; place-items: center; flex: 0 0 28px;
}
.activity-icon.green { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-line); }
.activity-icon.amber { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-line); }
.activity-icon.red   { background: var(--red-bg);   color: var(--red);   border: 1px solid var(--red-line); }
.activity-icon.blue  { background: var(--blue-bg);  color: var(--blue);  border: 1px solid var(--blue-line); }
.activity-icon.gray  { background: var(--bg-3); color: var(--text-2); border: 1px solid var(--border-1); }
.activity-text { flex: 1; min-width: 0; font-size: 13px; }
.activity-text b { font-weight: 500; }
.activity-time { font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ── Empty states ────────────────────────────────────────────── */
.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty .empty-icon {
  width: 48px; height: 48px; margin: 0 auto 16px;
  border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border-2);
  display: grid; place-items: center; color: var(--text-3);
}
.empty .empty-title { color: var(--text-1); font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.empty .empty-msg { font-size: 13px; max-width: 360px; margin: 0 auto 20px; }

/* ── Login ───────────────────────────────────────────────────── */
.login-shell {
  min-height: 100vh; display: grid; place-items: center;
  background: var(--bg-0); position: relative; overflow: hidden; padding: 24px;
}
.login-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(62,207,142,.12), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(110,168,255,.08), transparent 50%);
}
.login-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-2) 1px, transparent 1px);
  background-size: 48px 48px; background-position: -1px -1px;
  mask-image: radial-gradient(ellipse at 50% 40%, black 30%, transparent 70%);
  opacity: .5;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--bg-1); border: 1px solid var(--border-2);
  border-radius: var(--radius-lg); padding: 32px;
  position: relative; z-index: 1; box-shadow: var(--shadow-3);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.login-h { font-size: 19px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 6px; }
.login-sub { font-size: 13px; color: var(--text-3); margin: 0 0 24px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.login-meta { text-align: center; margin-top: 22px; font-size: 12px; color: var(--text-3); }

/* ── Callout ─────────────────────────────────────────────────── */
.callout {
  display: flex; gap: 10px; padding: 12px 14px;
  border-radius: var(--radius); border: 1px solid var(--border-2);
  background: var(--bg-2); font-size: 12.5px; color: var(--text-2);
}
.callout.warn    { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.callout.info    { background: var(--blue-bg);  border-color: var(--blue-line);  color: var(--blue); }
.callout.danger  { background: var(--red-bg);   border-color: var(--red-line);   color: var(--red); }
.callout-icon { flex: 0 0 16px; margin-top: 1px; }

/* ── Payload / code blocks ───────────────────────────────────── */
.payload {
  background: var(--bg-0); border: 1px solid var(--border-2);
  border-radius: var(--radius); padding: 12px 14px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-2);
  white-space: pre; overflow-x: auto; line-height: 1.55;
}
.payload .k { color: #b08cff; }
.payload .s { color: var(--green); }
.payload .n { color: var(--amber); }
.payload .b { color: var(--blue); }

/* ── Misc utilities ──────────────────────────────────────────── */
.divider { height: 1px; background: var(--border-2); margin: 16px 0; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--text-3); }
.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
.req { color: var(--red); }
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  display: inline-block; animation: spin .7s linear infinite;
  vertical-align: -2px;
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeIn     { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideInUp  { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes spin       { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes fadeOut    { from { opacity: 1; } to { opacity: 0; } }
.fade-out { animation: fadeOut .3s ease forwards; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .app { grid-template-columns: 64px 1fr; }
  .sidebar .nav-label, .sidebar-brand-name, .sidebar-brand-sub,
  .sidebar-section-label, .nav-item .badge-mini { display: none; }
  .nav-item { justify-content: center; padding: 8px; }
  .sidebar-brand { justify-content: center; padding: 6px 0 18px; }
}
@media (max-width: 720px) {
  .page { padding: 18px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .drawer, .drawer.wide { width: 100vw; }
  .topbar { padding: 0 12px; }
  .search-box { display: none; }
  .page-header { flex-direction: column; }
}
