/* ═══════════════════════════════════════════════════════════════════════════
   Phivote — Design System
   Dark premium trading terminal. Bloomberg × Linear × crypto-native.
   Tokens, reset, base typography, RTL support, and shared component atoms.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Surfaces ──────────────────────────────────────────────── */
  --bg-void:    #06080c;
  --bg-base:    #0a0e14;
  --bg-panel:   #0e131b;
  --bg-raised:  #141a24;
  --bg-hover:   #1a212d;

  --glass:        rgba(16, 22, 31, 0.55);
  --glass-strong: rgba(18, 24, 34, 0.82);

  --line:        rgba(255, 255, 255, 0.06);
  --line-mid:    rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.16);

  /* ── Text ──────────────────────────────────────────────────── */
  --txt:   #eaf0f7;
  --txt-2: #9aa7b8;
  --txt-3: #5d6a7c;
  --txt-4: #3a4453;

  /* ── Brand / signal ────────────────────────────────────────── */
  --accent:      #00e5a0;
  --accent-2:    #18b4ff;
  --accent-ink:  #00130c;
  --accent-dim:  rgba(0, 229, 160, 0.12);

  --long:        #00e5a0;
  --long-dim:    rgba(0, 229, 160, 0.12);
  --long-ink:    #062d20;
  --short:       #ff4d6d;
  --short-dim:   rgba(255, 77, 109, 0.12);
  --short-ink:   #350810;
  --gold:        #ffc24b;
  --gold-dim:    rgba(255, 194, 75, 0.13);
  --gold-ink:    #2a1d00;

  /* ── Glows & shadows ───────────────────────────────────────── */
  --glow-accent: 0 0 0 1px rgba(0, 229, 160, 0.35), 0 0 28px rgba(0, 229, 160, 0.22);
  --glow-gold:   0 0 0 1px rgba(255, 194, 75, 0.35), 0 0 24px rgba(255, 194, 75, 0.2);
  --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:      0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg:   0 28px 70px rgba(0, 0, 0, 0.6);

  /* ── Radii ─────────────────────────────────────────────────── */
  --r-xs: 4px;
  --r-sm: 7px;
  --r:    11px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* ── Type ──────────────────────────────────────────────────── */
  --font-ui:   'Inter', 'Vazirmatn', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
  --font-fa:   'Vazirmatn', 'Inter', system-ui, sans-serif;

  --maxw: 1320px;
}

/* Persian gets Vazirmatn as the primary UI face. */
html[lang='fa'] {
  --font-ui: 'Vazirmatn', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg-base);
  color: var(--txt);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  font-feature-settings: 'cv01' 1, 'cv03' 1, 'ss01' 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── Ambient background: layered radial mesh + faint grain ──────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 600px at 12% -8%, rgba(0, 229, 160, 0.10), transparent 60%),
    radial-gradient(1000px 700px at 92% 0%, rgba(24, 180, 255, 0.09), transparent 55%),
    radial-gradient(800px 800px at 50% 120%, rgba(124, 92, 255, 0.07), transparent 60%),
    var(--bg-base);
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
}

/* ════════════════ Typography helpers ════════════════ */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; color: var(--txt); }
.mono { font-family: var(--font-mono); font-feature-settings: 'tnum' 1, 'zero' 1; }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
}
.gradient-text {
  background: linear-gradient(100deg, var(--txt) 10%, var(--accent) 55%, var(--accent-2) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* Custom scrollbar — terminal feel */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--txt-4); background-clip: padding-box; }

/* ════════════════ Layout ════════════════ */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
}
.container-wide { max-width: 1560px; }

/* ════════════════ Glass panel ════════════════ */
.glass {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ════════════════ Buttons ════════════════ */
.btn {
  --bw: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  padding: 12px 20px;
  border-radius: var(--r-sm);
  border: var(--bw) solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.14s ease, box-shadow 0.2s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  user-select: none;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: linear-gradient(180deg, #1cffb6, var(--accent));
  color: var(--accent-ink);
  box-shadow: 0 8px 24px rgba(0, 229, 160, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(0, 229, 160, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn-glass {
  background: var(--glass-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--txt);
  border-color: var(--line-mid);
}
.btn-glass:hover { border-color: var(--line-strong); background: var(--bg-hover); transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--txt-2); }
.btn-ghost:hover { color: var(--txt); background: var(--bg-hover); }

.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 15px 28px; font-size: 15px; }
.btn-block { width: 100%; }

/* ════════════════ Pills & badges ════════════════ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid var(--line-mid);
  background: var(--glass);
  color: var(--txt-2);
}
.pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.pill .dot.live { animation: pulse 1.7s ease-in-out infinite; }
.pill .dot.idle { background: var(--txt-3); box-shadow: none; }
.pill .dot.err  { background: var(--short); box-shadow: 0 0 8px var(--short); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.5;
  white-space: nowrap;
}
.badge.fresh     { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 12px rgba(0,229,160,0.35); }
.badge.first     { background: transparent; color: var(--accent-2); border: 1px solid var(--accent-2); }
.badge.vol       { background: var(--long-dim); color: var(--long); border: 1px solid rgba(0,229,160,0.4); }
.badge.rejection { background: var(--gold); color: var(--gold-ink); }
.badge.pro       { background: linear-gradient(100deg, var(--gold), #ff9d3c); color: var(--gold-ink); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.82); }
}

/* ════════════════ Form controls ════════════════ */
.input, .select {
  background: var(--bg-void);
  border: 1px solid var(--line-mid);
  color: var(--txt);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  font-variant-numeric: tabular-nums;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.input::-webkit-outer-spin-button, .input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-inline-end: 32px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--txt-2) 50%),
    linear-gradient(135deg, var(--txt-2) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% + 1px),
    calc(100% - 11px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
html[dir='rtl'] .select {
  background-position:
    16px calc(50% + 1px),
    21px calc(50% + 1px);
}
.select option { background: var(--bg-panel); color: var(--txt); }

/* segmented control */
.segment {
  display: inline-flex;
  background: var(--bg-void);
  border: 1px solid var(--line-mid);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 2px;
}
.segment button {
  background: transparent;
  border: none;
  color: var(--txt-2);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 7px 13px;
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: all 0.14s;
  position: relative;
}
.segment button:hover { color: var(--txt); }
.segment button.active {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 2px 10px rgba(0, 229, 160, 0.3);
}
.segment button.scalp { font-size: 11px; padding: 7px 10px; opacity: 0.85; }
.segment button.scalp.active { opacity: 1; }

/* ════════════════ Brand mark ════════════════ */
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  position: relative;
  flex-shrink: 0;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 9px; }
.brand-mark svg { width: 22px; height: 22px; }
/* The sign-in gate gets a larger emblem for presence. */
.gate-brand .brand-mark { width: 52px; height: 52px; }
.brand-name {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.03em;
}
.brand-name b { color: var(--accent); font-weight: 800; }

/* ════════════════ Top navigation ════════════════ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 11, 16, 0.72);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a {
  color: var(--txt-2);
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 13px;
  border-radius: var(--r-sm);
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover { color: var(--txt); background: var(--bg-hover); }
.nav-right { display: flex; align-items: center; gap: 10px; }

/* language toggle */
.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--line-mid);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.lang-toggle button {
  background: transparent;
  border: none;
  color: var(--txt-3);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 7px 10px;
  cursor: pointer;
  transition: all 0.14s;
}
.lang-toggle button.active { background: var(--txt); color: var(--bg-void); }
.lang-toggle button:not(.active):hover { color: var(--txt); }

/* ════════════════ Footer ════════════════ */
.footer {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.3));
  margin-top: 80px;
  padding: 56px 0 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer h5 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--txt-3);
  margin-bottom: 16px;
}
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links a { color: var(--txt-2); font-size: 13.5px; transition: color 0.15s; width: fit-content; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--txt-3);
  font-size: 12.5px;
}

/* ════════════════ Reveal-on-scroll ════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ════════════════ Modal system ════════════════ */
#sx-modal-root {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
#sx-modal-root.open { display: flex; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 0.2s;
}
#sx-modal-root.open .modal-backdrop { opacity: 1; }
.modal-card {
  position: relative; width: 100%; max-width: 420px;
  padding: 30px 28px 26px; border-radius: var(--r-lg);
  transform: translateY(14px) scale(0.98); opacity: 0;
  transition: transform 0.24s cubic-bezier(0.22,1,0.36,1), opacity 0.24s;
}
#sx-modal-root.open .modal-card { transform: none; opacity: 1; }
.modal-x {
  position: absolute; inset-inline-end: 14px; top: 14px;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: transparent; border: none; color: var(--txt-3); cursor: pointer;
  font-size: 15px; transition: background 0.13s, color 0.13s;
}
.modal-x:hover { background: var(--bg-hover); color: var(--txt); }
.modal-head { text-align: center; margin-bottom: 22px; }
.modal-mark {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: var(--r);
  display: grid; place-items: center; font-size: 24px;
  background: var(--bg-raised); border: 1px solid var(--line-mid);
}
.modal-mark.success { background: var(--accent); color: var(--accent-ink); box-shadow: var(--glow-accent); }
.modal-head h3 { font-size: 21px; margin-bottom: 6px; }
.modal-sub { color: var(--txt-2); font-size: 13.5px; }
.modal-body { display: flex; flex-direction: column; gap: 12px; }
.field-lbl { font-size: 12px; font-weight: 600; color: var(--txt-2); margin-bottom: -4px; }
.modal-input { width: 100%; padding: 12px 14px; font-family: var(--font-ui); }
.modal-note { font-size: 11.5px; color: var(--txt-3); text-align: center; line-height: 1.6; margin-top: 4px; }
.checkout-price { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin-top: 6px; }
.checkout-amount { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.checkout-unit { color: var(--txt-2); font-size: 14px; }
.checkout-usdt { color: var(--txt-3); font-size: 12.5px; margin-top: 4px; }
.pay-btn { justify-content: center; }
.pay-usdt { display: flex; flex-direction: column; gap: 12px; }
.pay-amount { display: flex; align-items: baseline; justify-content: center; gap: 9px; font-size: 22px; }
.pay-amount .mono { font-weight: 800; letter-spacing: -0.01em; }
.pay-amount b { color: var(--accent); }
.pay-net { font-family: var(--font-mono); font-size: 10px; color: var(--txt-3); border: 1px solid var(--line-mid); border-radius: var(--r-xs); padding: 2px 7px; letter-spacing: 0.1em; align-self: center; }
.pay-addr { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line-mid); border-radius: var(--r-sm); background: var(--bg-void); }
.pay-addr code { flex: 1; font-size: 11px; word-break: break-all; color: var(--txt-2); text-align: start; }
.copy-btn { background: var(--bg-hover); border: 1px solid var(--line-mid); color: var(--txt-2); font-size: 11px; font-weight: 600; padding: 6px 11px; border-radius: var(--r-xs); cursor: pointer; white-space: nowrap; transition: all 0.13s; }
.copy-btn:hover { color: var(--txt); border-color: var(--line-strong); }
.upsell-list { list-style: none; display: flex; flex-direction: column; gap: 9px; margin: 4px 0 8px; }
.upsell-list li { position: relative; padding-inline-start: 26px; font-size: 13.5px; color: var(--txt-2); }
.upsell-list li::before {
  content: '✓'; position: absolute; inset-inline-start: 0; top: 0;
  color: var(--accent); font-weight: 800;
}
.alerts-ctx {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 14px; margin-bottom: 4px; border: 1px solid var(--line-mid);
  border-radius: var(--r-sm); background: var(--bg-void);
  font-size: 12.5px; color: var(--txt-2); letter-spacing: 0.06em; text-transform: uppercase;
}
.alerts-ctx i { color: var(--txt-4); font-style: normal; }
.alerts-ctx span { font-weight: 600; }
.modal-spinner {
  width: 38px; height: 38px; margin: 8px auto 0; border-radius: 50%;
  border: 3px solid var(--line-mid); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════ Auth gate (shown before the scanner) ════════════════ */
.auth-gate {
  position: fixed; inset: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(120% 90% at 50% -10%, rgba(0, 229, 160, 0.08), transparent 60%), var(--bg-void);
  overflow: hidden;
}
.gate-aurora {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(40% 50% at 16% 14%, rgba(24, 180, 255, 0.10), transparent 70%),
    radial-gradient(46% 56% at 86% 88%, rgba(0, 229, 160, 0.10), transparent 70%);
}
.gate-card {
  position: relative; width: 100%; max-width: 408px;
  padding: 36px 32px 26px; border-radius: var(--r-lg);
  text-align: center; box-shadow: var(--shadow-lg);
  animation: gate-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes gate-in { from { opacity: 0; transform: translateY(16px) scale(0.985); } to { opacity: 1; transform: none; } }
.gate-brand { justify-content: center; margin-bottom: 22px; }
.gate-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.gate-sub { color: var(--txt-2); font-size: 13.5px; line-height: 1.6; margin-bottom: 22px; }
.gate-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px; margin-bottom: 20px;
  background: var(--bg-void); border: 1px solid var(--line-mid); border-radius: var(--r);
}
.gate-tab {
  padding: 9px 0; border: none; border-radius: var(--r-sm);
  background: transparent; color: var(--txt-2);
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.gate-tab:hover { color: var(--txt); }
.gate-tab.active { background: var(--bg-raised); color: var(--txt); box-shadow: var(--shadow-sm); }
.gate-form { display: flex; flex-direction: column; gap: 10px; text-align: start; }
.gate-form .input { width: 100%; padding: 12px 14px; }
.gate-form .btn { margin-top: 6px; }
.gate-code {
  display: inline-block; margin-top: 18px;
  color: var(--accent); font-size: 12.5px; font-weight: 600; text-decoration: none;
}
.gate-code:hover { text-decoration: underline; }
.gate-demo { color: var(--txt-4); font-size: 11px; line-height: 1.6; margin-top: 14px; }

/* ════════════════ Quick sign-in (social) ════════════════ */
/* Shared by the /app gate (#gateSocial) and the sign-in modal. */
.gate-social { text-align: start; }
.social-row { display: flex; flex-direction: column; gap: 10px; }
.btn-social { justify-content: center; gap: 10px; }
.social-ic { display: inline-flex; align-items: center; }
.social-ic svg { width: 18px; height: 18px; }
.or-divider {
  display: flex; align-items: center; gap: 12px; margin: 12px 0;
  color: var(--txt-4); font-size: 11px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
}
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--line-mid); }
.auth-stack { display: flex; flex-direction: column; gap: 12px; text-align: start; }

/* Ephemeral toast (auth round-trip errors) */
.sx-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px);
  z-index: 3000; max-width: min(92vw, 420px);
  background: var(--glass-strong); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  padding: 12px 18px; color: var(--txt); font-size: 13.5px; font-weight: 600; text-align: center;
  box-shadow: var(--shadow-lg, 0 12px 36px rgba(0, 0, 0, 0.45));
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
}
.sx-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ════════════════ Utilities ════════════════ */
.hide { display: none !important; }
.mt-auto { margin-top: auto; }
[hidden] { display: none !important; }

/* ════════════════ Responsive base ════════════════ */
@media (max-width: 900px) {
  .container { padding: 0 18px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .nav-links { display: none; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
  /* Top nav: wrap + compact so the right cluster never clips off-screen. */
  .nav-inner { flex-wrap: wrap; height: auto; min-height: 58px; padding: 9px 0; column-gap: 10px; row-gap: 8px; }
  .nav-right { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
  .nav-back { display: none; }                 /* the brand already links home */
  .brand-name { font-size: 17px; }
  .btn-sm { padding: 7px 12px; font-size: 12.5px; }
  .lang-toggle button { padding: 6px 9px; }
}

/* Notch / home-indicator safe areas (standalone PWA, viewport-fit=cover). */
@supports (padding: env(safe-area-inset-top)) {
  .nav { padding-top: env(safe-area-inset-top); }
  .sx-toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* ════════════════ Account chip + profile panel ════════════════ */
.acct-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 13px 4px 4px; border-radius: var(--r-pill);
  background: var(--bg-panel); border: 1px solid var(--line);
  color: var(--txt-2); font-family: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.acct-chip:hover { border-color: var(--line-strong); color: var(--txt); background: var(--bg-hover); }
.acct-chip.is-pro { border-color: rgba(255, 194, 75, 0.4); }
.acct-av {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); font-weight: 800; font-size: 13px;
}
/* OAuth photo overlays the initials and is clipped to the avatar circle. */
.acct-av img, .prof-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.acct-chip.is-pro .acct-av { background: linear-gradient(135deg, var(--gold), #ff9d3b); color: var(--gold-ink); }
.acct-tier { white-space: nowrap; }

.prof-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.prof-av {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink); font-weight: 800; font-size: 24px;
}
.prof-id h3 { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.prof-id p { color: var(--txt-3); font-size: 13px; margin-top: 2px; word-break: break-all; }

.prof-sub { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 18px; background: var(--bg-panel); text-align: center; }
.prof-tier {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 11px; border-radius: var(--r-pill); margin-bottom: 13px;
  color: var(--txt-2); background: var(--bg-raised); border: 1px solid var(--line);
}
.prof-sub.trial .prof-tier { color: var(--gold); background: var(--gold-dim); border-color: rgba(255, 194, 75, 0.3); }
.prof-sub.pro .prof-tier { color: var(--accent); background: var(--accent-dim); border-color: rgba(0, 229, 160, 0.3); }
.prof-big { font-family: var(--font-mono); font-size: 32px; font-weight: 700; color: var(--txt); line-height: 1.1; }
.prof-big small { font-family: var(--font-ui); font-size: 13px; font-weight: 500; color: var(--txt-3); }
.prof-bar { height: 6px; border-radius: var(--r-pill); background: var(--bg-raised); overflow: hidden; margin: 15px 0 0; }
.prof-bar span { display: block; height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 1s linear; }
.prof-sub.trial .prof-bar span { background: linear-gradient(90deg, var(--gold), #ff9d3b); }
.prof-exp { color: var(--txt-3); font-size: 12.5px; margin-top: 10px; }

.prof-stats { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin: 16px 0; }
.prof-stats > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; background: var(--bg-panel); font-size: 13px; }
.prof-stats .k { color: var(--txt-3); }
.prof-stats .v { color: var(--txt); font-weight: 600; }
.prof-actions { display: flex; flex-direction: column; gap: 8px; }
