/* VAL 2026 — Linear / Vercel inspired design system */

:root,
[data-theme="val-dark"] {
  --surface-base: #09090b;
  --surface-1: #111113;
  --surface-2: #18181b;
  --surface-3: #1f1f23;
  --surface-hover: #27272a;
  --border: rgba(255,255,255,.06);
  --border-hover: rgba(255,255,255,.12);
  --text: #fafafa;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --accent: #a78bfa;
  --accent-hover: #c4b5fd;
  --accent-muted: rgba(167,139,250,.12);
  --accent-glow: rgba(167,139,250,.25);
  --success: #4ade80;
  --success-muted: rgba(74,222,128,.12);
  --danger: #f87171;
  --danger-muted: rgba(248,113,113,.12);
  --warning: #fbbf24;
  --warning-muted: rgba(251,191,36,.12);
  --info: #60a5fa;
  --mesh-1: rgba(167,139,250,.15);
  --mesh-2: rgba(99,102,241,.1);
  --mesh-3: rgba(139,92,246,.08);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SF Mono", "Cascadia Code", "Consolas", monospace;
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar: 240px;
  --sidebar-mini: 68px;
  --ease: cubic-bezier(.16,1,.3,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
}

[data-theme="val-midnight"] {
  --surface-base: #030712; --surface-1: #0a0f1a; --surface-2: #111827; --surface-3: #1e293b;
  --accent: #38bdf8; --accent-hover: #7dd3fc; --accent-muted: rgba(56,189,248,.12); --accent-glow: rgba(56,189,248,.2);
  --mesh-1: rgba(56,189,248,.12); --mesh-2: rgba(59,130,246,.08); --mesh-3: rgba(37,99,235,.06);
}

[data-theme="val-emerald"] {
  --surface-base: #021208; --surface-1: #051a0f; --surface-2: #0a2418; --surface-3: #0f3020;
  --accent: #34d399; --accent-hover: #6ee7b7; --accent-muted: rgba(52,211,153,.12); --accent-glow: rgba(52,211,153,.2);
  --mesh-1: rgba(52,211,153,.1); --mesh-2: rgba(16,185,129,.08); --mesh-3: rgba(5,150,105,.06);
}

[data-theme="val-rose"] {
  --surface-base: #0c0406; --surface-1: #15080c; --surface-2: #1f0d12; --surface-3: #2a1118;
  --accent: #fb7185; --accent-hover: #fda4af; --accent-muted: rgba(251,113,133,.12); --accent-glow: rgba(251,113,133,.2);
  --mesh-1: rgba(251,113,133,.1); --mesh-2: rgba(244,63,94,.08); --mesh-3: rgba(225,29,72,.06);
}

[data-theme="val-light"] {
  --surface-base: #fafafa; --surface-1: #ffffff; --surface-2: #f4f4f5; --surface-3: #e4e4e7;
  --surface-hover: #d4d4d8; --border: rgba(0,0,0,.06); --border-hover: rgba(0,0,0,.12);
  --text: #09090b; --text-secondary: #52525b; --text-tertiary: #a1a1aa;
  --accent: #7c3aed; --accent-hover: #8b5cf6; --accent-muted: rgba(124,58,237,.08); --accent-glow: rgba(124,58,237,.15);
  --mesh-1: rgba(124,58,237,.06); --mesh-2: rgba(99,102,241,.04); --mesh-3: rgba(139,92,246,.03);
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  margin: 0; min-height: 100vh;
  font-family: var(--font);
  background: var(--surface-base);
  color: var(--text);
  letter-spacing: -0.011em;
  line-height: 1.5;
}
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-size: 13px; }
.mobile-only { display: none; }
.hide-mobile { display: flex; }

/* Mesh background */
.mesh-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.mesh-orb {
  position: absolute; border-radius: 50%; filter: blur(80px);
  animation: float 20s ease-in-out infinite;
}
.mesh-orb-1 { width: 600px; height: 600px; background: var(--mesh-1); top: -200px; left: -100px; }
.mesh-orb-2 { width: 500px; height: 500px; background: var(--mesh-2); bottom: -150px; right: -100px; animation-delay: -7s; }
.mesh-orb-3 { width: 400px; height: 400px; background: var(--mesh-3); top: 40%; left: 50%; animation-delay: -14s; }
.mesh-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent);
  opacity: .4;
}
@keyframes float {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(30px,-20px) scale(1.05); }
  66% { transform: translate(-20px,15px) scale(.95); }
}

/* Login */
.login-screen {
  position: relative; z-index: 10;
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-shell {
  display: grid; grid-template-columns: 1fr 400px; gap: 48px; max-width: 960px; width: 100%; align-items: center;
}
.login-showcase h1 {
  font-size: clamp(2rem, 5vw, 3rem); font-weight: 600; letter-spacing: -0.04em; line-height: 1.1; margin: 16px 0;
}
.login-showcase p { color: var(--text-secondary); font-size: 15px; max-width: 380px; margin: 0 0 24px; }
.showcase-badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-muted); color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: .04em;
}
.showcase-features { list-style: none; padding: 0; margin: 0; }
.showcase-features li {
  padding: 8px 0; color: var(--text-secondary); font-size: 14px;
  padding-left: 20px; position: relative;
}
.showcase-features li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }
.login-card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px;
  box-shadow: 0 0 0 1px var(--border), 0 24px 48px rgba(0,0,0,.4);
  animation: rise .5s var(--ease) both;
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 28px; }
.login-brand strong { display: block; font-size: 16px; font-weight: 600; }
.login-brand span { color: var(--text-secondary); font-size: 13px; }
.login-step { display: flex; flex-direction: column; gap: 12px; }
.login-hint { margin: 0; font-size: 12px; }
.recaptcha-note { margin: 0; font-size: 11px; opacity: .65; text-align: center; }
.turnstile-wrap { display: flex; justify-content: center; min-height: 68px; margin: 4px 0 8px; }
.turnstile-wrap.hidden { display: none; }
.login-brand .brand-mark {
  width: 48px; height: 48px; min-width: 48px; min-height: 48px;
  border-radius: 12px;
  background: #0a0a0a;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0; padding: 0;
}
.login-brand .brand-mark .brand-logo,
.login-brand img.brand-logo {
  width: 48px; height: 48px; max-width: 48px; max-height: 48px;
  object-fit: cover; display: block;
  image-rendering: pixelated;
}
.brand-mark {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #000));
  display: grid; place-items: center; font-weight: 700; font-size: 18px; color: #fff;
  overflow: hidden; flex-shrink: 0;
}
.brand-mark .brand-logo {
  width: 100%; height: 100%; max-width: 100%; max-height: 100%;
  object-fit: cover; display: block;
}
.brand-mark.sm { width: 32px; height: 32px; font-size: 14px; border-radius: 8px; }
.error-text { color: var(--danger); font-size: 13px; margin-top: 12px; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* App shell */
.app { position: relative; z-index: 1; display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex-shrink: 0;
  background: var(--surface-1); border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  transition: width .25s var(--ease);
}
.sidebar.collapsed { width: var(--sidebar-mini); }
.sidebar.collapsed .brand-text, .sidebar.collapsed .nav-label, .sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-meta, .sidebar.collapsed .cmd-trigger span, .sidebar.collapsed .cmd-trigger kbd,
.sidebar.collapsed #logout-btn, .sidebar.collapsed .tg-profile-text { display: none; }
.sidebar.collapsed .tg-collapse {
  position: static; transform: none; margin: 6px auto 0;
  display: inline-flex !important; width: 28px; height: 28px;
}
.sidebar.collapsed .tg-profile-card {
  position: relative; flex-direction: column; justify-content: center; padding: 12px 6px;
}
.sidebar.collapsed .tg-collapse svg { transform: rotate(180deg); }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar.collapsed .cmd-trigger.mini { padding: 10px; justify-content: center; }
.sidebar-toggle-btn { flex-shrink: 0; }
.sidebar-toggle-btn .sidebar-toggle-icon { transition: transform .25s var(--ease); }
body.sidebar-collapsed .sidebar-toggle-btn .sidebar-toggle-icon { transform: rotate(90deg); }
.sidebar-inner { display: flex; flex-direction: column; height: 100%; padding: 16px 12px; }

.brand-row { display: flex; align-items: center; gap: 10px; padding: 4px 6px 16px; }

/* Telegram profile card — sidebar top */
.tg-profile-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 10px 16px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.tg-avatar-wrap { position: relative; flex-shrink: 0; }
.tg-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; background: var(--surface-3);
  border: 2px solid var(--border-hover);
  box-shadow: 0 0 0 2px var(--accent-muted);
}
.tg-online-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--success); border: 2px solid var(--surface-1);
  box-shadow: 0 0 6px var(--success);
}
.tg-profile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tg-profile-text strong {
  font-size: 14px; font-weight: 600; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tg-username {
  font-size: 12px; color: var(--text-tertiary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tg-plan-badge {
  display: inline-flex; align-self: flex-start; margin-top: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
}
.tg-plan-badge.free { background: var(--surface-3); color: var(--text-secondary); border: 1px solid var(--border); }
.tg-plan-badge.vip { background: linear-gradient(135deg, rgba(234,179,8,.2), rgba(249,115,22,.15)); color: #fbbf24; border: 1px solid rgba(251,191,36,.3); }
.tg-plan-badge.lifetime { background: linear-gradient(135deg, rgba(167,139,250,.2), rgba(139,92,246,.15)); color: var(--accent); border: 1px solid rgba(167,139,250,.35); }
.tg-plan-badge.paid { background: var(--accent-muted); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.tg-plan-badge.expired { background: var(--danger-muted); color: var(--danger); border-color: transparent; opacity: .85; }

.sidebar.collapsed .tg-profile-text,
.sidebar.collapsed .tg-collapse { display: none; }
.sidebar.collapsed .tg-profile-card { justify-content: center; padding: 12px 8px; }
.sidebar.collapsed .tg-avatar { width: 36px; height: 36px; }
.brand-text { flex: 1; min-width: 0; }
.brand-text strong { display: block; font-size: 14px; font-weight: 600; letter-spacing: -.02em; }
.brand-text span { font-size: 11px; color: var(--text-tertiary); }

.nav { flex: 1; overflow-y: auto; }
.nav-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-tertiary); padding: 16px 10px 6px; margin: 0;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; border: 0; background: transparent;
  color: var(--text-secondary); padding: 8px 10px; border-radius: 8px;
  cursor: pointer; font: inherit; font-size: 13px; font-weight: 500;
  transition: all .15s var(--ease); margin-bottom: 2px;
}
.nav-item svg { opacity: .7; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active { background: var(--accent-muted); color: var(--accent); }
.nav-item.active svg { opacity: 1; color: var(--accent); }

.sidebar-foot { padding-top: 12px; border-top: 1px solid var(--border); }
.user-pill { display: flex; gap: 10px; align-items: center; padding: 8px; margin-bottom: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent-muted); color: var(--accent);
  display: grid; place-items: center; font-weight: 600; font-size: 12px;
}
.user-meta strong { display: block; font-size: 12px; font-weight: 600; }
.status-online { font-size: 11px; color: var(--success); }

.main-wrap { flex: 1; margin-left: var(--sidebar); transition: margin-left .25s var(--ease); min-width: 0; }
.sidebar.collapsed ~ .main-wrap { margin-left: var(--sidebar-mini); }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-1) 80%, transparent);
  backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 40;
}
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.topbar-center { flex: 1; max-width: 420px; justify-content: center; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.page-head h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.page-head p { margin: 0; font-size: 12px; color: var(--text-tertiary); }

.cmd-trigger {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-tertiary); font: inherit; font-size: 13px; cursor: pointer;
  transition: all .15s var(--ease);
}
.cmd-trigger:hover { border-color: var(--border-hover); color: var(--text-secondary); background: var(--surface-3); }
.cmd-trigger kbd, .cmd-input-wrap kbd {
  margin-left: auto; padding: 2px 6px; border-radius: 4px;
  background: var(--surface-base); border: 1px solid var(--border);
  font-size: 10px; font-family: inherit; color: var(--text-tertiary);
}
.cmd-trigger.mini { margin-bottom: 12px; padding: 8px 10px; font-size: 12px; }

.main-content { padding: 24px; max-width: 1280px; }
.page { display: none; }
.page.active { display: block; animation: fadeUp .35s var(--ease) both; }

/* Surfaces & Bento */
.surface {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  transition: border-color .2s;
}
.surface:hover { border-color: var(--border-hover); }
.surface-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.surface-head h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-secondary); }

.bento-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px;
}
.bento-stat {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  transition: transform .2s var(--ease-spring), border-color .2s;
  animation: fadeUp .4s var(--ease) both;
}
.bento-stat:nth-child(2) { animation-delay: .05s; }
.bento-stat:nth-child(3) { animation-delay: .1s; }
.bento-stat:nth-child(4) { animation-delay: .15s; }
.bento-stat:hover { transform: translateY(-2px); border-color: var(--border-hover); }
.bento-stat .label { font-size: 12px; color: var(--text-tertiary); font-weight: 500; }
.bento-stat .value { font-size: 28px; font-weight: 600; letter-spacing: -.03em; margin: 6px 0 2px; }
.bento-stat .delta { font-size: 11px; color: var(--text-tertiary); }
.bento-stat .delta.up { color: var(--success); }

.bento-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.bento-wide { grid-row: span 1; }
.bento-full { grid-column: 1 / -1; }

/* Data rows */
.data-rows { display: flex; flex-direction: column; gap: 2px; }
.data-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: 8px; transition: background .15s;
}
.data-row:hover { background: var(--surface-2); }
.data-row strong { font-size: 13px; font-weight: 500; }
.data-row .meta { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 0; max-height: 280px; overflow-y: auto; }
.timeline.tall { max-height: 400px; }
.timeline-item {
  display: flex; gap: 12px; padding: 10px 8px; border-radius: 8px;
  transition: background .15s; font-size: 13px;
}
.timeline-item:hover { background: var(--surface-2); }
.tl-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; }
.tl-dot.info { background: var(--info); }
.tl-dot.warn { background: var(--warning); }
.tl-dot.error { background: var(--danger); }
.tl-body { flex: 1; min-width: 0; }
.tl-body strong { font-weight: 500; display: block; }
.tl-body span { color: var(--text-tertiary); font-size: 12px; }
.tl-time { color: var(--text-tertiary); font-size: 11px; white-space: nowrap; }

/* Pills & badges */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 500;
  background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border);
}
.pill.live .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); animation: pulse 2s infinite; }
.pill.warn { background: var(--warning-muted); color: var(--warning); border-color: transparent; }
.pill.ok { background: var(--success-muted); color: var(--success); border-color: transparent; }
.pill.bad { background: var(--danger-muted); color: var(--danger); border-color: transparent; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.field-row { display: flex; gap: 12px; }
.flex-1 { flex: 1; }
.w-140 { width: 140px; }
input, select, textarea {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}
textarea { resize: vertical; min-height: 80px; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.switch {
  appearance: none; width: 36px; height: 20px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border); cursor: pointer; position: relative;
  transition: background .2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: var(--text-tertiary);
  transition: transform .2s var(--ease-spring);
}
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { transform: translateX(16px); background: #fff; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px; border-radius: 8px; border: none;
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .15s var(--ease);
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #6d28d9, #4f46e5);
  color: #fff;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,.1);
  text-shadow: 0 1px 1px rgba(0,0,0,.25);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #7c3aed, #6366f1); transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-hover); }
.btn-danger { background: var(--danger-muted); color: var(--danger); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: none;
  background: transparent; color: var(--text-secondary);
  display: grid; place-items: center; cursor: pointer; transition: all .15s;
}
.icon-btn.ghost:hover { background: var(--surface-2); color: var(--text); }

/* Command palette */
.cmd-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  animation: fadeIn .15s ease both;
}
.cmd-palette {
  position: fixed; top: 18%; left: 50%; transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px)); z-index: 201;
  background: var(--surface-1); border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.5), 0 0 0 1px var(--border);
  animation: cmdIn .25s var(--ease) both;
}
@keyframes cmdIn { from { opacity:0; transform: translateX(-50%) scale(.96) translateY(-8px); } to { opacity:1; transform: translateX(-50%) scale(1); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.cmd-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.cmd-input-wrap input {
  flex: 1; border: none; background: transparent; padding: 0;
  font-size: 15px; box-shadow: none !important;
}
.cmd-input-wrap input:focus { outline: none; }
.cmd-results { max-height: 320px; overflow-y: auto; padding: 8px; }
.cmd-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  font-size: 13px; transition: background .1s;
}
.cmd-item:hover, .cmd-item.active { background: var(--accent-muted); }
.cmd-item .cmd-icon { width: 28px; height: 28px; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; font-size: 14px; }
.cmd-item .cmd-label { flex: 1; font-weight: 500; }
.cmd-item .cmd-hint { font-size: 11px; color: var(--text-tertiary); }

/* Theme popover */
.theme-popover {
  position: absolute; top: calc(100% + 8px); right: 0; width: 220px;
  background: var(--surface-1); border: 1px solid var(--border-hover);
  border-radius: var(--radius); padding: 12px; box-shadow: 0 16px 48px rgba(0,0,0,.4); z-index: 100;
  animation: fadeUp .2s var(--ease) both;
}
.theme-picker-wrap { position: relative; }
.popover-title { font-size: 11px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 10px; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.theme-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); cursor: pointer; font: inherit; font-size: 11px; color: var(--text-secondary);
  transition: all .15s;
}
.theme-card:hover { border-color: var(--border-hover); }
.theme-card.active, .theme-card.selected { border-color: var(--accent); background: var(--accent-muted); color: var(--accent); }
.swatch { width: 100%; height: 24px; border-radius: 4px; }
.sw-dark { background: linear-gradient(135deg, #a78bfa, #09090b); }
.sw-midnight { background: linear-gradient(135deg, #38bdf8, #030712); }
.sw-emerald { background: linear-gradient(135deg, #34d399, #021208); }
.sw-rose { background: linear-gradient(135deg, #fb7185, #0c0406); }
.sw-light { background: linear-gradient(135deg, #fafafa, #e4e4e7); border: 1px solid var(--border); }

/* Tables */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 600;
  color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
tr:hover td { background: var(--surface-2); }
td code { font-family: var(--mono); font-size: 12px; color: var(--text-secondary); }
.status-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
}
.status-chip .dot { width: 6px; height: 6px; border-radius: 50%; }
.status-chip.up .dot { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-chip.down .dot { background: var(--danger); }

/* Layouts */
.split-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mass-layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; }
.mass-toolbar { align-items: flex-end; margin-bottom: -4px; }
.mass-toolbar .field { margin: 0; }
.gate-select { width: 100%; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; }
.gate-picker-block { margin-bottom: 16px; }
.gate-picker-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.gate-picker-head span:first-child { font-size: 13px; font-weight: 600; color: var(--text); }
.gate-picker-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.gate-pick-card {
  position: relative; overflow: hidden; text-align: left;
  padding: 14px 14px 12px; border-radius: 14px;
  border: 1px solid var(--border); background: linear-gradient(145deg, var(--surface-2), var(--surface-3));
  color: var(--text); cursor: pointer;
  transition: transform .22s var(--ease), border-color .22s, box-shadow .22s, background .22s;
  box-shadow: 0 0 0 rgba(0,0,0,0);
}
.gate-pick-card:hover { transform: translateY(-2px); border-color: var(--border-hover); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.gate-pick-card.active {
  border-color: var(--accent);
  background: linear-gradient(145deg, var(--accent-muted), var(--surface-2));
  box-shadow: 0 0 0 1px var(--accent-glow), 0 12px 32px var(--accent-glow);
}
.gate-pick-glow {
  position: absolute; inset: -40% auto auto -20%; width: 120px; height: 120px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  opacity: 0; transition: opacity .25s;
  pointer-events: none;
}
.gate-pick-card:hover .gate-pick-glow, .gate-pick-card.active .gate-pick-glow { opacity: 1; }
.gate-pick-icon {
  display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center;
  border-radius: 10px; background: var(--surface-base); border: 1px solid var(--border);
  font-size: 16px; margin-bottom: 10px;
}
.gate-pick-card strong { display: block; font-size: 13px; line-height: 1.3; margin-bottom: 4px; }
.gate-pick-meta { font-size: 11px; color: var(--text-tertiary); }
.gate-pick-badge {
  position: absolute; top: 10px; right: 10px;
  font-size: 9px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 999px;
  background: var(--surface-base); border: 1px solid var(--border); color: var(--text-tertiary);
}
.gate-pick-card.active .gate-pick-badge { color: var(--accent); border-color: var(--accent); background: var(--accent-muted); }
.gate-pick-card.gate-offline { opacity: .65; }
.gate-pick-card.gate-offline .gate-pick-live { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.mass-shopify-opts, .mass-stripe-opts { margin-bottom: 12px; }
.site-range-block { margin-top: 4px; }
.site-range-desc { margin-top: 8px; font-size: 11px; }
.bin-tabs { margin-bottom: 16px; }
.bin-tab-pane { display: none; }
.bin-tab-pane.active { display: block; }
.bin-mass-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 16px; }
.bin-mass-card { padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.bin-mass-card h4 { margin: 0 0 8px; font-size: 15px; }
.bin-mass-card.fail { opacity: .7; border-color: var(--danger-muted); }
.bin-flag { font-size: 22px; margin-right: 6px; }
.proxy-pool-row { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 8px; }
.mass-results { margin-top: 16px; }
.mass-result-tabs { margin-bottom: 12px; }
.tab-count {
  display: inline-flex; min-width: 18px; height: 18px; align-items: center; justify-content: center;
  padding: 0 5px; margin-left: 6px; border-radius: 999px; font-size: 10px;
  background: var(--surface-3); color: var(--text-secondary);
}
.seg.active .tab-count { background: var(--accent-muted); color: var(--accent); }
.result-cards-list { max-height: 320px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.result-card {
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); font-size: 12px;
}
.result-card.approved { border-color: rgba(74,222,128,.25); background: var(--success-muted); }
.result-card.declined { border-color: rgba(248,113,113,.2); }
.result-card.errors { border-color: rgba(251,191,36,.25); background: var(--warning-muted); }
.result-card code { display: block; font-size: 11px; margin-bottom: 6px; color: var(--text); }
.result-card span { color: var(--text-secondary); line-height: 1.4; word-break: break-word; }
.proxy-saved-list { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow: auto; }
.proxy-saved-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
}
.proxy-saved-row code { font-size: 11px; word-break: break-all; }
.proxy-saved-meta { font-size: 11px; color: var(--text-tertiary); }
.font-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.font-chip { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-secondary); cursor: pointer; font-size: 13px; transition: border-color .2s, color .2s, background .2s; }
.font-chip:hover { border-color: var(--border-hover); color: var(--text); }
.font-chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-muted); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.settings-grid .span-all { grid-column: 1 / -1; }

.result-panel {
  min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--surface-2); border-radius: var(--radius); border: 1px dashed var(--border);
  color: var(--text-tertiary); font-size: 13px;
}
.result-panel.empty .empty-icon { font-size: 32px; opacity: .3; margin-bottom: 8px; }
.result-panel.has-data { align-items: stretch; border-style: solid; padding: 16px; }
.result-kv div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.result-kv span:first-child { color: var(--text-tertiary); }

.code-block {
  margin-top: 12px; padding: 14px; background: var(--surface-base);
  border: 1px solid var(--border); border-radius: 8px;
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  overflow: auto; max-height: 360px; white-space: pre-wrap;
}

.progress-block { margin-top: 16px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 8px; }
.progress-track { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .4s var(--ease); }

.metric-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.metric {
  text-align: center; padding: 14px 8px; background: var(--surface-2);
  border-radius: 8px; border: 1px solid var(--border);
}
.metric .num { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.metric .lbl { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

/* BIN */
.bin-wrap { max-width: 720px; }
.bin-flag-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.bin-flag-row h4 { margin: 0; }
.bin-hero { display: flex; gap: 10px; margin-bottom: 20px; }
.bin-input { flex: 1; font-size: 20px !important; letter-spacing: .12em; padding: 14px 16px !important; }
.bin-card {
  padding: 24px; background: var(--surface-2); border-radius: var(--radius-lg);
  border: 1px solid var(--border); animation: fadeUp .3s var(--ease) both;
}
.bin-card h4 { margin: 0 0 16px; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.bin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bin-field { padding: 12px; background: var(--surface-1); border-radius: 8px; }
.bin-field label { display: block; font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.bin-field span { font-weight: 500; font-size: 13px; }

/* Segmented control */
.segmented {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-2); border-radius: 8px; border: 1px solid var(--border); margin-bottom: 16px;
}
.seg, .tab {
  padding: 7px 16px; border: none; background: transparent;
  color: var(--text-secondary); font: inherit; font-size: 13px; font-weight: 500;
  border-radius: 6px; cursor: pointer; transition: all .15s;
}
.seg.active, .tab.active { background: var(--surface-1); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* KV list */
.kv-list { display: flex; flex-direction: column; gap: 2px; }
.kv-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: 6px; font-size: 13px;
}
.kv-row:hover { background: var(--surface-2); }
.kv-row span:first-child { color: var(--text-tertiary); flex-shrink: 0; }
.kv-row code { font-family: var(--mono); font-size: 12px; text-align: right; word-break: break-all; }

.about-block { font-size: 13px; color: var(--text-secondary); line-height: 1.8; }
.about-block strong { color: var(--text); }
.hint { font-size: 12px; color: var(--text-tertiary); }

/* Drawer / notifications */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 90; animation: fadeIn .2s ease; }
.drawer {
  position: fixed; top: 0; right: 0; width: min(380px, 100vw); height: 100vh;
  background: var(--surface-1); border-left: 1px solid var(--border); z-index: 100;
  display: flex; flex-direction: column;
  animation: slideIn .3s var(--ease) both;
  box-shadow: -16px 0 48px rgba(0,0,0,.3);
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.drawer-actions { display: flex; gap: 4px; align-items: center; }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px; }
.notif-item {
  display: flex; gap: 12px; padding: 12px; border-radius: 8px; margin-bottom: 6px;
  border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; transition: all .15s;
}
.notif-item.unread { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: var(--accent-muted); }
.notif-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; flex-shrink: 0; }
.notif-icon.success { background: var(--success-muted); color: var(--success); }
.notif-icon.error { background: var(--danger-muted); color: var(--danger); }
.notif-icon.info { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.notif-icon.warn { background: var(--warning-muted); color: var(--warning); }
.notif-body p { margin: 0 0 4px; font-size: 13px; font-weight: 500; }
.notif-body time { font-size: 11px; color: var(--text-tertiary); }
.notif-badge {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700; display: grid; place-items: center;
}
.notif-btn { position: relative; }
.empty-inline { text-align: center; padding: 32px; color: var(--text-tertiary); font-size: 13px; }

/* Toast */
.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast-item {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; min-width: 260px; max-width: 360px;
  background: var(--surface-1); border: 1px solid var(--border-hover);
  border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,.35);
  font-size: 13px; font-weight: 500;
  animation: toastIn .3s var(--ease-spring) both;
}
.toast-item.leaving { animation: toastOut .2s ease forwards; }
.toast-item.success { border-left: 3px solid var(--success); }
.toast-item.error { border-left: 3px solid var(--danger); }
.toast-item.info { border-left: 3px solid var(--info); }
.toast-item.warn { border-left: 3px solid var(--warning); }
@keyframes toastIn { from { opacity:0; transform: translateX(16px) scale(.95); } to { opacity:1; transform: none; } }
@keyframes toastOut { to { opacity:0; transform: translateX(16px); } }

.skeleton { height: 48px; border-radius: 8px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px; }

@media (max-width: 1024px) {
  .bento-stats { grid-template-columns: repeat(2, 1fr); }
  .bento-grid { grid-template-columns: 1fr; }
  .split-layout, .mass-layout { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; max-width: 420px; }
  .login-showcase { display: none; }
}

@media (max-width: 768px) {
  .mobile-only { display: grid; }
  .hide-mobile { display: none !important; }
  .sidebar { transform: translateX(-100%); width: var(--sidebar) !important; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrap { margin-left: 0 !important; }
  .main-content { padding: 16px; }
  .metric-row { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 12px 16px; }
}
