/* ==========================================================================
   BEFAMEX TREASURY — hoja de estilos unica
   Tesoreria USDT · tema oscuro con acento verde esmeralda
   Sin frameworks ni CDNs: la CSP del panel solo admite recursos propios.
   ========================================================================== */

:root {
  /* Fondo: casi negro con una sombra de verde, no gris puro */
  --bg:          #070c0a;
  --bg-soft:     #0b1310;
  --surface:     #0f1a16;
  --surface-2:   #142219;
  --surface-3:   #1a2b21;
  --border:      #1e3229;
  --border-soft: #17271f;

  --text:        #e8f2ec;
  --text-dim:    #8fa79b;
  --text-faint:  #5d7269;

  --accent:      #10b981;
  --accent-soft: #34d399;
  --accent-deep: #059669;
  --accent-glow: rgba(16, 185, 129, .18);

  --in:      #34d399;   /* entradas  */
  --out:     #fb7185;   /* salidas   */
  --warn:    #fbbf24;
  --danger:  #f43f5e;
  --info:    #60a5fa;

  --radius:    16px;
  --radius-sm: 10px;
  --radius-lg: 22px;

  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px -8px rgba(0,0,0,.6);
  --shadow-lg: 0 2px 4px rgba(0,0,0,.4), 0 24px 48px -12px rgba(0,0,0,.7);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas,
          "Liberation Mono", monospace;

  --sidebar-w: 248px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ============================ Base ============================ */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Halo verde muy tenue detras de todo, da profundidad sin ruido */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(16,185,129,.07), transparent 70%),
    radial-gradient(700px 400px at 90% 5%, rgba(52,211,153,.045), transparent 70%);
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p  { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent-soft); text-decoration: none; transition: color .16s; }
a:hover { color: var(--accent); }

hr { border: 0; border-top: 1px solid var(--border-soft); margin: 1.25rem 0; }

::selection { background: var(--accent); color: #04140d; }

:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Barras de scroll discretas */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: #24402f; }

.ic { width: 20px; height: 20px; flex: none; }
.ic-sm { width: 16px; height: 16px; flex: none; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.tiny  { font-size: .78rem; }
.small { font-size: .86rem; }
.center { text-align: center; }
.right { text-align: right; }
.bold { font-weight: 650; }
.hide { display: none !important; }
.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;
}

/* ============================ Estructura ============================ */

.shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  border-right: 1px solid var(--border-soft);
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: .7rem; padding: 0 .5rem; }
.brand-mark {
  width: 38px; height: 38px; flex: none;
  border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent-soft), var(--accent-deep));
  color: #04140d;
  font-weight: 800; font-size: 1rem; letter-spacing: -.04em;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.brand-name { font-weight: 680; font-size: .96rem; letter-spacing: -.02em; line-height: 1.15; }
.brand-sub  { font-size: .72rem; color: var(--text-faint); letter-spacing: .06em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .11em;
  color: var(--text-faint); padding: 0 .75rem; margin: .9rem 0 .4rem;
}
.nav-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .62rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: .92rem; font-weight: 520;
  transition: background .16s, color .16s, transform .16s var(--ease);
  position: relative;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item:active { transform: scale(.98); }
.nav-item.is-active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.nav-item.is-active::before {
  content: ""; position: absolute; left: -1rem; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.nav-item .ic { opacity: .85; }
.nav-item.is-active .ic { opacity: 1; color: var(--accent-soft); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: .6rem; }
.who {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .7rem; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border-soft);
}
.who-avatar {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--accent-soft);
  font-weight: 700; font-size: .82rem;
}

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

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.1rem 1.75rem;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(7,12,10,.78);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 1.22rem; }
.topbar-sub { font-size: .82rem; color: var(--text-faint); margin-top: .1rem; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .6rem; }

.content { padding: 1.75rem; flex: 1; width: 100%; max-width: 1320px; margin: 0 auto; }

/* Menu movil */
.menu-btn { display: none; }

/* Barra de pestanas inferior (movil) */
.tabbar { display: none; }

/* ============================ Tarjetas ============================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card-lg { padding: 1.6rem; border-radius: var(--radius-lg); }
.card-head {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: 1.1rem;
}
.card-head h2 { font-size: 1.02rem; }
.card-head .card-actions { margin-left: auto; display: flex; gap: .5rem; align-items: center; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-head { padding: 1.15rem 1.25rem 0; margin-bottom: .9rem; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.row-tight { gap: .45rem; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.push { margin-left: auto; }

/* ============================ Saldo principal ============================ */

.balance {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 1.9rem 1.75rem;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(16,185,129,.15), transparent 58%),
    linear-gradient(155deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.balance::after {
  content: ""; position: absolute; right: -70px; top: -90px;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent 68%);
  pointer-events: none;
}
.balance-label {
  display: flex; align-items: center; gap: .5rem;
  font-size: .8rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-dim); font-weight: 600;
}
.balance-amount {
  font-family: var(--mono);
  font-size: clamp(2.4rem, 6.5vw, 3.5rem);
  font-weight: 700; letter-spacing: -.035em; line-height: 1.05;
  margin: .5rem 0 .15rem;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 0 42px rgba(16,185,129,.28);
}
.balance-amount .cur { font-size: .42em; color: var(--accent-soft); margin-left: .35rem; font-weight: 600; letter-spacing: 0; }
.balance-meta { display: flex; align-items: center; gap: .5rem; font-size: .83rem; color: var(--text-faint); }
.balance-actions { display: flex; gap: .7rem; margin-top: 1.5rem; flex-wrap: wrap; }
.balance.is-stale .balance-amount { opacity: .45; transition: opacity .3s; }

/* Punto latiendo = dato en vivo */
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,.5); }
  70%  { box-shadow: 0 0 0 9px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* ============================ Estadisticas ============================ */

.stat {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  transition: border-color .2s, transform .2s var(--ease);
}
.stat:hover { border-color: var(--border); transform: translateY(-2px); }
.stat-label {
  display: flex; align-items: center; gap: .45rem;
  font-size: .78rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .07em; font-weight: 600;
}
.stat-value {
  font-family: var(--mono); font-size: 1.5rem; font-weight: 660;
  letter-spacing: -.02em; margin-top: .45rem; font-variant-numeric: tabular-nums;
}
.stat-value.pos { color: var(--in); }
.stat-value.neg { color: var(--out); }
.stat-foot { font-size: .78rem; color: var(--text-faint); margin-top: .2rem; }

/* ============================ Botones ============================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .62rem 1.05rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit; font-size: .9rem; font-weight: 570;
  cursor: pointer;
  transition: background .16s, border-color .16s, transform .12s var(--ease), box-shadow .2s;
  white-space: nowrap;
  text-decoration: none;
  position: relative;
}
.btn:hover { background: var(--surface-3); border-color: #2a4636; color: var(--text); }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn.is-busy { opacity: .6; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: linear-gradient(140deg, var(--accent-soft), var(--accent-deep));
  border-color: transparent;
  color: #04140d;
  font-weight: 680;
  box-shadow: 0 4px 16px -4px var(--accent-glow);
}
.btn-primary:hover {
  background: linear-gradient(140deg, #4ade9f, var(--accent));
  color: #04140d;
  box-shadow: 0 6px 22px -4px rgba(16,185,129,.45);
}
.btn-danger { border-color: rgba(244,63,94,.35); color: #fda4af; background: rgba(244,63,94,.08); }
.btn-danger:hover { background: rgba(244,63,94,.16); border-color: rgba(244,63,94,.5); color: #fecdd3; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-lg { padding: .95rem 1.5rem; font-size: 1rem; border-radius: 14px; }
.btn-sm { padding: .4rem .7rem; font-size: .82rem; }
.btn-icon { padding: .5rem; }
.btn-block { width: 100%; }

/* Boton grande de accion del panel de inicio */
.action-btn {
  flex: 1; min-width: 190px;
  display: flex; align-items: center; gap: .9rem;
  padding: 1.05rem 1.25rem;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text); cursor: pointer;
  transition: transform .2s var(--ease), border-color .2s, background .2s;
  text-align: left;
}
.action-btn:hover { transform: translateY(-3px); border-color: var(--accent-deep); background: var(--surface-3); }
.action-btn:active { transform: translateY(-1px) scale(.99); }
.action-btn .ab-icon {
  width: 44px; height: 44px; flex: none; border-radius: 13px;
  display: grid; place-items: center;
}
.action-btn.in  .ab-icon { background: rgba(52,211,153,.13); color: var(--in); }
.action-btn.out .ab-icon { background: rgba(251,113,133,.12); color: var(--out); }
.action-btn .ab-title { font-weight: 650; font-size: 1rem; }
.action-btn .ab-sub { font-size: .8rem; color: var(--text-faint); }

/* Spinner dentro de un boton ocupado */
.btn.is-busy .btn-text { opacity: .35; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 16px; height: 16px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 18px; height: 18px; flex: none;
  border: 2px solid var(--surface-3); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}

/* ============================ Formularios ============================ */

.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.05rem; }
.field:last-child { margin-bottom: 0; }
.label { font-size: .84rem; font-weight: 580; color: var(--text-dim); }
.label .req { color: var(--accent-soft); }
.hint { font-size: .79rem; color: var(--text-faint); line-height: 1.45; }

.input, .select, .textarea {
  width: 100%;
  padding: .68rem .85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-family: inherit; font-size: .93rem;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.input:hover, .select:hover, .textarea:hover { border-color: #2a4636; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent-deep);
  box-shadow: 0 0 0 3px rgba(16,185,129,.13);
  background: var(--surface);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:disabled, .select:disabled { opacity: .55; cursor: not-allowed; }
.textarea { resize: vertical; min-height: 78px; line-height: 1.5; }

.select {
  appearance: none;
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238fa79b' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem center;
  background-size: 16px;
}

.input-mono { font-family: var(--mono); font-size: .88rem; letter-spacing: .01em; }

/* Campo de monto grande */
.amount-field { position: relative; }
.amount-field .input {
  font-family: var(--mono); font-size: 1.75rem; font-weight: 650;
  padding: .85rem 5rem .85rem .95rem;
  letter-spacing: -.02em;
}
.amount-field .amount-cur {
  position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); font-weight: 620; font-size: .95rem;
  pointer-events: none;
}

/* Casillas y opciones */
.check { display: flex; align-items: flex-start; gap: .6rem; cursor: pointer; user-select: none; }
.check input[type="checkbox"], .check input[type="radio"] {
  width: 18px; height: 18px; flex: none; margin: .12rem 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.check-text { font-size: .89rem; line-height: 1.45; }

/* Codigo de 6 digitos */
.code-input {
  font-family: var(--mono);
  font-size: 1.9rem; font-weight: 650;
  letter-spacing: .55em; text-indent: .55em;
  text-align: center;
  padding: .85rem .5rem;
}

/* ============================ Avisos ============================ */

.alert {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: .89rem; line-height: 1.5;
  margin-bottom: 1rem;
}
.alert .ic { margin-top: .1rem; }
.alert-success { background: rgba(16,185,129,.09);  border-color: rgba(16,185,129,.28);  color: #a7f3d0; }
.alert-error   { background: rgba(244,63,94,.09);   border-color: rgba(244,63,94,.3);    color: #fecdd3; }
.alert-warning { background: rgba(251,191,36,.09);  border-color: rgba(251,191,36,.28);  color: #fde68a; }
.alert-info    { background: rgba(96,165,250,.08);  border-color: rgba(96,165,250,.25);  color: #bfdbfe; }

.flashes { position: fixed; top: 1rem; right: 1rem; z-index: 90; width: min(380px, calc(100vw - 2rem)); }
.flashes .alert { box-shadow: var(--shadow-lg); backdrop-filter: blur(12px); }
.flashes .alert.is-out { animation: flashOut .35s var(--ease) forwards; }
@keyframes flashOut { to { opacity: 0; transform: translateX(24px); } }

/* ============================ Etiquetas de estado ============================ */

.tag {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .22rem .6rem;
  border-radius: 999px;
  font-size: .76rem; font-weight: 620;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.tag-ok      { background: rgba(16,185,129,.12);  color: #6ee7b7; border-color: rgba(16,185,129,.25); }
.tag-wait    { background: rgba(251,191,36,.11);  color: #fcd34d; border-color: rgba(251,191,36,.24); }
.tag-live    { background: rgba(96,165,250,.11);  color: #93c5fd; border-color: rgba(96,165,250,.24); }
.tag-bad     { background: rgba(244,63,94,.11);   color: #fda4af; border-color: rgba(244,63,94,.25); }
.tag-idle    { background: var(--surface-2);      color: var(--text-dim); border-color: var(--border-soft); }
.tag-in      { background: rgba(52,211,153,.12);  color: var(--in); }
.tag-out     { background: rgba(251,113,133,.12); color: var(--out); }

/* Punto que late en los estados en curso */
.tag-live .tag-dot, .tag-wait .tag-dot { animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* ============================ Tablas ============================ */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th {
  text-align: left; font-weight: 620; font-size: .74rem;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint);
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-soft);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
.table th a { color: inherit; display: inline-flex; align-items: center; gap: .3rem; }
.table th a:hover { color: var(--text); }
.table th.is-sorted { color: var(--accent-soft); }
.table td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.table tbody tr { transition: background .13s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.table .num.pos { color: var(--in); }
.table .num.neg { color: var(--out); }

.row-link { color: var(--text); font-weight: 570; }
.row-link:hover { color: var(--accent-soft); }

/* Lista compacta para movil y para el resumen del inicio */
.mlist { display: flex; flex-direction: column; }
.mitem {
  display: flex; align-items: center; gap: .85rem;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--border-soft);
  transition: background .13s;
}
.mitem:last-child { border-bottom: 0; }
.mitem:hover { background: var(--surface-2); }
.mitem-icon {
  width: 38px; height: 38px; flex: none; border-radius: 11px;
  display: grid; place-items: center;
}
.mitem-icon.in  { background: rgba(52,211,153,.11); color: var(--in); }
.mitem-icon.out { background: rgba(251,113,133,.1); color: var(--out); }
.mitem-icon.fee { background: rgba(168,85,247,.1);  color: #c084fc; }
.mitem-body { min-width: 0; flex: 1; }
.mitem-title {
  font-weight: 570; font-size: .92rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mitem-sub { font-size: .78rem; color: var(--text-faint); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.mitem-amount { font-family: var(--mono); font-weight: 640; font-size: .95rem; text-align: right; white-space: nowrap; }
.mitem-amount.pos { color: var(--in); }
.mitem-amount.neg { color: var(--out); }

/* ============================ Estado vacio ============================ */

.empty { padding: 3rem 1.5rem; text-align: center; color: var(--text-faint); }
.empty-icon {
  width: 54px; height: 54px; margin: 0 auto 1rem;
  border-radius: 16px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-faint);
}
.empty h3 { color: var(--text-dim); font-size: .98rem; margin-bottom: .3rem; }
.empty p { font-size: .87rem; max-width: 34ch; margin: 0 auto; }

/* ============================ Direcciones y hashes ============================ */

.addr {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: var(--mono); font-size: .84rem;
  padding: .22rem .5rem; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  color: var(--text-dim);
}
.addr:hover { border-color: var(--border); color: var(--text); }

.addr-box {
  display: flex; align-items: center; gap: .6rem;
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-family: var(--mono); font-size: .9rem;
  word-break: break-all; line-height: 1.5;
}
.addr-box .addr-text { flex: 1; min-width: 0; }
/* Los ultimos caracteres resaltados: es lo que se compara al pegar una cartera */
.addr-tail { color: var(--accent-soft); font-weight: 700; }

.copy-btn {
  flex: none; display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .6rem; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-dim); cursor: pointer;
  font-family: var(--font); font-size: .78rem; font-weight: 570;
  transition: all .16s;
}
.copy-btn:hover { background: var(--surface-3); color: var(--text); }
.copy-btn.is-done { background: rgba(16,185,129,.14); border-color: rgba(16,185,129,.35); color: #6ee7b7; }

/* ============================ QR ============================ */

.qr-frame {
  display: inline-block; padding: .9rem; border-radius: 14px;
  background: #fff; line-height: 0;
  box-shadow: 0 8px 28px -8px rgba(0,0,0,.6);
}
.qr-frame svg { display: block; border-radius: 4px; }

/* ============================ Filtros ============================ */

.filters {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.15rem;
}
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .85rem;
}
.filters .field { margin-bottom: 0; }
.filters-foot {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-soft);
}

/* Atajos de periodo */
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
  padding: .34rem .75rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-dim); font-size: .82rem; font-weight: 550;
  cursor: pointer; transition: all .16s; white-space: nowrap;
}
.chip:hover { background: var(--surface-3); color: var(--text); }
.chip.is-on {
  background: rgba(16,185,129,.14); border-color: var(--accent-deep);
  color: var(--accent-soft); font-weight: 620;
}

/* Detalles plegables */
.disclosure summary {
  cursor: pointer; list-style: none;
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .85rem; color: var(--text-dim); font-weight: 560;
  padding: .3rem 0;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary:hover { color: var(--text); }
.disclosure summary::after {
  content: ""; width: 7px; height: 7px;
  border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor;
  transform: rotate(45deg) translateY(-2px); transition: transform .2s var(--ease);
}
.disclosure[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.disclosure[open] > *:not(summary) { animation: fadeUp .28s var(--ease) both; }

/* ============================ Paginacion ============================ */

.pager { display: flex; align-items: center; gap: .5rem; justify-content: center; padding: 1.15rem; flex-wrap: wrap; }
.pager-info { color: var(--text-faint); font-size: .84rem; margin-right: auto; }
.pager a, .pager span {
  min-width: 34px; height: 34px; padding: 0 .55rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; border: 1px solid var(--border-soft);
  background: var(--surface-2); color: var(--text-dim);
  font-size: .85rem; font-weight: 560;
  transition: all .16s;
}
.pager a:hover { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.pager .is-current {
  background: rgba(16,185,129,.15); border-color: var(--accent-deep);
  color: var(--accent-soft); font-weight: 680;
}
.pager .is-off { opacity: .35; pointer-events: none; }

/* ============================ Linea de tiempo ============================ */

.timeline { display: flex; flex-direction: column; gap: 0; padding-left: .35rem; }
.tl-item { display: flex; gap: .9rem; padding-bottom: 1.1rem; position: relative; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: 11px; top: 24px; bottom: 0;
  width: 1.5px; background: var(--border);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  width: 23px; height: 23px; flex: none; border-radius: 50%;
  display: grid; place-items: center; z-index: 1;
  background: var(--surface-2); border: 1.5px solid var(--border);
  color: var(--text-faint);
}
.tl-dot.done   { background: rgba(16,185,129,.16); border-color: var(--accent-deep); color: var(--accent-soft); }
.tl-dot.active { background: rgba(251,191,36,.15); border-color: rgba(251,191,36,.5); color: #fcd34d; }
.tl-dot.active::after {
  content: ""; position: absolute; width: 23px; height: 23px; border-radius: 50%;
  border: 1.5px solid rgba(251,191,36,.5); animation: ring 1.8s ease-out infinite;
}
@keyframes ring { to { transform: scale(1.9); opacity: 0; } }
.tl-body { padding-top: .05rem; }
.tl-title { font-size: .9rem; font-weight: 580; }
.tl-time { font-size: .77rem; color: var(--text-faint); }

/* ============================ Grafica ============================ */

.chart { width: 100%; height: 150px; display: block; overflow: visible; }
.chart .bar-in  { fill: var(--in);  opacity: .85; }
.chart .bar-out { fill: var(--out); opacity: .8; }
.chart .grid-line { stroke: var(--border-soft); stroke-width: 1; }
.chart rect { transition: opacity .15s; }
.chart rect:hover { opacity: 1; }

/* ============================ Codigos de respaldo ============================ */

.codes-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .55rem; margin: 1rem 0;
}
.code-chip {
  font-family: var(--mono); font-size: .95rem; font-weight: 620;
  padding: .6rem; text-align: center; border-radius: 9px;
  background: var(--bg-soft); border: 1px dashed var(--border);
  letter-spacing: .04em;
}

/* ============================ Acceso ============================ */
/* Look "liquid crystal": boveda de fondo, tarjeta de vidrio con reflejo
   que barre, halos verdes que respiran y detalles de luz. Todo CSS. */

.auth-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--bg); }
.auth-bg img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  animation: authZoom 26s ease-in-out infinite alternate;
}
.auth-veil {
  position: absolute; inset: 0;
  background:
    radial-gradient(78% 62% at 50% 42%, rgba(7,12,10,.10) 0%, rgba(7,12,10,.62) 62%, rgba(7,12,10,.9) 100%),
    linear-gradient(180deg, rgba(7,12,10,.55) 0%, rgba(7,12,10,.25) 40%, rgba(7,12,10,.78) 100%);
}
/* Rejilla tecnologica, apenas insinuada y desvanecida hacia los bordes */
.auth-grid {
  position: absolute; inset: 0; opacity: .5;
  background:
    repeating-linear-gradient(0deg,   rgba(52,211,153,.05) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg,  rgba(52,211,153,.05) 0 1px, transparent 1px 44px);
  -webkit-mask-image: radial-gradient(60% 55% at 50% 45%, #000 0%, transparent 100%);
          mask-image: radial-gradient(60% 55% at 50% 45%, #000 0%, transparent 100%);
}
.auth-glow {
  position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none;
  background: radial-gradient(circle, rgba(16,185,129,.34) 0%, transparent 70%);
}
.auth-glow.ag-1 { width: 460px; height: 460px; top: -140px; left: -120px; animation: glowDrift 14s ease-in-out infinite alternate; }
.auth-glow.ag-2 { width: 520px; height: 520px; bottom: -180px; right: -140px; animation: glowDrift 17s ease-in-out infinite alternate-reverse; }

.auth-wrap {
  min-height: 100vh; display: grid; place-items: center;
  padding: 1.5rem; position: relative; z-index: 1;
}

/* --- Tarjeta de vidrio --- */
.auth-card {
  width: 100%; max-width: 430px;
  position: relative; overflow: hidden;
  background: linear-gradient(165deg, rgba(18,32,25,.66) 0%, rgba(9,16,12,.78) 100%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
          backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(52,211,153,.17);
  border-radius: var(--radius-lg);
  padding: 2.2rem 1.95rem 1.9rem;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    inset 0 0 0 1px rgba(255,255,255,.02),
    0 30px 70px -20px rgba(0,0,0,.75),
    0 0 60px -18px rgba(16,185,129,.28);
}
/* Reflejo que barre el vidrio: casi imperceptible, solo una insinuacion */
.auth-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  opacity: .15;
  background: linear-gradient(115deg,
    transparent 34%, rgba(52,211,153,.10) 45%,
    rgba(232,242,236,.12) 50%, rgba(52,211,153,.08) 55%, transparent 66%);
  background-size: 260% 100%;
  animation: authSheen 6.5s var(--ease) infinite;
}
/* Linea de luz inferior, como el destello del mockup */
.auth-card::after {
  content: ""; position: absolute; left: 12%; right: 12%; bottom: 0; height: 2px;
  border-radius: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(52,211,153,.85), transparent);
  filter: blur(1px);
  animation: authPulse 3.6s ease-in-out infinite;
}

.auth-head { text-align: center; margin-bottom: 1.7rem; position: relative; }
/* Emblema hexagonal con halo que respira */
.auth-head .brand-mark {
  width: 58px; height: 62px; margin: 0 auto 1rem;
  border-radius: 0;
  clip-path: polygon(50% 0%, 96% 25%, 96% 75%, 50% 100%, 4% 75%, 4% 25%);
  background: linear-gradient(150deg, rgba(52,211,153,.95), rgba(5,150,105,.9) 55%, rgba(6,58,40,.95));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
  display: grid; place-items: center;
  font-size: 1.35rem; font-weight: 800; color: #04140d;
  position: relative;
  animation: hexBreath 3.8s ease-in-out infinite;
}
.auth-head h1 { font-size: 1.34rem; letter-spacing: -.02em; }
.auth-head h1 .grn {
  background: linear-gradient(120deg, var(--accent-soft), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-head p { color: var(--text-dim); font-size: .88rem; margin-top: .35rem; }

/* --- Campos con icono y foco luminoso --- */
.input-ic { position: relative; }
.input-ic > svg {
  position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-faint); pointer-events: none;
  transition: color .2s ease;
}
.input-ic .input { padding-left: 2.5rem; }
.input-ic:focus-within > svg { color: var(--accent-soft); }
.auth-card .input {
  background: rgba(7,13,10,.62);
  border-color: rgba(52,211,153,.14);
  transition: border-color .2s ease, box-shadow .25s ease, background .2s ease;
}
.auth-card .input:focus {
  border-color: rgba(52,211,153,.55);
  box-shadow: 0 0 0 3px rgba(16,185,129,.14), 0 0 22px -6px rgba(16,185,129,.45);
  background: rgba(7,13,10,.78);
}
/* Ojo para mostrar/ocultar la contrasena */
.eye-btn {
  position: absolute; right: .45rem; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-faint); cursor: pointer;
  display: grid; place-items: center; transition: color .2s ease, background .2s ease;
}
.eye-btn:hover { color: var(--accent-soft); background: rgba(52,211,153,.08); }
.eye-btn svg { width: 18px; height: 18px; }
.eye-btn .eye-off { display: none; }
.eye-btn.is-on .eye-on { display: none; }
.eye-btn.is-on .eye-off { display: block; }
.input-ic .input.has-eye { padding-right: 2.9rem; }

/* --- Boton principal del acceso: gradiente + destello al pasar --- */
.auth-card .btn-primary {
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--accent-soft) 0%, var(--accent) 55%, var(--accent-deep) 100%);
  border: 0;
  box-shadow: 0 10px 30px -8px rgba(16,185,129,.55), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), filter .18s ease;
}
.auth-card .btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 14px 36px -8px rgba(16,185,129,.65), inset 0 1px 0 rgba(255,255,255,.35);
}
.auth-card .btn-primary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  background-size: 250% 100%; background-position: 120% 0;
  transition: background-position .6s var(--ease);
}
.auth-card .btn-primary:hover::after { background-position: -120% 0; }

/* --- Ornamento inferior: candado entre dos lineas de luz --- */
.auth-sep {
  display: flex; align-items: center; gap: .9rem;
  margin-top: 1.6rem; color: var(--accent-soft);
}
.auth-sep::before, .auth-sep::after {
  content: ""; height: 1px; flex: 1;
  background: linear-gradient(90deg, transparent, rgba(52,211,153,.4));
}
.auth-sep::after { background: linear-gradient(90deg, rgba(52,211,153,.4), transparent); }
.auth-sep .lock-badge {
  width: 34px; height: 38px; flex: none;
  clip-path: polygon(50% 0%, 96% 25%, 96% 75%, 50% 100%, 4% 75%, 4% 25%);
  background: rgba(16,185,129,.12);
  border: 0; display: grid; place-items: center;
  animation: authPulse 3.6s ease-in-out infinite;
}
.auth-sep .lock-badge svg { width: 14px; height: 14px; }

.auth-foot { text-align: center; margin-top: .95rem; font-size: .8rem; color: var(--text-faint); }

@keyframes authZoom  { from { transform: scale(1); } to { transform: scale(1.07); } }
@keyframes glowDrift {
  from { transform: translate(0, 0) scale(1); opacity: .75; }
  to   { transform: translate(46px, -30px) scale(1.14); opacity: 1; }
}
@keyframes authSheen {
  0%       { background-position: 130% 0; }
  46%,100% { background-position: -130% 0; }
}
@keyframes authPulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes hexBreath {
  0%, 100% { filter: drop-shadow(0 6px 18px rgba(16,185,129,.35)); transform: translateY(0); }
  50%      { filter: drop-shadow(0 10px 26px rgba(16,185,129,.6));  transform: translateY(-2px); }
}

/* ============================ Diagnostico ============================ */

.check-row {
  display: flex; align-items: flex-start; gap: .8rem;
  padding: .8rem 0; border-bottom: 1px solid var(--border-soft);
}
.check-row:last-child { border-bottom: 0; }
.check-mark {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
}
.check-mark.ok  { background: rgba(16,185,129,.15); color: var(--in); }
.check-mark.bad { background: rgba(244,63,94,.13);  color: var(--out); }
.check-name { font-weight: 570; font-size: .91rem; }
.check-note { font-size: .81rem; color: var(--text-faint); word-break: break-word; }

/* ============================ Animaciones de entrada ============================ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.anim { animation: fadeUp .42s var(--ease) both; }
.anim-1 { animation-delay: .04s; }
.anim-2 { animation-delay: .09s; }
.anim-3 { animation-delay: .14s; }
.anim-4 { animation-delay: .19s; }
.anim-5 { animation-delay: .24s; }
.anim-6 { animation-delay: .29s; }

/* Filas de tabla escalonadas */
.stagger > * { animation: fadeUp .35s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .05s; }
.stagger > *:nth-child(3) { animation-delay: .08s; }
.stagger > *:nth-child(4) { animation-delay: .11s; }
.stagger > *:nth-child(5) { animation-delay: .14s; }
.stagger > *:nth-child(6) { animation-delay: .17s; }
.stagger > *:nth-child(7) { animation-delay: .20s; }
.stagger > *:nth-child(8) { animation-delay: .23s; }
.stagger > *:nth-child(n+9) { animation-delay: .26s; }

/* Quien pida menos movimiento, que no tenga movimiento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ============================ Responsive ============================ */

@media (max-width: 1024px) {
  :root { --sidebar-w: 210px; }
  .content { padding: 1.35rem; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 860px) {
  /* En movil el panel se comporta como app nativa: cabecera fija arriba,
     barra de pestanas abajo, y el menu lateral entra como cajon deslizante
     (ahi viven Depositos y Retiros, que no caben en la barra inferior). */
  .shell { flex-direction: column; }

  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 80;
    width: min(280px, 84vw); height: 100dvh;
    transform: translateX(-102%);
    transition: transform .28s var(--ease);
    box-shadow: 24px 0 48px -12px rgba(0,0,0,.75);
    overflow-y: auto;
    /* Espacio para que "Cerrar sesion" no quede debajo de la barra inferior */
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
  }
  .sidebar.is-open { transform: none; }

  /* Velo que oscurece el contenido y cierra el cajon al tocarlo */
  .sidebar.is-open::after {
    content: ""; position: fixed; inset: 0 0 0 min(280px, 84vw);
    background: rgba(0,0,0,.55); z-index: -1;
  }

  .topbar { padding: .9rem 1rem; }
  .topbar h1 { font-size: 1.05rem; }

  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 11px;
    background: linear-gradient(140deg, var(--accent-soft), var(--accent-deep));
    color: #04140d; border: 0; flex: none;
  }

  .content { padding: 1rem 1rem calc(5.2rem + env(safe-area-inset-bottom)); }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  .balance { padding: 1.5rem 1.25rem; border-radius: 18px; }
  .balance-actions { flex-direction: column; }
  .action-btn { min-width: 0; width: 100%; }

  .card { padding: 1.05rem; border-radius: 14px; }
  .card-lg { padding: 1.2rem; }

  .tabbar {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: rgba(11,19,16,.94);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--border);
    padding: .45rem .4rem calc(.45rem + env(safe-area-inset-bottom));
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: .18rem;
    padding: .4rem .2rem; border-radius: 11px;
    color: var(--text-faint); font-size: .68rem; font-weight: 570;
    transition: color .16s, background .16s;
  }
  .tab:active { background: var(--surface-2); }
  .tab.is-active { color: var(--accent-soft); }
  .tab .ic { width: 21px; height: 21px; }

  .flashes { top: auto; bottom: calc(5.5rem + env(safe-area-inset-bottom)); left: 1rem; right: 1rem; width: auto; }

  /* Tablas anchas: se leen deslizando */
  .table { font-size: .84rem; }
  .table th, .table td { padding: .65rem .75rem; }

  .filters-grid { grid-template-columns: 1fr 1fr; }
  .pager-info { width: 100%; text-align: center; margin: 0 0 .5rem; }

  .amount-field .input { font-size: 1.5rem; }
  .code-input { font-size: 1.55rem; letter-spacing: .38em; text-indent: .38em; }
}

@media (max-width: 480px) {
  .filters-grid { grid-template-columns: 1fr; }
  .balance-amount { font-size: 2.2rem; }
  .auth-card { padding: 1.6rem 1.25rem; }
  .codes-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================ Impresion ============================ */

@media print {
  .sidebar, .tabbar, .topbar-actions, .filters, .pager, .btn, .flashes { display: none !important; }
  body { background: #fff; color: #000; }
  body::before { display: none; }
  .card, .balance { border: 1px solid #ccc; box-shadow: none; background: #fff; }
  .content { padding: 0; max-width: none; }
}
