/* ──────────────────────────────────────────────────────────────
   PokeKING Admin · Tokens & Base
   ────────────────────────────────────────────────────────────── */

:root {
  /* Indigo primary */
  --primary-50:  #EEF2FF;
  --primary-100: #E0E7FF;
  --primary-200: #C7D2FE;
  --primary-300: #A5B4FC;
  --primary-400: #818CF8;
  --primary-500: #6366F1;
  --primary-600: #4F46E5;
  --primary-700: #4338CA;
  --primary-800: #3730A3;

  --indigo:   #6366F1;
  --indigo-2: #4F46E5;

  /* Semantic */
  --success: #10B981;
  --success-bg: #ECFDF5;
  --warning: #F59E0B;
  --warning-bg: #FEF3C7;
  --danger:  #EF4444;
  --danger-bg: #FEF2F2;
  --info:    #3B82F6;
  --info-bg: #EFF6FF;

  /* Type chip palette (Pokémon, subdued — for type chips only) */
  --t-normal:#A8A77A; --t-fire:#EE8130; --t-water:#6390F0; --t-electric:#F7D02C;
  --t-grass:#7AC74C; --t-ice:#96D9D6; --t-fighting:#C22E28; --t-poison:#A33EA1;
  --t-ground:#E2BF65; --t-flying:#A98FF3; --t-psychic:#F95587; --t-bug:#A6B91A;
  --t-rock:#B6A136; --t-ghost:#735797; --t-dragon:#6F35FC; --t-dark:#705746;
  --t-steel:#B7B7CE; --t-fairy:#D685AD;

  /* Light defaults */
  --bg: #FAFAF9;
  --bg-elev: #F4F4F2;
  --surface: #FFFFFF;
  --surface-2: #F7F7F5;
  --surface-3: #EFEFEC;
  --border: #E7E5E1;
  --border-strong: #D6D3CE;
  --text: #18181B;
  --text-2: #52525B;
  --text-3: #8A8A93;
  --text-on-primary: #FFFFFF;
  --shadow-sm: 0 1px 0 rgba(15,15,20,.04), 0 1px 2px rgba(15,15,20,.04);
  --shadow-md: 0 4px 12px rgba(15,15,20,.06), 0 1px 3px rgba(15,15,20,.04);
  --shadow-lg: 0 24px 48px rgba(15,15,20,.12), 0 4px 12px rgba(15,15,20,.06);
  --shadow-pop: 0 12px 32px rgba(15,15,20,.18);

  /* Radius */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-pill: 999px;

  /* Spacing scale (8px grid) */
  --s-1: 4px;   --s-2: 8px;   --s-3: 12px;  --s-4: 16px;
  --s-5: 20px;  --s-6: 24px;  --s-7: 32px;  --s-8: 40px;
  --s-9: 48px;  --s-10: 64px;

  /* Type */
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Helvetica Neue", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, monospace;
  --font-pixel: "Pixelify Sans", "Geist Mono", monospace;

  --topbar-h: 56px;
  --sidebar-w: 232px;
  --sidebar-w-collapsed: 64px;
}

[data-theme="dark"] {
  --bg:        #0B0B0F;
  --bg-elev:   #111117;
  --surface:   #14141B;
  --surface-2: #1A1A22;
  --surface-3: #22222B;
  --border:    #25252F;
  --border-strong: #34343F;
  --text:      #F4F4F5;
  --text-2:    #A1A1AA;
  --text-3:    #71717A;
  --text-on-primary: #FFFFFF;

  --primary-50:  #1E1B4B;
  --primary-100: #312E81;
  --primary-bg: rgba(99,102,241,.12);

  --success-bg: rgba(16,185,129,.12);
  --warning-bg: rgba(245,158,11,.12);
  --danger-bg:  rgba(239,68,68,.12);
  --info-bg:    rgba(59,130,246,.12);

  --shadow-sm: 0 1px 0 rgba(0,0,0,.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 24px 48px rgba(0,0,0,.6);
  --shadow-pop: 0 12px 32px rgba(0,0,0,.6);
}

/* Auto follow system when [data-theme="auto"] */
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg:        #0B0B0F;
    --bg-elev:   #111117;
    --surface:   #14141B;
    --surface-2: #1A1A22;
    --surface-3: #22222B;
    --border:    #25252F;
    --border-strong: #34343F;
    --text:      #F4F4F5;
    --text-2:    #A1A1AA;
    --text-3:    #71717A;
    --primary-bg: rgba(99,102,241,.12);
    --success-bg: rgba(16,185,129,.12);
    --warning-bg: rgba(245,158,11,.12);
    --danger-bg:  rgba(239,68,68,.12);
    --info-bg:    rgba(59,130,246,.12);
    --shadow-sm: 0 1px 0 rgba(0,0,0,.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,.4);
    --shadow-lg: 0 24px 48px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.5;
}

/* Scroll styling */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 2px solid var(--bg);
  border-radius: var(--r-pill);
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ─── Reset elements ──────────────────────────────────────── */
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5, h6, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* ─── Selection & focus ───────────────────────────────────── */
::selection { background: var(--primary-200); color: var(--primary-800); }
[data-theme="dark"] ::selection,
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] ::selection { background: rgba(99,102,241,.35); color: #fff; }
}
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; border-radius: var(--r-sm); }

/* ─── Utility ─────────────────────────────────────────────── */
.mono { font-family: var(--font-mono); font-feature-settings: "ss03"; }
.pixel { font-family: var(--font-pixel); letter-spacing: .02em; }
.muted { color: var(--text-2); }
.dim   { color: var(--text-3); }

.hstack { display: flex; align-items: center; gap: var(--s-3); }
.vstack { display: flex; flex-direction: column; gap: var(--s-3); }

/* ─── App shell ────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
  background: var(--bg);
}
.app-shell.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
.app-shell > .topbar { grid-column: 1 / -1; }
.app-shell > .sidebar { grid-row: 2; }
.app-shell > .main { grid-row: 2; overflow: auto; }

/* ─── Topbar ──────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center;
  padding: 0 var(--s-5);
  gap: var(--s-5);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  height: var(--topbar-h);
  z-index: 30;
  position: relative;
}
.brand {
  display: flex; align-items: center; gap: var(--s-3);
  font-weight: 600;
  letter-spacing: -.01em;
  width: calc(var(--sidebar-w) - var(--s-5));
  margin-left: calc(-1 * var(--s-5) + var(--s-5));
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(155deg, var(--indigo) 50%, #fff 50%);
  position: relative;
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 2px var(--indigo);
  flex-shrink: 0;
}
.brand-mark::after {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--indigo);
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.brand-text {
  display: flex; flex-direction: column; line-height: 1;
}
.brand-text .name { font-weight: 600; font-size: 14px; }
.brand-text .role {
  font-family: var(--font-mono);
  font-size: 10px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .12em;
  margin-top: 2px;
}

.global-search {
  flex: 1; max-width: 480px;
  display: flex; align-items: center; gap: var(--s-2);
  height: 34px;
  padding: 0 var(--s-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-3);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.global-search:hover { border-color: var(--border-strong); background: var(--surface); }
.global-search .kbd {
  margin-left: auto;
  display: flex; gap: 4px;
}

.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-weight: 500;
}

.top-right { margin-left: auto; display: flex; align-items: center; gap: var(--s-3); }
.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  color: var(--text-2);
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 7px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg);
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo), #A855F7);
  display: grid; place-items: center;
  color: white; font-weight: 600; font-size: 12px;
  cursor: pointer;
}

/* ─── Sidebar ─────────────────────────────────────────── */
.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg);
  padding: var(--s-3) var(--s-3) var(--s-4);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.sidebar-section {
  padding: var(--s-3) var(--s-3) var(--s-2);
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 8px var(--s-3);
  border-radius: var(--r-md);
  color: var(--text-2);
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background .1s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 7px calc(var(--s-3) - 1px);
}
[data-theme="dark"] .nav-item.active,
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .nav-item.active { background: var(--surface-2); }
}
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-item.active .icon { color: var(--indigo); opacity: 1; }
.nav-item .label { flex: 1; }
.nav-item .badge { margin-left: auto; }

/* ─── Main content ────────────────────────────────────── */
.main { padding: var(--s-7) var(--s-8); }
.main .page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: var(--s-6);
  gap: var(--s-4);
}
.breadcrumb {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: 13px; color: var(--text-3);
  margin-bottom: var(--s-2);
}
.breadcrumb .sep { opacity: .5; }
.page-title { font-size: 24px; font-weight: 600; letter-spacing: -.015em; }
.page-subtitle { color: var(--text-2); margin-top: var(--s-1); font-size: 13px; }

/* ─── Primitives ──────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-pad { padding: var(--s-6); }
.card-pad-sm { padding: var(--s-5); }
.card-header {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-weight: 600; font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 34px; padding: 0 var(--s-4);
  font-weight: 500; font-size: 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: background .1s, border-color .1s, transform .04s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(0.5px); }
.btn.primary {
  background: var(--indigo); border-color: var(--indigo); color: var(--text-on-primary);
}
.btn.primary:hover { background: var(--indigo-2); border-color: var(--indigo-2); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn.success { color: var(--success); }
.btn.success:hover { background: var(--success-bg); border-color: var(--success); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 28px; padding: 0 var(--s-3); font-size: 12px; border-radius: var(--r-sm); }
.btn.xs { height: 24px; padding: 0 var(--s-2); font-size: 11px; border-radius: var(--r-sm); gap: 4px; }
.btn.icon { width: 34px; padding: 0; justify-content: center; }
.btn.icon.sm { width: 28px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  white-space: nowrap;
  font-size: 12px; font-weight: 500;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.pending { color: #92400E; background: var(--warning-bg); border-color: transparent; }
.pill.approved { color: #065F46; background: var(--success-bg); border-color: transparent; }
.pill.rejected { color: #991B1B; background: var(--danger-bg); border-color: transparent; }
.pill.merged   { color: var(--primary-700); background: var(--primary-50); border-color: transparent; }
.pill.new      { color: #1E40AF; background: var(--info-bg); border-color: transparent; }
[data-theme="dark"] .pill.pending,@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .pill.pending { color: #FCD34D; }
}
[data-theme="dark"] .pill.approved,@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .pill.approved { color: #6EE7B7; }
}
[data-theme="dark"] .pill.rejected,@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .pill.rejected { color: #FCA5A5; }
}
[data-theme="dark"] .pill.merged,@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .pill.merged { color: #C7D2FE; }
}
[data-theme="dark"] .pill.new,@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .pill.new { color: #93C5FD; }
}

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font-size: 11px; font-weight: 600;
  background: var(--indigo);
  color: white;
  border-radius: var(--r-pill);
}
.badge.subtle { background: var(--surface-3); color: var(--text-2); }

.type-chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 7px;
  font-size: 11px; font-weight: 500;
  border-radius: var(--r-sm);
  color: white;
  text-shadow: 0 1px 0 rgba(0,0,0,.12);
}

.input, .textarea, .select {
  display: block; width: 100%;
  height: 34px;
  padding: 0 var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--primary-100);
}
[data-theme="dark"] .input:focus,@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .input:focus { box-shadow: 0 0 0 3px rgba(99,102,241,.2); }
}
.textarea { height: auto; min-height: 80px; padding: 8px 12px; resize: vertical; line-height: 1.5; }
.input.error { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }

label.field {
  display: block;
  font-size: 12px; font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

/* ─── Table ─────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.table thead th {
  text-align: left;
  font-weight: 500;
  color: var(--text-3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 1;
}
.table tbody td {
  padding: var(--s-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr {
  background: var(--surface);
  transition: background .08s;
}
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.selected { background: var(--primary-50); }
[data-theme="dark"] .table tbody tr.selected,@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .table tbody tr.selected { background: rgba(99,102,241,.08); }
}
.table tbody tr.focused {
  box-shadow: inset 2px 0 0 var(--indigo);
}

/* ─── Sprite / Avatar tiles ──────────────────────────── */
.sprite {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  display: grid; place-items: center;
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--text-3);
  border: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.sprite.sm { width: 28px; height: 28px; font-size: 8px; }
.sprite.lg { width: 64px; height: 64px; font-size: 11px; }
.sprite.missing {
  border-style: dashed;
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-bg);
}

/* Pixel "monster" silhouette as SVG-less placeholder via radial gradient */
.sprite-svg { width: 100%; height: 100%; display: block; }

/* ─── Status dot ────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  margin-right: 6px;
}
.status-dot.ok { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.status-dot.warn { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-bg); }
.status-dot.err { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }

/* ─── Empty state ───────────────────────────────────── */
.empty {
  padding: var(--s-9) var(--s-6);
  text-align: center;
  color: var(--text-2);
}
.empty .glyph {
  width: 56px; height: 56px;
  margin: 0 auto var(--s-4);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--text-3);
}

/* ─── Drawer ────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 50;
  animation: fadeIn .15s ease;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 560px; max-width: 100vw;
  background: var(--bg);
  border-left: 1px solid var(--border);
  z-index: 51;
  display: flex; flex-direction: column;
  animation: drawerIn .22s cubic-bezier(.2,.7,.2,1);
  box-shadow: var(--shadow-lg);
}
.drawer.wide { width: 920px; }
.drawer-header {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer-body { flex: 1; overflow-y: auto; padding: var(--s-5); }
.drawer-footer {
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3);
}

@keyframes drawerIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ─── Toast ──────────────────────────────────────────── */
.toast-stack {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 90;
  display: flex; flex-direction: column-reverse;
  gap: var(--s-2);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  display: flex; align-items: center; gap: var(--s-3);
  box-shadow: var(--shadow-lg);
  animation: slideUp .22s ease;
  min-width: 240px;
}
.toast .toast-icon { color: var(--success); display: grid; place-items: center; }

/* ─── KPI Card ──────────────────────────────────────── */
.kpi {
  padding: var(--s-5);
  display: flex; flex-direction: column; gap: var(--s-2);
  min-height: 108px;
  position: relative;
}
.kpi .kpi-label {
  font-size: 12px; color: var(--text-2);
  display: flex; align-items: center; gap: 6px;
}
.kpi .kpi-value {
  font-size: 28px; font-weight: 600; letter-spacing: -.02em;
  font-feature-settings: "tnum";
}
.kpi .kpi-foot {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-3); margin-top: auto;
}
.delta { font-weight: 500; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--text-3); }

/* ─── Diff highlights ────────────────────────────────── */
.diff-add { background: rgba(16,185,129,.12); color: var(--success); border-radius: 3px; padding: 0 4px; }
.diff-del { background: rgba(239,68,68,.10); color: var(--danger); border-radius: 3px; padding: 0 4px; text-decoration: line-through; }
.diff-changed {
  background: rgba(245,158,11,.12);
  border-radius: 3px; padding: 0 4px;
  box-shadow: inset 0 -1px 0 var(--warning);
}

/* ─── Login ─────────────────────────────────────────── */
.login-wrap {
  position: fixed; inset: 0;
  background: var(--bg);
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-art {
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--s-9);
}
.login-form-wrap {
  display: grid; place-items: center;
  padding: var(--s-9);
}
.login-form { width: 100%; max-width: 340px; }
@media (max-width: 960px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
}

/* ─── Command Palette ───────────────────────────────── */
.cmdk-backdrop {
  position: fixed; inset: 0;
  background: rgba(10,10,15,.4);
  z-index: 80;
  display: flex; justify-content: center;
  padding-top: 12vh;
  animation: fadeIn .14s ease;
}
.cmdk {
  width: 600px; max-width: 92vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 60vh;
  animation: pop .14s cubic-bezier(.2,.8,.2,1);
}
.cmdk-input {
  border: 0; outline: none;
  padding: var(--s-4) var(--s-5);
  font-size: 15px;
  background: transparent;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.cmdk-input::placeholder { color: var(--text-3); }
.cmdk-list { overflow-y: auto; padding: var(--s-2); }
.cmdk-group {
  padding: var(--s-2) var(--s-3) 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
}
.cmdk-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 8px var(--s-3);
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
}
.cmdk-item .icon { width: 18px; height: 18px; color: var(--text-2); }
.cmdk-item .meta { margin-left: auto; color: var(--text-3); font-size: 11px; font-family: var(--font-mono); }
.cmdk-item.active { background: var(--primary-50); }
[data-theme="dark"] .cmdk-item.active,@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .cmdk-item.active { background: rgba(99,102,241,.12); }
}
.cmdk-foot {
  border-top: 1px solid var(--border);
  padding: 8px var(--s-4);
  font-size: 11px;
  color: var(--text-3);
  display: flex; align-items: center; gap: var(--s-4);
}

/* ─── Section header (in lists) ─────────────────────── */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: var(--s-7) 0 var(--s-4);
}
.section-head .h { font-weight: 600; font-size: 15px; }
.section-head .h .count { color: var(--text-3); margin-left: 6px; font-weight: 400; }

/* ─── Misc ──────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: var(--s-5) 0; }
.dot-sep { color: var(--text-3); }
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-bottom-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  display: flex; align-items: flex-start; gap: var(--s-3);
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.alert.info { background: var(--info-bg); border-color: transparent; color: #1E40AF; }
.alert.warn { background: var(--warning-bg); border-color: transparent; color: #92400E; }
.alert.danger { background: var(--danger-bg); border-color: transparent; color: #991B1B; }
[data-theme="dark"] .alert.info, @media (prefers-color-scheme: dark) { [data-theme="auto"] .alert.info { color: #93C5FD; } }
[data-theme="dark"] .alert.warn, @media (prefers-color-scheme: dark) { [data-theme="auto"] .alert.warn { color: #FCD34D; } }
[data-theme="dark"] .alert.danger, @media (prefers-color-scheme: dark) { [data-theme="auto"] .alert.danger { color: #FCA5A5; } }

.progress {
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress > .fill {
  height: 100%;
  background: var(--indigo);
  border-radius: var(--r-pill);
  transition: width .3s ease;
}
.progress > .fill.warn { background: var(--warning); }
.progress > .fill.danger { background: var(--danger); }

/* ─── Page-specific ─────────────────────────────────── */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}
.team-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--s-2);
}

/* Tree (data editor) */
.tree-item {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 6px var(--s-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
}
.tree-item:hover { background: var(--surface-2); }
.tree-item.active { background: var(--primary-50); color: var(--primary-700); font-weight: 500; }
[data-theme="dark"] .tree-item.active,@media (prefers-color-scheme: dark) {
  [data-theme="auto"] .tree-item.active { background: rgba(99,102,241,.12); color: var(--primary-300); }
}
.tree-item.group { font-weight: 600; color: var(--text); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding-top: var(--s-3); }
.tree-item .count { margin-left: auto; color: var(--text-3); font-size: 11px; font-family: var(--font-mono); }

/* Hex-ish brand motif (subtle, used 1 place: login art) */
.hex-bg {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0);
  background-size: 20px 20px;
  opacity: .6;
  pointer-events: none;
}
