/* ============================================================================
   RetroPacket Admin — design system
   ----------------------------------------------------------------------------
   Same colour family as retropacket.com (obsidian + indigo) so the panel reads
   as part of the product, but built for density: a dashboard operator scanning
   licenses, revenue, and abuse alerts late at night wants information per inch,
   not marketing whitespace. Dark only. No gradient text, no glass-by-default.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500;600&family=Geist:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Surfaces — obsidian, tinted toward the indigo hue (never pure black). */
  --bg: oklch(16% 0.012 280);
  --surface-1: oklch(19% 0.014 280);
  --surface-2: oklch(22% 0.018 281);
  --surface-3: oklch(26% 0.022 282);
  --surface-hover: oklch(24% 0.02 281);

  --topbar-bg: oklch(16% 0.012 280 / 0.85);

  --border: oklch(30% 0.02 282 / 0.7);
  --border-soft: oklch(28% 0.018 282 / 0.5);
  --border-strong: oklch(40% 0.04 285 / 0.8);

  /* Indigo accent — the product signature. */
  --accent: oklch(72% 0.16 290);
  --accent-strong: oklch(66% 0.19 291);
  --accent-soft: oklch(72% 0.16 290 / 0.14);
  --accent-faint: oklch(72% 0.16 290 / 0.07);

  /* Semantic status. */
  --ok: oklch(74% 0.16 162);
  --ok-soft: oklch(74% 0.16 162 / 0.14);
  --warn: oklch(80% 0.14 78);
  --warn-soft: oklch(80% 0.14 78 / 0.14);
  --danger: oklch(66% 0.2 17);
  --danger-soft: oklch(66% 0.2 17 / 0.14);
  --info: oklch(74% 0.12 230);
  --info-soft: oklch(74% 0.12 230 / 0.14);

  /* Text. */
  --text: oklch(96% 0.008 280);
  --text-muted: oklch(78% 0.014 282);
  --text-dim: oklch(64% 0.018 283);
  --text-faint: oklch(52% 0.02 284);

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-head: 'Geist', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', monospace;

  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 16px;
  --r-xl: 22px;

  --sidebar-w: 244px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-quint: cubic-bezier(0.23, 1, 0.32, 1);

  --shadow-1: 0 1px 2px oklch(0% 0 0 / 0.3);
  --shadow-2: 0 8px 24px -12px oklch(0% 0 0 / 0.55);
  --shadow-pop: 0 24px 60px -20px oklch(0% 0 0 / 0.7);
}

:root[data-theme="light"] {
  /* Colors - Soft Slate-Indigo light theme (less bright, easy on the eyes) */
  --bg: #f0f2f5;
  --surface-1: #e5e8ef;
  --surface-2: #d8dce6;
  --surface-3: #c5cbd7;
  --surface-hover: #dfe3ed;

  --topbar-bg: rgba(240, 242, 245, 0.85);

  --border: rgba(124, 58, 237, 0.12);
  --border-soft: rgba(124, 58, 237, 0.06);
  --border-strong: rgba(124, 58, 237, 0.25);

  --accent: #7c3aed;
  --accent-strong: #6d28d9;
  --accent-soft: rgba(124, 58, 237, 0.12);
  --accent-faint: rgba(124, 58, 237, 0.06);

  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, 0.12);
  --warn: #e69500;
  --warn-soft: rgba(230, 149, 0, 0.12);
  --danger: #e63939;
  --danger-soft: rgba(230, 57, 57, 0.12);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.12);

  --text: #1e293b;
  --text-muted: #475569;
  --text-dim: #64748b;
  --text-faint: #94a3b8;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-2: 0 8px 24px -12px rgba(0, 0, 0, 0.1);
  --shadow-pop: 0 24px 60px -20px rgba(0, 0, 0, 0.15);
}

/* Light theme overrides for buttons & pills */
:root[data-theme="light"] .btn--primary {
  color: #ffffff;
}
:root[data-theme="light"] .sidebar__logo {
  color: #ffffff;
}

html {
  transition: background-color 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
body, .sidebar, .topbar, .panel, .btn, .input, .select, .textarea, .seg, .plan-card {
  transition: background-color 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}


* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body { background: var(--bg); min-height: 100vh; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 9999px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

::selection { background: var(--accent-soft); color: var(--text); }

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }

code, .mono { font-family: var(--font-mono); font-variant-ligatures: none; }

/* Focus ring — visible, accent-tinted, never removed without replacement. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ══════════════════ APP SHELL ══════════════════ */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 18px;
}
.sidebar__logo {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--accent-strong), var(--accent));
  color: oklch(18% 0.02 280);
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 0 0 1px var(--border-strong), 0 6px 16px -6px var(--accent-soft);
}
.sidebar__title { display: flex; flex-direction: column; line-height: 1.1; }
.sidebar__title b { font-family: var(--font-head); font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.sidebar__title span { font-size: 11px; color: var(--text-dim); letter-spacing: 0.06em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav__group {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 14px 10px 6px;
  font-weight: 600;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }
.nav a:hover { background: var(--surface-hover); color: var(--text); }
.nav a.active { background: var(--accent-faint); color: var(--text); }
.nav a.active svg { color: var(--accent); opacity: 1; }
.nav a.active::before {
  content: '';
  position: absolute;
  left: -14px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav__badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9999px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
}

.sidebar__foot {
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
  margin-top: 8px;
}
.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
}
.sidebar__avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--surface-3);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
  text-transform: uppercase;
}
.sidebar__user-meta { line-height: 1.2; flex: 1; min-width: 0; }
.sidebar__user-meta b { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-meta span { font-size: 11px; color: var(--text-dim); }
.sidebar__logout {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  color: var(--text-dim);
  transition: background 0.16s, color 0.16s;
}
.sidebar__logout:hover { background: var(--danger-soft); color: var(--danger); }
.sidebar__logout svg { width: 16px; height: 16px; }

/* ══════════════════ MAIN ══════════════════ */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar__title { font-size: 19px; font-weight: 700; }
.topbar__sub { font-size: 12.5px; color: var(--text-dim); margin-left: 2px; }
.topbar__spacer { flex: 1; }

.page { padding: 24px 28px 64px; max-width: 1320px; width: 100%; }

/* ══════════════════ BUTTONS ══════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s var(--ease), opacity 0.15s;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn--primary { background: var(--accent); border-color: transparent; color: oklch(18% 0.02 280); }
.btn--primary:hover { background: var(--accent-strong); }
.btn--danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: white; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn--sm { padding: 6px 11px; font-size: 12.5px; }
.btn--xs { padding: 4px 9px; font-size: 11.5px; gap: 5px; border-radius: 6px; }
.btn--icon { padding: 8px; }
.btn--block { width: 100%; }

/* ══════════════════ FORM CONTROLS ══════════════════ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.15s var(--ease), background 0.15s;
}
.input::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-1);
}
.textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.select { cursor: pointer; 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='%23888' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px;
}
.input--mono { font-family: var(--font-mono); font-size: 12.5px; }

/* ══════════════════ PANELS / SECTIONS ══════════════════ */
.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.panel__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.panel__head h2 { font-size: 14.5px; font-weight: 700; }
.panel__head .muted { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.panel__head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel__body { padding: 18px; }
.panel__body--flush { padding: 0; }
.panel--alert { border-color: var(--danger-soft); box-shadow: 0 0 0 1px var(--danger-soft); }

.section-title {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
  margin: 4px 0 12px;
}

/* ══════════════════ METRIC TILES ══════════════════
   Not the hero-metric template: these are compact instrument readouts in a
   dense row, each with a label, value, and an optional delta or sub-figure. */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.metric {
  background: var(--surface-1);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 0.16s var(--ease);
}
.metric:hover { background: var(--surface-2); }
.metric__top { display: flex; align-items: center; gap: 8px; }
.metric__top svg { width: 15px; height: 15px; color: var(--text-dim); }
.metric__label { font-size: 11.5px; color: var(--text-dim); font-weight: 600; letter-spacing: 0.02em; }
.metric__value { font-family: var(--font-head); font-size: 27px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.metric__value small { font-size: 15px; color: var(--text-dim); font-weight: 600; margin-left: 1px; }
.metric__sub { font-size: 11.5px; color: var(--text-faint); }
.metric__sub b { color: var(--text-muted); font-weight: 600; }
.metric--accent .metric__value { color: var(--accent); }
.metric--ok .metric__value { color: var(--ok); }

/* ══════════════════ TABLES ══════════════════ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-1);
  position: sticky;
  top: 0;
}
table.data tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
table.data tbody tr { transition: background 0.12s var(--ease); }
table.data tbody tr:hover { background: var(--surface-hover); }
table.data tbody tr.is-clickable { cursor: pointer; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .col-num { text-align: right; font-family: var(--font-mono); font-size: 12.5px; }
table.data .cell-actions { text-align: right; white-space: nowrap; }
.cell-strong { font-weight: 600; }
.cell-dim { color: var(--text-dim); }
.cell-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }

/* ══════════════════ PILLS / BADGES ══════════════════ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}
.pill--none::before { display: none; }
.pill--ok { background: var(--ok-soft); color: var(--ok); }
.pill--active { background: var(--ok-soft); color: var(--ok); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }
.pill--issued { background: var(--info-soft); color: var(--info); }
.pill--danger, .pill--revoked, .pill--banned { background: var(--danger-soft); color: var(--danger); }
.pill--expired, .pill--suspended, .pill--disabled { background: var(--warn-soft); color: var(--warn); }
.pill--accent { background: var(--accent-soft); color: var(--accent); }

.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-muted);
}

/* ══════════════════ TOOLBAR (filters/search above tables) ══════════════════ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar .search {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 380px;
}
.toolbar .search svg {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}
.toolbar .search .input { padding-left: 34px; }
.seg {
  display: inline-flex;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 2px;
}
.seg button {
  padding: 5px 11px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface-3); color: var(--text); }

/* ══════════════════ DRAWER (license/user detail) ══════════════════ */
.drawer-scrim {
  position: fixed;
  inset: 0;
  background: oklch(10% 0.01 280 / 0.6);
  backdrop-filter: blur(2px);
  z-index: 80;
}
.drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: min(540px, 94vw);
  background: var(--surface-1);
  border-left: 1px solid var(--border);
  z-index: 81;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-pop);
}
.drawer__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.drawer__head h2 { font-size: 16px; }
.drawer__head .mono { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.drawer__close {
  margin-left: auto;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-dim);
  background: transparent; border: none;
  transition: background 0.15s, color 0.15s;
}
.drawer__close:hover { background: var(--surface-hover); color: var(--text); }
.drawer__body { padding: 20px 22px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 22px; }

/* key/value grid used in drawers */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; font-size: 13px; }
.kv dt { color: var(--text-dim); font-weight: 500; }
.kv dd { text-align: right; font-weight: 500; }
.kv dd.mono { font-family: var(--font-mono); font-size: 12px; }

/* ══════════════════ MODAL / DIALOG ══════════════════ */
.modal-scrim {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: oklch(10% 0.01 280 / 0.62);
  backdrop-filter: blur(3px);
  z-index: 90;
  padding: 20px;
}
.modal {
  width: min(460px, 96vw);
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.modal__head { padding: 18px 20px 12px; }
.modal__head h3 { font-size: 16px; }
.modal__head p { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.modal__body { padding: 4px 20px 18px; display: flex; flex-direction: column; gap: 14px; }
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-2);
}

/* ══════════════════ TOAST ══════════════════ */
.toast-stack {
  position: fixed;
  bottom: 22px; right: 22px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 15px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-2);
  font-size: 13.5px;
  font-weight: 500;
}
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast--ok { border-color: var(--ok-soft); }
.toast--ok svg { color: var(--ok); }
.toast--err { border-color: var(--danger-soft); }
.toast--err svg { color: var(--danger); }

/* ══════════════════ MISC ══════════════════ */
.row-actions { display: inline-flex; gap: 6px; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack--sm { gap: 10px; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex--between { justify-content: space-between; }
.flex--wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__track {
  width: 38px; height: 22px;
  border-radius: 9999px;
  background: var(--surface-3);
  position: relative;
  transition: background 0.2s var(--ease);
  flex-shrink: 0;
}
.toggle__track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s var(--ease), background 0.2s;
}
.toggle input:checked + .toggle__track { background: var(--accent); }
.toggle input:checked + .toggle__track::after { transform: translateX(16px); background: oklch(18% 0.02 280); }
.toggle input:focus-visible + .toggle__track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* mini bar chart */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; justify-content: flex-end; }
.bars__bar {
  width: 100%;
  max-width: 26px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  min-height: 3px;
  transition: height 0.5s var(--ease-out-quint);
}
.bars__bar--muted { background: var(--surface-3); }
.bars__label { font-size: 10px; color: var(--text-faint); }

/* empty / loading */
.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-dim);
}
.empty svg { width: 34px; height: 34px; margin-bottom: 12px; color: var(--text-faint); }
.empty h3 { font-size: 15px; color: var(--text-muted); margin-bottom: 4px; }
.empty p { font-size: 13px; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.loading-page { display: grid; place-items: center; min-height: 60vh; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.7s linear infinite; width: 16px; height: 16px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ══════════════════ LOGIN ══════════════════ */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: '';
  position: absolute;
  top: -20%; left: 50%;
  transform: translateX(-50%);
  width: 900px; height: 600px;
  background: radial-gradient(ellipse at center, var(--accent-soft) 0%, transparent 70%);
  filter: blur(60px);
  pointer-events: none;
}
.login-card {
  position: relative;
  width: min(400px, 100%);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 34px 32px;
  box-shadow: var(--shadow-pop);
}
.login-card__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card__sub { font-size: 13px; color: var(--text-dim); margin-bottom: 24px; }
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.login-error {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}
.login-error svg { width: 16px; height: 16px; flex-shrink: 0; }
.login-foot { margin-top: 22px; text-align: center; font-size: 11.5px; color: var(--text-faint); }

@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.28s var(--ease);
    width: var(--sidebar-w);
  }
  .sidebar.open { transform: translateX(0); }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .page { padding: 18px 16px 56px; }
  .topbar { padding: 14px 16px; }
}
.sidebar__backdrop {
  display: none;
}
@media (max-width: 880px) {
  .sidebar__backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: oklch(10% 0.01 280 / 0.5);
    z-index: 55;
  }
  .menu-btn { display: grid !important; }
}
.menu-btn { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ══════════════════ DASHBOARD ADDITIONS ══════════════════
   Customer-portal-only components layered on top of the shared admin design
   system: the buy-page plan grid, the copy-able code box used on the download
   and post-payment screens, and a simple two-up responsive grid. */

/* Two-up responsive grid for account / download panels. */
.dl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

/* Plan cards on the Buy page. */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.plan-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 20px;
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.plan-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.plan-card__name { font-family: var(--font-head); font-size: 17px; font-weight: 700; }
.plan-card__desc { font-size: 12.5px; color: var(--text-dim); margin-top: -6px; }
.plan-card__price {
  font-family: var(--font-head);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent);
}
.plan-card__period { font-size: 13px; color: var(--text-dim); font-weight: 600; margin-left: 3px; }
.plan-card__features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 4px 0 8px;
  flex: 1;
}
.plan-card__features li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text-muted);
}
.plan-card__features li svg { color: var(--accent); flex-shrink: 0; }

/* Copy-able command / credential box. */
.code-box {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}
.code-box code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  word-break: break-all;
  user-select: all;
}

/* Theme switch & Language dropdown rules for topbar */
.theme-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.theme-btn:hover {
  border-color: var(--border-soft);
  color: var(--text);
  background: var(--surface-2);
}
:root[data-theme="light"] .theme-btn:hover {
  border-color: rgba(0,0,0,0.05);
  background: rgba(0,0,0,0.03);
}

.lang-dropdown-container {
  position: relative;
  display: inline-block;
}
.lang-dropdown-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  height: 32px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.lang-dropdown-btn:hover,
.lang-dropdown-btn.active {
  border-color: var(--border-soft);
  color: var(--text);
  background: var(--surface-2);
}
:root[data-theme="light"] .lang-dropdown-btn:hover,
:root[data-theme="light"] .lang-dropdown-btn.active {
  border-color: var(--border);
  background: rgba(0,0,0,0.03);
}
.lang-dropdown-btn .icon-globe {
  opacity: 0.8;
  transition: transform 0.3s;
}
.lang-dropdown-btn:hover .icon-globe {
  transform: rotate(15deg);
}
.lang-dropdown-btn .icon-chevron {
  opacity: 0.6;
  transition: transform 0.3s;
}
.lang-dropdown-btn .icon-chevron.open {
  transform: rotate(180deg);
}
.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  min-width: 145px;
  box-shadow: var(--shadow-pop);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: slide-dropdown 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  transform-origin: top right;
}
:root[data-theme="light"] .lang-dropdown-menu {
  background-color: rgba(229, 232, 239, 0.95);
}
@keyframes slide-dropdown {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.lang-dropdown-item {
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 5px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.lang-dropdown-item:hover {
  background-color: var(--surface-3);
  color: var(--text);
}
:root[data-theme="light"] .lang-dropdown-item:hover {
  background-color: rgba(0,0,0,0.04);
}
.lang-dropdown-item.selected {
  background-color: var(--accent-faint);
  color: var(--accent);
  font-weight: 500;
}
:root[data-theme="light"] .lang-dropdown-item.selected {
  background-color: rgba(124, 58, 237, 0.1);
  color: var(--accent);
}
.lang-item-short {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  background-color: var(--surface-3);
  color: var(--text-muted);
  padding: 1px 4px;
  border-radius: 3px;
  width: 22px;
  text-align: center;
}
.lang-dropdown-item.selected .lang-item-short {
  background-color: var(--accent);
  color: var(--bg);
}
.lang-item-indicator {
  position: absolute;
  right: 12px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--accent);
}

