/* ==========================================================================
   kambiop — Banca digital + Wallet
   Lenguaje visual: kambiop dark terminal (Binance-style)
   Basado en los tokens del repo kambio-usdc-savings (Tailwind v4 / shadcn)
   ========================================================================== */

:root {
  --radius: 8px;
  --background: #F5F6F8;
  --background-2: #FFFFFF;
  --foreground: #10131A;
  --card: #FFFFFF;
  --card-hover: #EEF1F5;
  --popover: #FFFFFF;
  --secondary: #EDEFF3;
  --muted: #F1F3F6;
  --muted-foreground: #667085;
  --primary: #E8A800;
  --primary-hover: #F5B800;
  --primary-foreground: #141414;
  --destructive: #E5484D;
  --up: #0CA678;
  --down: #E5484D;
  --border: rgba(16, 24, 40, 0.09);
  --input: rgba(16, 24, 40, 0.13);
  --ring: var(--primary);
  --terminal: #FFFFFF;
  --grad-brand: linear-gradient(135deg, #F0B90B 0%, #f5c518 60%, #FFC94D 100%);
  --shadow-card: 0 1px 2px rgba(16,24,40,.05), 0 12px 32px -18px rgba(16,24,40,.28);
  --shadow-pop: 0 24px 60px -18px rgba(16,24,40,.35);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --sidebar-w: 240px;
  --bar-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

/* Protección anti-desbordamiento horizontal en móvil: nada debe pasar
   del ancho del viewport (ni barras de scroll laterales raras). */
html, body { max-width: 100%; overflow-x: hidden; }
body { width: 100%; }
.app, .shell, .main, .panel, .modal, .onboarding-card, .offer-grid, .stats-grid { max-width: 100%; min-width: 0; }
.sim-id, .app-addr, .tx-sub, .cdd-txt, .bc-amount { max-width: 100%; }
input, select, textarea, button { max-width: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(232, 168, 0, 0.09) 0%, transparent 55%),
    radial-gradient(1000px 520px at -10% 15%, rgba(12, 166, 120, 0.05) 0%, transparent 55%),
    var(--background);
  background-attachment: fixed;
  color: var(--foreground);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(240, 185, 11, 0.3); color: var(--foreground); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C9CED6; border-radius: 8px; border: 2px solid var(--background); }
::-webkit-scrollbar-thumb:hover { background: #ADB3BD; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }

.tabular { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.text-primary { color: var(--primary); }
.text-up { color: var(--up); }
.text-down { color: var(--down); }
.text-muted { color: var(--muted-foreground); }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-lg { flex-direction: column; gap: 14px; margin-bottom: 20px; }
.brand-logo { width: 28px; height: 28px; flex: 0 0 auto; }
.brand-logo.sm { width: 22px; height: 22px; }
.brand-logo img { width: 100%; height: 100%; border-radius: 7px; }
.brand-name { font-weight: 600; letter-spacing: -0.025em; font-size: 17px; }
.brand-lg .brand-name { font-size: 20px; }

/* ============================== KICKERS / TXT ============================== */

.kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted-foreground);
}

.panel-sub { margin: 0; font-size: 12px; color: var(--muted-foreground); }

/* ============================== BOTONES ============================== */

.btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  padding: 0 16px;
  height: 36px;
  white-space: nowrap;
  transition: all .15s ease;
  border: 1px solid transparent;
}
.btn .ic { width: 16px; height: 16px; display: inline-flex; }
.btn .ic svg { width: 100%; height: 100%; }
.btn-primary {
  background: var(--grad-brand); color: var(--primary-foreground);
  font-weight: 600;
  box-shadow: 0 8px 20px -8px rgba(240, 185, 11, 0.5), 0 1px 0 rgba(255,255,255,.25) inset;
}
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: none; }
.btn-outline {
  background: rgba(255, 255, 255, 0.75); border-color: var(--input); color: var(--foreground);
  backdrop-filter: blur(6px);
}
.btn-outline:hover { background: #FFFFFF; border-color: rgba(16,24,40,.22); }
.btn-ghost { background: transparent; color: var(--muted-foreground); }
.btn-ghost:hover { background: rgba(16,24,40,.05); color: var(--foreground); }
.btn-danger { background: rgba(229,72,77,.1); color: var(--down); }
.btn-danger:hover { background: rgba(229,72,77,.16); color: var(--down); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 40px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }

/* ============================== CAMPOS ============================== */

.field-label { display: block; margin: 14px 0 6px; font-size: 12px; font-weight: 500; color: var(--muted-foreground); }
.field {
  width: 100%;
  height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--input);
  background: #FFFFFF;
  color: var(--foreground);
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field::placeholder { color: var(--muted-foreground); }
.field:focus { border-color: var(--ring); box-shadow: 0 0 0 3px rgba(240, 185, 11, .25); }
select.field { appearance: none; cursor: pointer; }
select.field { color-scheme: dark; }
select.field option { background: var(--popover) !important; color: var(--foreground) !important; }
select.field option:disabled { color: var(--muted-foreground) !important; }

/* ============================== ONBOARDING ============================== */

.onboarding {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(60% 40% at 20% 20%, rgba(240, 185, 11, .08), transparent 60%),
    radial-gradient(50% 35% at 80% 30%, rgba(20, 195, 134, .06), transparent 60%),
    var(--background);
}
.onboarding-card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, var(--card-hover), var(--card));
  border: 1px solid rgba(16,24,40,.1);
  border-radius: var(--radius-xl);
  padding: 34px 32px;
  text-align: center;
  box-shadow: var(--shadow-pop), 0 1px 0 rgba(255,255,255,.6) inset;
}
.onboarding-card .brand-logo { width: 52px; height: 52px; }
.onboarding-card .brand-logo img { border-radius: 14px; box-shadow: 0 10px 30px -8px rgba(240, 185, 11, .35); }
.ob-sub { font-size: 14px; color: var(--muted-foreground); margin: -6px 0 22px; }
.onboarding-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--muted); border-radius: var(--radius); padding: 3px; margin-bottom: 18px; }
.ob-tab { padding: 8px; border-radius: 4px; font-size: 14px; font-weight: 500; color: var(--muted-foreground); }
.ob-tab.active { background: var(--card); color: var(--foreground); }
.onboarding form { text-align: left; }
.onboarding-hint { min-height: 18px; font-size: 13px; margin: 14px 0 0; }
.onboarding-foot { margin: 22px 0 0; font-size: 12px; color: var(--muted-foreground); }

/* ============================== APP SHELL ============================== */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(31,34,39,.85), rgba(22,24,28,.9));
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--border);
}
.side-head { height: var(--bar-h); border-bottom: 1px solid var(--border); padding: 0 20px; }
.side-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 12px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500;
  color: var(--muted-foreground);
  transition: all .15s;
  position: relative;
}
.nav-item .ic { width: 16px; height: 16px; display: inline-flex; }
.nav-item .ic svg { width: 100%; height: 100%; }
.nav-item:hover { background: rgba(16,24,40,.05); color: var(--foreground); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(240, 185, 11, .14), rgba(240, 185, 11, .05));
  color: var(--primary);
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%; width: 3px;
  border-radius: 3px; background: var(--grad-brand);
}
.side-foot { border-top: 1px solid var(--border); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.balance-chip { border: 1px solid var(--border); background: var(--background); border-radius: var(--radius); padding: 10px 12px; }
.bc-label { display: block; font-size: 11px; color: var(--muted-foreground); margin-bottom: 2px; }
.bc-amount { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ============================== TOPBAR ============================== */

.topbar {
  display: none;
  position: sticky; top: 0; z-index: 40;
  height: var(--bar-h);
  align-items: center; justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(22, 24, 28, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
}
.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-chip { max-width: 40vw; min-width: 0; overflow: hidden; }
.topbar-chip-amt { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 38vw; }
.topbar .chip { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); }
.topbar .chip .ic { width: 18px; height: 18px; }
.chip .ic svg { width: 100%; height: 100%; }
.topbar-chip {
  display: flex; align-items: center;
  border: 1px solid var(--border); background: var(--card);
  border-radius: var(--radius); padding: 7px 12px;
}
.topbar-chip-amt { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.avatar {
  width: 34px; height: 34px; border-radius: 999px;
  background: var(--primary); color: var(--primary-foreground);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.profile-avatar {
  width: 44px; height: 44px; border-radius: 999px;
  background: var(--primary); color: var(--primary-foreground);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex: 0 0 auto;
}

/* ============================== MAIN / VIEWS ============================== */

.main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 48px 32px 96px; }
.view { display: none; }
.view.active { display: block; animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.home-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.balance-hero {
  margin: 0; font-size: 46px; font-weight: 650; letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums; line-height: 1.08;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px;
  max-width: 100%; overflow-wrap: anywhere;
}
.balance-hero #total-balance, .balance-hero #c-total { min-width: 0; overflow-wrap: anywhere; }
.balance-suffix { font-size: 20px; font-weight: 500; color: var(--muted-foreground); margin-left: 0; }
.balance-sub { margin: 6px 0 0; font-size: 14px; color: var(--muted-foreground); }
/* Gradiente sutil solo en los números de saldo principales */
#total-balance, #c-total {
  background: linear-gradient(180deg, #10131A 35%, #6B7280 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-actions { display: flex; gap: 10px; }

/* hairline grids */
.stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-bottom: 20px;
}
.stats-grid.sm3 { grid-template-columns: repeat(3, 1fr); }
.stats-grid.sm4 { grid-template-columns: repeat(4, 1fr); }
.stat-cell {
  background: linear-gradient(180deg, var(--card), rgba(31,34,39,.6));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; transition: all .18s; box-shadow: var(--shadow-card);
}
a.stat-cell:hover { background: var(--card-hover); border-color: rgba(16,24,40,.14); transform: translateY(-2px); }
.sc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sc-top .ic { width: 18px; height: 18px; color: var(--primary); }
.sc-top .ic svg { width: 100%; height: 100%; }
.sc-label { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--muted-foreground); }
.sc-value { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }

/* ============================== PANEL ============================== */

.panel {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--card), rgba(31,34,39,.7));
  padding: 20px; margin-bottom: 20px;
  box-shadow: var(--shadow-card);
  transition: border-color .2s;
}
.panel:hover { border-color: rgba(16,24,40,.14); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-title { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.link { font-size: 13px; color: var(--primary); }

/* chart */
.chart { width: 100%; height: 170px; }
.chart svg { width: 100%; height: 100%; display: block; }

/* ============================== LISTAS ============================== */

.tx-list, .asset-list { display: flex; flex-direction: column; }
.tx-list > li, .asset-list > li, .set-row {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.tx-list > li:first-child, .asset-list > li:first-child, .set-row:first-child { border-top: 0; }

.tx-item { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 12px 0; }
.tx-ico {
  width: 40px; height: 40px; border-radius: 50% !important;
  border: 1px solid rgba(16,24,40,.08); background: linear-gradient(180deg, #FFFFFF, #EEF1F5);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; flex: 0 0 auto;
  box-shadow: 0 4px 12px -4px rgba(16,24,40,.18);
}
.tx-green { color: var(--up); }
.tx-red { color: var(--down); }
.tx-violet { color: #7C3AED; }
.tx-main { flex: 1; min-width: 0; }
.tx-title { margin: 0 0 3px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.banca-chip {
  font-size: 9px; font-weight: 800; letter-spacing: 0.05em;
  border: 1px solid; border-radius: 999px; padding: 1px 7px; line-height: 1.7;
  background: rgba(16, 24, 40, 0.04); white-space: nowrap;
}
.tx-sub { margin: 0; font-size: 11px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-right { text-align: right; flex: 0 0 auto; }
.tx-amount { margin: 0 0 3px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.amount-pos { color: var(--up); }
.amount-neg { color: var(--down); }

.empty-list {
  border: 1px dashed rgba(16,24,40,.14); border-radius: var(--radius-lg);
  padding: 44px 20px; text-align: center;
  background: rgba(16,24,40,.02);
}
.empty-title { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.empty-sub { margin: 0; font-size: 13px; color: var(--muted-foreground); }

/* ============================== CHIPS / BADGES ============================== */

.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; border: 1px solid var(--border); padding: 4px 10px; font-size: 11px; font-weight: 500; }
.badge-success { border-color: rgba(20, 195, 134, .3); background: rgba(20, 195, 134, .1); color: var(--up); }

/* ============================== TABS ============================== */

.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 0; }
.cartera-tools { display: flex; justify-content: flex-end; padding: 10px 2px; }
.spin { display: inline-block; animation: rot 1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.tabbtn {
  padding: 12px 16px;
  font-size: 14px; font-weight: 500;
  color: var(--muted-foreground);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabbtn:hover { color: var(--foreground); }
.tabbtn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabpane { display: none; padding-top: 18px; }
.tabpane.active { display: block; }

.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter { border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--muted-foreground); }
.filter.active { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }

/* ============================== FAQ ============================== */

.search-wrap { margin-bottom: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 6px 13px; font-size: 13px; color: var(--muted-foreground); }
.chip.active { border-color: var(--primary); color: var(--primary); background: rgba(240, 185, 11, .1); }
#faq-count { margin-bottom: 10px; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: 0; }
.faq-q { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 2px; text-align: left; font-size: 14px; font-weight: 500; }
.faq-q .chev { transition: transform .2s; color: var(--muted-foreground); display: inline-flex; }
.faq-item.open .faq-q .chev { transform: rotate(90deg); color: var(--primary); }
.faq-a { display: none; padding: 0 2px 16px; font-size: 14px; line-height: 1.7; color: var(--muted-foreground); }
.faq-item.open .faq-a { display: block; }

.support-cta { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }

/* ============================== AJUSTES ============================== */

.profile-card {
  display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(240,185,11,.06), var(--card) 45%);
  padding: 22px 20px; margin-bottom: 26px; box-shadow: var(--shadow-card);
}
.profile-main { flex: 1; min-width: 0; }
.profile-name { margin: 0 0 2px; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.profile-mail { margin: 0 0 2px; font-size: 14px; color: var(--muted-foreground); }
.profile-id { margin: 0; font-size: 12px; color: var(--muted-foreground); }

.set-group {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--card), rgba(31,34,39,.6));
  margin-bottom: 26px; overflow: hidden; box-shadow: var(--shadow-card);
}
.set-row { display: flex; align-items: center; gap: 14px; padding: 16px 18px; transition: background .15s; }
a.set-row:hover { background: rgba(16,24,40,.04); }
.set-icon { width: 34px; height: 34px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--muted); display: flex; align-items: center; justify-content: center; color: var(--primary); flex: 0 0 auto; }
.set-icon .ic { width: 17px; height: 17px; }
.set-icon .ic svg { width: 100%; height: 100%; }
.set-main { flex: 1; min-width: 0; }
.set-title { margin: 0 0 2px; font-size: 14px; font-weight: 500; }
.set-sub { margin: 0; font-size: 12px; color: var(--muted-foreground); }
.chev { display: inline-flex; color: var(--muted-foreground); }
.chev .ic { width: 16px; height: 16px; }
.chev .ic svg { width: 100%; height: 100%; }

/* ============================== MERCADO ============================== */

.offer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.offer-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--card), rgba(31,34,39,.7));
  padding: 16px; box-shadow: var(--shadow-card); transition: all .18s;
}
.offer-card:hover { border-color: rgba(16,24,40,.14); transform: translateY(-2px); }
.offer-op { margin: 0 0 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; }
.offer-op.buy { color: var(--up); }
.offer-op.sell { color: var(--down); }
.offer-amt { margin: 0 0 2px; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.offer-rate { margin: 0 0 10px; font-size: 13px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.offer-meta { font-size: 12px; color: var(--muted-foreground); }

.note-panel { background: var(--terminal); }
.note-title { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.steps-mini { display: flex; flex-direction: column; gap: 10px; }
.steps-mini li { display: flex; align-items: baseline; gap: 12px; font-size: 14px; color: var(--foreground); }
.steps-mini .num { font-size: 13px; font-weight: 500; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

/* ============================== BOTTOM NAV ============================== */

.bottomnav {
  display: none;
  position: fixed;
  inset-inline: 0; bottom: 0; z-index: 40;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--border);
  background: color-mix(in oklab, var(--background) 95%, transparent);
  backdrop-filter: blur(12px);
  padding-bottom: var(--safe-bottom);
}
.bn-item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; color: var(--muted-foreground); font-size: 10px; font-weight: 500; }
.bn-item .ic { width: 20px; height: 20px; }
.bn-item .ic svg { width: 100%; height: 100%; }
.bn-item.active { color: var(--primary); }

/* ============================== MODAL ============================== */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, .5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fade .18s ease both;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: 100%; max-width: 420px;
  background: linear-gradient(180deg, #FFFFFF, var(--background));
  border: 1px solid rgba(16,24,40,.12);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-pop), 0 1px 0 rgba(255,255,255,.6) inset;
  animation: zoomIn .18s ease both;
}
@keyframes zoomIn { from { opacity: 0; transform: scale(.97) } to { opacity: 1; transform: none } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.modal-title { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.modal-close { width: 30px; height: 30px; border-radius: var(--radius); color: var(--muted-foreground); font-size: 16px; }
.modal-close:hover { background: var(--secondary); color: var(--foreground); }
.modal-field-row { margin-bottom: 16px; }
.modal-field-row label { display: block; font-size: 12px; font-weight: 500; color: var(--muted-foreground); margin-bottom: 6px; }
.modal-note { margin: 12px 0; font-size: 12.5px; line-height: 1.6; color: var(--muted-foreground); word-break: break-word; }
.fee-note {
  display: flex; align-items: center; gap: 8px;
  margin: 4px 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(12, 166, 120, .08);
  border: 1px solid rgba(12, 166, 120, .25);
  color: var(--up);
  font-size: 12.5px;
  line-height: 1.45;
}
.fee-note strong { color: var(--foreground); font-weight: 600; }
.amt-row { display: flex; gap: 8px; }
.amt-row .field { flex: 1; min-width: 0; }
.amt-max {
  flex-shrink: 0; padding: 10px 14px; font-size: 12px; font-weight: 700;
  border-radius: var(--radius); color: var(--up);
  border: 1px solid rgba(20, 195, 134, .4); background: rgba(20, 195, 134, .1);
}
.amt-max:hover { background: rgba(20, 195, 134, .2); border-color: var(--up); }
.snd-bal { margin-top: 8px; font-size: 12px; line-height: 1.5; }
.snd-bal.ok { color: var(--up); }
.snd-bal.warn { color: var(--primary); }
.no-funds {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center; padding: 18px 6px 14px;
}
.nf-ico { font-size: 34px; }
.nf-title { font-size: 15px; font-weight: 600; }
.nf-sub { font-size: 12.5px; color: var(--muted-foreground); line-height: 1.5; }
.sim-card { border: 1px dashed var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: rgba(16, 24, 40, 0.02); }
.sim-title { display: block; font-size: 12px; color: var(--muted-foreground); margin-bottom: 8px; }
.sim-id { font-size: 13px; word-break: break-all; font-family: "JetBrains Mono", ui-monospace, monospace; }

/* ============================== DROPDOWN CUSTOM ============================== */

.cdd { position: relative; }
.cdd-btn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--input); border-radius: var(--radius);
  padding: 10px 12px; color: var(--foreground); text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.cdd-btn:hover { border-color: var(--ring); }
.cdd.open .cdd-btn { border-color: var(--ring); box-shadow: 0 0 0 3px rgba(240, 185, 11, .25); }
.cdd-ico {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
}
.cdd-txt { flex: 0 1 auto; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdd-sub { font-size: 11px; color: var(--muted-foreground); font-weight: 500; flex: 1; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdd-arrow { color: var(--muted-foreground); font-size: 11px; transition: transform .15s; }
.cdd.open .cdd-arrow { transform: rotate(180deg); }
.cdd-menu {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--popover); border: 1px solid rgba(16,24,40,.12);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  max-height: 240px; overflow-y: auto;
  display: none; padding: 4px;
}
.cdd.open .cdd-menu { display: block; animation: cddIn .13s ease-out; }
@keyframes cddIn { from { opacity: 0; transform: translateY(-4px) } to { opacity: 1; transform: none } }
.cdd-opt {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 8px 8px; border-radius: var(--radius-sm); text-align: left;
  color: var(--foreground);
}
.cdd-opt:hover { background: var(--secondary); }
.cdd-opt.sel { background: var(--secondary); }
.cdd-opt-txt { flex: 1; min-width: 0; }
.cdd-opt-title { display: block; font-size: 13px; font-weight: 600; }
.cdd-opt-sub { display: block; font-size: 11px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdd-opt .cdd-ico { width: 26px; height: 26px; font-size: 12px; }
.cdd-check { color: var(--primary); font-weight: 800; font-size: 12px; }
.cdd-empty { padding: 14px; text-align: center; color: var(--muted-foreground); font-size: 12px; }

/* ============================== TOAST ============================== */

#toast-root {
  position: fixed; z-index: 120;
  left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  background: #FFFFFF;
  border: 1px solid rgba(16,24,40,.12);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  font-size: 13.5px;
  box-shadow: var(--shadow-pop);
  animation: fadeUp .25s ease both;
  max-width: 90vw;
  backdrop-filter: blur(10px);
}
.toast.out { opacity: 0; transition: opacity .25s; }
.toast.success .t-ico { color: var(--up); }
.toast.warning .t-ico { color: var(--primary); }

/* ============================== FOOTER ============================== */

.legal { border-top: 1px solid var(--border); padding-top: 20px; font-size: 12px; color: var(--muted-foreground); }

.ic { display: inline-flex; }
.ic svg { width: 100%; height: 100%; }

/* ============================== RESPONSIVE ============================== */

@media (max-width: 1023px) {
  .sidebar { display: none; }
  .topbar { display: flex; }
  .bottomnav { display: grid; }
  .main { padding: 28px 16px 96px; }
  .balance-hero { font-size: 36px; }
  .stats-grid.sm4 { grid-template-columns: repeat(2, 1fr); }
  .busy-fab { display: none; }
  #toast-root { bottom: calc(76px + var(--safe-bottom)); }
}

@media (max-width: 560px) {
  .home-top { flex-direction: column; align-items: flex-start; gap: 16px; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1; }
  .stats-grid, .stats-grid.sm3 { grid-template-columns: 1fr; }
  .modal { padding: 18px; }
  .balance-hero { font-size: 32px; }
  .panel { padding: 16px; }
  .onboarding-card { padding: 26px 20px; }
}

@media (max-width: 420px) {
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal { max-width: 100%; border-radius: 18px 18px 0 0; padding: 20px 16px calc(20px + var(--safe-bottom)); max-height: 92vh; overflow-y: auto; }
  .amt-row { flex-direction: column; gap: 6px; }
  .amt-max { width: 100%; text-align: center; }
}

/* ==========================================================================
   PÁGINAS DE APP (wallet / trade / p2p / admin) — mismo lenguaje visual que
   el index (banca). Estas páginas las maneja app.js; aquí se estilan el marco
   y las clases dinámicas que app.js genera (ofertas, escrow, libro, admin).
   ========================================================================== */

/* ---------- Marco compartido ---------- */
.app-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  height: 58px; padding: 0 20px;
  background: rgba(22, 24, 28, 0.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.app-topbar-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.app-topbar-brand .brand-name { font-size: 17px; }
.app-topbar-nav { display: flex; gap: 4px; margin-left: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.app-topbar-nav::-webkit-scrollbar { display: none; }
.app-topbar-nav a {
  color: var(--muted-foreground); text-decoration: none;
  font-size: 13.5px; font-weight: 500; padding: 7px 13px; border-radius: 8px; white-space: nowrap;
}
.app-topbar-nav a:hover { color: var(--foreground); background: rgba(16, 24, 40, 0.05); }
.app-topbar-nav a.active { color: var(--primary); background: rgba(240, 185, 11, 0.1); }
.app-logout { flex-shrink: 0; }
.app-main { max-width: 900px; margin: 0 auto; padding: 26px 16px 110px; }

/* Barra inferior móvil (misma que el index) */
.app-bottomnav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: rgba(30, 32, 36, 0.97); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.app-bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted-foreground); text-decoration: none; font-size: 10px; font-weight: 600; height: 54px;
}
.app-bottomnav a.active { color: var(--primary); }
.app-bottomnav svg { width: 20px; height: 20px; }

/* ---------- Acceso (login / registro en wallet y trade) ---------- */
.app-auth { max-width: 430px; margin: 30px auto; }
.app-auth-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  padding: 28px; box-shadow: var(--shadow-card);
}
.app-auth-logo {
  width: 52px; height: 52px; border-radius: 14px; background: var(--grad-brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 26px; color: var(--primary-foreground); margin-bottom: 14px;
}
.app-auth-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.app-auth-sub { color: var(--muted-foreground); font-size: 13px; line-height: 1.55; margin: 0 0 18px; }
.app-auth-tabs { display: flex; gap: 4px; background: var(--secondary); border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.app-tab-btn {
  flex: 1; height: 38px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted-foreground); font-weight: 600; font-size: 13px; cursor: pointer;
}
.app-tab-btn.active { background: var(--card-hover); color: var(--foreground); }
.app-form { display: flex; flex-direction: column; gap: 10px; }
.app-form input, .app-form select, .app-form textarea {
  height: 46px; border-radius: 10px; border: 1px solid var(--input);
  background: var(--background); color: var(--foreground); padding: 0 13px; font-size: 14px; width: 100%;
}
.app-form textarea { height: auto; padding: 11px 13px; }
.app-form input::placeholder, .app-form textarea::placeholder { color: var(--muted-foreground); }
.app-form input:focus, .app-form select:focus, .app-form textarea:focus {
  outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgba(240, 185, 11, 0.22);
}
.app-btn-primary {
  height: 46px; border: 0; border-radius: 10px; background: var(--grad-brand);
  color: var(--primary-foreground); font-weight: 700; font-size: 14px; cursor: pointer;
}
.app-btn-primary:hover { filter: brightness(1.06); }
.app-btn-danger {
  height: 44px; border: 1px solid rgba(234, 77, 90, 0.35); border-radius: 10px;
  background: rgba(234, 77, 90, 0.14); color: var(--down); font-weight: 700; font-size: 13.5px; cursor: pointer;
}
.app-hint { color: var(--muted-foreground); font-size: 12.5px; line-height: 1.5; margin: 4px 0; }

/* ---------- Wallet ---------- */
.bal-card {
  background: linear-gradient(135deg, rgba(240, 185, 11, 0.12), rgba(20, 195, 134, 0.05)), var(--card);
  border: 1px solid var(--border); border-radius: 18px; padding: 22px;
}
.bal-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.bal-label { color: var(--muted-foreground); font-size: 12px; font-weight: 600; }
.bal-amount { font-size: 36px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1; }
.bal-ccy { color: var(--primary); font-weight: 700; font-size: 13px; margin-top: 2px; }
.bal-sub { color: var(--muted-foreground); font-size: 12px; margin-top: 6px; }
.bal-toggle { display: flex; gap: 4px; background: var(--secondary); border-radius: 8px; padding: 3px; }
.bal-toggle button {
  border: 0; background: transparent; color: var(--muted-foreground);
  font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 6px; cursor: pointer;
}
.bal-toggle button.active { background: var(--card-hover); color: var(--foreground); }
.q-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.q-act {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 4px; display: flex; flex-direction: column; align-items: center; gap: 7px;
  color: var(--foreground); font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.q-act:hover { background: var(--card-hover); }
.q-ico {
  width: 34px; height: 34px; border-radius: 10px; background: rgba(240, 185, 11, 0.12);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.app-section { margin-top: 22px; }
.fx-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.fx-head > span:first-child { font-weight: 600; font-size: 14px; }
.fx-count { color: var(--muted-foreground); font-size: 12px; }
.act-tabs { display: flex; gap: 4px; background: var(--secondary); border-radius: 8px; padding: 3px; }
.act-tabs button {
  border: 0; background: transparent; color: var(--muted-foreground);
  font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 6px; cursor: pointer;
}
.act-tabs button.active { background: var(--card-hover); color: var(--foreground); }
.app-list { display: flex; flex-direction: column; gap: 8px; }
.app-row {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; display: flex; align-items: center; gap: 12px;
}
.app-row-ico {
  width: 38px; height: 38px; border-radius: 12px; background: rgba(240, 185, 11, 0.12);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; flex-shrink: 0;
}
.app-row-body { flex: 1; min-width: 0; }
.app-row-name { font-weight: 600; font-size: 14px; }
.app-row-ccy { color: var(--muted-foreground); font-size: 11.5px; margin-top: 1px; }
.app-row-bal { text-align: right; }
.app-row-amount { font-weight: 700; font-size: 14px; }
.app-row-sub { color: var(--muted-foreground); font-size: 11px; margin-top: 1px; }
.app-list-head { display: flex; justify-content: space-between; color: var(--muted-foreground); font-size: 11.5px; font-weight: 600; padding: 0 4px; margin-bottom: 2px; }
.app-tx { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 13px 14px; display: flex; align-items: center; gap: 12px; min-width: 0; }
.tx-ico {
  width: 36px; height: 36px; border-radius: 50%; background: rgba(240, 185, 11, 0.12);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tx-body { flex: 1; min-width: 0; }
.tx-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-sub { color: var(--muted-foreground); font-size: 11px; margin-top: 1px; }
.tx-amt { font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.tx-in { color: var(--up); }
.tx-out { color: var(--down); }
.app-empty {
  color: var(--muted-foreground); font-size: 13px; text-align: center;
  padding: 26px 12px; border: 1px dashed var(--border); border-radius: 14px;
}
.app-coin {
  width: 40px; height: 40px; border-radius: 50%; background: rgba(20, 195, 134, 0.14);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: var(--up);
}
.app-coinbig {
  width: 64px; height: 64px; margin: 4px auto 12px; border-radius: 50%;
  background: rgba(240, 185, 11, 0.14); display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 28px; color: var(--primary);
}
.app-addr {
  font-family: ui-monospace, monospace; font-size: 12px; color: var(--foreground);
  word-break: break-all; background: var(--background); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; text-align: center; margin-bottom: 12px;
}
.app-qr { display: flex; justify-content: center; margin: 10px 0 14px; }
.app-qr img, .app-qr canvas { border-radius: 12px; border: 4px solid #fff; }
.sec-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; cursor: pointer; color: var(--foreground); margin-bottom: 8px;
}
.sec-row:hover { background: var(--card-hover); }
.sec-ico {
  width: 36px; height: 36px; border-radius: 10px; background: rgba(240, 185, 11, 0.12);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sec-ico svg { color: var(--primary); }
.sec-txt { flex: 1; min-width: 0; }
.sec-txt strong { font-size: 13.5px; }
.sec-txt small { color: var(--muted-foreground); font-size: 11.5px; }
.sec-arrow { color: var(--muted-foreground); font-size: 18px; }

/* ---------- Modales (2FA / exportar / recibir / enviar) ---------- */
.app-modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 7, 10, 0.78); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.app-modal-card {
  width: 100%; max-width: 430px; max-height: 88vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  padding: 22px; box-shadow: var(--shadow-pop);
}
.app-modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.app-modal-head h3 { margin: 0; font-size: 17px; }
.app-icon-btn {
  background: transparent; border: 0; color: var(--muted-foreground);
  font-size: 18px; padding: 6px; cursor: pointer; border-radius: 8px;
}
.app-icon-btn:hover { background: rgba(16, 24, 40, 0.06); color: var(--foreground); }
.app-avatar {
  width: 42px; height: 42px; border-radius: 50%; background: var(--grad-brand);
  display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--primary-foreground);
}

/* ---------- P2P ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(240, 185, 11, 0.12); color: var(--primary);
  border-radius: 999px; padding: 4px 12px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.pill.success { background: rgba(20, 195, 134, 0.12); color: var(--up); }
.hint { color: var(--muted-foreground); font-size: 13px; line-height: 1.55; margin: 6px 0; }
.hint.warn { color: var(--primary); }
.order-item {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 15px; margin-bottom: 10px;
}
.offer-item header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.oc { color: var(--muted-foreground); font-size: 11px; font-family: ui-monospace, monospace; }
.offer-badge { border-radius: 8px; padding: 3px 10px; font-size: 11px; font-weight: 800; }
.offer-badge.buy { background: rgba(20, 195, 134, 0.14); color: var(--up); }
.offer-badge.sell { background: rgba(234, 77, 90, 0.14); color: var(--down); }
.offer-main { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.offer-amt { font-size: 18px; font-weight: 700; }
.offer-ves { color: var(--muted-foreground); font-size: 13px; }
.meta { color: var(--muted-foreground); font-size: 12.5px; line-height: 1.55; margin-top: 8px; }
.meta strong { color: var(--foreground); }
.offer-rate strong { color: var(--foreground); }
.wa-link { color: var(--primary); text-decoration: none; font-weight: 600; }
.wa-link:hover { text-decoration: underline; }
.account {
  background: rgba(240, 185, 11, 0.06); border: 1px dashed rgba(240, 185, 11, 0.35);
  border-radius: 10px; padding: 12px; font-size: 13px; margin: 10px 0; line-height: 1.6;
}
.proof-row { display: flex; gap: 8px; margin: 10px 0; }
.proof-row input { flex: 1; }
.ins-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px; margin-top: 12px;
}
.status.ok {
  background: rgba(20, 195, 134, 0.1); border: 1px solid rgba(20, 195, 134, 0.25);
  color: var(--up); border-radius: 10px; padding: 13px; font-size: 13px; line-height: 1.5;
}
.status.done {
  background: rgba(20, 195, 134, 0.1); color: var(--up); border-radius: 10px;
  padding: 13px; font-size: 13px;
}
.deal-meta { margin-top: 10px; }
.steps { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 14px 0 8px; }
.step { display: flex; align-items: center; gap: 6px; color: var(--muted-foreground); font-size: 11.5px; font-weight: 600; }
.s-dot {
  width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}
.step.current { color: var(--foreground); }
.step.current .s-dot { border-color: var(--primary); color: var(--primary); }
.step.done { color: var(--muted-foreground); }
.step.done .s-dot { background: var(--up); border-color: var(--up); color: #FFFFFF; }
.step-connector { width: 14px; height: 1px; background: var(--border); margin: 0 4px; }

/* ---------- Trade ---------- */
.pair-row { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.pair-sel {
  height: 42px; background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  color: var(--foreground); padding: 0 12px; font-weight: 700; font-size: 14px; cursor: pointer;
}
.pair-last { display: flex; flex-direction: column; }
.pair-last-price { font-size: 24px; font-weight: 800; letter-spacing: -0.3px; }
.pair-last-sub { color: var(--muted-foreground); font-size: 12px; }
.chart-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 14px; margin-bottom: 14px; min-width: 0;
}
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 600; font-size: 13px; }
.interval-row { display: flex; gap: 4px; }
.interval-row button {
  background: transparent; border: 1px solid transparent; color: var(--muted-foreground);
  border-radius: 6px; padding: 4px 8px; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.interval-row button.active { background: rgba(240, 185, 11, 0.12); color: var(--primary); }
.trade-chart { width: 100%; height: 320px; display: block; border-radius: 10px; background: #FAFBFC; }
.trade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.book-card, .order-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px; min-width: 0; }
.book-list { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.book-head-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; color: var(--muted-foreground); font-size: 11px; padding: 4px; }
.book-row { position: relative; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; padding: 5px 6px; border-radius: 6px; overflow: hidden; }
.book-depth { position: absolute; inset: 0; width: 0; background: rgba(240, 185, 11, 0.07); z-index: 0; }
.book-row > span { position: relative; z-index: 1; }
.book-row.ask .book-price { color: var(--down); }
.book-row.bid .book-price { color: var(--up); }
.book-qty { text-align: right; color: var(--foreground); }
.book-total { text-align: right; color: var(--muted-foreground); }
.side-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.side-tabs button {
  flex: 1; height: 36px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--secondary); color: var(--muted-foreground); font-weight: 700; font-size: 13px; cursor: pointer;
}
.side-tabs button.active { color: var(--foreground); background: var(--card-hover); }
.o-lbl { font-size: 12px; color: var(--muted-foreground); font-weight: 600; margin-top: 4px; }
.o-total { display: flex; justify-content: space-between; align-items: center; margin: 8px 0; font-size: 13px; }
.o-total strong { color: var(--foreground); }
.o-fee { font-size: 11.5px; color: var(--muted-foreground); margin-bottom: 8px; }
.trade-bals { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted-foreground); }
.th-list { display: flex; flex-direction: column; gap: 8px; }
.th-row {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; font-size: 12.5px;
}
.mo-row {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.mo-cancel {
  color: var(--down); font-size: 12px; font-weight: 700;
  background: transparent; border: 0; cursor: pointer; white-space: nowrap;
}

/* ---------- Admin ---------- */
.admin-tools { margin-bottom: 10px; }
.fees-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-top: 12px; }
.fee-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 15px; display: flex; gap: 12px; align-items: flex-start;
}
.fee-ico { font-size: 22px; }
.fee-body { flex: 1; min-width: 0; }
.fee-label { color: var(--muted-foreground); font-size: 12px; display: block; }
.fee-value { font-size: 18px; font-weight: 800; display: block; margin: 3px 0; }
.fee-value.fee-green { color: var(--up); }
.fee-value.fee-gold { color: var(--primary); }
.fee-value.fee-red { color: var(--down); }

/* Ledger contable (panel admin) */
.ledger-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; padding: 2px 0; }
.ledger-line .tx-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-amt { display: inline-flex; gap: 6px; white-space: nowrap; flex-shrink: 0; }
.ledger-amt .fee-red { color: var(--down); }
.ledger-amt .fee-green { color: var(--up); }
.fee-sub { color: var(--muted-foreground); font-size: 11px; }
.wa-box {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; margin-top: 16px;
}
.wa-qr { width: 190px; border-radius: 10px; margin-top: 12px; }
.keybox { font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all; }
.mono { font-family: ui-monospace, monospace; }
.muted { color: var(--muted-foreground); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.coin.usdt { color: var(--up); font-weight: 800; }

/* ---------- Formularios compartidos ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .field { margin-bottom: 0; }
.span-2 { grid-column: span 2; }
.rate-row { display: flex; gap: 8px; }
.rate-row input { flex: 1; min-width: 0; }
.field-check { margin: 12px 0 4px; font-size: 13px; color: var(--muted-foreground); }
.field-check input { margin-right: 8px; }
.badge, .badge-success { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 12px; font-size: 11.5px; font-weight: 700; }

/* Toast flotante para páginas de app (app.js usa #toast) */
#toast { position: fixed; z-index: 130; left: 50%; bottom: 84px; transform: translateX(-50%); }
#toast.hidden { display: none; }

/* ---------- Responsive páginas de app ---------- */
@media (max-width: 767px) {
  .app-topbar-nav { display: none; }
  .app-bottomnav { display: flex; }
  .app-main { padding: 20px 14px 118px; }
  .trade-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .q-actions { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .bal-amount { font-size: 30px; }
  .app-auth { margin: 16px auto; }
}
@media (max-width: 480px) {
  .q-actions { grid-template-columns: repeat(2, 1fr); }
  .app-topbar { padding: 0 14px; }
}

/* ==========================================================================
   a11y + performance + UX
   ========================================================================== */

/* Skip link: oculto hasta que recibe foco por teclado. Salta al contenido
   principal para usuarios con screen readers o navegación por teclado. */
.skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  z-index: 10000;
  padding: 10px 16px;
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.18s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 8px;
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

/* Focus visible global para todos los elementos interactivos.
   Solo aparece con teclado (no con mouse) gracias a :focus-visible. */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible,
.btn:focus-visible,
.nav-item:focus-visible,
.chip:focus-visible {
  outline-offset: 3px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.field:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
  border-color: var(--ring);
}

/* Inputs/buttons deshabilitados: cursor + opacidad consistentes */
[disabled],
button[disabled],
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Screen reader only: contenido solo para lectores de pantalla */
.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;
}

/* prefers-reduced-motion: usuarios con sensibilidad al movimiento
   (vestibular, etc.) piden reducir o eliminar animaciones. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Impresión: layout limpio y sin colores innecesarios */
@media print {
  .sidebar, .topbar, .app-bottomnav, .app-topbar, .skip-link,
  #toast, .modal-backdrop, button { display: none !important; }
  body { background: white !important; color: black !important; }
  .panel, .card, .box { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* Performance: will-change solo en elementos que sí se animan,
   para no forzar al navegador a mantener capas de más. */
.nav-item, .chip, .btn, .panel, .card,
.app-bottomnav a, .app-topbar a {
  will-change: auto;
}

/* Selección de texto más visible en dark mode */
::selection { background: rgba(240, 185, 11, 0.35); color: var(--foreground); }

/* Foco visible para inputs en estado de error */
.field.has-error,
.field[aria-invalid="true"] {
  border-color: var(--destructive);
  box-shadow: 0 0 0 3px rgba(234, 77, 90, 0.15);
}
.field.has-error:focus-visible,
.field[aria-invalid="true"]:focus-visible {
  outline-color: var(--destructive);
}

/* ==========================================================================
   Animaciones + micro-interacciones
   Respeta prefers-reduced-motion (override arriba).
   ========================================================================== */

/* Transición suave al cambiar entre tabs (sidebar y bottom nav) */
.nav-item,
.app-bottomnav a,
.app-topbar a {
  position: relative;
  transition: color 0.18s ease, background-color 0.18s ease, transform 0.12s ease;
}
.nav-item::after,
.app-bottomnav a::after,
.app-topbar a::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-item.active::after,
.nav-item[aria-current="page"]::after,
.app-bottomnav a.active::after,
.app-bottomnav a[aria-current="page"]::after,
.app-topbar a.active::after {
  transform: scaleX(1);
}

/* Press feedback en botones y cards */
.btn,
button:not(.skip-link):not(.chip),
.nav-item,
.app-bottomnav a,
.panel,
.card,
.box,
.chip {
  transition:
    transform 0.12s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.22s ease,
    color 0.18s ease;
}
.btn:hover:not([disabled]),
button:not(.skip-link):not(.chip):not([disabled]):hover {
  transform: translateY(-1px);
}
.btn:active:not([disabled]),
button:not(.skip-link):not(.chip):not([disabled]):active,
.nav-item:active,
.app-bottomnav a:active,
.chip:active {
  transform: translateY(0) scale(0.98);
}

/* Panel/card hover sutil */
.panel:hover,
.card:hover,
.box:hover {
  border-color: rgba(240, 185, 11, 0.25);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 18px 40px -16px rgba(0,0,0,.7);
}

/* Skeleton screens para loading (en lugar de spinners simples) */
@keyframes skeleton-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(
    90deg,
    var(--card) 0%,
    var(--card-hover) 50%,
    var(--card) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  min-height: 12px;
}
.skeleton-line { height: 14px; margin: 8px 0; }
.skeleton-line.short { width: 40%; }
.skeleton-line.med   { width: 70%; }
.skeleton-line.long  { width: 100%; }
.skeleton-circle { width: 36px; height: 36px; border-radius: 50%; }
.skeleton-card {
  height: 80px;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

/* Fade-in para vistas que se renderizan dinámicamente */
@keyframes kambiop-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.app-main > * ,
.shell > * ,
.view,
.tab-panel,
[data-view] {
  animation: kambiop-fade-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Toast más pulido (override del #toast ya existente) */
#toast {
  position: fixed;
  z-index: 130;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%) translateY(20px);
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 20px 50px -12px rgba(0,0,0,.7);
  max-width: 90vw;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#toast:not(.hidden) {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
#toast.toast-success { border-color: var(--up); }
#toast.toast-error   { border-color: var(--destructive); }
#toast.toast-info    { border-color: var(--ring); }

/* Modal: backdrop y entrada del card */
.modal-backdrop {
  animation: kambiop-fade-in 0.18s ease;
}
.modal-card,
.modal > .card,
.modal > .panel {
  animation: modal-pop 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Number ticker: efecto de "contador" para balances */
.balance-pulse {
  animation: balance-pulse 0.6s ease;
}
@keyframes balance-pulse {
  0%   { color: var(--foreground); }
  50%  { color: var(--primary); }
  100% { color: var(--foreground); }
}

