/* ============================================================
   QUANTYXCAPITAL — fondo negro, acento dorado champagne.
   Verde y rojo se usan solo para la dirección del mercado.
   Móvil primero; a partir de 1000 px aparece el riel lateral.
   ============================================================ */

:root {
  color-scheme: dark;
  --bg-0: #000000;      /* lienzo */
  --bg-1: #0A0A0B;      /* tarjetas y gráfico */
  --bg-2: #121214;      /* elevado */
  --bg-3: #1A1A1D;      /* hover */
  --bg-4: #242428;      /* presionado / activo */
  --line: #1D1D21;
  --line-2: #2C2C32;
  --txt-0: #F4F4F1;
  --txt-1: #A2A2A8;
  --txt-2: #6B6B73;
  --txt-3: #45454C;
  --brand: #E3B341;
  --brand-hi: #F3D27A;
  --brand-lo: #B8892A;
  --brand-a10: rgba(227, 179, 65, 0.10);
  --brand-a25: rgba(227, 179, 65, 0.25);
  --up: #2ECC8F;
  --up-a12: rgba(46, 204, 143, 0.12);
  --dn: #F2555A;
  --dn-a12: rgba(242, 85, 90, 0.12);
  --warn: #E9973F;
  --info: #4EA8F5;
  --violet: #9B7BF7;
  --grid: rgba(255, 255, 255, 0.04);
  --chart-wick: #6C7688;
  --scrim: rgba(0, 0, 0, 0.72);
  --font-ui: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-num: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-full: 999px;
  --nav-h: 60px;
  --rail-w: 256px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg-0); }
body {
  background: var(--bg-0); color: var(--txt-0);
  font-family: var(--font-ui); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
body.sheet-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-weight: 700; text-wrap: balance; }

.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.muted { color: var(--txt-1); }
.small { font-size: 12px; }
.up { color: var(--up); } .dn { color: var(--dn); } .mut { color: var(--txt-1); }
.center { text-align: center; }
.pad { padding: 14px 4px; }
.fine { font-size: 12px; color: var(--txt-2); line-height: 1.5; }
.link { color: var(--brand-hi); font-weight: 600; font-size: 13px; }
.icon { flex: none; }
.noscript { padding: 24px; color: var(--txt-1); }

/* ---- Armazón -------------------------------------------------------- */

.app { min-height: 100dvh; }
.rail { display: none; }
.col { min-width: 0; }
.head { display: contents; }
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
}
/* El buscador: siempre a la vista. En el teléfono el logo se va al bajar y él se queda pegado arriba. */
.searchdock {
  position: sticky; top: 0; z-index: 20;
  padding: 6px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
  background: rgba(0, 0, 0, 0.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.searchdock.stuck { padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
.brand { display: flex; align-items: center; gap: 9px; margin-right: auto; flex: none; }
/* Crece con el ancho del teléfono, sin llegar a tocar el botón de la wallet en los más estrechos. */
.brand-logo { display: block; height: clamp(48px, 15.5vw, 60px); width: auto; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 3px var(--up-a12); display: inline-block; }
.offline { display: flex; gap: 8px; align-items: center; padding: 8px 16px; background: var(--dn-a12); color: var(--dn); font-size: 13px; }

.content {
  display: flex; flex-direction: column; gap: 16px;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(var(--nav-h) + 28px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  max-width: 1180px; margin: 0 auto; outline: none;
}
.content[data-view="token"], .content[data-view="cripto"] { padding-bottom: calc(var(--nav-h) + 96px + env(safe-area-inset-bottom, 0px)); }
.view-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.view-title { font-size: 22px; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(0, 0, 0, 0.94); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--nav-h); font-size: 11px; font-weight: 600; color: var(--txt-2);
}
.nav-item.active { color: var(--brand); }

/* ---- Botones, chips, pestañas ---------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 46px; padding: 0 18px; border-radius: var(--r-md);
  font-weight: 700; transition: transform 120ms, opacity 120ms, background 120ms;
}
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: #14100A; }
.btn-ghost { border: 1px solid var(--line-2); }
.btn-ghost:hover { background: var(--bg-3); }
.btn-buy { background: var(--up); color: #04150E; }
.btn-sell { background: var(--dn); color: #1B0506; }
.btn-danger { background: var(--dn-a12); color: var(--dn); border: 1px solid var(--dn); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--txt-1); flex: none; }
.icon-btn:hover { background: var(--bg-3); color: var(--txt-0); }
.icon-btn.on { color: var(--brand); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 12px; border-radius: var(--r-full);
  border: 1px solid var(--line-2); background: var(--bg-1);
  font-size: 13px; font-weight: 600; color: var(--txt-1); white-space: nowrap;
}
.chip:hover:not(:disabled) { color: var(--txt-0); border-color: var(--txt-3); }
.chip.active { border-color: var(--brand); color: var(--brand-hi); background: var(--brand-a10); }
.chip:disabled { opacity: 0.4; cursor: not-allowed; }
.chip-sm { min-height: 28px; padding: 0 10px; font-size: 12px; }
.chip-icon { padding: 0 9px; }
.wallet-chip { color: var(--brand-hi); border-color: var(--brand-a25); }

.tabs { display: flex; gap: 6px; }
.tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: var(--r-full);
  font-size: 13px; font-weight: 700; color: var(--txt-1); background: var(--bg-1); border: 1px solid var(--line); white-space: nowrap;
}
.tab.active { color: #14100A; background: var(--brand); border-color: var(--brand); }
.tabs-scroll { overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.tabs-side { display: grid; grid-template-columns: 1fr 1fr; }
.tabs-side .tab { border-radius: var(--r-md); }

.pill { display: inline-block; padding: 2px 7px; border-radius: var(--r-full); font-size: 12px; font-weight: 600; }
.pill.up { background: var(--up-a12); } .pill.dn { background: var(--dn-a12); } .pill.mut { background: var(--bg-3); }
.tag { display: inline-block; padding: 1px 6px; border-radius: 5px; font-size: 10px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--txt-1); background: var(--bg-3); }
.tag-pad { color: var(--brand-hi); background: var(--brand-a10); }
.tag-bad { color: var(--dn); background: var(--dn-a12); }
.ok-mark { color: var(--info); display: inline-flex; }

/* ---- Tarjetas, bloques, estados -------------------------------------- */

.card { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card h2, .block-head h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.h2-side, .risk { margin-left: auto; }
.block { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hint { font-size: 13px; color: var(--txt-2); }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: var(--r-md); background: var(--brand-a10); border: 1px solid var(--brand-a25); font-size: 13px; color: var(--txt-0); }
.callout .icon { color: var(--brand); margin-top: 1px; }

.state { display: grid; justify-items: center; gap: 10px; padding: 44px 12px; text-align: center; color: var(--txt-1); }
.state-title { color: var(--txt-0); font-weight: 700; font-size: 16px; }
.state-icon { color: var(--txt-2); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--brand); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--bg-1); }
.skel { background: var(--bg-3); border-radius: 6px; animation: pulse 1.2s ease-in-out infinite; }
.skel-av { width: 40px; height: 40px; border-radius: 50%; }
.skel-a { height: 14px; flex: 1; max-width: 180px; }
.skel-b { height: 14px; width: 70px; margin-left: auto; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* ---- Filas de token --------------------------------------------------- */

.list { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.avatar { border-radius: 50%; object-fit: cover; flex: none; background: var(--bg-3); display: block; }
.avatar-txt { display: grid; place-items: center; color: #fff; font-weight: 700; }
.av-slot { display: block; width: 40px; height: 40px; }

.trow, .arow {
  display: grid; align-items: center; column-gap: 12px;
  padding: 10px 12px; border-radius: var(--r-md);
  background: var(--bg-1); border: 1px solid var(--line);
  min-width: 0; text-align: left; width: 100%;
  transition: background 120ms, border-color 120ms;
}
.trow:hover, a.arow:hover, .arow-btn:hover { background: var(--bg-2); border-color: var(--line-2); }
.trow { grid-template-columns: auto 40px minmax(0, 1fr) auto; grid-template-areas: "rank av id price" "rank av id chg"; row-gap: 3px; }
.trow-rank { grid-area: rank; min-width: 14px; font-size: 12px; color: var(--txt-2); text-align: right; }
.trow-rank:empty { display: none; }
.trow > .avatar { grid-area: av; }
.trow-id { grid-area: id; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trow-sym { display: flex; align-items: center; gap: 6px; min-width: 0; }
.trow-sym strong, .trow-id > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow-sub { font-size: 12px; color: var(--txt-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-price { grid-area: price; justify-self: end; font-size: 14px; }
.c-chg { grid-area: chg; justify-self: end; }
.c-wide, .only-wide, .thead { display: none; }

.trow-live { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "av id cap" "av id age"; }
.trow-live > :nth-child(1) { grid-area: av; }
.trow-live > :nth-child(3) { grid-area: age; justify-self: end; font-size: 12px; }
.trow-live > :nth-child(4) { display: none; }
.trow-live > :nth-child(5) { grid-area: cap; justify-self: end; }
.trow-curve { grid-template-columns: 40px minmax(0, 1fr) auto auto; grid-template-areas: none; }
.trow-curve > * { grid-area: auto; }
.trow-mini { grid-template-columns: 36px minmax(0, 1fr) auto auto; grid-template-areas: none; }
.trow-mini > * { grid-area: auto; font-size: 13px; }
.trow-mini strong { font-size: 15px; }

.arow { display: flex; }
.arow-val { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 14px; }
.arow-val .muted { font-size: 12px; }
.arow-btn { color: var(--txt-0); }
.arow-btn > .icon:last-child { margin-left: auto; color: var(--txt-2); }
.act-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--bg-3); flex: none; }
.act-icon.up { background: var(--up-a12); } .act-icon.dn { background: var(--dn-a12); }

.curve { display: block; height: 5px; border-radius: 3px; background: var(--bg-4); overflow: hidden; margin-top: 4px; }
.curve-lg { height: 9px; border-radius: 5px; margin: 0; }
.curve-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-lo), var(--brand-hi)); }
.curve-pct { font-size: 13px; color: var(--brand-hi); }

.live-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.live-status { font-size: 13px; color: var(--txt-1); display: inline-flex; align-items: center; gap: 8px; }
.live-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--txt-3); }
.live-status.on::before { background: var(--up); box-shadow: 0 0 0 3px var(--up-a12); }

/* ---- Búsqueda ---------------------------------------------------------- */

.search-bar { display: flex; align-items: center; gap: 8px; padding: 0 6px 0 14px; border-radius: var(--r-md); background: var(--bg-1); border: 1px solid var(--line-2); color: var(--txt-2); }
.search-bar:focus-within { border-color: var(--brand); }
.search-input { flex: 1; min-width: 0; background: none; border: none; outline: none; padding: 13px 0; color: var(--txt-0); }
.search-input::-webkit-search-cancel-button { display: none; }
.recents { display: flex; gap: 8px; flex-wrap: wrap; }
.recent { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: var(--r-full); background: var(--bg-1); border: 1px solid var(--line); font-weight: 600; font-size: 13px; }

/* ---- Token -------------------------------------------------------------- */

.token-top { display: flex; align-items: center; gap: 10px; }
.token-name { min-width: 0; margin-right: auto; }
.token-name h1 { display: flex; align-items: center; gap: 6px; font-size: 20px; line-height: 1.15; }
.token-name .muted { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.token-grid { display: flex; flex-direction: column; gap: 14px; }
.token-main, .token-side { display: contents; }
.token-price { display: flex; flex-direction: column; gap: 8px; }
.big { font-size: 32px; font-weight: 600; line-height: 1.1; }
.chg { display: inline-flex; gap: 6px; align-items: baseline; font-size: 12px; padding: 4px 9px; border-radius: var(--r-full); background: var(--bg-1); border: 1px solid var(--line); }
.chart-wrap { position: relative; margin-inline: -16px; }
.chart-box { height: 300px; background: var(--bg-1); border-block: 1px solid var(--line); }
.chart-canvas { display: block; touch-action: pan-y; cursor: crosshair; }
.chart-note { position: absolute; left: 16px; right: 80px; top: 10px; font-size: 12px; color: var(--txt-1); pointer-events: none; }
.tf .chip { flex: 1; justify-content: center; padding: 0 6px; }
.tf .chip-icon { flex: none; }
.trade-bar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); z-index: 25;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 16px;
  background: rgba(0, 0, 0, 0.94); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.token-main > .card:last-child { order: 9; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .muted { font-size: 12px; }
.pos-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.risk { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: var(--r-full); }
.risk-verde { color: var(--up); background: var(--up-a12); }
.risk-amarillo { color: var(--warn); background: rgba(233, 151, 63, 0.14); }
.risk-rojo { color: var(--dn); background: var(--dn-a12); }
.reasons { display: flex; flex-direction: column; gap: 8px; }
.reasons li { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; }
.reasons li::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 6px; }
.reasons li.ok::before { background: var(--up); } .reasons li.warn::before { background: var(--warn); } .reasons li.bad::before { background: var(--dn); }
.tape { display: flex; flex-direction: column; }
.tape-row { display: grid; grid-template-columns: 64px 1fr 1fr auto; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.tape-row:last-child { border-bottom: none; }
.tape-row > :nth-child(n+2) { text-align: right; }
.side { font-weight: 700; }

/* ---- Cartera ------------------------------------------------------------ */

.balance-card { gap: 10px; }
.balance-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; }
.hero-title { font-size: 24px; line-height: 1.15; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.action { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: var(--r-md); background: var(--bg-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.action:hover { background: var(--bg-3); }
.action-icon { color: var(--brand); display: inline-flex; }
.receive { display: grid; justify-items: center; gap: 14px; }
.qr { width: 232px; height: 232px; border-radius: var(--r-md); image-rendering: pixelated; }
.addr { word-break: break-all; text-align: center; font-size: 13px; padding: 10px 12px; border-radius: var(--r-md); background: var(--bg-1); border: 1px solid var(--line); width: 100%; }
.addr-sm { word-break: break-all; font-size: 12px; max-width: 62%; }

.onboard { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 18px 0 6px; max-width: 460px; margin: 0 auto; }
.onboard h1 { font-size: 26px; }
.points { display: grid; gap: 12px; text-align: left; width: 100%; padding: 6px 0; }
.points li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--txt-1); }
.points li .icon { color: var(--brand); margin-top: 2px; }
.points strong { color: var(--txt-0); }
.phrase { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; counter-reset: w; }
.phrase li { counter-increment: w; display: flex; gap: 8px; align-items: baseline; padding: 10px; border-radius: var(--r-sm); background: var(--bg-1); border: 1px solid var(--line-2); font-size: 14px; }
.phrase li::before { content: counter(w); color: var(--txt-2); font-size: 11px; min-width: 14px; }
.step-count { font-size: 12px; font-weight: 700; color: var(--brand); letter-spacing: 0.06em; text-transform: uppercase; }

/* ---- Formularios --------------------------------------------------------- */

.form, .flow, .trade { display: flex; flex-direction: column; gap: 12px; }
.label { font-size: 13px; font-weight: 600; color: var(--txt-1); margin-bottom: -6px; }
.input { width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--r-md); background: var(--bg-1); border: 1px solid var(--line-2); outline: none; }
.input:focus { border-color: var(--brand); }
.textarea { padding: 12px 14px; resize: vertical; min-height: 84px; line-height: 1.5; }
select.input { appearance: none; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input { padding-right: 64px; }
.input-wrap > button { position: absolute; right: 6px; }
.form-error { color: var(--dn); font-size: 13px; font-weight: 600; }
.problems { display: grid; gap: 4px; }
.problems li { color: var(--warn); font-size: 13px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); }

.trade-token { display: flex; gap: 10px; align-items: center; }
.trade-token div { display: flex; flex-direction: column; min-width: 0; }
.amount { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: var(--r-md); background: var(--bg-1); border: 1px solid var(--line-2); }
.amount:focus-within { border-color: var(--brand); }
.amount-input { flex: 1; min-width: 0; background: none; border: none; outline: none; font-size: 28px; font-weight: 600; padding: 10px 0; }
.amount-unit { font-weight: 700; color: var(--txt-1); }
.balance-line { font-size: 13px; color: var(--txt-1); margin-top: -6px; }
.quote { display: flex; flex-direction: column; gap: 8px; min-height: 96px; }
.quote-main { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: var(--r-md); background: var(--bg-1); border: 1px solid var(--line); }
.quote-main strong { font-size: 20px; }
.quote-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--txt-1); }
.quote-row .num { color: var(--txt-0); text-align: right; }
.quote-row.warn .num { color: var(--warn); } .quote-row.bad .num { color: var(--dn); }
.progress { display: grid; gap: 8px; padding: 12px; border-radius: var(--r-md); background: var(--bg-1); border: 1px solid var(--line); }
.step { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--txt-2); }
.step.done { color: var(--up); } .step.now { color: var(--txt-0); font-weight: 600; }
.step-dot { width: 8px; height: 8px; margin: 0 4px; border-radius: 50%; background: currentColor; }
.step.now .step-dot { animation: pulse 1s ease-in-out infinite; }

/* ---- Hojas y avisos ------------------------------------------------------- */

.sheet-root { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; align-items: flex-end; }
.sheet-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity 200ms; }
.sheet {
  position: relative; width: 100%; max-width: 480px; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--bg-2); border: 1px solid var(--line-2); border-bottom: none; border-radius: 20px 20px 0 0;
  transform: translateY(100%); transition: transform 320ms var(--ease);
}
.sheet-root.open .sheet { transform: none; } .sheet-root.open .sheet-scrim { opacity: 1; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 4px 18px; }
.sheet-head h2 { font-size: 17px; }
.sheet-body { overflow-y: auto; padding: 8px max(18px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); }

#toasts { position: fixed; left: 0; right: 0; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 80; display: grid; justify-items: center; gap: 8px; padding: 0 16px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 440px; padding: 11px 14px; border-radius: var(--r-md); background: var(--bg-3); border: 1px solid var(--line-2); font-size: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6); animation: drop 240ms var(--ease); }
.toast.out { opacity: 0; transition: opacity 240ms; }
.toast-ok .icon { color: var(--up); } .toast-error .icon { color: var(--dn); } .toast-info .icon { color: var(--brand); }
.toast a { color: var(--brand-hi); font-weight: 700; }
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } }

/* ---- Escritorio ------------------------------------------------------------ */

@media (min-width: 720px) {
  .phrase { grid-template-columns: repeat(4, 1fr); }
  .sheet-root { align-items: center; }
  .sheet { border-radius: 20px; border-bottom: 1px solid var(--line-2); max-height: 88dvh; transform: translateY(24px); opacity: 0; transition: transform 240ms var(--ease), opacity 200ms; }
  .sheet-root.open .sheet { opacity: 1; }
}

@media (min-width: 1000px) {
  .app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .rail { display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100dvh; padding: 20px 14px; border-right: 1px solid var(--line); }
  .rail-nav { display: flex; flex-direction: column; gap: 4px; }
  .rail .nav-item { flex-direction: row; justify-content: flex-start; gap: 12px; height: 46px; padding: 0 12px; border-radius: var(--r-md); font-size: 14px; }
  .rail .nav-item:hover { background: var(--bg-2); color: var(--txt-0); }
  .rail .nav-item.active { background: var(--brand-a10); }
  .rail-foot { margin-top: auto; font-size: 12px; color: var(--txt-2); padding: 0 12px; display: flex; align-items: center; gap: 8px; }
  .bottom-nav, .topbar .brand { display: none; }
  /* Barra superior: buscador a la izquierda y la wallet a la derecha, siempre fija. */
  .head {
    display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 20;
    padding: 12px 28px; background: rgba(0, 0, 0, 0.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  }
  .topbar { display: contents; }
  .searchdock, .searchdock.stuck { position: static; order: -1; flex: 1; max-width: 560px; padding: 0; background: none; backdrop-filter: none; border: none; }
  .searchdock .search-input { padding: 10px 0; }
  .wallet-chip { margin-left: auto; }
  .content, .content[data-view="token"], .content[data-view="cripto"] { padding: 24px 28px 48px; }

  .only-narrow { display: none; } .only-wide { display: block; }
  .thead, .trow:not(.trow-live):not(.trow-curve):not(.trow-mini) { grid-template-columns: 26px 40px minmax(150px, 1.9fr) repeat(7, minmax(72px, 1fr)); grid-template-areas: none; }
  .thead { display: grid; column-gap: 12px; padding: 0 12px; font-size: 12px; color: var(--txt-2); }
  .thead span:nth-child(n+4) { text-align: right; }
  .trow:not(.trow-live):not(.trow-curve):not(.trow-mini) > * { grid-area: auto; }
  .trow-rank:empty { display: block; }
  .c-wide { display: block; text-align: right; font-size: 14px; }
  .c-price, .c-chg { justify-self: end; }
  .thead-live, .trow-live { grid-template-columns: 40px minmax(160px, 2fr) repeat(3, minmax(90px, 1fr)); grid-template-areas: none; }
  .trow-live > :nth-child(n) { grid-area: auto; display: block; justify-self: end; font-size: 14px; }
  .trow-live > :nth-child(-n+2) { justify-self: stretch; }
  .trow-live > .trow-id { display: flex; }
  .thead-live span:nth-child(n+3) { text-align: right; }

  .token-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; gap: 20px; }
  .token-main, .token-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
  .token-side { position: sticky; top: 86px; }
  .trade-bar { position: static; padding: 0; background: none; backdrop-filter: none; border: none; }
  .chart-wrap { margin-inline: 0; }
  .chart-box { height: 420px; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
  .token-main > .card:last-child { order: 0; }
  .big { font-size: 36px; }
  .balance-card { max-width: 560px; }
}

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

/* ---- Unidad del monto (dólares / SOL) y aviso de red ---------------------- */
button.amount-unit { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-full); background: var(--bg-3); color: var(--txt-0); font-weight: 700; }
button.amount-unit:hover:not(:disabled) { background: var(--bg-4); }
button.amount-unit:disabled { background: none; padding: 0; color: var(--txt-1); cursor: default; }
.net-hint { font-size: 13px; margin-top: -4px; }
.net-hint.ok { color: var(--up); }
.net-hint.bad { color: var(--warn); }

/* ---- Otras redes (Bitcoin, Polygon, Base…) ---- */
.coin { position: relative; flex: none; display: block; }
.coin-net { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--bg-0); background: var(--bg-3); object-fit: cover; }
button.arow { width: 100%; text-align: left; }
.asset-top { display: flex; align-items: center; gap: 14px; }
.asset-top .big { font-size: 26px; display: block; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet-body .tabs-scroll { margin-inline: -18px; padding-inline: 18px; flex: none; }
.net-hint.bad { color: var(--warn); }
.balance-card .big { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow-val { flex: none; }

/* ---- Logo oficial (marca/logo-kit) ---- */
.onboard-logo img { display: block; }
@media (max-width: 999px) {
  /* Con el logo grande, menos aire arriba y abajo para que la cabecera no crezca de más. */
  .topbar { padding-top: calc(7px + env(safe-area-inset-top, 0px)); padding-bottom: 7px; }
}
@media (min-width: 1000px) {
  .rail .brand { margin-right: 0; padding: 2px 2px 0; }
  .rail .brand-logo { width: 100%; max-width: 224px; height: auto; }
}

/* ---- Buscador, categorías y criptos principales ---- */
@media (max-width: 999px) {
  /* En las pantallas de detalle y en la cartera el buscador se aparta: ahí manda lo que estás viendo. */
  .app[data-view="token"] .searchdock, .app[data-view="cripto"] .searchdock, .app[data-view="cartera"] .searchdock { display: none; }
  /* La pestaña de abajo ya dice dónde estás: el título sobra y deja sitio a la lista. */
  .content[data-view="descubrir"] .view-title, .content[data-view="buscar"] .view-title { display: none; }
}
/* La fila de pestañas se desvanece a la derecha: señal de que sigue al deslizar. */
.tabs-scroll { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent); }
.subtabs .chip { min-height: 32px; padding: 0 11px; font-size: 12.5px; }
.controls:empty { display: none; }

.chip-static { cursor: default; }
.chip-static:hover { color: var(--txt-1); border-color: var(--line-2); }
.chip-cat, .chip-cat:hover { color: var(--brand-hi); border-color: var(--brand-a25); background: var(--brand-a10); }
.chip-warn, .chip-warn:hover { color: var(--warn); border-color: rgba(233, 151, 63, 0.35); }
.net-logo { display: block; border-radius: 50%; flex: none; }
.meta-chips { margin-top: -4px; }
.share-x { color: var(--txt-0); border: 1px solid var(--line-2); }
.how-text { font-size: 14px; color: var(--txt-1); line-height: 1.5; }
.trade-bar.single { grid-template-columns: 1fr; }
.block-head .hint { white-space: nowrap; }

.cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cat { display: flex; flex-direction: column; gap: 3px; padding: 12px; border-radius: var(--r-md); background: var(--bg-1); border: 1px solid var(--line); min-width: 0; transition: background 120ms, border-color 120ms; }
.cat:hover { background: var(--bg-2); border-color: var(--line-2); }
.cat-icon { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 5px; border-radius: 10px; color: var(--brand); background: var(--brand-a10); }
.cat strong { font-size: 14px; }
.cat-text { font-size: 11.5px; line-height: 1.3; color: var(--txt-2); }

.majors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.major { display: flex; flex-direction: column; gap: 4px; padding: 11px 10px; border-radius: var(--r-md); background: var(--bg-1); border: 1px solid var(--line); min-width: 0; transition: background 120ms, border-color 120ms; }
a.major:hover { background: var(--bg-2); border-color: var(--line-2); }
.major-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.major-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.major-price { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.major.skel { height: 88px; border: none; }

/* ---- Recibir: red elegida ---- */
.net-select { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: var(--r-md); background: var(--bg-1); border: 1px solid var(--line-2); text-align: left; color: var(--txt-0); }
.net-select:hover { background: var(--bg-3); }
.net-select .trow-sub { font-size: 11.5px; }
.net-change { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; color: var(--brand-hi); font-weight: 600; font-size: 13px; flex: none; }

@media (min-width: 1000px) {
  .majors { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .cats { max-width: 720px; }
  .thead.thead-coin, .trow.trow-coin:not(.trow-live):not(.trow-curve):not(.trow-mini) { grid-template-columns: 26px 40px minmax(150px, 1.9fr) repeat(5, minmax(84px, 1fr)); }
  .trow-coin .only-narrow { display: none; }
}
