/* ---------- Theme tokens (light is the default; dark via [data-theme="dark"]) ---------- */

:root {
  --brand: linear-gradient(135deg, #7c3aed, #ec4899 50%, #f97316);
  --brand-x: linear-gradient(90deg, #7c3aed, #ec4899, #f97316, #7c3aed);
  --brand-glow: 0 10px 40px -10px rgba(236, 72, 153, 0.45);
  --teal: #14b8a6;
  --emerald: #34d399;
  --green: #22c55e;
  --pink: #ec4899;
  --purple: #8b5cf6;
  --violet: #7c3aed;
  --blue: #3b82f6;
  --cyan: #22d3ee;
  --orange: #f97316;
  --amber: #f59e0b;
  --red: #ef4444;
  --rose: #fb7185;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sidebar-w: 80px;

  --bg: #f6f5ff;
  --bg-glow:
    radial-gradient(900px 600px at 0% -10%, rgba(167, 139, 250, 0.28), transparent 60%),
    radial-gradient(800px 600px at 100% 0%, rgba(103, 232, 249, 0.16), transparent 60%),
    radial-gradient(900px 700px at 50% 110%, rgba(244, 114, 182, 0.12), transparent 60%);
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --surface-2: #f3f1fd;
  --surface-3: #e9e6fa;
  --hover: rgba(124, 58, 237, 0.04);
  --border: #ebe8f8;
  --border-strong: #e2e8f0;
  --shadow: 0 12px 34px -20px rgba(76, 29, 149, 0.28);
  --track: #ece9f8;
  --input-bg: #ffffff;
  --modal-bg: radial-gradient(500px 200px at 100% 0%, rgba(236, 72, 153, 0.08), transparent 70%), #ffffff;
  --toast-bg: #ffffff;
  --contrast-bg: #0f172a;
  --contrast-text: #ffffff;
  --secondary-bg: rgba(255, 255, 255, 0.85);
  --sidebar-bg: rgba(255, 255, 255, 0.86);
  --hero-bg:
    radial-gradient(600px 380px at 92% 30%, rgba(251, 146, 60, 0.16), transparent 70%),
    radial-gradient(500px 340px at 0% 0%, rgba(167, 139, 250, 0.26), transparent 70%),
    linear-gradient(115deg, #ffffff 0%, #faf5ff 45%, #fff1f2 80%, #fff7ed 100%);
  --promo-bg:
    radial-gradient(700px 300px at 15% 50%, rgba(45, 212, 191, 0.14), transparent 70%),
    linear-gradient(120deg, #f0fdfa, #eef2ff 55%, #f5f3ff);
  --files-bg: radial-gradient(900px 420px at 28% 0%, rgba(45, 212, 191, 0.1), transparent 70%), #ffffff;
  --stat-bg: #ffffff;
  --stat-low-bg: #fff1f2;
  --stat-low-border: #fecdd3;
  --alert-bg: #fff1f2;
  --alert-border: #fecdd3;
  --alert-text: #be123c;
  --banner-bg: #f5f3ff;
  --banner-border: #ddd6fe;
  --banner-text: #5b21b6;
  --checking: #b45309;
  --ok: #16a34a;
  --ok-bg: #dcfce7;
  --bad: #dc2626;
  --bad-bg: #fee2e2;
  --refund: #0f766e;
  --refund-bg: #ccfbf1;
  --wait: #b45309;
  --wait-bg: #fef3c7;
  --demo: #6d28d9;
  --demo-bg: #ede9fe;
  --sim-text: #059669;
  --ai-text: #4f46e5;
  --c-cyan: #0891b2;
  --c-orange: #ea580c;
  --dot-ring: #ffffff;
  --code-bg: #f8fafc;
  color-scheme: light;
}

[data-theme='dark'] {
  --bg: #070a17;
  --bg-glow:
    radial-gradient(1200px 700px at 8% -10%, rgba(139, 92, 246, 0.16), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, rgba(249, 115, 22, 0.08), transparent 60%),
    radial-gradient(1000px 800px at 30% 100%, rgba(20, 184, 166, 0.1), transparent 60%);
  --text: #f5f6fb;
  --text-2: #c9cce0;
  --muted: #8b90ab;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-solid: #10122a;
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(255, 255, 255, 0.09);
  --hover: rgba(255, 255, 255, 0.025);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --shadow: none;
  --track: rgba(255, 255, 255, 0.09);
  --input-bg: rgba(4, 5, 14, 0.55);
  --modal-bg: radial-gradient(500px 200px at 100% 0%, rgba(168, 85, 247, 0.16), transparent 70%), #10122a;
  --toast-bg: #171a36;
  --contrast-bg: #ffffff;
  --contrast-text: #0b0c18;
  --secondary-bg: rgba(8, 10, 24, 0.55);
  --sidebar-bg: rgba(7, 10, 23, 0.86);
  --hero-bg:
    radial-gradient(600px 380px at 92% 30%, rgba(249, 115, 22, 0.18), transparent 70%),
    radial-gradient(500px 340px at 0% 0%, rgba(168, 85, 247, 0.16), transparent 70%),
    linear-gradient(115deg, #17142b 0%, #211729 42%, #2c1820 75%, #33201a 100%);
  --promo-bg:
    radial-gradient(700px 300px at 15% 50%, rgba(20, 184, 166, 0.12), transparent 70%),
    linear-gradient(120deg, #0b1822, #0e1326 55%, #141232);
  --files-bg: radial-gradient(900px 420px at 28% 0%, rgba(20, 184, 166, 0.14), transparent 70%), #0b0f1e;
  --stat-bg: rgba(255, 255, 255, 0.04);
  --stat-low-bg: rgba(239, 68, 68, 0.07);
  --stat-low-border: rgba(248, 113, 113, 0.22);
  --alert-bg: rgba(244, 63, 94, 0.07);
  --alert-border: rgba(244, 63, 94, 0.35);
  --alert-text: #fecdd3;
  --banner-bg: rgba(139, 92, 246, 0.1);
  --banner-border: rgba(139, 92, 246, 0.3);
  --banner-text: #ddd6fe;
  --checking: #fcd34d;
  --ok: #4ade80;
  --ok-bg: rgba(34, 197, 94, 0.12);
  --bad: #f87171;
  --bad-bg: rgba(239, 68, 68, 0.13);
  --refund: #2dd4bf;
  --refund-bg: rgba(20, 184, 166, 0.13);
  --wait: #fbbf24;
  --wait-bg: rgba(245, 158, 11, 0.13);
  --demo: #c4b5fd;
  --demo-bg: rgba(139, 92, 246, 0.16);
  --sim-text: #34d399;
  --ai-text: #a5b4fc;
  --c-cyan: #22d3ee;
  --c-orange: #f97316;
  --dot-ring: #0b0f1e;
  --code-bg: rgba(4, 5, 14, 0.55);
  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 0.92em; }

.i { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes gradient-x { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.text-brand { background: var(--brand-x); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: gradient-x 6s ease infinite; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Sidebar (left rail on desktop, top bar on smaller screens) ---------- */

body.has-sidebar { padding-left: var(--sidebar-w); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-w);
  display: flex; flex-direction: column; align-items: center; padding: 14px 0 16px;
  background: var(--sidebar-bg); backdrop-filter: blur(14px);
}
.sidebar::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 2px; background: linear-gradient(180deg, #7c3aed, #ec4899, #f97316); }
.side-logo { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--brand); color: #fff; box-shadow: var(--brand-glow); }
.side-logo .i { width: 24px; height: 24px; }
.side-sep { width: 100%; height: 1px; margin: 14px 0; background: var(--border); }
.side-nav, .side-bottom { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.side-nav { flex: 1; }
.side-btn {
  position: relative; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; border: 0;
  background: none; color: var(--muted); text-decoration: none; transition: background 0.15s, color 0.15s, transform 0.15s;
}
.side-btn .i { width: 22px; height: 22px; }
.side-btn:hover { background: var(--surface-2); color: var(--text); }
.side-btn.active, .side-btn.cta { background: var(--brand); color: #fff; box-shadow: var(--brand-glow); }
.side-btn.active:hover, .side-btn.cta:hover { transform: translateY(-1px); }
.side-avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 14px; font-weight: 800; }
.side-btn[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  padding: 6px 10px; border-radius: 8px; background: var(--contrast-bg); color: var(--contrast-text);
  font-size: 12.5px; font-weight: 700; white-space: nowrap; pointer-events: none;
}

@media (max-width: 1023px) {
  body.has-sidebar { padding-left: 0; }
  .sidebar { position: sticky; top: 0; inset: auto; width: 100%; height: 64px; flex-direction: row; padding: 0 16px; gap: 8px; }
  .sidebar::after { top: auto; left: 0; width: auto; height: 2px; background: linear-gradient(90deg, #7c3aed, #ec4899, #f97316); }
  .side-sep { display: none; }
  .side-nav, .side-bottom { flex-direction: row; gap: 6px; }
  .side-nav { margin-left: 8px; }
  .side-logo { width: 40px; height: 40px; border-radius: 12px; }
  .side-btn { width: 42px; height: 42px; border-radius: 12px; }
  .side-btn .i { width: 20px; height: 20px; }
  .side-avatar { width: 34px; height: 34px; font-size: 13px; }
  .side-btn[data-tip]:hover::after { display: none; }
}

/* ---------- Icon tiles & buttons ---------- */

.tile { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 14px; color: #fff; }
.tile .i { width: 22px; height: 22px; }
.tile-lg { width: 64px; height: 64px; border-radius: 18px; }
.tile-lg .i { width: 30px; height: 30px; }
.g-brand { background: var(--brand); box-shadow: var(--brand-glow); }
.g-pink { background: linear-gradient(135deg, #f472b6, #a855f7); box-shadow: 0 10px 28px -10px rgba(236, 72, 153, 0.7); }
.g-orange { background: linear-gradient(135deg, #fb923c, #ef4444); box-shadow: 0 10px 28px -10px rgba(249, 115, 22, 0.7); }
.g-blue { background: linear-gradient(135deg, #22d3ee, #3b82f6); box-shadow: 0 10px 28px -10px rgba(59, 130, 246, 0.7); }
.g-teal { background: linear-gradient(135deg, #2dd4bf, #10b981); box-shadow: 0 10px 28px -10px rgba(20, 184, 166, 0.7); }
.g-violet { background: linear-gradient(135deg, #d946ef, #7c3aed); box-shadow: 0 10px 28px -10px rgba(168, 85, 247, 0.7); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 20px;
  border-radius: 14px; border: 1px solid transparent; font-weight: 700; font-size: 15px; white-space: nowrap;
  text-decoration: none; transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; filter: none; }
.btn-brand { background: var(--brand); background-size: 200% 100%; color: #fff; box-shadow: var(--brand-glow); }
.btn-brand:hover { background-position: 100% 0; }
.btn-secondary { background: var(--secondary-bg); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-contrast { background: var(--contrast-bg); color: var(--contrast-text); }
.btn-lg { padding: 16px 30px; border-radius: 16px; font-size: 17px; }
.btn-block { width: 100%; }

/* ---------- Buy-checks widget (landing pricing card) ---------- */

.buy { display: grid; gap: 18px; }
.buy-rate { padding: 4px 18px; border-radius: 18px; background: var(--surface-solid); border: 1px solid var(--border); }
.buy-rate div { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; }
.buy-rate div + div { border-top: 1px solid var(--border); }
.buy-rate span { color: var(--text-2); }
.buy-rate strong { font-weight: 800; }
.buy-rate .big { font-size: 26px; font-weight: 900; }
.buy-label { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.qty { display: grid; grid-template-columns: 44px 1fr 44px; gap: 10px; align-items: center; margin-top: 10px; }
.qty button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid #ddd6fe; background: #f5f3ff; color: #6d28d9; display: grid; place-items: center; }
[data-theme='dark'] .qty button { border-color: rgba(139, 92, 246, 0.35); background: rgba(139, 92, 246, 0.12); color: #c4b5fd; }
.qty button:hover { filter: brightness(0.97); }
.qty label { display: grid; justify-items: center; padding: 8px; border-radius: 16px; background: var(--surface-solid); border: 1px solid var(--border); }
.qty input { width: 100%; border: 0; background: none; text-align: center; font-size: 26px; font-weight: 900; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.qty input:focus { outline: none; }
.qty small { color: var(--muted); font-size: 12.5px; }
.presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.presets button { position: relative; padding: 8px 0; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: 800; }
.presets button[aria-pressed='true'] { border-color: transparent; background: var(--brand); color: #fff; box-shadow: 0 4px 10px -2px rgba(236, 72, 153, 0.35); }
.presets em { position: absolute; top: -9px; right: -4px; padding: 1px 6px; border-radius: 999px; background: #10b981; color: #fff; font-size: 10px; font-style: normal; font-weight: 800; }
.buy-total { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-radius: 18px; background: var(--surface-2); }
.buy-total span { font-weight: 700; color: var(--text-2); }
.buy-total s { margin-right: 8px; color: var(--muted); font-size: 15px; }
.buy-total strong { font-size: 28px; font-weight: 900; }
.buy-note { font-size: 13px; color: var(--muted); text-align: center; }
.buy-note a { color: var(--text); font-weight: 700; }

/* Shop mode: steps and a "Buy on …" link instead of the calculator */
.buy-steps { display: grid; gap: 4px; margin: 0; padding: 4px 18px; border-radius: 18px; background: var(--surface-solid); border: 1px solid var(--border); list-style: none; }
.buy-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 0; color: var(--text-2); }
.buy-steps li + li { border-top: 1px solid var(--border); }
.buy-steps span { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); color: var(--text); font-size: 13px; font-weight: 800; }
.buy-shop { white-space: normal; text-align: center; overflow-wrap: anywhere; }

/* ---------- Forms & toasts ---------- */

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(0.98); opacity: 0; } }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; margin-bottom: 8px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); }
.input { position: relative; }
.input > .i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input input, .input select {
  width: 100%; height: 50px; padding: 0 14px 0 46px; border-radius: 16px; border: 2px solid var(--border-strong);
  background: var(--input-bg); font-size: 15px; transition: border-color 0.15s, box-shadow 0.15s;
}
.input input::placeholder { color: var(--muted); }
.input input:focus, .input select:focus { outline: none; border-color: #a78bfa; box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15); }
.form-error { margin-top: 4px; padding: 10px 14px; border-radius: 12px; background: var(--bad-bg); color: var(--bad); font-size: 14px; font-weight: 600; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 13px 16px; border-radius: 14px; background: var(--toast-bg);
  border: 1px solid var(--border-strong); box-shadow: 0 20px 40px -20px rgba(15, 23, 42, 0.5); font-size: 14px; font-weight: 600; animation: pop 0.2s ease;
}
.toast.success .i { color: var(--ok); } .toast.error .i { color: var(--bad); } .toast.info .i { color: var(--c-cyan); }

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