/* =====================================================================
   TixInvoice.com – design system & components
   Light/dark via [data-theme] on <html>; tokens first, components after.
   ===================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/InterVariable.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/InterVariable-Italic.woff2') format('woff2');
}

/* ---------- Tokens ---------- */
:root {
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f5f7fb;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --surface-3: #e8edf5;
  --border: #dfe4ec;
  --border-strong: #c9d1de;
  --text: #0f1729;
  --text-muted: #5b6577;
  --text-faint: #8b95a7;
  --heading: #0b1a3a;

  --primary: #1a73e8;
  --primary-hover: #1665cc;
  --primary-active: #1257b3;
  --primary-soft: #e6f0fd;
  --primary-soft-text: #0f4ea8;
  --navy: #0b2c6b;
  --accent-gradient: linear-gradient(135deg, #0b2c6b 0%, #1a73e8 100%);

  --success: #16a34a;
  --success-soft: #e6f7ec;
  --success-text: #0f7a36;
  --warning: #d97706;
  --warning-soft: #fdf1e0;
  --warning-text: #9a5200;
  --danger: #dc2626;
  --danger-soft: #fde8e8;
  --danger-text: #a61b1b;
  --info: #0284c7;
  --info-soft: #e3f3fb;
  --info-text: #075985;

  --shadow-sm: 0 1px 2px rgba(15, 23, 41, 0.06), 0 1px 1px rgba(15, 23, 41, 0.04);
  --shadow-md: 0 6px 18px -6px rgba(15, 23, 41, 0.15), 0 2px 6px rgba(15, 23, 41, 0.06);
  --shadow-lg: 0 24px 48px -16px rgba(15, 23, 41, 0.25);
  --ring: 0 0 0 3px rgba(26, 115, 232, 0.28);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --header-h: 64px;
  --sidebar-w: 260px;
  --container: 1180px;

  --ease: cubic-bezier(.2,.7,.2,1);
  --t-fast: 140ms;
  --t: 220ms;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0b0d12;
  --bg-elevated: #12151c;
  --surface: #141821;
  --surface-2: #1a1f2a;
  --surface-3: #222836;
  --border: #262c39;
  --border-strong: #343c4d;
  --text: #e6e9f0;
  --text-muted: #9aa4b8;
  --text-faint: #6b7588;
  --heading: #f4f6fb;

  --primary: #3b8bf5;
  --primary-hover: #5a9df7;
  --primary-active: #2f7be3;
  --primary-soft: rgba(59, 139, 245, 0.14);
  --primary-soft-text: #8ab8fa;
  --navy: #9db9ee;
  --accent-gradient: linear-gradient(135deg, #1f4fb0 0%, #3b8bf5 100%);

  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.14);
  --success-text: #6ee7a0;
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --warning-text: #fbbf24;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --danger-text: #fca5a5;
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.14);
  --info-text: #7dd3fc;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
  --ring: 0 0 0 3px rgba(59, 139, 245, 0.35);

  color-scheme: dark;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}
img, svg, video { max-width: 100%; display: block; }
img { height: auto; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--heading); line-height: 1.2; margin: 0 0 .5em; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 3rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 1em; }
small, .text-sm { font-size: .875rem; }
.text-xs { font-size: .78rem; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success-text); }
.text-warning { color: var(--warning-text); }
.text-danger { color: var(--danger-text); }
.fw-600 { font-weight: 600; }
.mono { font-family: var(--font-mono); font-size: .9em; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
code, kbd, pre { font-family: var(--font-mono); font-size: .9em; }
code, kbd { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: .1em .35em; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; overflow: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
[hidden] { display: none !important; }
.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; background: var(--primary); color: #fff; padding: 8px 12px; border-radius: var(--radius-sm); z-index: 1000; }
.skip-link:focus { left: 8px; }
::selection { background: rgba(26,115,232,.25); }

.icon { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* ---------- Layout helpers ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.container--narrow { max-width: 760px; }
.container--medium { max-width: 960px; }
.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--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.gap-1 { gap: 6px; } .gap-2 { gap: 10px; } .gap-3 { gap: 16px; } .gap-4 { gap: 24px; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 32px; } .mt-5 { margin-top: 48px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; } .mb-4 { margin-bottom: 32px; }
.w-full { width: 100%; }
.hide-sm { }
@media (max-width: 900px) { .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; } .hide-sm { display: none !important; } }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; }
.brand__logo { height: 26px; width: auto; }
.brand__logo--dark { display: none; }
[data-theme="dark"] .brand__logo--light { display: none; }
[data-theme="dark"] .brand__logo--dark { display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius); border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; line-height: 1.2; cursor: pointer; white-space: nowrap;
  background: var(--surface-2); color: var(--text); text-decoration: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  user-select: none;
}
.btn:hover { text-decoration: none; background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn--primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -8px rgba(26,115,232,.7); }
.btn--primary:hover { background: var(--primary-hover); color: #fff; }
.btn--primary:active { background: var(--primary-active); }
.btn--secondary { background: var(--surface); border-color: var(--border-strong); }
.btn--secondary:hover { border-color: var(--primary); color: var(--primary); background: var(--surface); }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--surface-2); }
.btn--outline { background: transparent; border-color: var(--border-strong); }
.btn--outline:hover { border-color: var(--primary); color: var(--primary); }
.btn--warning { background: var(--warning); color: #fff; border-color: transparent; box-shadow: 0 6px 16px -8px rgba(217,119,6,.7); }
.btn--warning:hover { background: var(--warning-text); color: #fff; }
[data-theme="dark"] .btn--warning, [data-theme="dark"] .btn--warning:hover { color: #1a1206; }
[data-theme="dark"] .btn--warning:hover { background: var(--warning-text); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #b91c1c; color: #fff; }
.btn--danger-outline { background: transparent; border-color: var(--danger); color: var(--danger-text); }
.btn--danger-outline:hover { background: var(--danger-soft); }
.btn--success { background: var(--success); color: #fff; }
.btn--success:hover { background: #12843c; color: #fff; }
.btn--sm { padding: 7px 12px; font-size: .85rem; border-radius: var(--radius-sm); }
.btn--xs { padding: 4px 8px; font-size: .78rem; border-radius: var(--radius-sm); gap: 5px; }
.btn--lg { padding: 14px 26px; font-size: 1.05rem; border-radius: 12px; }
.btn--block { width: 100%; }
.btn--discord { background: #5865F2; color: #fff; }
.btn--discord:hover { background: #4752c4; color: #fff; }
.btn .icon { width: 1.1em; height: 1.1em; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ''; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn--secondary.is-loading::after, .btn--ghost.is-loading::after, .btn--outline.is-loading::after { border-color: var(--border-strong); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: var(--radius); border: 1px solid transparent; background: transparent; color: var(--text-muted); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .icon { width: 20px; height: 20px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.btn-group { display: inline-flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) { .form-row, .form-row--3 { grid-template-columns: 1fr; } }
label, .label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: 6px; color: var(--text); }
.label-hint, .form-hint { display: block; font-weight: 400; font-size: .8rem; color: var(--text-muted); margin-top: 5px; }
.input, .select, .textarea,
input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="url"], input[type="search"], input[type="tel"], input[type="password"], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  min-height: 42px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:disabled, select:disabled, textarea:disabled { opacity: .6; background: var(--surface-2); cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; vertical-align: middle; cursor: pointer; }
.input--sm, input.input--sm, select.input--sm { padding: 6px 8px; min-height: 34px; font-size: .85rem; }
.input--xs, input.input--xs, select.input--xs { padding: 4px 6px; min-height: 30px; font-size: .8rem; }
.input-inline { display: inline-block; width: auto; }
.checkbox, .radio { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; cursor: pointer; }
.checkbox input, .radio input { margin-top: 3px; }
.input-error, .is-invalid { border-color: var(--danger) !important; }
.field-error { color: var(--danger-text); font-size: .8rem; margin-top: 5px; }
.input-group { display: flex; }
.input-group > * { border-radius: 0; }
.input-group > :first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > :last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group .btn { border: 1px solid var(--border-strong); }
select { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b95a7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 18px; }
legend { font-weight: 600; padding: 0 6px; }

/* Choice cards (radio as card) */
.choice-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.choice { position: relative; display: block; padding: 16px 16px 16px 46px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast); }
.choice:hover { border-color: var(--primary); }
.choice input { position: absolute; left: 16px; top: 19px; }
.choice__title { font-weight: 600; display: block; margin-bottom: 4px; }
.choice__desc { font-size: .85rem; color: var(--text-muted); }
.choice.is-selected, .choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }

/* Toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { width: 42px; height: 24px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background var(--t-fast); flex: 0 0 auto; }
.switch__track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--t-fast); }
.switch input:checked + .switch__track { background: var(--primary); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--ring); }

/* ---------- Cards / panels ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card__body { padding: 22px 24px; }
.card__header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card__header h2, .card__header h3 { margin: 0; font-size: 1.05rem; }
.card__footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card--flat { box-shadow: none; }
.card--soft { background: var(--surface-2); border-color: transparent; }
.card--accent { border-top: 3px solid var(--primary); }
@media (max-width: 640px) { .card__body, .card__header, .card__footer { padding-left: 16px; padding-right: 16px; } }

/* Stat tiles */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat__label { font-size: .8rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat__value { font-size: 1.7rem; font-weight: 700; color: var(--heading); letter-spacing: -0.02em; line-height: 1.1; }
.stat__sub { font-size: .8rem; color: var(--text-muted); }
.stat--primary { background: var(--accent-gradient); border-color: transparent; color: #fff; }
.stat--primary .stat__label, .stat--primary .stat__sub { color: rgba(255,255,255,.8); }
.stat--primary .stat__value { color: #fff; }

/* ---------- Badges / tags ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; line-height: 1.5; background: var(--surface-3); color: var(--text-muted); white-space: nowrap; }
.badge--primary { background: var(--primary-soft); color: var(--primary-soft-text); }
.badge--success { background: var(--success-soft); color: var(--success-text); }
.badge--warning { background: var(--warning-soft); color: var(--warning-text); }
.badge--danger { background: var(--danger-soft); color: var(--danger-text); }
.badge--info { background: var(--info-soft); color: var(--info-text); }
.badge--outline { background: transparent; border: 1px solid var(--border-strong); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Radio list ---------- */
.radio-list { display: grid; gap: 10px; }
.radio { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; }
.radio:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio input { margin-top: 3px; flex: 0 0 auto; }
.radio small { line-height: 1.4; }

/* ---------- Country flags (SVG) ---------- */
.fi { display: inline-block; width: 1.35em; height: 1em; background-size: cover; background-position: 50%; background-repeat: no-repeat; vertical-align: -.15em; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }

/* ---------- Admin: impersonation banner + login-as form ---------- */
.impersonation-bar { align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; position: sticky; top: calc(var(--header-h) + 8px); z-index: 50; }
.admin-loginas { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.admin-loginas select { flex: 1 1 320px; max-width: 640px; }
.admin-table form { display: inline; }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 16px; font-size: .92rem; }
.alert .icon { margin-top: 2px; }
.alert p:last-child { margin-bottom: 0; }
.alert--info { background: var(--info-soft); border-color: transparent; color: var(--info-text); }
.alert--success { background: var(--success-soft); border-color: transparent; color: var(--success-text); }
.alert--warning { background: var(--warning-soft); border-color: transparent; color: var(--warning-text); }
.alert--danger, .alert--error { background: var(--danger-soft); border-color: transparent; color: var(--danger-text); }
.alert--disclaimer { background: var(--warning-soft); border: 1px dashed var(--warning); color: var(--text); }
.alert strong { font-weight: 700; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th, .table td { padding: 10px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr.is-selected td { background: var(--primary-soft); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table--compact th, .table--compact td { padding: 7px 10px; }
.table .row-muted td { opacity: .6; }
.table .cell-actions { white-space: nowrap; text-align: right; }
.table-empty { padding: 48px 20px; text-align: center; color: var(--text-muted); }
.table-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.table-toolbar__filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.table-toolbar__filters input, .table-toolbar__filters select { width: auto; min-width: 140px; }
.table-toolbar__filters input[type="search"] { min-width: 220px; }
.table-toolbar__filters input[type="checkbox"] { min-width: 0; width: auto; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 16px; background: var(--primary-soft); border: 1px solid var(--primary); border-radius: var(--radius); margin-bottom: 14px; }
.bulk-bar strong { color: var(--primary-soft-text); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 16px; border: 0; background: none; color: var(--text-muted); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.is-active, .tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel[hidden] { display: none; }
.tabs--wrap { flex-wrap: wrap; overflow: visible; }

/* ---------- Stepper ---------- */
.stepper { display: flex; gap: 8px; align-items: center; margin: 0 0 28px; padding: 0; list-style: none; flex-wrap: wrap; }
.stepper__step { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-weight: 600; font-size: .875rem; }
.stepper__num { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); color: var(--text-muted); font-size: .8rem; }
.stepper__step.is-active { color: var(--text); }
.stepper__step.is-active .stepper__num { background: var(--primary); color: #fff; }
.stepper__step.is-done .stepper__num { background: var(--success); color: #fff; }
.stepper__sep { flex: 1; height: 2px; min-width: 24px; background: var(--border); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(5, 8, 15, .6); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 900; animation: fadeIn var(--t) var(--ease); }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: popIn var(--t) var(--ease); }
.modal--lg { max-width: 820px; }
.modal__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal__header h3 { margin: 0; font-size: 1.1rem; }
.modal__body { padding: 20px 22px; }
.modal__footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; background: var(--surface-2); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
body.modal-open { overflow: hidden; }

/* ---------- Toasts ---------- */
.toast-root { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-md); font-size: .9rem; animation: toastIn var(--t) var(--ease); border-left: 4px solid var(--primary); }
.toast--success { border-left-color: var(--success); }
.toast--error, .toast--danger { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }
.toast.is-leaving { opacity: 0; transform: translateX(20px); transition: all var(--t) var(--ease); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; display: inline-block; }
.dropdown__menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 6px; z-index: 50; }
.dropdown__item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: var(--radius-sm); color: var(--text); text-align: left; cursor: pointer; font-size: .9rem; text-decoration: none; }
.dropdown__item:hover { background: var(--surface-2); text-decoration: none; }
.dropdown__item--danger { color: var(--danger-text); }

/* ---------- Misc components ---------- */
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.lang-switch a { padding: 5px 10px; font-size: .75rem; font-weight: 700; color: var(--text-muted); text-decoration: none; }
.lang-switch a.is-active { background: var(--primary); color: #fff; }
.lang-switch a:hover:not(.is-active) { background: var(--surface-2); }

.empty { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty .icon { width: 48px; height: 48px; margin: 0 auto 14px; color: var(--text-faint); }
.empty h3 { color: var(--text); }

.kbd-steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.kbd-steps li { position: relative; padding-left: 44px; margin-bottom: 14px; }
.kbd-steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-soft-text); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: .85rem; }

.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); transition: width var(--t) var(--ease); }

.divider { display: flex; align-items: center; gap: 12px; color: var(--text-faint); font-size: .8rem; margin: 18px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }

.copy-field { display: flex; gap: 8px; align-items: center; }
.copy-field input, .copy-field textarea { font-family: var(--font-mono); font-size: .8rem; }

.tooltip { position: relative; cursor: help; border-bottom: 1px dotted var(--text-faint); }

.spinner { width: 22px; height: 22px; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }

/* ---------- Public site: header / footer ---------- */
.site-header { position: sticky; top: 0; z-index: 100; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--border); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; height: var(--header-h); }
.site-nav { display: flex; gap: 6px; }
.site-nav a { padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text-muted); font-weight: 500; font-size: .95rem; }
.site-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.site-header__actions { display: flex; align-items: center; gap: 10px; }
.nav-toggle { display: none; }
@media (max-width: 860px) {
  .site-nav { display: none; position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; padding: 12px 20px 16px; background: var(--bg-elevated); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md); }
  .site-nav.is-open { display: flex; }
  .nav-toggle { display: inline-flex; }
  .site-header .lang-switch { display: none; }
}
.site-main { min-height: 60vh; }
.site-footer { border-top: 1px solid var(--border); padding: 48px 0 28px; margin-top: 64px; background: var(--surface); }
.site-footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; margin-bottom: 28px; }
.site-footer__links { display: flex; flex-direction: column; gap: 8px; }
.site-footer__links a { color: var(--text-muted); }
.site-footer__links a:hover { color: var(--primary); }
.site-footer__brand .brand__logo { height: 22px; margin-bottom: 12px; }
.site-footer__disclaimer { font-size: .8rem; border-top: 1px solid var(--border); padding-top: 18px; }
.site-footer__copy { font-size: .8rem; margin: 0; }
@media (max-width: 760px) { .site-footer__grid { grid-template-columns: 1fr 1fr; } .site-footer__brand { grid-column: 1 / -1; } }

/* ---------- Landing sections ---------- */
.section { padding: 72px 0; }
.section--tight { padding: 48px 0; }
.section--alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section__head { max-width: 680px; margin: 0 auto 40px; text-align: center; }
.section__head p { color: var(--text-muted); font-size: 1.05rem; }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); margin-bottom: 10px; }

.hero { padding: 72px 0 56px; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: -20% -10% auto -10%; height: 520px; background: radial-gradient(60% 60% at 50% 0%, rgba(26,115,232,.18), transparent 70%); pointer-events: none; }
.hero__inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; position: relative; }
.hero h1 { margin-bottom: 18px; }
.hero__lead { font-size: 1.15rem; color: var(--text-muted); max-width: 560px; margin-bottom: 26px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero__note { font-size: .82rem; color: var(--text-faint); margin-top: 14px; }
.hero__visual { position: relative; }
.hero__visual img { width: 100%; max-width: 520px; margin: 0 auto; filter: drop-shadow(0 30px 40px rgba(11,44,107,.25)); }
@media (max-width: 900px) { .hero__inner { grid-template-columns: 1fr; text-align: center; } .hero__lead { margin: 0 auto 26px; } .hero__actions { justify-content: center; } .hero__visual img { max-width: 360px; } }

.feature { padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease); }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.feature__icon { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.feature__icon .icon { width: 22px; height: 22px; }
.feature h3 { font-size: 1.05rem; margin-bottom: 6px; }
.feature p { color: var(--text-muted); font-size: .92rem; margin: 0; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; counter-reset: s; }
.step { position: relative; padding: 28px 24px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.step__num { position: absolute; top: -16px; left: 24px; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-gradient); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-md); }
.step h3 { font-size: 1.05rem; }
.step p { color: var(--text-muted); font-size: .92rem; margin: 0; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }

.platforms { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.platform { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-weight: 600; }
.platform--soon { opacity: .6; border-style: dashed; }

.faq { max-width: 780px; margin: 0 auto; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; }
.faq summary { padding: 16px 18px; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--primary); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq .faq__body { padding: 0 18px 16px; color: var(--text-muted); }

.cta { background: var(--accent-gradient); color: #fff; border-radius: var(--radius-xl); padding: 48px 32px; text-align: center; }
.cta h2 { color: #fff; }
.cta p { color: rgba(255,255,255,.85); max-width: 560px; margin: 0 auto 24px; }
.cta .btn--primary { background: #fff; color: var(--navy); box-shadow: none; }
.cta .btn--primary:hover { background: #eef3ff; color: var(--navy); }

/* ---------- Auth page ---------- */
.auth-page { min-height: calc(100vh - var(--header-h)); display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 440px; text-align: center; }
.auth-card .brand__logo { height: 34px; margin: 0 auto 24px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar { width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 200; }
.app-sidebar__brand { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); padding: 0 20px; border-bottom: 1px solid var(--border); }
.app-sidebar__brand .brand__logo { height: 22px; }
.app-sidebar__close { display: none; }
.app-nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.app-nav__item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); color: var(--text-muted); font-weight: 500; text-decoration: none; transition: background var(--t-fast), color var(--t-fast); }
.app-nav__item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.app-nav__item.is-active { background: var(--primary-soft); color: var(--primary-soft-text); font-weight: 600; }
.app-nav__item .icon { width: 20px; height: 20px; }
.app-sidebar__footer { padding: 14px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.app-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-user__avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.app-user__avatar--fallback { display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: #fff; font-weight: 700; }
.app-user__meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.app-user__meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.app-user__meta a { font-size: .8rem; }
.app-sidebar__tools { display: flex; align-items: center; justify-content: space-between; }
.app-sidebar__backdrop { position: fixed; inset: 0; background: rgba(5,8,15,.5); z-index: 190; }
.app-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar { height: var(--header-h); display: flex; align-items: center; gap: 14px; padding: 0 28px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 100; }
.app-topbar__menu { display: none; }
.app-topbar__title { font-size: 1.15rem; margin: 0; flex: 1; }
.app-topbar__actions { display: flex; align-items: center; gap: 10px; }
.app-main { padding: 28px; flex: 1; width: 100%; max-width: 1400px; }
.page--wide .app-main { max-width: 1806px; } /* 1750px table + 2 x 28px padding */
.app-footer { padding: 16px 28px; border-top: 1px solid var(--border); font-size: .78rem; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--text-muted); }
.app-footer__links { display: flex; gap: 14px; }
.app-footer__links a { color: var(--text-muted); }
@media (max-width: 1024px) {
  .app-sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform var(--t) var(--ease); box-shadow: var(--shadow-lg); }
  .app-sidebar.is-open { transform: none; }
  .app-sidebar__close, .app-topbar__menu { display: inline-flex; }
  .app-main { padding: 20px 16px; }
  .app-topbar { padding: 0 16px; }
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h2 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-muted); }

/* Onboarding */
.onboarding { max-width: 820px; margin: 0 auto; }

/* Reco list */
.reco { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); margin-bottom: 10px; font-size: .92rem; }
.reco--success { border-color: var(--success); background: var(--success-soft); }
.reco--warning { border-color: var(--warning); background: var(--warning-soft); }
.reco--info { border-color: var(--info); background: var(--info-soft); }

/* Print */
@media print { .site-header, .site-footer, .app-sidebar, .app-topbar, .app-footer, .toast-root { display: none !important; } body { background: #fff; } }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
