/* ==========================================================================
   1337 Global — customer panel
   Light / dark design system. Theme is set on <html data-theme="…">.
   ========================================================================== */

:root {
  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --surface-3: #f1f1f4;
  --border: #e6e6eb;
  --border-strong: #d5d6dd;
  --text: #111216;
  --text-2: #3d404b;
  --muted: #6b6f7c;
  --faint: #9b9ead;

  --brand: #dc2626;
  --brand-hover: #b91c1c;
  --brand-soft: #fef2f2;
  --brand-soft-2: #fde3e3;
  --brand-text: #c81e1e;
  --on-brand: #ffffff;

  --success: #15803d;
  --success-soft: #ecfdf3;
  --warning: #b45309;
  --warning-soft: #fff8eb;
  --danger: #c81e1e;
  --danger-soft: #fef2f2;
  --info: #1d4ed8;
  --info-soft: #eff4ff;

  --shadow-xs: 0 1px 2px rgba(17, 18, 22, .05);
  --shadow-sm: 0 1px 3px rgba(17, 18, 22, .07), 0 1px 2px rgba(17, 18, 22, .04);
  --shadow-lg: 0 24px 48px -12px rgba(17, 18, 22, .22);
  --ring: 0 0 0 3px rgba(220, 38, 38, .18);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --sidebar-w: 252px;
  --topbar-h: 60px;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0b0c0f;
  --surface: #131519;
  --surface-2: #171a1f;
  --surface-3: #1d2027;
  --border: #252830;
  --border-strong: #323641;
  --text: #ececf1;
  --text-2: #c5c8d2;
  --muted: #8d91a0;
  --faint: #5f6371;

  --brand: #ef4444;
  --brand-hover: #f05252;
  --brand-soft: rgba(239, 68, 68, .10);
  --brand-soft-2: rgba(239, 68, 68, .18);
  --brand-text: #f87171;
  --on-brand: #ffffff;

  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, .10);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, .10);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .10);
  --info: #7aa7ff;
  --info-soft: rgba(122, 167, 255, .10);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .7);
  --ring: 0 0 0 3px rgba(239, 68, 68, .28);
  color-scheme: dark;
}

/* ── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
table { border-collapse: collapse; width: 100%; }
code, .mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: -.01em; }
::selection { background: var(--brand-soft-2); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }

.icon { width: 18px; height: 18px; flex-shrink: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.skip-link:focus { left: 8px; }
.eyebrow { display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.demo-bar {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 7px 16px; font-size: 13px;
  background: var(--info-soft); color: var(--info); border-bottom: 1px solid var(--border);
}
.demo-bar .icon { width: 15px; height: 15px; }

/* ── App shell ────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.demo-bar ~ .app .sidebar { top: 35px; }
.sidebar-head {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px 0 20px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { height: 40px; width: auto; }
.brand-text { display: grid; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--muted); }
.sidebar-head .sidebar-close { display: none; }

.nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }
.nav-label {
  padding: 18px 10px 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint);
}
.nav-label:first-child { padding-top: 6px; }
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 10px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link .icon { width: 18px; height: 18px; color: var(--muted); transition: color .15s; }
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link:hover .icon { color: var(--text-2); }
.nav-link.is-active { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.nav-link.is-active .icon { color: var(--brand); }
.nav-link .nav-ext { width: 14px; height: 14px; margin-left: auto; color: var(--faint); }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.server-chip {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .15s, background .15s;
}
.server-chip:hover { border-color: var(--border-strong); background: var(--surface-3); }
.server-chip-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--surface-3); color: var(--muted); }
.server-chip-icon .icon { width: 16px; height: 16px; }
.server-chip-text { flex: 1; min-width: 0; display: grid; }
.server-chip-text .eyebrow { font-size: 10px; }
.server-chip-text .mono { font-size: 13px; font-weight: 500; }
.server-chip-copy { width: 15px; height: 15px; color: var(--faint); }

.user-card { display: flex; align-items: center; gap: 10px; padding: 4px 2px 0 4px; }
.avatar {
  display: grid; place-items: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-soft-2); color: var(--brand-text);
  font-weight: 700; font-size: 14px;
}
.user-card-text { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.user-card-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-btn, .topbar-logo { display: none; }
.topbar-logo img { height: 32px; width: auto; }
.topbar-spacer { flex: 1; }

.balance-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  transition: border-color .15s;
}
.balance-chip:hover { border-color: var(--border-strong); }
.balance-chip .icon { width: 16px; height: 16px; color: var(--muted); }
.balance-chip-label { font-size: 13px; color: var(--muted); }
.balance-chip-value { font-family: var(--font-mono); font-weight: 600; font-size: 13px; }
.balance-chip.is-low .balance-chip-value { color: var(--danger); }

.content { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px 28px 64px; outline: none; }

/* ── Page header ──────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.page-sub { margin-top: 4px; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
  user-select: none;
}
.btn .icon { width: 16px; height: 16px; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-xs); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn .spinner { display: none; }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-icon { display: none; }

.icon-btn {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 36px; height: 36px;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--muted);
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn-sm { width: 30px; height: 30px; }
.icon-btn-sm .icon { width: 15px; height: 15px; }

[data-theme="light"] .theme-icon-dark, [data-theme="dark"] .theme-icon-light { display: none; }

/* Language menu (<details>) */
.lang-menu { position: relative; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px;
  border-radius: var(--radius-sm); color: var(--muted); font-size: 13px; font-weight: 600;
  cursor: pointer; list-style: none; user-select: none; transition: background .15s, color .15s;
}
.lang-btn::-webkit-details-marker { display: none; }
.lang-btn:hover, .lang-menu[open] .lang-btn { background: var(--surface-3); color: var(--text); }
.lang-btn .icon { width: 17px; height: 17px; }
.lang-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 190px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.lang-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: var(--radius-xs); font-size: 14px; font-weight: 500; color: var(--text-2); }
.lang-list a:hover { background: var(--surface-3); color: var(--text); }
.lang-list a.is-active { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.lang-code { font-size: 11px; font-weight: 700; color: var(--faint); letter-spacing: .04em; }
.auth-top { display: flex; align-items: center; gap: 4px; }

.spinner { width: 16px; height: 16px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cards ────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head-plain { border-bottom: 0; padding-bottom: 0; }
.card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title .icon { width: 17px; height: 17px; color: var(--muted); }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.stack { display: grid; gap: 20px; }
.stack-sm { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }

/* ── Stats ────────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { padding: 18px 20px; }
.stat-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-label .icon { width: 16px; height: 16px; }
.stat-value { margin-top: 8px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-value.mono { font-size: 24px; font-weight: 600; }
.stat-meta { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.stat-hero { background: linear-gradient(135deg, var(--brand) 0%, #9f1515 100%); border-color: transparent; color: #fff; position: relative; overflow: hidden; }
.stat-hero::after {
  content: ""; position: absolute; right: -40px; top: -60px; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%);
}
.stat-hero .stat-label, .stat-hero .stat-meta { color: rgba(255,255,255,.8); }
.stat-hero .stat-meta a { color: #fff; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-brand { background: var(--brand-soft); color: var(--brand-text); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dot-pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ── Forms ────────────────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 16px; }
.label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.hint { font-size: 12.5px; color: var(--muted); }
.input, .select {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--faint); }
.input:hover, .select:hover { border-color: var(--faint); }
.input:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input:disabled { background: var(--surface-3); color: var(--muted); }
.input.mono { font-size: 14px; }
.select {
  appearance: none; padding-right: 34px; cursor: pointer;
  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='%236b6f7c' stroke-width='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 10px center;
}
.select-sm, .input-sm { height: 34px; font-size: 13px; }
.input-wrap { position: relative; }
.input-wrap > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.input-wrap > .input { padding-left: 38px; }
.input-wrap > .input-action { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.input-wrap > .input.has-action { padding-right: 42px; }
.input-prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.input-amount { height: 56px; padding-left: 32px !important; font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--text-2); }
.check input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--brand); cursor: pointer; flex-shrink: 0; }
.check a, .link { color: var(--brand-text); font-weight: 600; }
.check a:hover, .link:hover { text-decoration: underline; text-underline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 34px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); font-weight: 600; font-size: 13px; color: var(--text-2);
  transition: border-color .15s, background .15s, color .15s;
}
.chip:hover { border-color: var(--faint); color: var(--text); }
.chip.is-selected { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }

.strength { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 2px; }
.strength > span { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .25s, background .25s; }

.field-error { font-size: 12.5px; color: var(--danger); }

/* ── Alerts ───────────────────────────────────────────────────────────── */
.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font-size: 13.5px; }
.alert .icon { width: 18px; height: 18px; margin-top: 1px; }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert strong { font-weight: 600; }
.alert p { color: var(--text-2); }

/* ── Key / value rows ─────────────────────────────────────────────────── */
.kv { display: grid; }
.kv-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.kv-row:last-child { border-bottom: 0; }
.kv-key { color: var(--muted); font-size: 13px; font-weight: 500; }
.kv-val { display: flex; align-items: center; gap: 4px; min-width: 0; font-weight: 500; }
.kv-val .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Tables ───────────────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .input-wrap { flex: 1 1 240px; max-width: 360px; }
.toolbar .input { height: 36px; }
.toolbar-spacer { flex: 1; }
.table-wrap { position: relative; overflow-x: auto; }
.table { font-size: 13.5px; }
.table th {
  padding: 10px 16px; text-align: left; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.cell-strong { font-weight: 600; }
.cell-sub { display: block; font-size: 12px; color: var(--muted); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 4px; }
.pager button {
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 500;
}
.pager button:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-3); }
.pager button[aria-current="page"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.pager button:disabled { opacity: .4; cursor: default; }
.pager .icon { width: 15px; height: 15px; vertical-align: middle; }

.secret { display: inline-flex; align-items: center; gap: 2px; }
.secret-value { font-family: var(--font-mono); font-size: 13px; min-width: 9ch; }

/* ── Empty state ──────────────────────────────────────────────────────── */
.empty { display: grid; justify-items: center; gap: 6px; padding: 56px 24px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 8px; border-radius: 14px; background: var(--surface-3); color: var(--muted); }
.empty-icon .icon { width: 24px; height: 24px; }
.empty-title { font-weight: 600; font-size: 15px; }
.empty-text { color: var(--muted); max-width: 360px; }
.empty .btn { margin-top: 12px; }

/* ── List rows (activity) ─────────────────────────────────────────────── */
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); color: var(--muted); flex-shrink: 0; }
.list-icon .icon { width: 16px; height: 16px; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; }
.list-sub { font-size: 12.5px; color: var(--muted); }

/* ── Quick links ──────────────────────────────────────────────────────── */
.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick a {
  display: flex; align-items: center; gap: 10px; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13.5px;
  transition: border-color .15s, background .15s;
}
.quick a:hover { border-color: var(--border-strong); background: var(--surface-2); }
.quick .list-icon { width: 30px; height: 30px; border-radius: 8px; }

/* ── Banner ───────────────────────────────────────────────────────────── */
.banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--radius); background: var(--info-soft); border: 1px solid var(--border); }
.banner-brand { background: var(--brand-soft); }
.banner-brand .banner-icon { color: var(--brand); }
.banner-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--surface); color: var(--info); flex-shrink: 0; box-shadow: var(--shadow-xs); }
.banner-text { flex: 1; min-width: 0; }
.banner-title { font-weight: 600; }
.banner-sub { font-size: 13px; color: var(--muted); }

/* ── Plans ────────────────────────────────────────────────────────────── */
.plan { display: flex; flex-direction: column; }
.plan.is-current { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow-sm); }
.plan-head { padding: 20px 20px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.plan-name { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.plan-rates { padding: 16px 20px; flex: 1; }
.plan-rate { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13.5px; border-bottom: 1px dashed var(--border); }
.plan-rate:last-child { border-bottom: 0; }
.plan-foot { padding: 0 20px 20px; }

/* ── Steps (help) ─────────────────────────────────────────────────────── */
.steps { counter-reset: step; display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.steps li { counter-increment: step; display: flex; gap: 12px; }
.steps li::before {
  content: counter(step); display: grid; place-items: center; flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-text); font-weight: 700; font-size: 13px;
}

/* ── Referral ─────────────────────────────────────────────────────────── */
.ref-hero { background: linear-gradient(120deg, var(--brand-soft) 0%, var(--surface) 55%); }
.ref-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: center; }
.ref-hero-title { margin-top: 12px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.ref-hero .badge .icon { width: 14px; height: 14px; }
.ref-link-box { display: grid; gap: 8px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.ref-link-box .input { flex: 1; min-width: 0; }
.status-cell { display: inline-grid; gap: 3px; justify-items: start; }
.rules { margin: 0; padding-left: 18px; display: grid; gap: 8px; color: var(--text-2); font-size: 13.5px; }
.rules li::marker { color: var(--brand); }

/* ── Modal (native <dialog>) ──────────────────────────────────────────── */
.modal {
  width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.modal-sm { width: min(400px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(10, 11, 14, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in .18s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 0; }
.modal-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.modal-body { padding: 20px; }
.modal-head + .modal-body { padding-top: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ── Toasts ───────────────────────────────────────────────────────────── */
.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 8px; width: min(380px, calc(100vw - 40px)); pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); pointer-events: auto; font-weight: 500;
  animation: toast-in .2s ease-out;
}
.toast .icon { width: 18px; height: 18px; margin-top: 1px; }
.toast-success .icon { color: var(--success); }
.toast-error .icon { color: var(--danger); }
.toast-warning .icon { color: var(--warning); }
.toast-info .icon { color: var(--info); }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── Auth pages ───────────────────────────────────────────────────────── */
.auth-body { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); background-image: radial-gradient(1200px 500px at 50% -10%, var(--brand-soft) 0%, transparent 60%); }
.auth-top { position: absolute; top: 14px; right: 14px; }
.demo-bar ~ .auth-top { top: 48px; }
.auth-main { flex: 1; display: grid; place-items: center; padding: 48px 16px; }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-logo { display: block; width: max-content; margin: 0 auto 24px; }
.auth-logo img { height: 80px; width: auto; }
.auth-card { padding: 32px; box-shadow: var(--shadow-sm); }
.auth-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.auth-sub { margin-top: 4px; margin-bottom: 24px; color: var(--muted); }
.auth-alt { margin-top: 20px; text-align: center; color: var(--muted); }
.auth-help { margin-top: 24px; text-align: center; font-size: 13px; color: var(--muted); }
.auth-help a { color: var(--text-2); font-weight: 500; }
.auth-help a:hover { color: var(--brand-text); }
.result-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%; }
.result-icon .icon { width: 26px; height: 26px; }
.result-icon.is-success { background: var(--success-soft); color: var(--success); }
.result-icon.is-warning { background: var(--warning-soft); color: var(--warning); }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-wide { grid-column: 1 / -1; }
  .grid-main, .grid-3, .ref-hero-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); top: 0 !important; }
  .sidebar.is-open { transform: none; }
  .sidebar-head .sidebar-close { display: inline-grid; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(10, 11, 14, .5); }
  .sidebar.is-open + .sidebar-backdrop { display: block; }
  .main { margin-left: 0; }
  .topbar .menu-btn, .topbar-logo { display: inline-grid; }
  .topbar { padding: 0 12px; }
  .content { padding: 24px 16px 48px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .balance-chip-label, .topbar-cta span, .topbar .lang-btn span { display: none; }
  .topbar-cta { width: 36px; padding: 0; }
  .page-title { font-size: 22px; }
  .stats, .stats-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 21px; }
  .stat-value.mono { font-size: 19px; }
  .stat-wide { grid-column: 1 / -1; }
  .quick { grid-template-columns: minmax(0, 1fr); }
  .auth-card { padding: 24px 20px; }
  .toolbar .input-wrap { max-width: none; }
  .toasts { right: 12px; left: 12px; bottom: 12px; width: auto; }
  .card-body { padding: 16px; }
  .card-head { padding: 14px 16px; }
}

/* Tables become stacked cards when there is not enough room */
@media (max-width: 1100px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; border: 0; text-align: right; }
  .table-stack td::before { content: attr(data-label); color: var(--muted); font: 500 12.5px/1.4 var(--font); letter-spacing: 0; text-align: left; flex-shrink: 0; }
  .table-stack td.cell-title { font-size: 15px; padding-bottom: 8px; }
  .table-stack td.cell-title::before { display: none; }
  .table-stack td.actions { justify-content: flex-end; padding-top: 10px; }
  .table-stack td.actions::before { display: none; }
  .table-stack .num { text-align: right; }
  .table-stack .status-cell { justify-items: end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
