:root {
  --rojo: #E92622; --amarillo: #F1BF1E; --verde: #25973D; --azul: #2983C2; --negro: #262925;
  --fondo: #F4F5F2; --tarjeta: #FFFFFF; --gris-ui: #EEF0EC; --gris-txt: #8A8F87;
  --rojo-s: color-mix(in srgb, var(--rojo) 13%, #FFFFFF);
  --amarillo-s: color-mix(in srgb, var(--amarillo) 15%, #FFFFFF);
  --verde-s: color-mix(in srgb, var(--verde) 13%, #FFFFFF);
  --azul-s: color-mix(in srgb, var(--azul) 13%, #FFFFFF);
  --sombra: 0 2px 12px rgba(38,41,37,.06);
  --sombra-nav: 0 8px 28px rgba(38,41,37,.14);
  --franja: linear-gradient(90deg, var(--rojo) 0 25%, var(--amarillo) 25% 50%, var(--verde) 50% 75%, var(--azul) 75% 100%);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 24px; --nav-h: 68px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fondo); color: var(--negro); font-family: var(--font); font-size: 15px; -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--tarjeta); }
.login-card { width: 100%; max-width: 340px; text-align: center; }
.login-logo { display: block; height: 168px; width: auto; margin: 0 auto 14px; }
.login-name { font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.login-card .franja { width: 96px; margin: 14px auto 12px; }
.login-card .muted { margin: 0 0 30px; font-size: 14px; font-weight: 500; }
.login-card input { width: 100%; height: 60px; padding: 0 16px; border-radius: 18px; border: 0; background: var(--gris-ui); margin-bottom: 12px; text-align: center; letter-spacing: .3em; font-size: 22px; font-weight: 600; }
.login-card input::placeholder { letter-spacing: 0; font-size: 16px; font-weight: 500; color: var(--gris-txt); }
.login-card input:focus { outline: 2px solid var(--negro); }
.login-card .btn { height: 56px; font-size: 16px; }
.err { color: var(--rojo); min-height: 1.2em; font-size: 14px; font-weight: 600; }
.franja { height: 3px; border-radius: 99px; background: var(--franja); }

/* ---------- layout ---------- */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 10px) 16px 12px; background: var(--fondo); }
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--franja); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.brand img { height: 40px; width: auto; display: block; }
.round-btn { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--tarjeta); box-shadow: var(--sombra); display: grid; place-items: center; cursor: pointer; color: var(--negro); }
.round-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sync { position: absolute; top: 1px; right: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--gris-txt); border: 2px solid var(--tarjeta); }
.sync.ok { background: var(--verde); } .sync.busy { background: var(--amarillo); } .sync.off { background: var(--rojo); }
main { max-width: 860px; margin: 0 auto; padding: 18px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 110px); }
.tabs { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h); padding: 0 6px; background: var(--tarjeta); border-radius: 999px; box-shadow: var(--sombra-nav); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--gris-txt); font-size: 10.5px; font-weight: 600; }
.tabs a::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.tabs svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--negro); }
.tabs a.on::after { background: var(--negro); }
@media (min-width: 900px) {
  .tabs { top: 0; bottom: 0; left: 0; right: auto; width: 96px; height: auto; grid-template-columns: 1fr; grid-auto-rows: 76px; align-content: start; padding: 84px 0 0; border-radius: 0; box-shadow: var(--sombra); }
  .tabs a { font-size: 11.5px; }
  main, .top { margin-left: 96px; }
  .top { padding-left: 28px; padding-right: 28px; }
  main { padding: 24px 28px 48px; }
}

/* ---------- tipografía ---------- */
h1 { font-weight: 600; font-size: 28px; line-height: 1.15; margin: 4px 0 4px; letter-spacing: -.02em; }
h2 { font-weight: 700; font-size: 20px; margin: 0; letter-spacing: -.01em; }
h3 { font-size: 17px; font-weight: 700; margin: 26px 0 12px; letter-spacing: -.01em; }
.sub { color: var(--gris-txt); margin: 0 0 18px; font-size: 14.5px; font-weight: 500; }
.muted { color: var(--gris-txt); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--verde); font-weight: 700; } .neg { color: var(--rojo); font-weight: 700; }
.fig { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.orig { color: var(--gris-txt); font-weight: 500; }

/* ---------- tarjetas ---------- */
.card { background: var(--tarjeta); border-radius: var(--r); padding: 20px; box-shadow: var(--sombra); margin-bottom: 14px; }
.card.tap { cursor: pointer; }
.card.tap:active, .item.tap:active { transform: scale(.99); }
a.card { display: block; text-decoration: none; }
.hero { background: var(--rojo); color: #FFFFFF; }
.hero .hero-l { font-size: 14px; font-weight: 600; }
.hero .hero-s { font-size: 13.5px; font-weight: 500; }
.hero .bar { background: rgba(255,255,255,.3); margin-top: 8px; }
.hero .bar > i { background: #FFFFFF; }
.big { font-size: 46px; font-weight: 700; line-height: 1.05; margin: 8px 0 6px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 14px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
.kpi { background: var(--tarjeta); border-radius: var(--r); padding: 18px; box-shadow: var(--sombra); min-width: 0; }
.kpi .ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 12px; color: #FFFFFF; background: var(--negro); }
.kpi .ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic.rojo, .thumb.rojo { background: var(--rojo); } .ic.verde, .thumb.verde { background: var(--verde); } .ic.azul, .thumb.azul { background: var(--azul); }
.ic.negro, .thumb.negro { background: var(--negro); }
.kpi .ic.amarillo, .thumb.amarillo { background: var(--amarillo); color: var(--negro); }
.thumb.gris { background: var(--gris-ui); color: var(--negro); }
.kpi .l { font-size: 12.5px; color: var(--gris-txt); font-weight: 600; }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; overflow-wrap: anywhere; }
.kpi .s { font-size: 12.5px; color: var(--gris-txt); margin-top: 3px; font-weight: 500; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row + .row { margin-top: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.figs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.figs > div { background: var(--fondo); border-radius: 16px; padding: 12px 14px; min-width: 0; }
.figs .small { font-weight: 600; margin-bottom: 2px; }
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.item-title { font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 1.2; padding: 5px 10px; border-radius: 999px; background: var(--amarillo-s); color: var(--negro); font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--amarillo); flex: none; }
.badge.green { background: var(--verde-s); } .badge.green::before { background: var(--verde); }
.badge.red { background: var(--rojo-s); } .badge.red::before { background: var(--rojo); }
.badge.blue { background: var(--azul-s); } .badge.blue::before { background: var(--azul); }
.badge.gray { background: var(--gris-ui); } .badge.gray::before { background: var(--gris-txt); }
.divider { height: 1px; background: var(--gris-ui); margin: 14px 0; }
.note { background: var(--azul-s); color: var(--negro); border-radius: 20px; padding: 14px 16px; font-size: 14px; line-height: 1.5; margin-bottom: 14px; font-weight: 500; }
.note.red { background: var(--rojo-s); }
.note.yellow { background: var(--amarillo-s); }
.note b { font-weight: 700; }
.empty { text-align: center; color: var(--gris-txt); padding: 30px 12px; font-weight: 500; }

/* tarjeta BCV */
.bcv { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 20px; }
.bcv .ic { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--azul); color: #FFFFFF; font-weight: 700; font-size: 13px; }
.bcv .t { font-weight: 700; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.bcv .t span { white-space: nowrap; }
.bcv .d { font-size: 12.5px; color: var(--gris-txt); font-weight: 500; margin-top: 1px; }
.bcv.vieja { background: var(--rojo-s); }
.bcv.vieja .ic { background: var(--rojo); }
.bcv.vieja .t, .bcv.vieja .d b { color: var(--rojo); }
.bcv.vieja .d { color: var(--negro); }

/* ---------- listas tipo carrito ---------- */
.list { padding: 8px 16px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; }
.item + .item { border-top: 1px solid var(--gris-ui); }
.thumb { width: 48px; height: 48px; border-radius: 15px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 19px; color: #FFFFFF; }
.item-main { flex: 1; min-width: 0; }
.item-main .item-title { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.item-sub { font-size: 12.5px; color: var(--gris-txt); font-weight: 500; margin-top: 2px; }
.item-end { text-align: right; flex: none; }
.pill { display: inline-block; background: var(--negro); color: #FFFFFF; border-radius: 999px; padding: 7px 13px; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- barras ---------- */
.bar { height: 10px; border-radius: 99px; background: var(--gris-ui); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--azul); border-radius: 99px; }
.bar.green > i { background: var(--verde); } .bar.yellow > i { background: var(--amarillo); } .bar.red > i { background: var(--rojo); } .bar.black > i { background: var(--negro); }
.stackbar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--gris-ui); margin: 14px 0 10px; gap: 2px; }
.stackbar i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; font-weight: 500; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 6px; }
.hbars .hb { display: grid; grid-template-columns: 112px 1fr 64px; gap: 10px; align-items: center; font-size: 13px; margin: 10px 0; font-weight: 500; }
.hbars .hb .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- tablas ---------- */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 600; color: var(--gris-txt); font-size: 12px; padding: 2px 10px; white-space: nowrap; }
.tbl td { padding: 12px 10px; background: var(--fondo); vertical-align: middle; font-weight: 500; }
.tbl td:first-child { border-radius: 14px 0 0 14px; font-weight: 600; }
.tbl td:last-child { border-radius: 0 14px 14px 0; }
.tbl td.r, .tbl th.r { text-align: right; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; background: var(--gris-ui); }
.tbl a { text-decoration: none; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card.scroll-x { padding: 14px; }

/* ---------- controles ---------- */
.btn { border: 0; background: var(--gris-ui); color: var(--negro); height: 48px; padding: 0 20px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14.5px; display: inline-flex; align-items: center; gap: 6px; justify-content: center; white-space: nowrap; }
.btn.primary { background: var(--amarillo); color: var(--negro); font-weight: 700; }
.btn.dark { background: var(--negro); color: #FFFFFF; }
.btn.danger { color: var(--rojo); }
.btn.sm { height: 40px; padding: 0 16px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn:active, .fab:active, .round-btn:active { transform: scale(.97); }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn { background: var(--gris-ui); border: 0; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; color: var(--negro); font-size: 15px; line-height: 1; display: grid; place-items: center; flex: none; }
.fab { position: fixed; right: 20px; bottom: calc(12px + var(--nav-h) + env(safe-area-inset-bottom) + 14px); z-index: 15; width: 56px; height: 56px; border-radius: 50%; background: var(--amarillo); color: var(--negro); border: 0; box-shadow: var(--sombra-nav); cursor: pointer; display: grid; place-items: center; }
.fab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
@media (min-width: 900px) { .fab { bottom: 28px; right: 28px; } }
.chips { display: flex; gap: 8px; margin: 0 -16px 16px; padding: 2px 16px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 0; background: var(--gris-ui); color: var(--negro); height: 42px; padding: 0 18px; border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 600; white-space: nowrap; }
.chips button.on { background: var(--amarillo); font-weight: 700; }
label.f { display: block; margin-bottom: 14px; min-width: 0; }
label.f > span { display: block; font-size: 12.5px; color: var(--gris-txt); margin-bottom: 6px; font-weight: 600; }
.in, label.f input, label.f select, label.f textarea, .line input, .line select { width: 100%; height: 48px; padding: 0 14px; border: 0; border-radius: 14px; background: var(--gris-ui); font-size: 16px; font-weight: 500; min-width: 0; }
label.f textarea { height: auto; padding: 12px 14px; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--negro) 50%), linear-gradient(135deg, var(--negro) 50%, transparent 50%) !important; background-position: calc(100% - 19px) 21px, calc(100% - 14px) 21px !important; background-size: 5px 5px, 5px 5px !important; background-repeat: no-repeat !important; padding-right: 30px !important; text-overflow: ellipsis; }
.in:focus, label.f input:focus, label.f select:focus, label.f textarea:focus, .line input:focus, .line select:focus { outline: 2px solid var(--negro); outline-offset: -2px; }
label.chk { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 14.5px; font-weight: 500; min-height: 32px; }
label.chk input { width: 24px; height: 24px; accent-color: var(--verde); flex: none; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.fgrid .full { grid-column: 1 / -1; }
.hint { font-size: 12.5px; color: var(--gris-txt); margin-top: -8px; margin-bottom: 14px; font-weight: 500; }
.money { display: grid; grid-template-columns: 1fr 88px; gap: 8px; }
.stepper { display: flex; align-items: center; gap: 6px; background: var(--gris-ui); border-radius: 999px; padding: 4px; height: 48px; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--tarjeta); color: var(--negro); font-size: 20px; font-weight: 600; line-height: 1; cursor: pointer; flex: none; box-shadow: var(--sombra); }
label.f .stepper input { height: 40px; padding: 0; text-align: center; background: transparent; font-weight: 700; font-variant-numeric: tabular-nums; }
label.f .stepper input:focus { outline: 0; }
.cobro { background: var(--amarillo-s); border-radius: 20px; padding: 16px; margin-bottom: 14px; }
.cobro .big { font-size: 30px; margin: 4px 0; }
.cobro label.f { margin: 12px 0 0; }
.cobro label.f input { background: var(--tarjeta); }

/* líneas de costo */
.lines { margin: 8px 0 12px; display: grid; gap: 10px; }
.line { display: grid; grid-template-columns: 78px 1fr 80px 40px; gap: 8px; align-items: center; background: var(--fondo); border-radius: 20px; padding: 12px; }
.line input, .line select { background: var(--tarjeta); }
.line .cat { grid-column: 1 / -1; display: grid; grid-template-columns: 146px 1fr; gap: 8px; }
.line .meta { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--gris-txt); font-weight: 500; }
.line .meta b { color: var(--negro); font-size: 14px; }
.line .icon-btn { background: var(--tarjeta); color: var(--rojo); }
.soft { background: var(--fondo); border-radius: 20px; padding: 16px; margin-top: 14px; }
.calc { position: sticky; bottom: -20px; z-index: 2; background: var(--tarjeta); margin: 14px 0 0; padding: 8px 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; background: var(--gris-ui); border-radius: 20px; padding: 12px 8px; }
.grid3 span { display: block; font-size: 12px; color: var(--gris-txt); font-weight: 600; }
.grid3 b { font-size: 18px; font-weight: 700; }

/* checklist de lanzamiento */
.check-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--gris-ui); }
.check-row label.chk { margin: 0; flex: 1; }
.check-row .amt { display: block; font-weight: 700; cursor: pointer; text-align: right; }

/* ---------- sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: rgba(38,41,37,.45); }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 94dvh; background: var(--tarjeta); border-radius: 28px 28px 0 0; display: flex; flex-direction: column; animation: up .2s ease-out; }
.sheet-grip { width: 44px; height: 5px; border-radius: 99px; background: var(--gris-txt); margin: 10px auto 0; flex: none; }
@media (min-width: 700px) { .sheet-panel { left: 50%; top: 50%; bottom: auto; width: min(640px, 94vw); transform: translate(-50%, -50%); border-radius: 28px; max-height: 90dvh; animation: none; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px 10px; }
.sheet-body { padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-actions { display: flex; gap: 8px; margin-top: 10px; }
.sheet-actions .btn { flex: 1; padding: 0 12px; }
.toast { position: fixed; left: 50%; bottom: calc(12px + var(--nav-h) + 24px); transform: translateX(-50%) translateY(20px); background: var(--negro); color: #FFFFFF; padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
.toast.on { opacity: 1; transform: translateX(-50%); }

/* guía */
.guide p, .guide li { line-height: 1.6; font-size: 14.5px; font-weight: 500; }
.guide ol, .guide ul { padding-left: 20px; }
.guide h4 { font-size: 17px; font-weight: 700; margin: 22px 0 8px; }
.guide h4:first-child { margin-top: 0; }
.rank { display: grid; grid-template-columns: 32px 1fr; gap: 12px; margin: 12px 0; align-items: start; font-size: 14.5px; line-height: 1.5; font-weight: 500; }
.rank .n { width: 32px; height: 32px; border-radius: 50%; background: var(--amarillo); color: var(--negro); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
