/* Tokens portados de legacy/lib/core/theme/app_theme.dart. Todo color sale de
   un token: ninguna regla de abajo escribe un valor a mano, así el tema oscuro
   es un solo bloque y no una segunda hoja de estilos. */

:root {
    --primary: #3D6B50;
    --page: #F6F4F1;
    --surface: #FFFFFF;
    --border: #E4E0DB;
    --ink: #1A1917;
    --muted: #7A746D;
    --tinted: #F0EDE8;

    --income: #3D6B50;
    --expense: #9E4A40;
    --pending: #9A7B2D;
    --info: #4A7B8C;
    --movement: #7B6B8A;

    --stock-ok: #3D6B50;
    --stock-low: #9A7B2D;
    --stock-out: #9E4A40;

    --radius: 10px;
    --radius-chip: 8px;
    --radius-dialog: 14px;
    --control-height: 52px;

    --on-primary: #FFFFFF;
}

:root[data-theme="dark"] {
    --primary: #6DA67E;
    --page: #1A1917;
    --surface: #252420;
    --border: #3A3833;
    --ink: #F6F4F1;
    --muted: #9E9890;
    --tinted: #2E2D28;

    --income: #6DA67E;
    --expense: #CF7A70;
    --pending: #CDB05A;
    --info: #7CB5C8;
    --movement: #AA9ABB;

    --stock-ok: #6DA67E;
    --stock-low: #CDB05A;
    --stock-out: #CF7A70;

    --on-primary: #1A1A1A;
}

* { box-sizing: border-box; }

/* El `hidden` del navegador es una regla suya, y cualquier `display` de esta hoja
   le gana sin importar la especificidad. Sin esto, apagar algo que es `flex` no
   lo apaga: el aviso de versión nueva se quedaba a la vista con el atributo
   puesto. */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    background: var(--page);
    color: var(--ink);
    font: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-text-size-adjust: 100%;
}

/* Las siete escalas de texto del tema Flutter, fijadas acá en lugar de dejarlas
   caer en los valores por omisión del navegador. */
.t-display { font: 700 28px/1.25 inherit; letter-spacing: -0.5px; }
.t-title   { font: 600 22px/1.3 inherit; letter-spacing: -0.3px; }
.t-section { font: 600 18px/1.35 inherit; }
.t-body-em { font: 500 16px/1.5 inherit; }
.t-body    { font: 400 16px/1.4 inherit; }
.t-small   { font: 400 14px/1.4 inherit; }
.t-label   { font: 600 14px/1.45 inherit; }

.muted { color: var(--muted); }

/* Sin sombras en ninguna parte: una tarjeta es un borde de 1px. */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

label {
    display: block;
    margin-bottom: 14px;
}

label > span {
    display: block;
    margin-bottom: 6px;
    font: 600 14px/1.45 inherit;
}

input {
    display: block;
    width: 100%;
    height: var(--control-height);
    padding: 0 14px;
    background: var(--page);
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
}

input:focus {
    outline: none;
    border: 1.5px solid var(--primary);
}

/* Un desplegable es un campo más: antes solo estaba vestido el del pie de la
   venta, así que los de adentro de una hoja salían con la pinta del sistema. */
select {
    display: block;
    width: 100%;
    height: var(--control-height);
    padding: 0 12px;
    background: var(--page);
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
}

select:focus {
    outline: none;
    border: 1.5px solid var(--primary);
}

button {
    width: 100%;
    height: var(--control-height);
    border: 0;
    border-radius: var(--radius);
    background: var(--primary);
    color: var(--on-primary);
    font: 600 16px/1 inherit;
    cursor: pointer;
}

button:disabled {
    opacity: 0.6;
    cursor: default;
}

button.ghost {
    background: none;
    color: var(--primary);
    border: 1px solid var(--border);
}

.screen-login {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    max-width: 420px;
    margin: 0 auto;
    padding: 24px;
}

.brand {
    text-align: center;
    margin-bottom: 4px;
}

.brand .mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-dialog);
    background: var(--tinted);
    color: var(--primary);
    margin-bottom: 12px;
}

.error {
    background: var(--tinted);
    border: 1px solid var(--expense);
    color: var(--expense);
    border-radius: var(--radius-chip);
    padding: 10px 12px;
    font: 400 14px/1.45 inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar button {
    width: auto;
    height: auto;
    padding: 8px 12px;
    background: none;
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-chip);
    font: 600 14px/1 inherit;
}

main.home {
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 16px 60px;
    display: grid;
    gap: 16px;
}

.pending {
    border-left: 3px solid var(--pending);
    padding-left: 12px;
}

/* ---- Chrome: barra inferior, FAB, aviso ---------------------------------- */

.ic { width: 20px; height: 20px; flex: none; }
.ic.big { width: 32px; height: 32px; }

.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.view {
    flex: 1;
    padding: 12px 16px calc(96px + env(safe-area-inset-bottom));
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
}

/* La barra se apoya en una línea de 1px, sin sombra, igual que el tema Flutter. */
.bottombar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
}

.bottombar button {
    flex: 1;
    width: auto;
    height: 60px;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font: 600 12px/1 inherit;
}

.bottombar button .pill {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 28px;
    border-radius: 14px;
}

.bottombar button[aria-current] { color: var(--primary); }
.bottombar button[aria-current] .pill { background: color-mix(in srgb, var(--primary) 14%, transparent); }

.bottombar .badge-dot {
    position: absolute;
    transform: translate(14px, -12px);
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: var(--pending);
    color: var(--surface);
    font: 600 10px/16px inherit;
    text-align: center;
}

/* El FAB del tema Flutter es un cuadrado redondeado de 16px, no un círculo. */
.fab {
    position: fixed;
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    z-index: 21;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--primary);
    color: var(--on-primary);
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab .ic { width: 28px; height: 28px; }

.toast {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    z-index: 40;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: var(--radius-chip);
    background: var(--ink);
    color: var(--page);
}

.toast.show { display: flex; }
.toast.tone-error { background: var(--expense); color: var(--on-primary); }
.toast .linkbtn { margin-left: auto; }

/* ---- Hojas modales ------------------------------------------------------- */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--ink) 45%, transparent);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

body.modal-open { overflow: hidden; }

/* 16px arriba y nada abajo: la hoja sale del borde de la pantalla. */
.sheet {
    background: var(--surface);
    width: 100%;
    max-width: 560px;
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
}

.sheet.small { max-height: 60dvh; }
.sheet.full { height: 100dvh; max-height: 100dvh; border-radius: 0; }

.sheet-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 8px;
}

.sheet-body {
    padding: 8px 16px 16px;
    overflow-y: auto;
    flex: 1;
}

/* Pegado al final del scroll, no a la ventana: con el teclado abierto en
   Android una barra fija a la ventana queda tapada. */
.sheet-foot {
    position: sticky;
    bottom: 0;
    display: flex;
    gap: 12px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.sheet-foot button { flex: 1; }

.icon-btn {
    width: 44px;
    height: 44px;
    min-height: 44px;
    border: 0;
    border-radius: var(--radius-chip);
    background: none;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Filas, tarjetas, vacíos -------------------------------------------- */

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 64px;
    padding: 10px 0;
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 0;
    background: none;
    color: var(--ink);
    text-align: left;
    font: inherit;
    height: auto;
}

.row:first-of-type { border-top: 0; }
button.row:active { background: var(--tinted); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { display: flex; align-items: center; gap: 6px; }
.row-sub { color: var(--muted); }
.row-trail { text-align: right; white-space: nowrap; }

.row-lead {
    width: 40px;
    height: 40px;
    border-radius: 20px;
    background: var(--tinted);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.day-head { margin: 20px 0 4px; color: var(--primary); }

.metric { display: flex; flex-direction: column; gap: 6px; padding: 16px; }
.metric-head { display: flex; align-items: center; gap: 6px; }
.metric-value { font-variant-numeric: tabular-nums; }
.metric.income .metric-value { color: var(--income); }
.metric.expense .metric-value { color: var(--expense); }
.metric.info .metric-value { color: var(--info); }
.metric.pending .metric-value { color: var(--pending); }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty .ic { color: var(--border); }

.skeleton { display: grid; gap: 10px; padding: 8px 0; }
.sk-line { height: 14px; border-radius: 7px; background: var(--tinted); }
.sk-line:nth-child(2) { width: 70%; }
.sk-line:nth-child(3) { width: 45%; }

.note { display: flex; align-items: center; gap: 8px; color: var(--muted); margin: 8px 0; }

/* El aviso de datos guardados va con el mismo margen lateral que una pantalla. */
.stale-strip { max-width: 640px; width: 100%; margin: 0 auto; padding: 0 16px; }
.stale-strip:empty { display: none; }

/* ---- Chips, badges, estados de stock ------------------------------------ */

.chiprow { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
.chiprow::-webkit-scrollbar { display: none; }

.chip {
    width: auto;
    height: auto;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-chip);
    background: var(--surface);
    color: var(--muted);
    font: 400 14px/1 inherit;
    white-space: nowrap;
}

.chip.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

.badge {
    padding: 2px 8px;
    border-radius: var(--radius-chip);
    background: var(--tinted);
    color: var(--muted);
}

.pending-badge { background: color-mix(in srgb, var(--pending) 18%, transparent); color: var(--pending); }

.stock-ok { color: var(--stock-ok); }
.stock-low { color: var(--stock-low); }
.stock-out { color: var(--stock-out); }

.linkbtn {
    width: auto;
    height: auto;
    min-height: 0;
    padding: 4px 2px;
    background: none;
    border: 0;
    color: var(--primary);
    font: 600 14px/1.2 inherit;
    text-decoration: underline;
}

button.danger { background: var(--expense); }

/* ---- Carrito de Nueva venta --------------------------------------------- */

.cart-strip { background: var(--tinted); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; display: grid; gap: 6px; }
.cart-line { display: flex; gap: 8px; align-items: baseline; }
.cart-line .qty { font-weight: 600; }
.cart-line .name { flex: 1; min-width: 0; }

.stepper { display: flex; align-items: center; gap: 2px; }
.stepper button { width: 40px; height: 40px; min-height: 40px; padding: 0; background: none; border: 0; color: var(--primary); }
.stepper .n { min-width: 28px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* La venta que quedó a medio hacer, arriba de la pantalla. */
.draft-note { margin-bottom: 12px; border-left: 3px solid var(--pending); }

.total-bar { display: flex; align-items: center; gap: 12px; }
/* Un botón dentro de una fila se mide por su contenido: el global lo hace de 100%
   de ancho, que en una fila le come el espacio a lo demás. */
.total-bar .pause,
.total-bar .back,
.new-client {
    flex: none;
    width: auto;
    min-height: var(--control-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

/* Los chips del cobro son el contenido del último paso, no un detalle del pie. */
.chiprow.big { gap: 10px; }
.chiprow.big .chip { min-height: var(--control-height); padding: 0 18px; }
.total-bar .sum { flex: 1; display: flex; flex-direction: column; }
.total-bar .sum strong { font: 700 22px/1.2 inherit; font-variant-numeric: tabular-nums; }

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

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---- Barra superior y contenedor de pantallas ---------------------------- */

.topbar-actions { display: flex; gap: 2px; align-items: center; }

#screens { display: block; }

/* El tono de la burbuja de una fila sigue el significado de la acción. */
.row-lead.income { color: var(--income); background: color-mix(in srgb, var(--income) 14%, transparent); }
.row-lead.expense { color: var(--expense); background: color-mix(in srgb, var(--expense) 14%, transparent); }
.row-lead.info { color: var(--info); background: color-mix(in srgb, var(--info) 14%, transparent); }
.row-lead.pending { color: var(--pending); background: color-mix(in srgb, var(--pending) 14%, transparent); }
.row-lead.movement { color: var(--movement); background: color-mix(in srgb, var(--movement) 14%, transparent); }

a.row { text-decoration: none; }
a.row:active { background: var(--tinted); }

/* ---- Inicio -------------------------------------------------------------- */

.eyebrow { margin: 0 0 12px; }
.metric-grid + .metric, .metric + .card, .card + .card { margin-top: 12px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--muted); }
.section-head .ic { color: var(--muted); }
.rows { display: flex; flex-direction: column; }
.c-pending { color: var(--pending); }
.c-expense { color: var(--expense); }
.c-income { color: var(--income); }
.c-info { color: var(--info); }

/* ---- Asistente de la primera vez ---------------------------------------- */

/* El asistente es una puerta, no una pantalla con pestañas: mientras está
   abierto la barra de abajo y el botón + no tienen a dónde llevar. */
body.onboarding-open .bottombar,
body.onboarding-open .fab,
body.onboarding-open .topbar { display: none; }

.onboarding {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    max-width: 420px;
    margin: 0 auto;
    padding: 0;
}

.onboarding-body { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 48px 4px 16px; }
.onboarding-body h1 { margin: 0; }
.onboarding-body p { margin: 0; }
.onboarding-body label { margin-top: 14px; }

.onboarding-foot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 16px 4px calc(24px + env(safe-area-inset-bottom));
}
.onboarding-foot button { display: flex; align-items: center; justify-content: center; gap: 8px; }

.dots { display: flex; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 4px; background: var(--border); }
.dot.on { width: 24px; background: var(--primary); }

.stack { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* Una opción a lo ancho: el dedo no tiene que apuntar. */
.choice {
    width: 100%;
    min-height: var(--control-height);
    height: auto;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--ink);
    font: 400 16px/1.4 inherit;
}
.choice.tall { min-height: 64px; }
.choice.on {
    border: 2px solid var(--primary);
    background: color-mix(in srgb, var(--primary) 6%, var(--surface));
    font-weight: 600;
}
.choice.on .ic { color: var(--primary); }

/* ---- Formularios --------------------------------------------------------- */

label.invalid input { border-color: var(--expense); }
.err { color: var(--expense); display: block; margin-top: 4px; }
label em { display: block; margin-top: 4px; }

/* Un control que no es un input lleva su rótulo igual, y con el mismo aire que
   una etiqueta: antes cada hoja ponía un `span` suelto al lado del control, sin
   sitio donde escribir el error. */
.group { margin-bottom: 14px; }
.group > .t-label { display: block; margin-bottom: 6px; }
.group em { display: block; margin-top: 4px; }
.group .with-button { margin-bottom: 0; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair label,
.pair .group { margin-bottom: 0; }

.with-button { display: flex; gap: 8px; align-items: stretch; margin-bottom: 14px; }
.with-button input { flex: 1; }
.with-button button { width: 52px; flex: none; padding: 0; display: flex; align-items: center; justify-content: center; }

.tagwrap { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.tagwrap .chip { display: inline-flex; align-items: center; gap: 4px; }
.tagwrap .chip .ic { width: 14px; height: 14px; }

/* ---- Stock --------------------------------------------------------------- */

.view-actions { display: flex; gap: 2px; }
.rows.card { padding: 4px 16px; }
.rows.card .row:first-of-type { border-top: 0; }

/* Una salida dentro de un estado vacío: el botón no es la acción principal de la
   pantalla, así que no ocupa todo el ancho. */
.inline-cta {
    width: auto;
    min-height: 44px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

/* ---- Nueva venta --------------------------------------------------------- */

.sale-list { margin-top: 4px; }
.sale-list .row { min-height: 60px; }
.icon-btn.add, .stepper .add { color: var(--income); }
.icon-btn.add .ic { width: 28px; height: 28px; }

.cart-head { display: flex; align-items: center; justify-content: space-between; }
.cart-head strong { color: var(--primary); }

.extras { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 10px; }
.extras summary { cursor: pointer; color: var(--primary); padding: 6px 0; }
.extras[open] summary { margin-bottom: 8px; }

.foot-stack { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.foot-stack label { margin-bottom: 0; }
button.confirm { width: auto; min-width: 160px; display: flex; align-items: center; justify-content: center; gap: 8px; }

/* ---- Selector dentro de un formulario ------------------------------------ */

.picker {
    width: 100%;
    min-height: var(--control-height);
    height: auto;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--ink);
    font: inherit;
}
.picker.empty { color: var(--muted); }
.picker .ic { color: var(--muted); flex: none; }

/* ---- El portón de instalación -------------------------------------------- */

/* Lo único que se dibuja cuando el navegador está a la vista. Va con el aire de
   la pantalla de entrada, que es la otra que se ve sin haber entrado. */
.install-how { display: grid; gap: 8px; }
.install-how h2, .install-how p { margin: 0; }

.install-steps {
    margin: 4px 0 0;
    padding-left: 22px;
    display: grid;
    gap: 8px;
}
.install-steps li { padding-left: 2px; }
.install-steps::marker { color: var(--primary); }

/* La dirección se muestra para copiarla: es el único camino de quien entró por
   un visor que no instala nada. */
.install-addr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
}
.install-addr code {
    font-family: ui-monospace, Menlo, monospace;
    overflow-wrap: anywhere;
}
.install-addr button { width: auto; flex: none; display: flex; align-items: center; gap: 8px; }

/* ---- Buscador de contacto ------------------------------------------------ */

/* El contacto se escribe, no se despliega: con cien clientes la rueda del
   teléfono es una lista que no se recorre con el pulgar. El campo y el atajo
   para crear uno nuevo van en una línea, como estaba el paso del cliente. */
.combo { position: relative; }
.combo-box { display: flex; gap: 8px; align-items: stretch; }
.combo-field { position: relative; flex: 1; min-width: 0; }
.combo-field.on input { border: 1.5px solid var(--primary); font-weight: 500; padding-right: 52px; }
.combo-clear { position: absolute; top: 4px; right: 4px; }

/* La lista flota sobre el formulario en lugar de empujarlo: un campo del medio
   no puede mover los de abajo en cada tecla. El recorte lo pone el scroll de
   `.sheet-body`, y el pie es su hermano, así que nunca lo tapa. */
.combo-pop {
    position: absolute;
    top: calc(var(--control-height) + 4px);
    left: 0;
    right: 0;
    z-index: 2;
    max-height: 44dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* En el paso del cliente la lista es la pantalla: va en el flujo, sin marco. */
.combo.inline .combo-pop {
    position: static;
    max-height: none;
    margin-top: 10px;
    padding: 0;
    border: 0;
}

.combo-opt { min-height: 60px; cursor: pointer; }
.combo-opt.on, .combo-opt:active { background: var(--tinted); }
.combo-opt .ic { color: var(--primary); flex: none; }
.combo-note { padding: 10px 0; margin: 0; }

/* ---- Ventas y su detalle ------------------------------------------------- */

.row.is-voided .row-title { text-decoration: line-through; text-decoration-color: var(--muted); }
.row.is-voided { opacity: 0.72; }

button.ghost.more { margin-top: 16px; }

.detail-meta { display: grid; gap: 2px; margin-bottom: 8px; }
.meta { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.meta:last-child { border-bottom: 0; }
.items-head { margin: 16px 0 4px; color: var(--muted); }

/* ---- Contactos ----------------------------------------------------------- */

/* La burbuja con la inicial, como el CircleAvatar de la app vieja. */
.row-lead .t-body-em { color: var(--primary); }

/* ---- Registrar cobro ----------------------------------------------------- */

.balance-card { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

/* ---- Nuevo gasto --------------------------------------------------------- */

.amount { display: flex; align-items: stretch; }
.amount .affix {
    flex: none;
    display: flex;
    align-items: center;
    padding: 0 12px;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-right: 0;
    border-radius: var(--radius) 0 0 var(--radius);
}
.amount input { border-radius: 0 var(--radius) var(--radius) 0; min-width: 0; }

/* ---- Proveedores --------------------------------------------------------- */

/* La fila con acción: el área que abre el detalle y el botón de al lado. */
.row-hit {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: inherit;
    text-align: left;
    font: inherit;
    height: auto;
    min-height: 44px;
}
button.row-hit:active { background: var(--tinted); }

.row-action {
    width: auto;
    height: 36px;
    min-height: 36px;
    padding: 0 14px;
    background: var(--tinted);
    color: var(--primary);
    border-radius: var(--radius-chip);
    font: 600 14px/1 inherit;
}

/* ---- Caja y dinero ------------------------------------------------------- */

.total-card { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 12px; }
.c-movement { color: var(--movement); }
.new-move { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; }

/* ---- Reportes ------------------------------------------------------------ */

.range-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.range-row .chiprow { margin: 0; }
.row-lead.stock-low { color: var(--stock-low); background: color-mix(in srgb, var(--stock-low) 14%, transparent); }
.row-lead.stock-out { color: var(--stock-out); background: color-mix(in srgb, var(--stock-out) 14%, transparent); }

/* ---- Escáner ------------------------------------------------------------- */

.scan-viewport {
    width: 100%;
    aspect-ratio: 1;
    max-height: 52vh;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 12px;
}
.scan-viewport video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-viewport img { display: none; }
.manual-code { display: flex; gap: 8px; align-items: center; }
.manual-code button { width: auto; padding: 0 18px; }
.scan-btn { border: 1px solid var(--border); }
.with-scan { display: flex; gap: 8px; align-items: center; }
.with-scan input { min-width: 0; }
.with-scan .scan-btn { flex: none; }

/* ---- Foto del comprobante ------------------------------------------------ */

.photo-pick {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    cursor: pointer;
}
.photo-pick input[type="file"] { display: none; }
.photo-row { display: flex; align-items: center; gap: 12px; }
.photo-row button { width: auto; padding: 0 16px; }
.photo-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--tinted);
}
.photo-link { display: flex; align-items: center; gap: 12px; text-decoration: none; margin-top: 14px; }

/* ---- Aviso de versión nueva ---------------------------------------------- */

/* Se queda hasta que alguien lo toca: no es un toast, que se va solo. */
.updatebar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--ink);
    color: var(--page);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}
.updatebar .ic { flex: none; }
.updatebar span { flex: 1; }
.updatebar .linkbtn { width: auto; color: var(--page); text-decoration: underline; }
.updatebar code { font-family: ui-monospace, Menlo, monospace; font-size: 0.92em; opacity: 0.85; }

/* ---- El bloque de versión en Configuración ------------------------------- */

.version-line { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; min-height: 40px; }
.version-line code { font-family: ui-monospace, Menlo, monospace; text-align: right; overflow-wrap: anywhere; }
