/* ==========================================================
   REPARTO · estilos
   Colores y formas según el diseño (naranja #F26B1D, fondo crema)
   ========================================================== */
:root {
  --brand: #F26B1D;
  --brand-600: #DE5A0E;
  --brand-soft: #FDE7D9;
  --bg: #F4F3F0;
  --card: #FFFFFF;
  --ink: #1B1916;
  --ink-2: #3A3632;
  --muted: #77716A;
  --line: #E8E4DE;
  --soft: #EFEDE9;
  --chip-dark: #1B1916;
  --chip-dark-ink: #fff;
  --blue: #1E5BC6; --blue-bg: #E4EDFC;
  --green: #1C7A3E; --green-bg: #E2F3E7;
  --red: #B42318; --red-bg: #FCE6E3;
  --amber: #9A5B00; --amber-bg: #FFF1D6;
  --shadow: 0 1px 2px rgba(27, 25, 22, .04), 0 6px 20px rgba(27, 25, 22, .05);
  --r: 20px;
  --tabbar-h: 74px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121110; --card: #1D1B19; --ink: #F4F2EF; --ink-2: #D9D5D0; --muted: #9D978F;
    --line: #2C2926; --soft: #282522; --brand-soft: #3A2415; --chip-dark: #F4F2EF; --chip-dark-ink: #1B1916;
    --blue: #7FA9F5; --blue-bg: #1B2A45; --green: #6FCB8E; --green-bg: #173323; --red: #F29387; --red-bg: #3D1C18;
    --amber: #F3BE63; --amber-bg: #3A2A0E; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121110; --card: #1D1B19; --ink: #F4F2EF; --ink-2: #D9D5D0; --muted: #9D978F;
  --line: #2C2926; --soft: #282522; --brand-soft: #3A2415; --chip-dark: #F4F2EF; --chip-dark-ink: #1B1916;
  --blue: #7FA9F5; --blue-bg: #1B2A45; --green: #6FCB8E; --green-bg: #173323; --red: #F29387; --red-bg: #3D1C18;
  --amber: #F3BE63; --amber-bg: #3A2A0E; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased; overscroll-behavior-y: contain;
}
body.noscroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
.ic { flex: none; display: block; }
.rot { animation: rot 1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

html, body { overflow-x: hidden; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }
.page { padding: 18px 16px calc(var(--tabbar-h) + 24px + var(--safe-b)); }
body.no-tabs .page { padding-bottom: 32px; }
body.no-tabs .tabbar { display: none; }

.muted { color: var(--muted); }
.muted-strong { color: var(--muted); font-weight: 600; font-size: 14px; letter-spacing: .01em; }
.small { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 18px; }
.block { display: block; }
.red { color: var(--red); }
.txt-red { color: var(--red); }
.pend { color: var(--brand); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Pantalla de carga ---------- */
.splash { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; }
.splash b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.splash p { color: var(--muted); max-width: 320px; display: flex; gap: 8px; align-items: center; justify-content: center; }

/* ---------- Login ---------- */
.login { padding: 48px 20px 32px; min-height: 100dvh; display: flex; flex-direction: column; }
.login-logo { width: 64px; height: 64px; border-radius: 18px; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 20px rgba(242, 107, 29, .3); }
.login-title { font-size: 32px; font-weight: 800; letter-spacing: -.03em; margin-top: 20px; }
.login-sub { color: var(--muted); font-size: 17px; margin-top: 6px; margin-bottom: 18px; }
.lbl { display: block; font-weight: 600; font-size: 15px; margin: 16px 0 8px; }
.input-ic { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 0 14px; height: 58px; color: var(--muted); }
.input-ic:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input-ic input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 17px; color: var(--ink); height: 100%; min-width: 0; }
.input-ic input[readonly] { color: var(--muted); }
.eye { color: var(--muted); padding: 8px; margin-right: -8px; }
.login-row { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 20px; gap: 8px; font-size: 15px; }
.login-row .check { font-size: 16px; }
.login-row .link { text-align: right; }
.link { color: var(--brand); font-weight: 600; }
.link.danger, .danger { color: var(--red); }
.center-link { display: block; margin: 14px auto 0; text-align: center; font-weight: 600; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 15px; margin: 26px 0 16px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.bio-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.login-foot { text-align: center; color: var(--muted); font-size: 14px; margin-top: 28px; }
.login-foot.small { margin-top: 6px; font-size: 13px; }
.login-foot b { color: var(--ink); }
#app.login-mode { background: var(--bg); }

/* ---------- Check ---------- */
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 16px; user-select: none; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check span { width: 24px; height: 24px; border-radius: 7px; border: 1.8px solid #B8B2AB; display: grid; place-items: center; background: var(--card); flex: none; transition: .15s; }
.check input:checked + span { background: var(--brand); border-color: var(--brand); }
.check input:checked + span::after { content: ''; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-soft); }
.check.big { display: flex; margin: 18px 0 6px; font-weight: 500; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 18px; border-radius: 15px; font-weight: 700; font-size: 16px; white-space: nowrap; transition: transform .08s, background .15s, opacity .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn-lg { height: 58px; font-size: 18px; border-radius: 17px; }
.btn.sm { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(242, 107, 29, .28); }
.btn-primary:hover { background: var(--brand-600); }
.btn-outline { background: var(--card); border: 1px solid var(--line); }
.btn-soft { background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 15px; height: 46px; padding: 0 10px; }
.btn-ghost { background: var(--soft); font-weight: 600; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-soft { background: var(--red-bg); color: var(--red); }
.btn-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 14px; }
.btn-row .btn { white-space: normal; line-height: 1.15; text-align: center; padding: 0 8px; min-width: 0; font-size: 15px; gap: 6px; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.iconbtn { width: 48px; height: 48px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); display: grid; place-items: center; flex: none; position: relative; }
.iconbtn.sm { width: 36px; height: 36px; }
.iconbtn.lg { width: 52px; height: 52px; }
.iconbtn.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.iconbtn .dot { position: absolute; top: 10px; right: 11px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); border: 2px solid var(--card); }
.spin { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: rot .7s linear infinite; vertical-align: -3px; opacity: .8; }
.spin.sm { width: 14px; height: 14px; border-width: 2px; }

/* ---------- Encabezados ---------- */
.bar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; min-height: 48px; }
.bar-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-title.big { font-size: 30px; letter-spacing: -.03em; }
.bar-right { display: flex; gap: 10px; }
.home-hdr { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.home-hi { flex: 1; min-width: 0; }
.home-hi h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.home-hi p { color: var(--muted); font-size: 15px; }
.sec-hd { display: flex; justify-content: space-between; align-items: baseline; margin: 24px 0 12px; }
.sec-hd h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.grp { font-size: 13px; font-weight: 700; letter-spacing: .08em; color: var(--muted); margin: 20px 2px 10px; }

/* ---------- Avatares ---------- */
.avatar { width: 50px; height: 50px; border-radius: 50%; background: var(--soft); color: var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 16px; flex: none; }
.avatar.sm { width: 38px; height: 38px; font-size: 14px; }
.avatar.lg { width: 58px; height: 58px; font-size: 20px; }
.avatar.xl { width: 84px; height: 84px; font-size: 28px; }
.avatar-brand { background: var(--brand-soft); color: var(--brand); }
.profile .avatar.xl { background: var(--brand-soft); color: var(--brand); margin: 0 auto 12px; }

/* ---------- Tarjetas ---------- */
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card-t { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.card-t:not(:first-child) { margin-top: 18px; }
.caps { font-size: 14px; font-weight: 700; letter-spacing: .08em; color: var(--muted); margin-bottom: 14px; }
.card-hd { display: flex; justify-content: space-between; align-items: baseline; }
.card-hd .caps, .card-hd .card-t { margin-bottom: 14px; }
.list-card { padding: 4px 18px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; box-shadow: var(--shadow); }
.kpi span { font-size: 15px; font-weight: 500; color: var(--ink-2); }
.kpi b { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi small { color: var(--muted); font-size: 14px; }
.kpi-brand { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 10px 24px rgba(242, 107, 29, .28); }
.kpi-brand span, .kpi-brand small { color: rgba(255, 255, 255, .9); }

/* ---------- Gráfico ---------- */
.chart-hd { display: flex; justify-content: space-between; font-size: 17px; margin-bottom: 14px; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; height: 150px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }
.bar-track { flex: 1; width: 100%; max-width: 38px; display: flex; align-items: flex-end; }
.bar-fill { width: 100%; background: var(--soft); border-radius: 9px; transition: height .4s; }
.bar-fill.on { background: var(--brand); }
.bar-col span { font-size: 13px; color: var(--muted); font-weight: 600; }
.bar-col span.on { color: var(--ink); font-weight: 800; }

/* ---------- Próximos ---------- */
.up-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.up-time { display: flex; flex-direction: column; align-items: center; min-width: 50px; }
.up-time b { font-size: 17px; }
.up-time small { color: var(--muted); font-size: 13px; }
.up-main { flex: 1; min-width: 0; }
.up-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-addr { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* ---------- Estados ---------- */
.st { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.st-gray { background: var(--soft); color: var(--ink-2); }
.st-blue { background: var(--blue-bg); color: var(--blue); }
.st-green { background: var(--green-bg); color: var(--green); }
.st-red { background: var(--red-bg); color: var(--red); }
.st-amber { background: var(--amber-bg); color: var(--amber); }

/* ---------- Buscador y chips ---------- */
.search { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 16px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; color: var(--muted); margin-bottom: 14px; }
.search:focus-within { border-color: var(--brand); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 17px; color: var(--ink); min-width: 0; height: 100%; }
.search input::-webkit-search-cancel-button { display: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 8px; padding: 0 16px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0 0 8px; padding: 0; }
.chip { height: 42px; padding: 0 18px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 15px; white-space: nowrap; flex: none; display: inline-flex; align-items: center; gap: 8px; }
.chip.on { background: var(--chip-dark); color: var(--chip-dark-ink); border-color: var(--chip-dark); }
.chip.opt.on { background: var(--brand-soft); color: var(--ink); border-color: var(--brand); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.gray { background: #3A3632; } .dot.blue { background: #1E6FE8; } .dot.green { background: #1C8B47; }
.chip.light.on { background: var(--card); color: var(--ink); border-color: var(--ink); box-shadow: var(--shadow); }
.chip.light:not(.on) { opacity: .55; }

/* ---------- Pedidos ---------- */
.ocard { padding: 16px 18px; cursor: pointer; }
.ocard-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ocard-mid { display: flex; justify-content: space-between; gap: 12px; }
.ocard-mid h3 { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.ocard-mid p { font-size: 15px; }
.ocard-total { font-size: 19px; font-weight: 800; white-space: nowrap; }
.ocard-act { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.status-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; font-weight: 600; color: var(--ink-2); }
.note { display: flex; gap: 10px; align-items: flex-start; background: var(--soft); border-radius: 14px; padding: 12px 14px; margin: 0 0 14px; font-size: 15px; color: var(--ink-2); }
.note.warn { background: var(--amber-bg); color: var(--amber); }
.cust-card { display: flex; align-items: center; gap: 14px; }
.cust-card > div:nth-child(2) { flex: 1; min-width: 0; }
.cust-card p { font-size: 14px; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 14px; }
.quick.four { grid-template-columns: repeat(4, 1fr); margin: 18px 0; }
.q-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.q-btn .ic { width: 60px; height: 60px; padding: 18px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); box-sizing: border-box; }
.q-btn.brand .ic { background: var(--brand); color: #fff; border-color: var(--brand); }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.totals > div { display: flex; justify-content: space-between; padding: 5px 0; color: var(--ink-2); font-size: 16px; }
.totals { padding-top: 8px; }
.card.totals { padding: 14px 18px; }
.totals .grand { font-size: 22px; font-weight: 800; color: var(--ink); padding-top: 12px; margin-top: 6px; border-top: 1px solid var(--line); }
.totals.slim .grand { border: 0; margin: 0; }
.info > div { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; font-size: 15px; }
.info > div + div { border-top: 1px solid var(--line); }
.info span { color: var(--muted); }
.info b { text-align: right; font-weight: 600; }
.info .col { flex-direction: column; gap: 4px; }

/* ---------- Productos (stepper) ---------- */
.prow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.prow:last-child { border-bottom: 0; }
.prow-info { flex: 1; min-width: 0; }
.prow-info b { display: block; font-size: 17px; font-weight: 700; }
.prow-info small { color: var(--muted); font-size: 14px; }
.prow-info small b { display: inline; font-size: 14px; color: var(--ink); }
.prow.sel .prow-info > b { color: var(--ink); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 46px; height: 46px; border-radius: 14px; background: var(--soft); border: 1px solid var(--line); display: grid; place-items: center; }
.stepper button:active { background: var(--brand-soft); }
.stepper span { min-width: 30px; text-align: center; font-weight: 700; font-size: 18px; }
.qty-only { font-weight: 700; font-size: 18px; padding-right: 16px; }
.cust-pick { display: flex; gap: 14px; align-items: center; }
.cust-pick b { font-size: 19px; }
.addr { display: flex; gap: 6px; align-items: flex-start; color: var(--muted); font-size: 15px; margin-top: 12px; }
.addr .ic { margin-top: 2px; }
.mini-t { font-size: 15px; font-weight: 700; margin: 16px 0 8px; }

/* ---------- Formularios ---------- */
.field { display: block; margin-top: 14px; }
.field > span { display: block; font-size: 15px; color: var(--ink-2); margin-bottom: 7px; font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; height: 54px; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-size: 17px; outline: 0; }
.field textarea { height: auto; padding: 12px 16px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field b { display: flex; align-items: center; height: 54px; font-size: 20px; }
.hint { display: block; font-size: 13px; margin-top: 6px; min-height: 1em; }
.hint.ok { color: var(--green); } .hint.bad { color: var(--red); }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.two > .field { min-width: 0; }
.cash-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.seg { display: flex; background: var(--soft); border-radius: 14px; padding: 4px; gap: 2px; }
.seg button { flex: 1; min-width: 0; min-height: 44px; border-radius: 11px; font-weight: 600; font-size: 15px; color: var(--ink-2); line-height: 1.15; padding: 4px; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.minimap { height: 160px; border-radius: 16px; background: var(--soft); margin-top: 14px; overflow: hidden; position: relative; }
.minimap-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 14px; text-align: center; padding: 10px; }
.gps-st { color: var(--muted); font-size: 14px; margin: 12px 0 4px; display: flex; gap: 6px; align-items: center; }

/* ---------- Clientes ---------- */
.crow { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.crow:last-child { border-bottom: 0; }
.crow-main { flex: 1; min-width: 0; }
.crow-main b { display: block; font-size: 17px; }
.crow-main small { display: block; color: var(--muted); font-size: 14px; }
.crow-main em { display: block; font-style: normal; color: var(--brand); font-weight: 600; font-size: 14px; margin-top: 2px; }
.crow-main em.red { color: var(--red); }
.crow > .ic { color: var(--muted); }
.profile { text-align: center; margin-top: 6px; }
.profile h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.saldo { margin-top: 6px; color: var(--red); }
.hrow { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.hrow small { display: block; color: var(--muted); font-size: 13px; }
.hrow-r { display: flex; align-items: center; gap: 10px; }

/* ---------- Listas ---------- */
.list { display: flex; flex-direction: column; margin-top: 8px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--line); text-align: left; width: 100%; }
.list-row.sel { color: var(--brand); font-weight: 700; }
.list-row small { font-weight: 400; }
.mrow { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.mrow:last-child { border-bottom: 0; }
.mic { width: 42px; height: 42px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; flex: none; }
.mtxt { flex: 1; min-width: 0; }
.mtxt b { display: block; }
.mtxt small { color: var(--muted); font-size: 14px; }
.mrow.soon { opacity: .55; }
.me-card { display: flex; align-items: center; gap: 14px; }
.me-card b { font-size: 18px; display: block; }
.me-card small { display: block; color: var(--muted); font-size: 14px; }
.prod-row { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.prod-row:last-child { border-bottom: 0; }
.prod-row small { display: block; color: var(--muted); font-size: 13px; }
.prod-row.off { opacity: .5; }
.prod-r { text-align: right; }
.dev-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.dev-row small { display: block; color: var(--muted); font-size: 13px; }
.ev-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ev-row:last-child { border-bottom: 0; }
.ev-row small { display: block; color: var(--muted); font-size: 13px; }
.ev-row small.red { color: var(--red); }
.ev-act { display: flex; flex-direction: column; gap: 6px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty h3 { color: var(--ink); font-size: 18px; }
.loading { display: flex; gap: 10px; justify-content: center; padding: 30px; color: var(--muted); }

/* ---------- Sincronización ---------- */
.syncpill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 99px; margin: 2px 0 4px; background: var(--soft); color: var(--muted); max-width: 100%; }
.syncpill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.syncpill.ok { background: var(--green-bg); color: var(--green); }
.syncpill.off { background: var(--soft); color: var(--ink-2); }
.syncpill.warn { background: var(--amber-bg); color: var(--amber); }
.syncpill.run { background: var(--blue-bg); color: var(--blue); }
.offbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 600; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
body.map-mode .offbar { position: fixed; left: 0; right: 0; }
.sync-hero { display: flex; gap: 14px; align-items: center; }
.sync-hero small { display: block; color: var(--muted); font-size: 14px; }
.sync-ic { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; }
.sync-ic.ok { background: var(--green-bg); color: var(--green); }
.sync-ic.off { background: var(--soft); color: var(--muted); }
.install-card { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.install-card div { flex: 1; }
.install-card small { display: block; color: var(--muted); font-size: 13px; }

/* ---------- Facturas ---------- */
.inv-hero { background: #1B1916; color: #fff; border-radius: 22px; padding: 18px; margin-bottom: 14px; }
.inv-hero-top { display: flex; justify-content: space-between; font-size: 15px; color: rgba(255, 255, 255, .85); }
.inv-hero > b { display: block; font-size: 36px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 10px; }
.inv-hero-row { display: grid; grid-template-columns: repeat(3, 1fr); }
.inv-hero-row small { display: block; color: rgba(255, 255, 255, .7); font-size: 14px; }
.inv-hero-row b { font-size: 20px; }
:root[data-theme="dark"] .inv-hero { background: #26231F; }
.irow { display: flex; justify-content: space-between; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.irow:last-child { border-bottom: 0; }
.irow small { display: block; color: var(--muted); font-size: 14px; }
.irow-r { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* ---------- Barra inferior ---------- */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card); border-top: 1px solid var(--line); padding: 8px 6px calc(8px + var(--safe-b)); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.tab-ic { width: 56px; height: 34px; border-radius: 99px; display: grid; place-items: center; transition: background .15s; }
.tab.on { color: var(--brand); font-weight: 700; }
.tab.on .tab-ic { background: var(--brand-soft); }

/* ---------- Botón flotante ---------- */
.fab { position: fixed; z-index: 41; right: max(16px, calc(50% - 264px)); bottom: calc(var(--tabbar-h) + 14px + var(--safe-b)); display: flex; align-items: center; gap: 8px; height: 58px; padding: 0 24px; border-radius: 99px; background: var(--brand); color: #fff; font-weight: 700; font-size: 18px; box-shadow: 0 10px 26px rgba(242, 107, 29, .4); }
.fab-space { height: 70px; }
.sticky-cta { position: fixed; z-index: 41; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; bottom: 0; padding: 12px 16px calc(12px + var(--safe-b)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.sticky-space { height: 90px; }

/* ---------- Hoja inferior ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 100; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .4); opacity: 0; transition: opacity .2s; }
.sheet { position: absolute; left: 50%; bottom: 0; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: var(--bg); border-radius: 26px 26px 0 0; transform: translate(-50%, 100%); transition: transform .22s ease-out; padding-bottom: var(--safe-b); overscroll-behavior: contain; }
.sheet.full { height: 92dvh; }
.sheet-wrap.open .sheet-bg { opacity: 1; }
.sheet-wrap.open .sheet { transform: translate(-50%, 0); }
.sheet-grip { width: 42px; height: 5px; background: var(--line); border-radius: 9px; margin: 10px auto 0; }
.sheet-body { padding: 14px 18px 22px; }
.sheet-hd { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 8px; }
.sheet-body > .btn-block { margin-top: 16px; }
.sheet-body .prow { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; margin-bottom: 8px; }

/* ---------- Avisos ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 86px + var(--safe-b)); transform: translate(-50%, 20px); z-index: 200; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 15px; max-width: calc(100% - 32px); width: max-content; opacity: 0; pointer-events: none; transition: .2s; text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); color: #fff; }
.toast.ok { background: #1C7A3E; color: #fff; }
body.no-tabs .toast { bottom: calc(100px + var(--safe-b)); }

/* ---------- Mapa ---------- */
body.map-mode { overflow: hidden; }
body.map-mode .page { padding: 0; }
.map-page { position: fixed; inset: 0; bottom: calc(var(--tabbar-h) + var(--safe-b)); max-width: 560px; margin: 0 auto; }
.map { position: absolute; inset: 0; background: #E9E5DE; z-index: 1; }
:root[data-theme="dark"] .map { background: #26231F; }
.map-offline { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; color: var(--muted); padding: 30px; }
.map-top { position: absolute; top: 0; left: 0; right: 0; z-index: 500; padding: 14px 16px 0; padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
.map-search-row { display: flex; gap: 10px; }
.map-search-row .search { flex: 1; margin-bottom: 10px; box-shadow: var(--shadow); }
.map-search-row .iconbtn { width: 54px; height: 54px; box-shadow: var(--shadow); }
.map-top .chips { margin-bottom: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--card); padding: 8px 14px; border-radius: 99px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); }
.pill.warn { color: var(--amber); background: var(--amber-bg); margin-top: 8px; }
.map-card { position: absolute; left: 0; right: 0; bottom: 0; z-index: 500; background: var(--card); border-radius: 26px 26px 0 0; padding: 8px 18px 16px; box-shadow: 0 -6px 24px rgba(0, 0, 0, .12); }
.grip { width: 42px; height: 5px; background: var(--line); border-radius: 9px; margin: 0 auto 10px; }
.mc-top { display: flex; justify-content: space-between; align-items: center; }
.mc-total { font-size: 20px; font-weight: 800; }
.mc-mid { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin: 2px 0 14px; }
.mc-mid h3 { font-size: 21px; font-weight: 800; }
.mc-act { display: flex; gap: 10px; }
.mc-act .btn { flex: 1; height: 54px; font-size: 17px; }
.pin-wrap { background: none; border: 0; }
.pin { width: var(--s); height: var(--s); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); }
.pin span { transform: rotate(45deg); color: #fff; font-weight: 800; font-size: 15px; font-family: var(--font); }
.pin-orange { background: #F26B1D; } .pin-dark { background: #3A3632; } .pin-blue { background: #1E5BC6; } .pin-green { background: #1C7A3E; }
.leaflet-container { font-family: var(--font); }
.picker { position: relative; height: 100%; }
.pmap { position: absolute; inset: 0; }
.sheet.full .picker { height: calc(92dvh - 15px); }
.center-pin { position: absolute; left: 50%; top: 50%; z-index: 600; transform: translate(-50%, -100%); pointer-events: none; }
.picker-top { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 600; display: flex; gap: 10px; align-items: center; }
.picker-bot { position: absolute; bottom: 16px; left: 16px; right: 16px; z-index: 600; display: flex; gap: 10px; }
.picker-bot .btn { flex: 1; }

@media (max-width: 380px) {
  .kpi b { font-size: 23px; }
  .bar-title.big { font-size: 26px; }
  .chip { padding: 0 14px; }
  .q-btn .ic { width: 54px; height: 54px; padding: 16px; }
  .ocard-act .btn { font-size: 14px; gap: 5px; }
}
@media (min-width: 600px) {
  body { background: var(--bg); }
  #app { box-shadow: 0 0 0 1px var(--line); background: var(--bg); }
}
