/* CuantoVoy · estilos. Mobile-first, sin dependencias. Colores tomados del logo. */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../fonts/plus-jakarta-sans-latin-wght.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --brand-from: #FD9A03;
  --brand-mid: #FD6602;
  --brand-to: #F53C02;
  --brand-grad: linear-gradient(135deg, var(--brand-from) 0%, var(--brand-mid) 55%, var(--brand-to) 100%);
  --primary: #F35B04;
  --primary-strong: #C2410C;
  --primary-soft: #FFF1E6;
  --primary-ring: rgba(243, 91, 4, .28);

  --bg: #F6F6F7;
  --surface: #FFFFFF;
  --surface-2: #F1F1F3;
  --text: #1F2328;
  --text-muted: #6B7280;
  --text-faint: #9CA3AF;
  --border: #E8E8EC;
  --success: #15803D;
  --success-soft: #E8F6EE;
  --danger: #B91C1C;
  --danger-soft: #FDECEC;
  --usd: #0E9F8E;

  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .05);
  --shadow: 0 6px 24px -8px rgba(17, 24, 39, .12), 0 1px 3px rgba(17, 24, 39, .05);
  --shadow-brand: 0 10px 28px -10px rgba(245, 60, 2, .55);
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --col: 600px;
  --tint: #FFFFFF;
  --nav-bg: rgba(255, 255, 255, .92);
  --handle: #D4D4D8;
  --toast-bg: #1F2328;
  --skel-a: #ECECEF;
  --skel-b: #F6F6F7;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.45 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary-strong); text-decoration: none; font-weight: 600; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; border-radius: 10px; }

/* ------------------------------------------------------------------ arranque */
.splash {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--brand-grad);
}
.splash img { width: 120px; height: auto; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .75; transform: scale(.97); } }

/* ------------------------------------------------------------------ layout de la app */
.app {
  max-width: var(--col);
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(var(--safe-t) + 8px) 16px calc(var(--nav-h) + var(--safe-b) + 28px);
}
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 2px 14px;
}
.topbar h1 { font-size: 24px; font-weight: 800; }
.topbar .sub { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.back {
  width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--surface);
  display: grid; place-items: center; box-shadow: var(--shadow-sm); flex: none;
}
.avatar {
  width: 44px; height: 44px; border-radius: 50%; border: 0; flex: none;
  background: var(--primary-soft); color: var(--primary-strong);
  font-weight: 800; font-size: 18px; display: grid; place-items: center;
}

/* ------------------------------------------------------------------ navegación inferior */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 0 12px var(--safe-b);
  background: var(--nav-bg);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--col); margin: 0 auto; height: var(--nav-h);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: center;
}
.nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-faint); font-size: 12px; font-weight: 600; padding: 6px 0;
}
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--primary); }
.nav .fab {
  justify-self: center; width: 62px; height: 62px; margin-top: -26px; border-radius: 22px;
  border: 0; background: var(--brand-grad); color: #fff; box-shadow: var(--shadow-brand);
  display: grid; place-items: center; transition: transform .12s ease;
}
.nav .fab svg { width: 30px; height: 30px; stroke-width: 2.6; }
.nav .fab:active { transform: scale(.94); }

/* ------------------------------------------------------------------ superficies */
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 16px;
}
.section { margin-top: 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 10px; }
.section-head h2 { font-size: 17px; font-weight: 700; }
.section-head a, .section-head button { font-size: 14px; }
.linkbtn { background: none; border: 0; padding: 6px 0; color: var(--primary-strong); font-weight: 700; }

/* Tarjeta principal (degradé de la marca) */
.hero {
  position: relative; overflow: hidden;
  background: var(--brand-grad); color: #fff;
  border-radius: var(--radius-lg); padding: 22px 20px 20px; box-shadow: var(--shadow-brand);
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -50px; width: 190px; height: 190px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.22), rgba(255,255,255,0) 70%);
}
.hero .label { font-size: 15px; font-weight: 600; opacity: .92; }
.hero .amount { font-size: 44px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin-top: 6px; }
.hero .amount .cur { font-size: 24px; font-weight: 700; margin-right: 4px; opacity: .9; }
.hero .amount .dec { font-size: 24px; font-weight: 700; opacity: .85; }
.hero .alt { margin-top: 4px; font-size: 15px; font-weight: 600; opacity: .92; }
.hero .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.hero .pill { background: rgba(255,255,255,.2); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; }

/* Estadísticas */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm); min-width: 0; }
.stat .k { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.stat .v { font-size: 20px; font-weight: 800; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v .emoji { margin-right: 6px; }
.stat .v.text { font-size: 17px; white-space: normal; line-height: 1.25; }

/* Barras de categorías */
.bars { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; }
.bar-row .name { font-weight: 600; font-size: 15px; }
.bar-row .track { height: 8px; border-radius: 99px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 99px; background: var(--c, var(--primary)); width: var(--w, 0%); transition: width .5s ease; }
.bar-row .val { font-weight: 700; font-size: 15px; }

/* ------------------------------------------------------------------ chips y segmentos */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: 0 -2px; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 42px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.chip[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-strong); }
.chip .emoji { font-size: 18px; line-height: 1; }
.chip.cat[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 16%, var(--tint)); border-color: var(--c); color: var(--text); }
.chip .badge { font-size: 11px; font-weight: 700; color: var(--primary-strong); background: var(--surface); border-radius: 99px; padding: 1px 6px; }

.segment {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px;
  background: var(--surface-2); border-radius: 14px; padding: 4px;
}
.segment button {
  border: 0; background: transparent; border-radius: 10px; min-height: 40px;
  font-weight: 700; font-size: 14px; color: var(--text-muted);
}
.segment button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------------ listas de movimientos */
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.item {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center;
  width: 100%; padding: 12px 14px; border: 0; background: none; text-align: left;
  border-bottom: 1px solid var(--border);
}
.item:last-child { border-bottom: 0; }
.item:active { background: var(--surface-2); }
.bubble {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px;
  background: color-mix(in srgb, var(--c, #94A3B8) 18%, var(--tint));
}
.item .t { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .a { font-weight: 750; font-size: 15px; text-align: right; white-space: nowrap; }
.item .a .usd { color: var(--usd); }
.item .a small { display: block; font-weight: 500; font-size: 12px; color: var(--text-faint); }
.day-head {
  display: flex; justify-content: space-between; padding: 16px 4px 8px;
  font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: capitalize;
}

.rowlink {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 15px 16px;
  border: 0; background: none; text-align: left; border-bottom: 1px solid var(--border); color: var(--text);
  font-weight: 600; font-size: 16px;
}
.rowlink:last-child { border-bottom: 0; }
.rowlink .ic { width: 38px; height: 38px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; flex: none; font-size: 19px; }
.rowlink .ic svg { width: 20px; height: 20px; }
.rowlink .grow { flex: 1; min-width: 0; }
.rowlink .grow small { display: block; color: var(--text-muted); font-weight: 500; font-size: 13px; }
.rowlink .end { color: var(--text-faint); display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; }
.rowlink.danger { color: var(--danger); }
.rowlink.danger .ic { background: var(--danger-soft); }

.empty { text-align: center; padding: 34px 20px; color: var(--text-muted); }
.empty .big { font-size: 44px; margin-bottom: 8px; }
.empty h3 { color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* ------------------------------------------------------------------ formularios */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 14px; font-weight: 700; color: var(--text); }
.input, select.input, textarea.input {
  width: 100%; min-height: 52px; padding: 13px 15px; border-radius: 14px;
  border: 1.5px solid var(--border); background: var(--surface); font-size: 16px; outline: none;
  transition: border-color .12s, box-shadow .12s; appearance: none;
}
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m5 8 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 42px; }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.err { color: var(--danger); font-size: 13px; font-weight: 600; }
.hint { color: var(--text-muted); font-size: 13px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 52px; }
.pw-wrap button { position: absolute; right: 6px; top: 6px; width: 40px; height: 40px; border: 0; background: none; color: var(--text-muted); display: grid; place-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 0 22px; border-radius: 16px; border: 0;
  font-weight: 750; font-size: 17px; transition: transform .1s, opacity .15s, box-shadow .15s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn.block { width: 100%; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-brand); }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.ghost { background: transparent; color: var(--primary-strong); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.small { min-height: 42px; font-size: 15px; padding: 0 16px; border-radius: 12px; }
.btn svg { width: 20px; height: 20px; }
.btn .spin { width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.secondary .spin, .btn.ghost .spin { border-color: rgba(0,0,0,.12); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.row > .icon-only { flex: 0 0 56px; padding: 0; }

.searchbar { position: relative; }
.searchbar svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--text-faint); }
.searchbar .input { padding-left: 44px; }

/* ------------------------------------------------------------------ autenticación */
.auth { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.auth-top {
  background: var(--brand-grad); color: #fff; padding: calc(var(--safe-t) + 36px) 24px 64px; text-align: center;
}
.auth-top img { width: 150px; height: auto; margin: 0 auto; }
.auth-top p { margin: 14px 0 0; font-weight: 600; opacity: .95; }
.auth-card {
  flex: 1; width: 100%; max-width: 480px; margin: -36px auto 0; background: var(--surface);
  border-radius: 28px 28px 0 0; padding: 28px 22px calc(var(--safe-b) + 28px); box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.auth-card .lead { color: var(--text-muted); margin: 0 0 22px; }
.auth-links { margin-top: 18px; display: grid; gap: 12px; text-align: center; font-size: 15px; }
@media (min-width: 560px) { .auth-card { border-radius: 28px; flex: none; margin-bottom: 40px; } }

/* ------------------------------------------------------------------ hojas (bottom sheets) */
.backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(17, 24, 39, .42);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .18s ease;
}
.backdrop.open { opacity: 1; }
.sheet {
  width: 100%; max-width: var(--col); max-height: 94dvh; overflow: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 26px 26px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.18);
  transform: translateY(24px); transition: transform .22s cubic-bezier(.2,.9,.3,1);
  padding-bottom: var(--safe-b);
}
.backdrop.open .sheet { transform: translateY(0); }
.sheet.full { height: 94dvh; display: flex; flex-direction: column; }
.sheet-head {
  position: sticky; top: 0; z-index: 2; background: var(--bg);
  display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px;
}
.sheet-head::before {
  content: ""; position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  width: 40px; height: 4px; border-radius: 4px; background: var(--handle);
}
.sheet-head h2 { flex: 1; font-size: 18px; font-weight: 800; }
.icon-btn { width: 42px; height: 42px; border: 0; border-radius: 12px; background: var(--surface); display: grid; place-items: center; box-shadow: var(--shadow-sm); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.sheet-body { padding: 4px 16px 20px; }
.sheet.full .sheet-body { flex: 1; overflow: auto; }
.sheet-foot { position: sticky; bottom: 0; padding: 12px 16px calc(12px + var(--safe-b)); background: linear-gradient(to top, var(--bg) 75%, transparent); }
@media (min-width: 700px) {
  .backdrop { align-items: center; }
  .sheet { border-radius: 26px; max-height: 90dvh; }
  .sheet.full { height: auto; max-height: 90dvh; }
}

/* ------------------------------------------------------------------ formulario de gasto */
.amount-box {
  background: var(--surface); border-radius: var(--radius-lg); padding: 18px 16px 14px; box-shadow: var(--shadow-sm);
  text-align: center;
}
.amount-box .cur-toggle { display: inline-flex; margin-bottom: 4px; }
.amount-input {
  display: flex; align-items: baseline; justify-content: center; gap: 6px;
}
.amount-input .sym { font-size: 30px; font-weight: 800; color: var(--text-muted); }
.amount-input { cursor: text; }
.amount-input input {
  width: 1.6ch; min-width: 1.6ch; max-width: 100%; border: 0; outline: none; background: transparent; text-align: center;
  font-size: 48px; font-weight: 800; letter-spacing: -.02em; padding: 0; caret-color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.amount-input input::placeholder { color: var(--handle); }
.amount-box .err { margin-top: 6px; }
.form-block { margin-top: 18px; }
.form-block > .label { display: flex; justify-content: space-between; align-items: center; margin: 0 2px 8px; }
.sugg { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.sugg button { border: 0; background: var(--surface-2); border-radius: 999px; padding: 8px 12px; font-size: 14px; font-weight: 600; }
.more-toggle { margin-top: 14px; }

.done { text-align: center; padding: 36px 12px 12px; }
.done .ok-ring { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 16px; display: grid; place-items: center; background: var(--success-soft); color: var(--success); animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
.done .ok-ring svg { width: 42px; height: 42px; stroke-width: 3; }
.done h2 { font-size: 22px; font-weight: 800; }
.done p { color: var(--text-muted); margin: 6px 0 24px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* Detalle de gasto */
.detail-amount { text-align: center; padding: 8px 0 18px; }
.detail-amount .bubble { margin: 0 auto 10px; width: 64px; height: 64px; font-size: 32px; border-radius: 20px; }
.detail-amount .v { font-size: 36px; font-weight: 800; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; }
.kv dt { color: var(--text-muted); font-weight: 600; font-size: 14px; }
.kv dd { margin: 0; text-align: right; font-weight: 600; word-break: break-word; }

/* Emoji y colores (categorías) */
.emoji-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.emoji-grid button { aspect-ratio: 1; min-width: 0; padding: 0; border: 1.5px solid transparent; border-radius: 12px; background: var(--surface); font-size: 21px; line-height: 1; }
.emoji-grid button[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches button { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--surface); background: var(--c); box-shadow: 0 0 0 1.5px var(--border); }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--c); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); display: inline-block; }

/* ------------------------------------------------------------------ avisos */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 80; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; max-width: 440px; width: fit-content; display: flex; align-items: center; gap: 10px;
  background: var(--toast-bg); color: #fff; border-radius: 14px; padding: 12px 16px; font-weight: 600; font-size: 15px;
  box-shadow: 0 12px 30px rgba(0,0,0,.25); animation: toastIn .22s ease;
}
.toast.error { background: var(--danger); }
.toast button { border: 0; background: none; color: #FFB27A; font-weight: 800; padding: 4px; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } }
.banner { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--primary-soft); color: var(--primary-strong); font-weight: 600; font-size: 14px; margin-bottom: 12px; }
.banner button { margin-left: auto; flex: none; }
.offline { position: fixed; top: 0; left: 0; right: 0; z-index: 90; background: #1F2328; color: #fff; text-align: center; padding: calc(var(--safe-t) + 8px) 12px 8px; font-size: 14px; font-weight: 600; }

.skeleton { background: linear-gradient(90deg, var(--skel-a) 25%, var(--skel-b) 50%, var(--skel-a) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; }
@keyframes sk { to { background-position: -200% 0; } }

.footer-note { text-align: center; color: var(--text-faint); font-size: 12px; margin: 26px 0 0; }

/* ------------------------------------------------------------------ foto de ticket */
.scan-box { background: var(--primary-soft); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.scan-box.busy { opacity: .85; }
.scan-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; color: var(--primary-strong); margin-bottom: 10px; }
.scan-title svg { width: 18px; height: 18px; }
.scan-box .btn.secondary { background: var(--surface); }
.scan-status { font-size: 14px; font-weight: 600; margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.scan-status:empty { display: none; }
.scan-status .ok { color: var(--success); }
.scan-status .warn { color: var(--primary-strong); }
.spin.dark { display: inline-block; width: 18px; height: 18px; border: 3px solid rgba(0,0,0,.12); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.needs-review { position: relative; outline: 2px dashed var(--primary); outline-offset: 4px; border-radius: 14px; }
.needs-review::before {
  content: "Revisar"; position: absolute; right: 6px; top: -10px; z-index: 1;
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 99px;
}

/* ------------------------------------------------------------------ reportes */
.chart-box { position: relative; height: 220px; margin-top: 12px; }
.chart-box.donut { height: 200px; }
.report-hero .amount { font-size: 38px; }
.bar-row.click { width: 100%; border: 0; background: none; padding: 4px 0; text-align: left; cursor: pointer; border-radius: 12px; }
.bar-row.click:active { background: var(--surface-2); }
.bubble.rank { font-size: 16px; font-weight: 800; color: var(--primary-strong); background: var(--primary-soft); }

/* ------------------------------------------------------------------ panel admin */
.app.admin { padding-bottom: 40px; --col: 900px; max-width: 900px; }
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.admin-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 12px; color: var(--text-muted); font-weight: 700; white-space: nowrap; }
.admin-tabs a svg { width: 18px; height: 18px; }
.admin-tabs a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.admin-note { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin: 10px 2px 0; }
.admin-note svg { width: 16px; height: 16px; flex: none; }
.admin-user .grow small { white-space: normal; }
.err-row { border-bottom: 1px solid var(--border); padding: 12px 14px; }
.err-row:last-child { border-bottom: 0; }
.err-row summary { cursor: pointer; font-size: 14px; }
.err-row pre { white-space: pre-wrap; word-break: break-word; font-size: 12px; background: var(--surface-2); padding: 10px; border-radius: 10px; margin: 10px 0 0; }

/* ------------------------------------------------------------------ pantalla de bloqueo */
.lock {
  position: fixed; inset: 0; z-index: 100; overflow: auto;
  background: var(--brand-grad); color: #fff;
  display: flex; flex-direction: column; align-items: center;
  padding: calc(var(--safe-t) + 40px) 24px calc(var(--safe-b) + 20px);
}
.lock-top { text-align: center; }
.lock-top img { width: 96px; height: auto; margin: 0 auto 14px; }
.lock-top h1 { font-size: 26px; font-weight: 800; }
.lock-top p { margin: 4px 0 0; opacity: .9; font-weight: 600; }
.lock-area { flex: 1; width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px 0; }
.lock-hint { margin: 0 0 14px; font-weight: 700; opacity: .95; }
.lock-foot { display: grid; gap: 4px; justify-items: center; }
.lock-switch { display: grid; gap: 2px; justify-items: center; }
.lock-link { background: none; border: 0; color: #fff; font-weight: 700; font-size: 15px; padding: 10px 14px; }
.lock-link.dim { opacity: .75; font-weight: 600; }
.lock-bio {
  display: grid; justify-items: center; gap: 12px; background: rgba(255,255,255,.16); color: #fff;
  border: 2px solid rgba(255,255,255,.45); border-radius: 28px; padding: 26px 34px; font-weight: 800; font-size: 17px;
}
.lock-bio .fp { width: 72px; height: 72px; display: grid; place-items: center; }
.lock-bio .fp svg { width: 64px; height: 64px; }
.lock-bio:active { transform: scale(.97); }
.lock-pw { width: 100%; }
.lock-pw .input { background: rgba(255,255,255,.95); border-color: transparent; }
.lock-ok { background: #fff; color: var(--primary-strong); margin-top: 12px; }
.unlock-msg { min-height: 22px; text-align: center; font-weight: 700; font-size: 14px; margin: 8px 0; color: var(--danger); }
.lock .unlock-msg { color: #fff; background: rgba(0,0,0,.18); border-radius: 10px; padding: 0 10px; }
.lock .unlock-msg:empty { background: none; }

/* Teclado de PIN */
.pinpad { width: 100%; max-width: 300px; margin: 0 auto; }
.pin-dots { display: flex; justify-content: center; gap: 14px; height: 18px; margin-bottom: 6px; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--text-faint); transition: background .1s; }
.pin-dots span.on { background: var(--primary); border-color: var(--primary); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 10px; }
.key {
  aspect-ratio: 1.25; border: 0; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-sm);
  font-size: 26px; font-weight: 700; display: grid; place-items: center; color: var(--text);
}
.key:active { transform: scale(.95); background: var(--surface-2); }
.key.ok { background: var(--primary); color: #fff; }
.key.ok[disabled] { opacity: .35; }
.key svg { width: 26px; height: 26px; stroke-width: 2.6; }
.pinpad.dark .pin-dots span { border-color: rgba(255,255,255,.7); }
.pinpad.dark .pin-dots span.on { background: #fff; border-color: #fff; }
.pinpad.dark .key { background: rgba(255,255,255,.18); color: #fff; box-shadow: none; }
.pinpad.dark .key:active { background: rgba(255,255,255,.3); }
.pinpad.dark .key.ok { background: #fff; color: var(--primary-strong); }

/* Patrón */
.pattern { width: 100%; max-width: 300px; margin: 0 auto; }
.pattern-svg { width: 100%; aspect-ratio: 1; touch-action: none; user-select: none; -webkit-user-select: none; display: block; }
.pattern-dot { fill: var(--text-faint); transition: r .1s, fill .1s; }
.pattern-dot.on { fill: var(--primary); r: 15px; }
.pattern-line { fill: none; stroke: var(--primary); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.pattern.dark .pattern-dot { fill: rgba(255,255,255,.6); }
.pattern.dark .pattern-dot.on { fill: #fff; }
.pattern.dark .pattern-line { stroke: #fff; }
.pattern.error .pattern-dot.on, .pattern.error .pattern-line { fill: var(--danger); stroke: var(--danger); }
.pattern.dark.error .pattern-dot.on { fill: #FFD3C2; }
.pattern.dark.error .pattern-line { stroke: #FFD3C2; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.setup-step { text-align: center; font-weight: 700; margin: 4px 0 16px; }

/* Ajustes > Seguridad */
.lock-status { display: flex; gap: 14px; align-items: center; }
.lock-status .ls-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-muted); flex: none; }
.lock-status.on .ls-ic { background: var(--success-soft); color: var(--success); }
.lock-status .ls-ic svg { width: 24px; height: 24px; }
.pill-on, .pill-off { font-size: 12px; font-weight: 700; border-radius: 99px; padding: 3px 9px; }
.pill-on { background: var(--success-soft); color: var(--success); }
.pill-off { background: var(--primary-soft); color: var(--primary-strong); }
.rowlink.disabled { opacity: .6; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 6px; cursor: pointer; }
.switch-row small { display: block; font-size: 13px; }
.switch {
  appearance: none; flex: none; width: 52px; height: 32px; border-radius: 99px; background: var(--handle); position: relative;
  transition: background .15s; cursor: pointer; margin: 0;
}
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(20px); }

@media (min-width: 700px) {
  .hero .amount { font-size: 52px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
}

/* ------------------------------------------------------------------ modo oscuro (sigue la preferencia del sistema) */
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #FF6A1A;
    --primary-strong: #FF9152;
    --primary-soft: #3A2314;
    --primary-ring: rgba(255, 106, 26, .35);
    --bg: #111113;
    --surface: #1C1C1F;
    --surface-2: #27272B;
    --text: #F2F2F3;
    --text-muted: #A1A1AA;
    --text-faint: #71717A;
    --border: #2E2E33;
    --success: #4ADE80;
    --success-soft: #13301E;
    --danger: #F87171;
    --danger-soft: #3B1A1A;
    --usd: #2DD4BF;
    --tint: #1C1C1F;
    --nav-bg: rgba(28, 28, 31, .92);
    --handle: #3F3F46;
    --toast-bg: #3F3F46;
    --skel-a: #222226;
    --skel-b: #2C2C31;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 8px 28px -8px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
  select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2720%27 height=%2720%27 fill=%27none%27 stroke=%27%23A1A1AA%27 stroke-width=%272%27 stroke-linecap=%27round%27%3E%3Cpath d=%27m5 8 5 5 5-5%27/%3E%3C/svg%3E"); }
  .pin-dots span { border-color: var(--text-faint); }
  .lock-pw .input { color: #1F2328; }
}

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