/* ============================================================
   Orbit — Design System
   Tokens, primitives and components. Mobile-first, dark/light.
   ============================================================ */

:root {
  /* Brand */
  --brand-500: #4f46e5;
  --brand-600: #4338ca;
  --brand-400: #6366f1;
  --brand-glow: rgba(99, 102, 241, .35);
  --accent: #14b8a6;
  --success: #16a34a;
  --warning: #d97706;
  --danger:  #dc2626;

  /* Light theme surfaces */
  --bg: #f6f7fb;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f3f9;
  --border: #e5e7ef;
  --text: #12131a;
  --text-muted: #5b6072;
  --text-faint: #8a90a2;

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Shape */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(16,18,30,.06), 0 1px 3px rgba(16,18,30,.05);
  --shadow: 0 8px 24px rgba(16,18,30,.08);
  --shadow-lg: 0 24px 60px rgba(16,18,30,.14);

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;

  --maxw: 1200px;
  --ease: cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  --bg: #0b0d14;
  --bg-elev: #12141d;
  --surface: #151824;
  --surface-2: #1c2030;
  --border: #262b3d;
  --text: #eef0f6;
  --text-muted: #a5abbd;
  --text-faint: #6b7285;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 10px 30px rgba(0,0,0,.5);
  --shadow-lg: 0 30px 70px rgba(0,0,0,.6);
  --brand-glow: rgba(99,102,241,.45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--brand-400); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .4em; font-weight: 700; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
p { margin: 0 0 1em; color: var(--text-muted); }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--brand-400); outline-offset: 2px; border-radius: 6px; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--space-5); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--mono); }
.center { text-align: center; }
.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);border:0; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: .95rem;
  padding: 12px 20px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; transition: transform .12s var(--ease), box-shadow .2s var(--ease), background .2s;
  min-height: 44px; text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: linear-gradient(135deg, var(--brand-500), var(--brand-400)); color: #fff; box-shadow: 0 6px 20px var(--brand-glow); }
.btn-primary:hover { text-decoration: none; box-shadow: 0 10px 28px var(--brand-glow); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); text-decoration: none; }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 26px; font-size: 1.05rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Cards ---- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm);
}
.card-pad-lg { padding: var(--space-6); }

/* ---- Forms ---- */
.field { margin-bottom: var(--space-4); }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; font: inherit; padding: 13px 15px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text);
  transition: border-color .15s, box-shadow .15s; min-height: 46px;
}
.input:focus { border-color: var(--brand-400); box-shadow: 0 0 0 4px var(--brand-glow); outline: none; }
.input-hint { font-size: .82rem; color: var(--text-faint); margin-top: 6px; }

/* ---- Badges & status ---- */
.badge { display:inline-flex; align-items:center; gap:6px; font-size:.78rem; font-weight:600;
  padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.badge-dot::before { content:""; width:7px; height:7px; border-radius:50%; background: currentColor; }
.status-COMPLETED, .status-CONFIRMED, .status-active, .status-paid { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); }
.status-PENDING, .status-PROCESSING, .status-AWAITING_CONFIRMATION, .status-UNDER_REVIEW { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }
.status-FAILED, .status-REJECTED, .status-CANCELLED, .status-FROZEN, .status-expired { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }

/* ---- Alerts / toast ---- */
.flash-stack { position: fixed; top: 16px; right: 16px; z-index: 100; display: grid; gap: 10px; max-width: 92vw; }
.flash { padding: 13px 16px; border-radius: var(--radius); box-shadow: var(--shadow); font-size: .92rem;
  background: var(--surface); border: 1px solid var(--border); display:flex; gap:10px; align-items:flex-start; animation: slideIn .3s var(--ease); }
.flash-success { border-left: 4px solid var(--success); }
.flash-error { border-left: 4px solid var(--danger); }
@keyframes slideIn { from { opacity:0; transform: translateX(20px);} to {opacity:1; transform:none;} }

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table td { padding: 14px 12px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }

/* ---- Empty state ---- */
.empty { text-align:center; padding: var(--space-7) var(--space-4); color: var(--text-muted); }
.empty svg { margin: 0 auto var(--space-3); opacity:.6; }

/* ---- Utilities ---- */
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.flex { display:flex; gap: var(--space-3); }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.wrap { flex-wrap: wrap; }
.mt-2 { margin-top: var(--space-2);} .mt-4 { margin-top: var(--space-4);} .mt-6{margin-top:var(--space-6);}
.stack > * + * { margin-top: var(--space-4); }

@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2,1fr); } .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } .grid-4 { grid-template-columns: repeat(2,1fr);} .hide-sm { display:none !important; } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ============================================================
   App shell (authenticated)
   ============================================================ */
.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg-elev); border-right: 1px solid var(--border); padding: var(--space-5) var(--space-4);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.sidebar .brand { display:flex; align-items:center; gap:10px; font-weight:800; font-size:1.25rem; margin-bottom: var(--space-6); letter-spacing:-.03em; }
.nav { display: grid; gap: 4px; }
.nav a { display:flex; align-items:center; gap:12px; padding: 11px 14px; border-radius: var(--radius);
  color: var(--text-muted); font-weight:600; font-size:.95rem; transition: background .12s, color .12s; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration:none; }
.nav a.active { background: color-mix(in srgb, var(--brand-500) 14%, transparent); color: var(--brand-400); }
.nav svg { width:20px; height:20px; flex-shrink:0; }
.sidebar-foot { margin-top:auto; padding-top: var(--space-4); }
.main { min-width: 0; }
.topbar { display:flex; align-items:center; justify-content:space-between; padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border); position: sticky; top:0; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); z-index: 20; }
.content { padding: var(--space-6); max-width: 1080px; }
.mobile-nav { display:none; }

.brand-logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand-500), var(--accent)); display:inline-flex; align-items:center; justify-content:center; color:#fff; font-weight:800; box-shadow: 0 4px 14px var(--brand-glow); }

/* Balance hero */
.balance-hero { background: linear-gradient(135deg, var(--brand-600), var(--brand-400) 70%, var(--accent));
  color:#fff; border-radius: var(--radius-lg); padding: var(--space-6); box-shadow: var(--shadow-lg); position:relative; overflow:hidden; }
.balance-hero::after { content:""; position:absolute; right:-60px; top:-60px; width:220px; height:220px; border-radius:50%; background: rgba(255,255,255,.12); }
.balance-hero .label { opacity:.85; font-size:.9rem; font-weight:600; }
.balance-hero .amount { font-size: clamp(2.2rem,6vw,3.2rem); font-weight:800; letter-spacing:-.03em; margin:6px 0; }

/* Quick actions */
.actions { display:grid; grid-template-columns: repeat(4,1fr); gap: var(--space-4); }
.action-btn { display:flex; flex-direction:column; align-items:center; gap:10px; padding: var(--space-5) var(--space-3);
  border-radius: var(--radius-lg); border:1px solid var(--border); background: var(--surface); cursor:pointer; color: var(--text);
  font-weight:700; font-size:.95rem; transition: transform .12s var(--ease), box-shadow .2s, border-color .2s; }
.action-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand-400); text-decoration:none; }
.action-ico { width:48px; height:48px; border-radius: 14px; display:flex; align-items:center; justify-content:center;
  background: color-mix(in srgb, var(--brand-500) 14%, transparent); color: var(--brand-400); }
.action-ico svg { width:24px; height:24px; }

.balance-chip { display:flex; align-items:center; justify-content:space-between; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); }
.asset-badge { width:36px;height:36px;border-radius:50%; background: linear-gradient(135deg,var(--brand-500),var(--accent)); color:#fff; display:flex;align-items:center;justify-content:center;font-weight:700;font-size:.8rem; }

.qr-box { background:#fff; padding:16px; border-radius: var(--radius); display:inline-block; box-shadow: var(--shadow-sm); }
.qr-box img, .qr-box canvas, .qr-box svg { width: 200px; height: 200px; }
.copy-row { display:flex; gap:8px; align-items:center; background: var(--surface-2); padding: 8px 8px 8px 14px; border-radius: var(--radius); }
.copy-row code { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.85rem; }

.stepper { display:flex; gap:8px; margin-bottom: var(--space-5); }
.step { flex:1; height:4px; border-radius:99px; background: var(--border); }
.step.done { background: var(--brand-400); }

.warn-box { border:1px solid color-mix(in srgb,var(--warning) 40%,transparent); background: color-mix(in srgb,var(--warning) 10%,transparent);
  color: var(--text); padding: 14px 16px; border-radius: var(--radius); font-size:.9rem; }

.theme-toggle { background: var(--surface); border:1px solid var(--border); width:42px;height:42px;border-radius:50%; cursor:pointer; display:flex;align-items:center;justify-content:center; color: var(--text-muted); }
.theme-toggle:hover { background: var(--surface-2); }

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display:none; }
  .content { padding: var(--space-4); padding-bottom: 88px; }
  .topbar { padding: var(--space-3) var(--space-4); }
  .actions { grid-template-columns: repeat(4,1fr); gap: var(--space-2); }
  .action-btn { padding: var(--space-3) 4px; font-size:.8rem; }
  .action-ico { width:40px;height:40px; }
  .mobile-nav { display:flex; position:fixed; bottom:0; left:0; right:0; background: var(--bg-elev); border-top:1px solid var(--border);
    justify-content:space-around; padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); z-index:50; }
  .mobile-nav a { display:flex; flex-direction:column; align-items:center; gap:3px; font-size:.68rem; color: var(--text-faint); padding:4px 10px; }
  .mobile-nav a.active { color: var(--brand-400); }
  .mobile-nav svg { width:22px; height:22px; }
}

/* ============================================================
   Landing / marketing
   ============================================================ */
.marketing { background: radial-gradient(1200px 600px at 70% -10%, color-mix(in srgb, var(--brand-500) 18%, transparent), transparent 60%), var(--bg); }
.nav-public { display:flex; align-items:center; justify-content:space-between; padding: var(--space-4) 0; }
.nav-public .brand { display:flex; align-items:center; gap:10px; font-weight:800; font-size:1.3rem; letter-spacing:-.03em; color: var(--text); }
.nav-links { display:flex; align-items:center; gap: var(--space-5); }
.nav-links a { color: var(--text-muted); font-weight:600; }
.hero { padding: var(--space-8) 0 var(--space-7); display:grid; grid-template-columns: 1.05fr .95fr; gap: var(--space-7); align-items:center; }
.hero .eyebrow { display:inline-flex; gap:8px; align-items:center; font-size:.85rem; font-weight:700; color: var(--brand-400);
  background: color-mix(in srgb,var(--brand-500) 12%, transparent); padding:6px 14px; border-radius:999px; margin-bottom: var(--space-4); }
.hero h1 { margin-bottom: var(--space-4); }
.hero .lead { font-size: clamp(1.05rem,2vw,1.25rem); max-width: 48ch; }
.hero-cta { display:flex; gap: var(--space-3); flex-wrap:wrap; margin-top: var(--space-5); }

.phone { background: var(--surface); border:1px solid var(--border); border-radius: 28px; padding: var(--space-4); box-shadow: var(--shadow-lg);
  max-width: 340px; margin-inline:auto; animation: float 6s ease-in-out infinite; }
@keyframes float { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-12px);} }
.phone .mini-hero { background: linear-gradient(135deg,var(--brand-600),var(--accent)); color:#fff; border-radius: var(--radius-lg); padding: var(--space-5); }
.phone .mini-hero .amount { font-size:2rem; font-weight:800; }
.phone .mini-actions { display:grid; grid-template-columns: repeat(4,1fr); gap:8px; margin-top: var(--space-4); }
.phone .mini-actions div { background: var(--surface-2); border-radius: 12px; padding:12px 4px; text-align:center; font-size:.72rem; font-weight:600; color: var(--text-muted); }

.section { padding: var(--space-8) 0; }
.section-head { text-align:center; max-width: 60ch; margin: 0 auto var(--space-6); }
.feature-grid { display:grid; grid-template-columns: repeat(3,1fr); gap: var(--space-4); }
.feature { padding: var(--space-5); border-radius: var(--radius-lg); border:1px solid var(--border); background: var(--surface); transition: transform .2s var(--ease), box-shadow .2s; }
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature .ico { width:46px;height:46px;border-radius:13px; display:flex;align-items:center;justify-content:center; margin-bottom: var(--space-3);
  background: color-mix(in srgb,var(--brand-500) 14%, transparent); color: var(--brand-400); }
.feature h3 { font-size:1.15rem; }

.pill-row { display:flex; flex-wrap:wrap; gap:10px; justify-content:center; }
.pill { padding: 8px 16px; border-radius:999px; border:1px solid var(--border); background: var(--surface); font-weight:600; font-size:.9rem; }

.faq details { border:1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); margin-bottom: var(--space-3); background: var(--surface); }
.faq summary { font-weight:700; cursor:pointer; }
.faq p { margin-top: var(--space-3); margin-bottom:0; }

.cta-band { text-align:center; background: linear-gradient(135deg,var(--brand-600),var(--accent)); color:#fff; border-radius: var(--radius-lg); padding: var(--space-8) var(--space-5); box-shadow: var(--shadow-lg); }
.cta-band h2 { color:#fff; }
.cta-band .btn-ghost { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); color:#fff; }

.footer { border-top:1px solid var(--border); padding: var(--space-6) 0; color: var(--text-muted); font-size:.9rem; }
.footer-grid { display:grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--space-5); margin-bottom: var(--space-5); }
.footer-grid a { display:block; color: var(--text-muted); padding: 4px 0; }

.disclaimer { font-size:.82rem; color: var(--text-faint); border-top:1px solid var(--border); padding-top: var(--space-4); }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; text-align:center; }
  .hero .lead { margin-inline:auto; }
  .hero-cta { justify-content:center; }
  .feature-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .nav-links .hide-sm { display:none; }
}

/* Auth card */
.auth-wrap { min-height: 100vh; display:grid; place-items:center; padding: var(--space-5); }
.auth-card { width:100%; max-width: 420px; }
.auth-card .brand { display:flex; align-items:center; gap:10px; justify-content:center; font-weight:800; font-size:1.4rem; margin-bottom: var(--space-5); }
