/* Finanzas Pro: estilos. Oscuro, con acentos cian y violeta. Móvil primero. */
:root {
  --bg: #070A12;
  --panel: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.09);
  --text: #F2F5FF;
  --muted: #9AA3B8;
  --cyan: #2EE6FF;
  --violet: #8A6BFF;
  --amber: #FFB547;
  --coral: #FF6B8A;
  --grad: linear-gradient(135deg, #2EE6FF, #8A6BFF);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-d: 'Space Grotesk', var(--font);
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.4; -webkit-font-smoothing: antialiased;
}
body::before, body::after { content: ""; position: fixed; width: 480px; height: 480px; border-radius: 50%; pointer-events: none; z-index: 0; }
body::before { top: -180px; left: -140px; background: radial-gradient(circle, rgba(46, 230, 255, 0.18), transparent 65%); }
body::after { bottom: -200px; right: -160px; background: radial-gradient(circle, rgba(138, 107, 255, 0.2), transparent 65%); }
#app, #sheet-root { position: relative; z-index: 1; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--text); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-d); letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.hide { display: none !important; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
svg { flex: none; }

/* ---------- estructura ---------- */
.app { display: flex; min-height: 100vh; }
.side { display: none; }
.main { flex: 1; min-width: 0; width: 100%; max-width: 760px; margin: 0 auto; padding: 22px 16px 130px; display: flex; flex-direction: column; gap: 16px; }
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; padding: 0 16px calc(14px + env(safe-area-inset-bottom)); pointer-events: none; }
.bar {
  pointer-events: auto; width: 100%; max-width: 520px; height: 68px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px; border-radius: 24px; border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(18, 24, 40, 0.94);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); backdrop-filter: blur(14px);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 60px; min-height: 48px;
  font-size: 11px; font-weight: 600; color: var(--muted); background: none; border: 0;
}
.nav-item.on { color: var(--cyan); }
.nav-item svg { width: 22px; height: 22px; }
.fab {
  width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--grad); color: #070A12;
  display: flex; align-items: center; justify-content: center; transform: translateY(-14px); box-shadow: 0 0 24px rgba(46, 230, 255, 0.55);
}
.fab svg { width: 26px; height: 26px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; font-family: var(--font-d); font-weight: 700; font-size: 19px; }
.logo { width: 36px; height: 36px; border-radius: 12px; background: var(--grad); display: flex; align-items: center; justify-content: center; color: #070A12; box-shadow: 0 0 18px rgba(46, 230, 255, 0.45); }
.logo svg { width: 20px; height: 20px; }
@media (min-width: 960px) {
  .side { display: flex; flex-direction: column; gap: 6px; flex: 0 0 240px; position: sticky; top: 0; height: 100vh; padding: 28px 16px; border-right: 1px solid var(--line); background: rgba(255, 255, 255, 0.025); }
  .side .nav-item { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 14px; font-weight: 500; min-height: 44px; padding: 0 12px; border-radius: 14px; border: 1px solid transparent; color: #B4BCCF; width: 100%; }
  .side .nav-item.on { border-color: rgba(46, 230, 255, 0.35); background: rgba(46, 230, 255, 0.12); color: var(--cyan); font-weight: 600; }
  .side .nav-item svg { width: 20px; height: 20px; }
  .side .btn.primary { margin: 10px 0; }
  .bottom { display: none; }
  .main { max-width: 1120px; padding: 28px 32px 48px; }
  .only-mobile { display: none !important; }
}
@media (max-width: 959px) { .only-desktop { display: none !important; } }

/* ---------- encabezados y botones ---------- */
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.head h1 { font-size: 26px; font-weight: 600; }
.head .sub { font-size: 13px; color: var(--muted); }
.head .actions { display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.06); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 20px; height: 20px; }
.month { display: flex; align-items: center; gap: 2px; }
.month b { min-width: 118px; text-align: center; font-family: var(--font-d); font-weight: 600; font-size: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.06); font-weight: 600; font-size: 15px; }
.btn svg { width: 18px; height: 18px; }
.btn.primary { border: 0; background: var(--grad); color: #070A12; font-weight: 700; box-shadow: 0 0 24px rgba(46, 230, 255, 0.3); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 44px; padding: 0 14px; border-radius: 14px; font-size: 13px; }
.btn.danger { border-color: rgba(255, 107, 138, 0.45); color: #FF8FA6; background: transparent; }
.btn.wide { width: 100%; min-height: 56px; border-radius: 18px; font-size: 16px; }
.btn:disabled { opacity: 0.6; cursor: default; }
.link { color: var(--cyan); font-size: 13px; font-weight: 600; background: none; border: 0; padding: 0; min-height: 44px; display: inline-flex; align-items: center; }

/* ---------- paneles ---------- */
.panel { padding: 16px; border-radius: 24px; border: 1px solid var(--line); background: var(--panel); min-width: 0; }
.panel h2 { font-size: 17px; font-weight: 600; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.hero { padding: 20px; border-radius: 24px; border: 1px solid rgba(46, 230, 255, 0.3); background: linear-gradient(160deg, rgba(46, 230, 255, 0.1), rgba(138, 107, 255, 0.1)); box-shadow: 0 0 32px rgba(46, 230, 255, 0.1); }
.hero .label { font-size: 13px; color: var(--muted); }
.hero .big { font-family: var(--font-d); font-size: 42px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.meter { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 14px; }
.meter i { display: block; height: 100%; border-radius: 999px; background: var(--grad); box-shadow: 0 0 12px rgba(46, 230, 255, 0.6); }
.meter.warn i { background: var(--amber); box-shadow: none; }
.meter.over i { background: var(--coral); box-shadow: none; }
.meter.sm { height: 8px; margin-top: 6px; }
.row { display: flex; gap: 12px; }
.between { justify-content: space-between; align-items: baseline; }
.stat { flex: 1; padding: 12px; border-radius: 16px; background: rgba(7, 10, 18, 0.55); min-width: 0; }
.stat small { display: block; font-size: 12px; color: var(--muted); }
.stat b { font-family: var(--font-d); font-size: 18px; font-weight: 600; }
.cyan { color: var(--cyan); }
.warn-t { color: var(--amber); }
.over-t { color: #FF7A93; }
.grid2 { display: grid; gap: 16px; }
@media (min-width: 960px) { .grid2 { grid-template-columns: 1.5fr 1fr; } .grid2.even { grid-template-columns: 1fr 1fr; } }
.donut { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.legend { flex: 1 1 150px; min-width: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.legend span { flex: 1; }
.legend em { font-style: normal; color: var(--muted); }
.bars svg { width: 100%; height: auto; display: block; }

/* ---------- listas ---------- */
.tx { display: flex; align-items: center; gap: 12px; padding: 8px 0; width: 100%; background: none; border: 0; text-align: left; }
.tx-ic { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.tx-ic svg { width: 20px; height: 20px; }
.tx-main { flex: 1; min-width: 0; }
.tx-main b { display: block; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-main small { font-size: 12px; color: var(--muted); }
.tx-amt { font-family: var(--font-d); font-size: 15px; font-weight: 600; white-space: nowrap; }
.tx-amt.in { color: var(--cyan); }
.day-h { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 10px 0 2px; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); }
.empty .btn { margin-top: 14px; }
.pay-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.pay-row i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.pay-row div { flex: 1; min-width: 0; }
.pay-row small { display: block; font-size: 12px; color: var(--muted); }
.cat-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.cat-row:last-child { border-bottom: 0; }
.cat-top { display: flex; align-items: center; gap: 10px; }
.cat-top b { flex: 1; font-size: 14px; }
.cat-note { font-size: 11px; margin-top: 4px; color: var(--muted); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters .field { flex: 1 1 150px; }

/* ---------- formularios ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.fields { display: flex; gap: 10px; }
.fields > * { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); min-width: 0; }
.input, .select { height: 48px; width: 100%; padding: 0 14px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.05); color: var(--text); font-size: 15px; outline: 0; }
.input::placeholder { color: #8A93AB; }
.input:focus, .select:focus { border-color: var(--cyan); }
.input.sm { height: 40px; width: 112px; text-align: right; font-size: 14px; }
.input.amount { height: 72px; font-family: var(--font-d); font-size: 40px; font-weight: 700; border-radius: 20px; padding: 0 18px; }
.select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, #9AA3B8 50%), linear-gradient(135deg, #9AA3B8 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.select option { background: #141A2B; color: #F2F5FF; }
.error { color: #FF8FA6; font-size: 13px; min-height: 18px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
.chip { position: relative; flex: none; }
.chip input, .seg-item input, .sw-opt input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 12px; border: 1.5px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04); color: #C3CAD9; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip input:checked + span { border-color: var(--cyan); background: rgba(46, 230, 255, 0.14); color: var(--cyan); }
.chip input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
.chip .sw { width: 26px; height: 19px; border-radius: 5px; flex: none; }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); }
.seg-item { position: relative; flex: 1; }
.seg-item span { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 12px; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; padding: 0 8px; text-align: center; }
.seg-item input:checked + span { background: linear-gradient(135deg, rgba(46, 230, 255, 0.25), rgba(138, 107, 255, 0.25)); color: var(--text); }
.seg-item input:focus-visible + span { outline: 2px solid var(--cyan); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sw-opt { position: relative; }
.sw-opt span { display: block; width: 44px; height: 44px; padding: 3px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.sw-opt span::after { content: ""; display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
.sw-opt input:checked + span { border-color: var(--cyan); }
.sw-opt input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
form[data-kind="credito"] .f-balance { display: none; }
form:not([data-kind="credito"]) .f-credit { display: none; }
form[data-kind="efectivo"] .f-last4, form[data-kind="billetera"] .f-last4 { display: none; }

/* ---------- tarjetas ---------- */
.stack { display: flex; flex-direction: column; }
.card { position: relative; display: block; width: 100%; height: 190px; padding: 18px 20px; border-radius: 22px; border: 1px solid rgba(255, 255, 255, 0.22); box-shadow: 0 -6px 22px rgba(0, 0, 0, 0.4); overflow: hidden; text-align: left; color: #fff; }
.stack .card + .card { margin-top: -90px; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.card-bank { font-family: var(--font-d); font-size: 20px; font-weight: 700; line-height: 24px; }
.card-kind { font-size: 12px; line-height: 16px; opacity: 0.9; }
.card-top svg { width: 26px; height: 26px; }
.card-mid { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; min-height: 28px; }
.chip-ic { width: 38px; height: 28px; border-radius: 6px; background: linear-gradient(135deg, #F6D77A, #C99A2E); }
.card-num { font-family: var(--font-d); font-size: 20px; font-weight: 600; letter-spacing: 0.14em; }
.card-foot { position: absolute; left: 20px; right: 20px; bottom: 16px; display: flex; justify-content: space-between; align-items: flex-end; font-size: 12px; }
.card-foot small { display: block; opacity: 0.85; font-size: 12px; }
.card-foot b { display: block; font-family: var(--font-d); font-size: 18px; font-weight: 600; }
.card.preview { box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45); flex: none; }
@media (min-width: 960px) {
  .stack { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
  .stack .card + .card { margin-top: 0; }
}

/* ---------- bancos ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile { position: relative; display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 10px 12px; border-radius: 16px; border: 1.5px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04); text-align: left; min-width: 0; }
.tile.on { border-color: var(--cyan); background: rgba(46, 230, 255, 0.1); }
.tile .sw { width: 36px; height: 26px; border-radius: 6px; flex: none; }
.tile .txt { min-width: 0; }
.tile b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile small { font-size: 11px; color: var(--muted); }
.tile .tick { display: none; position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; border-radius: 50%; background: var(--cyan); color: #070A12; align-items: center; justify-content: center; }
.tile.on .tick { display: flex; }
.tick svg { width: 12px; height: 12px; }

/* ---------- hojas (modales) ---------- */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(3, 5, 10, 0.7); backdrop-filter: blur(4px); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 94vh; overflow-y: auto; background: #0E1424; border: 1px solid var(--line); border-radius: 28px 28px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); animation: up 0.22s ease-out; }
.sheet.full { height: 94vh; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet-head h2 { font-size: 20px; }
.sheet-foot { position: sticky; bottom: -20px; margin-top: 16px; padding-top: 12px; background: linear-gradient(transparent, #0E1424 30%); }
.sheet .list { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 700px) {
  .backdrop { align-items: center; }
  .sheet { border-radius: 28px; max-height: 90vh; }
  .sheet.full { height: auto; max-height: 90vh; }
}
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
#toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(10px); z-index: 80; padding: 12px 18px; border-radius: 14px; background: #1A2238; border: 1px solid var(--line); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; font-size: 14px; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- acceso ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; padding: 24px; border-radius: 28px; border: 1px solid rgba(46, 230, 255, 0.3); background: linear-gradient(160deg, rgba(46, 230, 255, 0.08), rgba(138, 107, 255, 0.08)); box-shadow: 0 0 40px rgba(46, 230, 255, 0.08); }
.auth .brand { justify-content: center; padding-bottom: 18px; }
.auth .seg { margin-bottom: 16px; }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }

/* ---------- extras ---------- */
.card[role="button"] { cursor: pointer; }
.cat-group.hide { display: none; }
.tx:hover { background: rgba(255, 255, 255, 0.03); }
.bar-label { fill: #9AA3B8; font-size: 9px; font-family: var(--font); }
.due { font-size: 12px; text-align: right; }
.hint { font-size: 12px; color: var(--muted); }
