/* ═══ DolarPrice · hoja de estilo unica ═══
   Tipografia del sistema a proposito: en Android rinde Roboto y en iOS SF Pro,
   que es justo lo que hace que se sienta app y no pagina. Ademas no hay que
   esperar ninguna descarga de fuente en una red movil venezolana. */

:root {
  --brand:      #16A34A;
  --brand-2:    #4ADE80;
  --teal:       #14B8A6;
  --binance:    #F0B90B;

  --bg:         #0B1210;
  --bg-2:       #0F1A16;
  --surface:    #131F1A;
  --surface-2:  #1A2A23;
  --line:       rgba(255,255,255,.07);
  --line-2:     rgba(255,255,255,.12);
  --text:       #EAF2ED;
  --muted:      #8CA096;
  --danger:     #F87171;

  --r-sm: 12px;
  --r:    18px;
  --r-lg: 26px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabh: 62px;

  --ease: cubic-bezier(.32,.72,0,1);
}

:root[data-theme="light"] {
  --bg:        #F2F6F3;
  --bg-2:      #FFFFFF;
  --surface:   #FFFFFF;
  --surface-2: #EDF3EF;
  --line:      rgba(6,32,20,.08);
  --line-2:    rgba(6,32,20,.14);
  --text:      #0C1D15;
  --muted:     #5C7268;
  --danger:    #DC2626;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:        #F2F6F3;
    --bg-2:      #FFFFFF;
    --surface:   #FFFFFF;
    --surface-2: #EDF3EF;
    --line:      rgba(6,32,20,.08);
    --line-2:    rgba(6,32,20,.14);
    --text:      #0C1D15;
    --muted:     #5C7268;
    --danger:    #DC2626;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Un halo verde tenue arriba, para que el fondo no sea un plano muerto */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 46vh;
  background: radial-gradient(100% 70% at 50% 0%, rgba(22,163,74,.20), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

svg.i { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ═══ Cabecera ═══ */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: calc(var(--safe-t) + 12px) 18px 12px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s;
}
.top.scrolled { border-bottom-color: var(--line); }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.06rem; letter-spacing: -.02em; }
.brand img { border-radius: 8px; display: block; }

.top-actions { display: flex; gap: 8px; }

.ico {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
  transition: transform .18s var(--ease), background .18s;
}
.ico:active { transform: scale(.9); background: var(--surface-2); }
.ico.spin svg { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ Contenedor ═══ */
main {
  position: relative; z-index: 1;
  padding: 4px 18px calc(var(--tabh) + var(--safe-b) + 24px);
  max-width: 560px; margin: 0 auto;
}

.tabpane { animation: pane .34s var(--ease); }
@keyframes pane { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ═══ Aviso de datos viejos / sin conexion ═══ */
.banner {
  display: flex; align-items: center; gap: 9px;
  margin: 8px 0 14px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: .84rem; font-weight: 500;
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
}
.banner.warn { background: color-mix(in srgb, var(--binance) 14%, transparent); color: var(--binance); border-color: color-mix(in srgb, var(--binance) 30%, transparent); }
/* display:flex le gana a la regla [hidden] del navegador, hay que decirlo aparte */
.banner[hidden] { display: none; }

/* ═══ Tarjeta principal ═══ */
.hero {
  position: relative; overflow: hidden;
  margin: 10px 0 12px;
  padding: 20px 22px 22px;
  border-radius: var(--r-lg);
  background: linear-gradient(150deg, color-mix(in srgb, var(--brand) 30%, var(--surface)), var(--surface) 62%);
  border: 1px solid var(--line-2);
  box-shadow: 0 18px 40px -22px rgba(0,0,0,.75);
}
.hero::after {
  content: ""; position: absolute; right: -46px; top: -46px;
  width: 170px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle, rgba(74,222,128,.22), transparent 68%);
  pointer-events: none;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.hero-date { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.hero-amount {
  display: flex; align-items: baseline; gap: 8px;
  font-size: clamp(2.5rem, 12vw, 3.4rem);
  font-weight: 800; letter-spacing: -.045em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hero-amount .cur { font-size: .34em; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.hero-sub { margin-top: 9px; font-size: .85rem; color: var(--muted); }

/* ═══ Etiquetas ═══ */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-bcv { background: color-mix(in srgb, var(--brand-2) 16%, transparent); color: var(--brand-2); }
.tag-bin { background: color-mix(in srgb, var(--binance) 16%, transparent); color: var(--binance); }
.tag-gap { background: color-mix(in srgb, var(--teal) 18%, transparent); color: var(--teal); }

/* ═══ Par de tarjetas ═══ */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mini {
  padding: 16px 16px 17px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
}
.mini-amount {
  margin-top: 11px;
  font-size: 1.5rem; font-weight: 750; letter-spacing: -.03em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.mini-sub { margin-top: 3px; font-size: .74rem; color: var(--muted); }

/* ═══ Conversor ═══ */
.conv { margin-top: 22px; }

.seg {
  display: flex; gap: 4px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px;
}
.seg-wide { margin-bottom: 12px; }
.seg-btn {
  flex: 1; padding: 9px 8px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: .87rem; font-weight: 600;
  cursor: pointer;
  transition: background .22s var(--ease), color .22s, transform .18s var(--ease);
}
.seg-btn:active { transform: scale(.97); }
.seg-btn.active { background: var(--surface-2); color: var(--text); box-shadow: 0 2px 8px -4px rgba(0,0,0,.5); }

.conv-body { position: relative; margin: 12px 0; }

.row-amt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  padding: 15px 18px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface);
  color: inherit; font: inherit; text-align: left;
  cursor: pointer;
  transition: border-color .22s, background .22s;
}
.row-amt + .row-amt { margin-top: 8px; }
.row-amt.on { border-color: color-mix(in srgb, var(--brand-2) 55%, transparent); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.row-lbl { font-size: .78rem; color: var(--muted); font-weight: 500; }
.row-val { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.row-val b {
  font-size: 1.42rem; font-weight: 750; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-val i { font-style: normal; font-size: .82rem; font-weight: 600; color: var(--muted); }
.row-amt.on .row-val b::after {
  content: ""; display: inline-block;
  width: 2px; height: 1.05em; margin-left: 3px; vertical-align: -.14em;
  background: var(--brand-2); border-radius: 1px;
  animation: caret 1.1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.swap {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 4px solid var(--bg); border-radius: 50%;
  background: var(--brand); color: #fff;
  font-size: 17px; cursor: pointer;
  transition: transform .3s var(--ease);
}
.swap:active { transform: translate(-50%, -50%) scale(.86) rotate(180deg); }

/* ═══ Teclado ═══ */
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.key {
  padding: 15px 0;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 1.35rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: transform .12s var(--ease), background .12s;
}
.key:active { transform: scale(.94); background: var(--surface-2); }
.key-alt { color: var(--muted); font-size: 1.6rem; line-height: 1; }
.key-alt svg { width: 22px; height: 22px; }

.conv-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.btn {
  padding: 13px 16px; border-radius: 14px;
  font: inherit; font-size: .92rem; font-weight: 650;
  cursor: pointer; border: 1px solid transparent;
  transition: transform .16s var(--ease), opacity .16s;
}
.btn:active { transform: scale(.96); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--muted); }
.btn.solid { background: var(--brand); color: #fff; box-shadow: 0 10px 24px -12px var(--brand); }

.stamp { margin: 20px 0 4px; text-align: center; font-size: .76rem; color: var(--muted); }

/* ═══ Listas ═══ */
.h2 { margin: 14px 0 3px; font-size: 1.3rem; font-weight: 750; letter-spacing: -.03em; }
.h2sub { margin: 0 0 16px; font-size: .82rem; color: var(--muted); }

.list { display: flex; flex-direction: column; gap: 9px; }
.item {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface);
}
.item-code {
  display: grid; place-items: center;
  width: 42px; height: 42px; flex: none;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: .72rem; font-weight: 750; letter-spacing: .02em;
}
.item-body { flex: 1; min-width: 0; }
.item-name { font-size: .93rem; font-weight: 600; }
.item-note { font-size: .74rem; color: var(--muted); }
.item-val { font-size: 1.06rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; text-align: right; }
.item-val small { display: block; font-size: .68rem; font-weight: 500; color: var(--muted); }

.note { margin-top: 16px; font-size: .76rem; color: var(--muted); line-height: 1.6; }

/* ═══ Historial ═══ */
.chips { display: flex; gap: 8px; margin-bottom: 14px; }
.chip {
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font: inherit; font-size: .8rem; font-weight: 600;
  cursor: pointer; transition: transform .16s var(--ease);
}
.chip:active { transform: scale(.94); }
.chip.active { background: color-mix(in srgb, var(--brand) 18%, var(--surface)); border-color: color-mix(in srgb, var(--brand-2) 45%, transparent); color: var(--brand-2); }

.chart-wrap {
  padding: 16px 14px 10px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface);
}
#chart { width: 100%; height: 160px; display: block; overflow: visible; }
.chart-legend { display: flex; justify-content: space-between; margin: 9px 2px 18px; font-size: .73rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ═══ Barra de pestanas ═══ */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  padding: 6px 10px calc(var(--safe-b) + 6px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 0 5px;
  border: 0; background: none;
  color: var(--muted); font: inherit; font-size: .67rem; font-weight: 600;
  cursor: pointer;
  transition: color .2s;
}
.tab svg { width: 22px; height: 22px; transition: transform .3s var(--ease); }
.tab.active { color: var(--brand-2); }
.tab.active svg { transform: translateY(-2px) scale(1.06); }
.tab:active svg { transform: scale(.88); }

/* ═══ Aviso flotante ═══ */
.toast {
  position: fixed; left: 50%; z-index: 60;
  bottom: calc(var(--tabh) + var(--safe-b) + 16px);
  transform: translate(-50%, 20px);
  max-width: 88vw;
  padding: 11px 18px; border-radius: 999px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line-2);
  box-shadow: 0 14px 34px -14px rgba(0,0,0,.7);
  font-size: .84rem; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: opacity .26s var(--ease), transform .26s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ═══ Tirar para recargar ═══ */
.pull {
  position: fixed; left: 50%; top: calc(var(--safe-t) + 8px); z-index: 25;
  transform: translate(-50%, -60px);
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line-2);
  opacity: 0;
  transition: opacity .2s;
}
.pull-spin {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--brand-2);
}
.pull.go .pull-spin { animation: spin .7s linear infinite; }

/* ═══ Esqueleto de carga ═══ */
.skel .hero-amount, .skel .mini-amount, .skel .hero-date {
  color: transparent;
  background: linear-gradient(100deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-2) 55%, var(--text)) 50%, var(--surface-2) 70%);
  background-size: 260% 100%;
  border-radius: 9px;
  animation: shimmer 1.5s infinite linear;
}
.skel .hero-amount .cur { color: transparent; }
@keyframes shimmer { from { background-position: 160% 0; } to { background-position: -60% 0; } }

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

/* Pantallas grandes: el teclado no hace falta tan grande */
@media (min-width: 480px) {
  .key { padding: 17px 0; }
}
