/* ============================================================
   XSELL — Admin console + auth · v4 "Carbon editorial"
   Flat, crisp graphite surfaces (no heavy glass blur), hairline
   borders, strong typographic hierarchy, one surgical crimson
   accent. Inter for UI · JetBrains Mono for data.
   Selector + token contract preserved from v3 — page-local
   <style> blocks keep working untouched.
   ============================================================ */

:root {
  /* Surfaces — flat, layered graphite */
  --bg:     #0c0d11;   /* page */
  --bg-1:   #111218;   /* small raised chips */
  --bg-2:   #16181f;   /* user chip / select options */
  --bg-3:   #0f1015;   /* input wells (recessed) */
  --raised: #1c1f28;   /* hover fills / default button */

  /* Kept for page-local styles; now solid (blur retired for perf) */
  --glass-bar:  #101117;   /* sidebar + topbar */
  --glass-card: #14161c;   /* cards */
  --blur: 0px;

  /* Lines — hairline first, stronger on interaction */
  --line:     rgba(255, 255, 255, 0.07);
  --line-2:   rgba(255, 255, 255, 0.13);
  --line-red: rgba(230, 49, 64, 0.5);

  /* Accent — single, surgical crimson */
  --red:        #e63140;
  --red-bright: #f4525f;
  --red-deep:   #b01f2c;
  --red-soft:   rgba(230, 49, 64, 0.12);
  --red-glow:   rgba(230, 49, 64, 0.3);

  /* Text */
  --text:        #dde1e9;
  --text-strong: #ffffff;
  --muted:       #9aa3b5;
  --dim:         #636e84;

  /* Status */
  --green: #3ddc97;
  --amber: #ffc24b;

  /* Type */
  --font-display: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-ui:      'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;

  /* Shape — tighter, more editorial */
  --radius-lg: 14px;
  --radius:    11px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow:    0 1px 1px rgba(0, 0, 0, 0.35), 0 12px 32px -18px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 20px 56px -24px rgba(0, 0, 0, 0.85);
  --glow:      0 0 0 3px var(--red-glow); /* keyboard focus ring */

  /* Motion */
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in:     cubic-bezier(0.55, 0, 1, 0.45);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --dur-fast: 110ms;
  --dur:      170ms;
  --dur-slow: 420ms;

  /* Layout */
  --sidebar-w:  252px;
  --topbar-h:   58px;
  --content-max: 1140px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(230, 49, 64, 0.28); color: var(--text-strong); }

a { color: inherit; }
.mono { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: 0; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.24); background-clip: content-box; }

/* ===========================================================
   APP SHELL + AMBIENT BACKGROUND
   =========================================================== */
.app { position: relative; min-height: 100dvh; }
.app::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(720px 420px at 8% -6%, rgba(230, 49, 64, 0.07), transparent 60%),
    radial-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 26px 26px, auto;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100dvh;
}

/* ---- Sidebar ---- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 13px;
  background: var(--glass-bar);
  border-right: 1px solid var(--line);
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 9px 14px;
  text-decoration: none;
  color: var(--text-strong);
}
.brand-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(165deg, #1d1f27, #121319);
  border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--shadow-sm);
  flex: none;
}
.brand-mark img { width: 24px; height: 24px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; }
.brand-text em { font-style: normal; font-size: 10.5px; color: var(--dim); letter-spacing: 0.16em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 2px 0; margin: 0 -3px; }
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 11px;
  border-radius: 9px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.045); }
.nav-link:focus-visible { outline: none; box-shadow: var(--glow); color: var(--text); }
.nav-ico { width: 18px; height: 18px; flex: none; display: grid; place-items: center; color: currentColor; opacity: 0.9; }
.nav-ico svg { width: 18px; height: 18px; }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link.active {
  color: var(--text-strong);
  background: linear-gradient(90deg, rgba(230, 49, 64, 0.14), rgba(230, 49, 64, 0.03) 70%);
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  width: 2.5px; height: 16px;
  transform: translateY(-50%);
  border-radius: 0 3px 3px 0;
  background: var(--red);
}
.nav-link.active .nav-ico { color: var(--red-bright); opacity: 1; }

/* ---- Collapsible nav groups ---- */
.nav-group { display: flex; flex-direction: column; }
.nav-group + .nav-group { margin-top: 1px; }
.nav-group-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; margin: 0; padding: 13px 11px 5px;
  background: none; border: 0; cursor: pointer; text-align: left;
  font-family: inherit; font-size: 10px; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase; color: var(--dim);
  transition: color var(--dur) var(--ease-out);
}
.nav-group-head:hover { color: var(--muted); }
.nav-group-head:focus-visible { outline: none; box-shadow: var(--glow); border-radius: 8px; }
.nav-chev { width: 12px; height: 12px; flex: none; opacity: 0.5; transition: transform var(--dur) var(--ease-out); }
.nav-group-head:hover .nav-chev { opacity: 0.85; }
.nav-group.collapsed .nav-chev { transform: rotate(-90deg); }
.nav-group-wrap { display: grid; grid-template-rows: 1fr; }
.nav.nav-anim .nav-group-wrap { transition: grid-template-rows var(--dur) var(--ease-out); }
.nav-group.collapsed .nav-group-wrap { grid-template-rows: 0fr; }
.nav-group-body { display: flex; flex-direction: column; gap: 1px; min-height: 0; overflow: hidden; }

.sidebar-foot { margin-top: auto; padding-top: 11px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 9px; border-radius: 9px;
  background: var(--bg-2); border: 1px solid var(--line);
}
.user-chip img, .user-fallback { width: 27px; height: 27px; border-radius: 50%; flex: none; }
.user-fallback { display: grid; place-items: center; background: var(--red-soft); color: var(--red-bright); font-weight: 700; font-size: 12.5px; }
.user-name { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout {
  display: block; text-align: center; padding: 8px 12px;
  border-radius: 9px; font-size: 12px; font-weight: 600;
  color: var(--muted); text-decoration: none;
  border: 1px solid var(--line); transition: color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.logout:hover { color: var(--red-bright); border-color: var(--line-red); background: var(--red-soft); }

/* ---- Main column ---- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 clamp(16px, 4vw, 36px);
  background: rgba(12, 13, 17, 0.92);
  border-bottom: 1px solid var(--line);
}
.page-title { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; color: var(--text-strong); }
.crumb {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--dim); display: inline-flex; align-items: center; gap: 10px;
}
.crumb::after { content: '/'; color: var(--line-2); font-weight: 400; }
.topbar-tag {
  margin-left: auto; font-size: 10.5px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--dim); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
  display: inline-flex; align-items: center; gap: 7px;
}
.topbar-tag::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px rgba(61, 220, 151, 0.6); }
.nav-toggle {
  display: none;
  width: 38px; height: 38px; flex: none;
  align-items: center; justify-content: center;
  border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); cursor: pointer;
  transition: background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.nav-toggle:hover { background: var(--raised); border-color: var(--line-2); }
.nav-toggle:focus-visible { outline: none; box-shadow: var(--glow); }
.nav-toggle svg { width: 19px; height: 19px; }

.content { padding: clamp(20px, 4vw, 34px); width: 100%; max-width: calc(var(--content-max) + 68px); margin: 0 auto; }

/* Scrim behind the mobile drawer */
.scrim { display: none; position: fixed; inset: 0; z-index: 35; background: rgba(5, 6, 9, 0.66); border: 0; }

/* ===========================================================
   CARDS
   =========================================================== */
.card {
  position: relative;
  background: var(--glass-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.card::after {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.09), transparent);
  pointer-events: none;
}
.card-head {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.012);
}
.card-title { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--text-strong); position: relative; padding-left: 14px; }
.card-title::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  width: 3px; height: 14px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: linear-gradient(180deg, var(--red-bright), var(--red-deep));
}
.card-sub { margin: 5px 0 0 14px; font-size: 12.5px; color: var(--muted); line-height: 1.55; max-width: 70ch; }
.card-body { padding: 22px; }
.card-body > :first-child { margin-top: 0; }

/* split (form + preview) and 2-up rows */
.split { display: grid; grid-template-columns: 1.12fr 0.88fr; gap: 20px; align-items: start; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.section-rule {
  display: flex; align-items: center; gap: 12px;
  margin: 24px 0 16px; font-size: 10.5px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--dim); font-weight: 700;
}
.section-rule::before { content: ''; width: 14px; height: 1px; background: var(--red); opacity: 0.6; }
.section-rule::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.section-rule:empty { margin: 16px 0; }
.section-rule:empty::before { display: none; }
.section-rule span { white-space: nowrap; }

/* ===========================================================
   FORMS
   =========================================================== */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.label { display: block; font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 6px; letter-spacing: 0.02em; }
.help { margin: 0 0 8px; font-size: 11.5px; color: var(--dim); line-height: 1.5; }
.help code, code { font-family: var(--font-mono); font-size: 0.86em; background: var(--bg-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--muted); }

.input, .textarea, .select {
  width: 100%;
  font: inherit; font-size: 13.5px;
  color: var(--text);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.textarea { resize: vertical; min-height: 92px; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--dim); }
.input:hover, .textarea:hover, .select:hover { border-color: rgba(255, 255, 255, 0.22); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: var(--glow), inset 0 1px 2px rgba(0, 0, 0, 0.25);
  background: var(--bg-1);
}
.input.mono { font-family: var(--font-mono); font-size: 12.5px; }
.input-sm { padding: 7px 10px; font-size: 12.5px; }
.select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23636e84' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 38px; cursor: pointer;
}
.select option { background: var(--bg-2); color: var(--text); }

/* checkbox rows */
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text); cursor: pointer; line-height: 1.45; }
.check input[type="checkbox"] { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--red); flex: none; cursor: pointer; }
.check span .muted, .check .muted { color: var(--dim); }

/* affix (e.g. € before fee) + color picker */
.affix { color: var(--dim); font-size: 13px; }
.color-row { display: flex; align-items: center; gap: 12px; }
.color-swatch {
  width: 44px; height: 32px; padding: 0; border: 1px solid var(--line-2);
  border-radius: 8px; background: none; cursor: pointer; overflow: hidden;
}
.color-swatch::-webkit-color-swatch-wrapper { padding: 3px; }
.color-swatch::-webkit-color-swatch { border: none; border-radius: 5px; }
.color-swatch::-moz-color-swatch { border: none; border-radius: 5px; }
.color-hex { font-size: 12.5px; color: var(--muted); text-transform: uppercase; font-family: var(--font-mono); }

.actions { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 22px; }

/* icon button (e.g. delete a row) */
.icon-btn {
  width: 33px; height: 33px; flex: none;
  display: grid; place-items: center;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--muted);
  cursor: pointer; font-size: 13px;
  transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.icon-btn:hover { color: var(--red-bright); border-color: var(--line-red); background: var(--red-soft); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--glow); }

/* ===========================================================
   BUTTONS
   =========================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 13px; font-weight: 600; line-height: 1;
  padding: 10px 17px; border-radius: 9px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  white-space: nowrap; user-select: none;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--glow); }
.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #ef4450, var(--red-deep));
  border-color: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 6px 18px -8px var(--red-glow);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--red-bright), var(--red)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 10px 24px -8px var(--red-glow); }
.btn-ghost { color: var(--text); background: rgba(255, 255, 255, 0.04); border-color: var(--line-2); }
.btn-ghost:hover { color: var(--text-strong); background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.24); }
.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ===========================================================
   TABLES
   =========================================================== */
.table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.table th {
  text-align: left; padding: 10px 14px;
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--dim); font-weight: 700;
  border-bottom: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.012);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--dur) var(--ease-out); }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.empty { color: var(--dim); padding: 26px 4px; font-size: 13.5px; text-align: center; }

.ch-link { color: var(--text); text-decoration: none; border-bottom: 1px solid transparent; transition: color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out); }
.ch-link:hover { color: var(--red-bright); border-bottom-color: var(--line-red); }
.tk-num { margin-left: 8px; font-family: var(--font-mono); font-size: 10.5px; color: var(--dim); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 7px; }

.count-pill {
  margin-left: auto; min-width: 30px; padding: 3px 11px; text-align: center;
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 999px;
}

/* ---- badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: capitalize; border-radius: 999px; border: 1px solid transparent;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-open { color: var(--green); background: rgba(61, 220, 151, 0.09); border-color: rgba(61, 220, 151, 0.3); }
.badge-closing { color: var(--amber); background: rgba(255, 194, 75, 0.09); border-color: rgba(255, 194, 75, 0.3); }
.badge-claim { color: var(--muted); background: rgba(255, 255, 255, 0.05); border-color: var(--line-2); margin-left: 6px; }
.badge-claim::before { display: none; }
.badge-open::before { animation: livePulse 2.2s var(--ease-out) infinite; }
@keyframes livePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.5); } 50% { box-shadow: 0 0 0 4px rgba(61, 220, 151, 0); } }

/* log level badges */
.lvl-error { color: var(--red-bright); background: var(--red-soft); border-color: var(--line-red); }
.lvl-warn  { color: var(--amber); background: rgba(255, 194, 75, 0.09); border-color: rgba(255, 194, 75, 0.32); }
.lvl-info  { color: var(--green); background: rgba(61, 220, 151, 0.09); border-color: rgba(61, 220, 151, 0.32); }
.lvl-debug { color: var(--dim); background: rgba(255, 255, 255, 0.04); border-color: var(--line-2); }

/* ===========================================================
   FLASH MESSAGES
   =========================================================== */
.flash {
  padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px;
  margin-bottom: 18px; border: 1px solid transparent; border-left-width: 3px;
}
.flash-ok   { color: #b9f5dd; background: rgba(61, 220, 151, 0.08); border-color: rgba(61, 220, 151, 0.42); }
.flash-err  { color: #ffc7cc; background: var(--red-soft); border-color: var(--line-red); }
.flash-warn { color: #ffe6b0; background: rgba(255, 194, 75, 0.08); border-color: rgba(255, 194, 75, 0.42); }

/* ===========================================================
   DASHBOARD STATS
   =========================================================== */
.grid { display: grid; gap: 20px; }
.grid-stats { grid-template-columns: repeat(2, 1fr); margin-bottom: 20px; }
.stat {
  position: relative; overflow: hidden;
  background: var(--glass-card);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px 22px 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 3px;
}
.stat::before {
  content: '';
  position: absolute; inset: 0 auto auto 0; width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--red), transparent 55%);
  opacity: 0.7;
}
.stat-num { font-size: 38px; font-weight: 700; line-height: 1.05; letter-spacing: -0.025em; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: var(--dim); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.stat-glow { position: absolute; top: -50px; right: -50px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, var(--red-glow), transparent 70%); opacity: 0.25; pointer-events: none; }
.stat-wide { grid-column: 1 / -1; flex-direction: column; gap: 12px; }
.stat-wide::before { display: none; }
.stat-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ===========================================================
   PAYMENTS — toggle switch + method blocks
   =========================================================== */
.switch { position: relative; display: inline-flex; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 38px; height: 22px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--line-2);
  display: inline-flex; align-items: center; padding: 2px;
  transition: background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.switch-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #aab2c2;
  transition: transform var(--dur) var(--ease-spring), background var(--dur) var(--ease-out);
}
.switch input:checked + .switch-track { background: linear-gradient(180deg, var(--red-bright), var(--red-deep)); border-color: transparent; }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .switch-track { box-shadow: var(--glow); }

.pay-block { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, 0.014); padding: 15px 17px; margin-bottom: 13px; transition: border-color var(--dur) var(--ease-out); }
.pay-block:hover { border-color: var(--line-2); }
.pay-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pay-name { font-size: 13.5px; font-weight: 700; color: var(--text-strong); }
.pay-key { color: var(--dim); font-size: 11px; font-family: var(--font-mono); background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }
.pay-fee { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.pay-fee-label { font-size: 11.5px; color: var(--muted); }
.pay-fee-input { width: 92px; }
.pay-packages { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.pkg-head, .pkg-row { display: grid; grid-template-columns: 1fr 1fr 34px; gap: 10px; align-items: center; }
.pkg-head { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); font-weight: 700; margin-bottom: 8px; }
.pkg-rows { display: flex; flex-direction: column; gap: 8px; }
.pkg-row { }
.pkg-add { margin-top: 12px; }

/* ===========================================================
   DISCORD EMBED PREVIEW (panel + price + checkout pages)
   =========================================================== */
.embed-preview { display: flex; background: #2b2d31; border: 1px solid rgba(0,0,0,0.45); border-radius: 10px; overflow: hidden; max-width: 540px; box-shadow: var(--shadow-sm); }
.embed-strip { width: 4px; flex: none; background: var(--red); }
.embed-inner { flex: 1; min-width: 0; padding: 15px 17px; display: flex; flex-direction: column; gap: 8px; }
.embed-author { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #fff; }
.embed-author img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.embed-author:empty { display: none; }
.embed-toprow { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; }
.embed-textcol { min-width: 0; flex: 1; }
.embed-title { font-size: 15px; font-weight: 700; color: #fff; }
.embed-desc { font-size: 13px; color: #c9ccd1; line-height: 1.5; margin-top: 3px; white-space: pre-wrap; word-break: break-word; }
.embed-thumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex: none; }
.embed-image { width: 100%; max-height: 220px; object-fit: cover; border-radius: 8px; margin-top: 2px; }
.embed-footer { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: #8a8d93; margin-top: 2px; }
.embed-footer img { width: 18px; height: 18px; border-radius: 50%; }
.embed-btn { align-self: flex-start; margin-top: 10px; padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; color: #fff; background: var(--red); }

/* ===========================================================
   LOGS — key/value chips
   =========================================================== */
.logs-table td { vertical-align: top; }
.kv-list { display: flex; flex-wrap: wrap; gap: 6px; }
.kv { display: inline-flex; align-items: baseline; gap: 6px; padding: 2px 9px; font-size: 11.5px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); }
.kv-k { color: var(--dim); font-family: var(--font-mono); font-size: 10.5px; }
.kv-v { color: var(--muted); }

/* ===========================================================
   AUTH / LOGIN
   =========================================================== */
.login-body { margin: 0; min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(700px 460px at 28% -10%, rgba(230, 49, 64, 0.1), transparent 60%),
    radial-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 26px 26px, auto;
}
.auth { width: 100%; max-width: 400px; }
.auth-card {
  background: var(--glass-card);
  border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px; text-align: center;
  position: relative; overflow: hidden;
}
.auth-card::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  opacity: 0.8;
}
.auth-mark { width: 58px; height: 58px; margin: 0 auto 20px; display: grid; place-items: center; border-radius: 15px; background: linear-gradient(165deg, #1d1f27, #121319); border: 1px solid var(--line-2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--shadow); }
.auth-mark img { width: 36px; height: 36px; object-fit: contain; }
.auth-title { margin: 0 0 8px; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; color: var(--text-strong); }
.auth-sub { margin: 0 0 24px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.auth-error { margin-bottom: 18px; padding: 11px 14px; border-radius: var(--radius-sm); font-size: 12.5px; color: #ffc7cc; background: var(--red-soft); border: 1px solid var(--line-red); }
.auth-btn { padding: 13px 18px; font-size: 14px; }
.auth-btn svg { width: 20px; height: 20px; }
.auth-foot { margin: 22px 0 0; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }

/* ===========================================================
   RESPONSIVE
   =========================================================== */
@media (max-width: 1180px) {
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    width: min(84vw, 300px);
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease-out);
    border-right: 1px solid var(--line-2);
    box-shadow: var(--shadow-lg);
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .app.nav-open .scrim { display: block; }
  .nav-toggle { display: inline-flex; }
  .crumb { display: none; }
}
@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; }
  .grid-stats { grid-template-columns: 1fr; }
  .card-head { padding: 15px 17px; }
  .card-body { padding: 17px; }
  .stat-num { font-size: 32px; }
  .pay-fee { margin-left: 0; width: 100%; }
  .topbar-tag { display: none; }
  /* wide tables scroll horizontally inside their card rather than the page */
  .card-body { overflow-x: auto; }
}

/* ===========================================================
   v5 — AIRIER CHROME + SERVER PICKER + SETUP WIZARD
   Calmer surfaces, more breathing room, the active-server
   header, the centred server picker and the friendly wizard.
   Appended last so it refines the v4 contract without touching it.
   =========================================================== */

/* Calmer ambient background — drop the dotted grid, keep one soft glow. */
.app::before {
  background:
    radial-gradient(760px 460px at 12% -8%, rgba(230, 49, 64, 0.06), transparent 62%),
    var(--bg);
  background-size: auto, auto;
}

/* A bit more air around content + between cards. */
.content { padding: clamp(22px, 4vw, 40px); }
.card { margin-bottom: 22px; }
.card::after { display: none; } /* retire the busy top-edge highlight */
.card-head { padding: 19px 24px; }
.card-body { padding: 24px; }

/* offline state for the topbar status tag */
.topbar-tag.is-off { color: var(--amber); border-color: rgba(255, 194, 75, 0.34); }
.topbar-tag.is-off::before { background: var(--amber); box-shadow: 0 0 6px rgba(255, 194, 75, 0.6); }

/* ---- Active-server header (top of the sidebar) ---- */
.brand { padding: 6px 9px 10px; }
.srv-active {
  display: flex; align-items: center; gap: 11px;
  margin: 0 -3px 8px; padding: 9px 10px;
  border-radius: 11px; text-decoration: none;
  background: var(--bg-2); border: 1px solid var(--line);
  transition: border-color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.srv-active:hover { border-color: var(--line-2); background: var(--raised); }
.srv-active:focus-visible { outline: none; box-shadow: var(--glow); }
.srv-active-icon { width: 38px; height: 38px; border-radius: 10px; flex: none; object-fit: cover; border: 1px solid var(--line-2); }
.srv-active-fallback { display: grid; place-items: center; background: var(--red-soft); color: var(--red-bright); font-weight: 700; font-size: 16px; }
.srv-active-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.srv-active-meta strong { font-size: 13.5px; font-weight: 700; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-active-meta em { font-style: normal; font-size: 10.5px; color: var(--dim); display: inline-flex; align-items: center; gap: 5px; letter-spacing: 0.04em; }
.srv-active-meta em svg { width: 12px; height: 12px; }
.srv-active:hover .srv-active-meta em { color: var(--red-bright); }

/* ---- Friendly page intro (picker + wizard) ---- */
.page-intro { max-width: 680px; margin: 6px 0 26px; }
.page-intro.center { margin-left: auto; margin-right: auto; text-align: center; }
.page-intro h1 { margin: 0; font-size: 25px; font-weight: 700; letter-spacing: -0.025em; color: var(--text-strong); }
.page-intro p { margin: 9px 0 0; font-size: 14px; color: var(--muted); line-height: 1.6; }
.page-intro.center p { margin-left: auto; margin-right: auto; max-width: 52ch; }

.section-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--dim); margin: 30px 0 14px; }
.section-label:first-child { margin-top: 0; }

/* ===========================================================
   SERVER PICKER
   =========================================================== */
.srv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px; }
.srv-form { margin: 0; display: flex; }
.srv-card {
  position: relative; width: 100%; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px; border-radius: var(--radius-lg);
  background: var(--glass-card); border: 1px solid var(--line);
  color: var(--text); font: inherit; text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out), background var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.srv-card:hover { transform: translateY(-2px); border-color: var(--line-red); background: #15171d; box-shadow: var(--shadow-lg); }
.srv-card:focus-visible { outline: none; box-shadow: var(--glow); }
.srv-card.is-active { border-color: var(--line-red); }
.srv-card.is-active::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  background: linear-gradient(180deg, var(--red-bright), var(--red-deep));
}
.srv-top { display: flex; align-items: center; gap: 13px; }
.srv-ico { width: 52px; height: 52px; border-radius: 14px; flex: none; object-fit: cover; border: 1px solid var(--line-2); }
.srv-ico-fallback { display: grid; place-items: center; background: linear-gradient(165deg, #20232c, #14161c); color: var(--text-strong); font-weight: 700; font-size: 21px; }
.srv-meta { min-width: 0; }
.srv-name { font-size: 15px; font-weight: 700; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-sub { font-size: 11.5px; color: var(--dim); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.srv-sub svg { width: 13px; height: 13px; }
.srv-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.srv-go { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); transition: color var(--dur) var(--ease-out), gap var(--dur) var(--ease-out); }
.srv-go svg { width: 15px; height: 15px; }
.srv-card:hover .srv-go { color: var(--red-bright); gap: 9px; }

.srv-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.03em; border-radius: 999px; border: 1px solid transparent; }
.srv-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.srv-chip.is-active { color: var(--green); background: rgba(61, 220, 151, 0.1); border-color: rgba(61, 220, 151, 0.32); }
.srv-chip.is-ready  { color: var(--muted); background: rgba(255, 255, 255, 0.05); border-color: var(--line-2); }
.srv-chip.is-new    { color: var(--amber); background: rgba(255, 194, 75, 0.1); border-color: rgba(255, 194, 75, 0.32); }

/* Invite / add-a-server card — dashed, quieter until hover */
.srv-card.add { align-items: center; justify-content: center; text-align: center; gap: 11px; border-style: dashed; border-color: var(--line-2); background: rgba(255, 255, 255, 0.012); box-shadow: none; min-height: 150px; }
.srv-card.add:hover { border-color: var(--line-red); background: var(--red-soft); transform: translateY(-2px); }
.srv-card.add .srv-add-ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--red-bright); }
.srv-card.add .srv-add-ico svg { width: 22px; height: 22px; }
.srv-card.add strong { font-size: 14px; color: var(--text-strong); font-weight: 700; }
.srv-card.add span { font-size: 11.5px; color: var(--dim); max-width: 24ch; }

.picker-empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* ===========================================================
   SETUP WIZARD
   =========================================================== */
.wiz-head { margin-bottom: 24px; }
.wiz-bar { height: 7px; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--line); overflow: hidden; margin-top: 14px; }
.wiz-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--red-bright), var(--red-deep)); transition: width var(--dur-slow) var(--ease-out); }
.wiz-progress-text { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; font-size: 12px; color: var(--muted); }
.wiz-progress-text b { color: var(--text-strong); font-weight: 700; }
.wiz-done-banner { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: var(--radius); background: rgba(61, 220, 151, 0.08); border: 1px solid rgba(61, 220, 151, 0.34); color: #b9f5dd; font-size: 13.5px; margin-bottom: 24px; }
.wiz-done-banner svg { width: 22px; height: 22px; flex: none; color: var(--green); }

.wiz-step { position: relative; padding-left: 52px; margin-bottom: 18px; }
.wiz-step::before { content: ''; position: absolute; left: 17px; top: 38px; bottom: -18px; width: 2px; background: var(--line); }
.wiz-step:last-child::before { display: none; }
.step-badge {
  position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
  background: var(--bg-2); border: 1px solid var(--line-2); color: var(--muted); z-index: 1;
}
.step-badge.done { background: rgba(61, 220, 151, 0.12); border-color: rgba(61, 220, 151, 0.4); color: var(--green); }
.step-badge.done svg { width: 18px; height: 18px; }
.step-badge.current { background: linear-gradient(180deg, #ef4450, var(--red-deep)); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -8px var(--red-glow); }

.wiz-card { background: var(--glass-card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.wiz-card.is-current { border-color: var(--line-red); }
.wiz-card-head { padding: 16px 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wiz-card-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-strong); }
.wiz-step-pill { margin-left: auto; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; }
.wiz-step-pill.done { color: var(--green); background: rgba(61, 220, 151, 0.1); border: 1px solid rgba(61, 220, 151, 0.3); }
.wiz-step-pill.todo { color: var(--amber); background: rgba(255, 194, 75, 0.1); border: 1px solid rgba(255, 194, 75, 0.3); }
.wiz-card-body { padding: 4px 20px 20px; }
.wiz-why { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 0 0 16px; max-width: 70ch; }
.wiz-why b { color: var(--text); font-weight: 600; }

.setup-item { display: flex; align-items: center; gap: 13px; padding: 12px 0; border-top: 1px solid var(--line); }
.setup-item:first-of-type { border-top: none; }
.setup-tick { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; border: 1.5px solid var(--line-2); }
.setup-tick.ok { background: rgba(61, 220, 151, 0.12); border-color: transparent; color: var(--green); }
.setup-tick.ok svg { width: 14px; height: 14px; }
.setup-tick.no { border-style: dashed; }
.setup-item-main { min-width: 0; flex: 1; }
.setup-item-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.setup-item-val { font-size: 11.5px; color: var(--dim); margin-top: 1px; }
.setup-item-val.set { color: var(--green); font-family: var(--font-mono); font-size: 11px; }
.setup-item form { margin: 0; }
.req-star { color: var(--red-bright); font-size: 11px; margin-left: 3px; }
.opt-tag { font-size: 10px; color: var(--dim); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; margin-left: 6px; text-transform: uppercase; letter-spacing: 0.08em; }

@media (max-width: 980px) {
  .wiz-step { padding-left: 46px; }
}
@media (max-width: 560px) {
  .srv-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .setup-item { flex-wrap: wrap; }
}
@media (max-width: 400px) {
  .srv-grid { grid-template-columns: 1fr; }
}

/* ===========================================================
   REDUCED MOTION
   =========================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
