/* ============ Estilos por pantalla ============ */

/* ---- Login ---- */
.login {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.login .card { width: min(380px, 100%); display: grid; gap: 14px; }
.login h1 { font-size: 1.4rem; text-align: center; }
.login .hint { text-align: center; font-size: .78rem; color: var(--muted); }

/* ---- Mesas ---- */
.tables-toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.tables-toolbar .btn { flex: 1; }

/* ---- Comanda ---- */
.order-head { display: grid; gap: 6px; margin-bottom: 12px; }
.order-head .spread h1 { font-size: 1.15rem; }
.order-note {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px dashed var(--line);
    color: var(--muted);
    font-size: .85rem;
}

.order-items { display: grid; gap: 8px; margin: 8px 0 96px; }
.oi {
    display: flex;
    align-items: stretch;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.oi.voided { opacity: .5; }
.oi.voided .oi-main { text-decoration: line-through; }
.oi.dispatched {
    border-color: color-mix(in srgb, var(--green) 35%, var(--line));
    background: color-mix(in srgb, var(--green) 7%, var(--surface));
}

/* casilla "despachado" a la izquierda de cada renglón */
.oi-check, .oi-check-slot {
    flex: none;
    width: 48px;
    align-self: stretch;
    display: flex; align-items: center; justify-content: center;
    border-right: 1px solid var(--line);
    color: var(--green);
}
.oi.dispatched .oi-check { border-right-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.oi-check:not(.on)::before {
    content: "";
    width: 21px; height: 21px;
    border: 2px solid var(--muted);
    border-radius: 999px;
    opacity: .55;
}
.oi-check.on { background: color-mix(in srgb, var(--green) 15%, transparent); }
.oi-check:active { background: var(--surface-2); }

.oi-main {
    flex: 1; min-width: 0;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    padding: 12px;
    text-align: left;
    align-items: start;
}
.oi-body { min-width: 0; }
.oi .qty { font-weight: 700; font-variant-numeric: tabular-nums; }
.oi .name { font-weight: 600; }
.oi .mods { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.oi .note { font-size: .8rem; color: var(--accent); margin-top: 2px; }
.oi .line { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.order-bar {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(var(--tabbar-h) + var(--safe-bottom));
    z-index: 25;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 10px 14px;
    display: grid;
    gap: 8px;
    max-width: 720px;
    margin: 0 auto;
}
.order-bar .total-row { display: flex; align-items: baseline; justify-content: space-between; }
.order-bar .total-row .amt { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.order-bar .actions { display: flex; gap: 8px; }
.order-bar .actions .btn { flex: 1; }

/* ---- Selector de productos (estilo POS) ---- */
.picker-cats { margin-bottom: 10px; }

.picker-grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-content: start;
    min-height: 56dvh; /* el selector siempre ocupa buena parte de la pantalla */
}
.pcell {
    display: flex; flex-direction: column; gap: 3px;
    min-height: 78px;
    padding: 10px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    text-align: left;
}
.pcell-nm { font-weight: 600; font-size: .88rem; line-height: 1.2; }
.pcell-pr { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pcell-ex { font-size: .7rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.pcell.active { border-color: var(--accent); background: var(--accent-soft); }
.pcell-step {
    margin-top: auto;
    display: flex; align-items: center; justify-content: space-between;
    gap: 4px;
}
.pcell-step button {
    width: 30px; height: 30px;
    border: 0; border-radius: 8px;
    background: var(--accent); color: var(--accent-ink);
    font-size: 1.1rem; font-weight: 700; line-height: 1;
}
.pcell-step span { font-weight: 700; font-variant-numeric: tabular-nums; }

.picker-cart {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.picker-cart-info { font-size: .86rem; color: var(--muted); }
.picker-cart-info b { color: var(--ink); font-variant-numeric: tabular-nums; }
.picker-cart .btn { min-height: 42px; padding: 0 20px; }

/* ---- Formulario compacto de renglón ---- */
.item-form { display: grid; gap: 12px; }
.if-price {
    font-size: 1.5rem; font-weight: 800; text-align: center;
    padding: 8px; border-radius: var(--radius-sm);
    background: var(--accent-soft); color: var(--accent);
    font-variant-numeric: tabular-nums;
}
.if-qtyrow { display: flex; align-items: center; gap: 8px; }
.if-stepper {
    display: flex; align-items: center;
    border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.if-stepper button {
    width: 46px; height: 44px;
    border: 0; background: var(--surface-2); color: var(--ink);
    font-size: 1.4rem; font-weight: 700; line-height: 1;
}
.if-stepper button:active { background: var(--line); }
.if-qval {
    min-width: 54px; text-align: center;
    font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums;
}
.if-half, .if-padtoggle {
    min-height: 44px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: 10px;
    background: var(--surface-2); color: var(--muted);
    font-weight: 700; font-size: .9rem;
}
.if-half.on, .if-padtoggle.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.if-padtoggle { margin-left: auto; }

.if-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.if-chips button {
    padding: 8px 13px;
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--surface); color: var(--ink);
    font-size: .84rem; font-weight: 500;
}
.if-chips button.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.if-notelink {
    color: var(--accent); font-weight: 600; font-size: .88rem;
    padding: 4px 0; text-align: left;
}

/* ---- Hoja de extras dentro del selector ---- */
.mod-overlay {
    position: absolute; inset: 0; z-index: 5;
    background: rgba(20, 12, 4, .45);
    display: flex; align-items: flex-end;
    animation: fade .15s ease;
}
.mod-card {
    width: 100%;
    background: var(--bg);
    border-radius: 18px 18px 0 0;
    padding: 14px 16px calc(16px + var(--safe-bottom));
    display: flex; flex-direction: column; gap: 12px;
    max-height: 92%;
    overflow-y: auto;
    animation: sheet-up .18s ease;
}
.mod-card > .item-form { flex: 1; }
.mod-card-head { display: flex; align-items: center; justify-content: space-between; }
.mod-card-head strong { font-size: 1.02rem; }

/* ---- Cobro ---- */
.pay-total { text-align: center; margin-bottom: 16px; }
.pay-total .amt { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pay-line { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pay-methods button { padding: 10px 4px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; font-size: .85rem; }
.pay-methods button.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pay-summary { display: flex; justify-content: space-between; font-weight: 700; padding: 4px 2px; font-variant-numeric: tabular-nums; }
.pay-summary.bad { color: var(--red); }
.pay-summary.ok { color: var(--green); }
.pay-change { text-align: center; font-size: 1.1rem; font-weight: 700; color: var(--green); }

/* ---- Seguridad ---- */
.sec-page { display: grid; gap: 14px; }
.sec-lead { font-size: .85rem; color: var(--muted); margin-top: -6px; }
.sec-card { display: grid; gap: 12px; }
.sec-row { display: flex; align-items: center; gap: 12px; }
.sec-ico { color: var(--accent); flex: none; }
.sec-row .grow { flex: 1; min-width: 0; }
.sec-row .t1 { font-weight: 600; }
.sec-row .t2 { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.sec-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sec-actions .btn { flex: 1; min-width: 130px; }

.pin-flow { display: grid; gap: 12px; }
.pin-flow-hint { text-align: center; font-size: .9rem; color: var(--muted); }

.sec-passkeys { display: grid; gap: 8px; }
.sec-passkey {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.sec-passkey .grow { flex: 1; min-width: 0; }
.sec-passkey .t1 { font-weight: 600; font-size: .92rem; }
.sec-passkey .t2 { font-size: .76rem; color: var(--muted); }

/* ---- Teclado de PIN ---- */
.pinpad { display: grid; gap: 16px; justify-items: center; }
.pin-dots { display: flex; gap: 14px; justify-content: center; padding: 4px 0; }
.pin-dot {
    width: 13px; height: 13px; border-radius: 50%;
    border: 2px solid var(--muted);
    transition: background .12s, border-color .12s, transform .12s;
}
.pin-dot.on { background: var(--accent); border-color: var(--accent); transform: scale(1.12); }
.pin-hint { color: var(--red); font-size: .85rem; font-weight: 600; text-align: center; }

.pin-keys {
    display: grid;
    grid-template-columns: repeat(3, 72px);
    gap: 12px;
}
.pin-key {
    height: 62px;
    border-radius: 16px;
    background: var(--surface-2);
    color: var(--ink);
    font-size: 1.5rem; font-weight: 600;
    font-variant-numeric: tabular-nums;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--line);
}
.pin-key:active { background: var(--line); transform: translateY(1px); }
.pin-key.pin-back { background: transparent; border-color: transparent; color: var(--muted); }
.pin-key.pin-ok { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pin-key.pin-ok:disabled { opacity: .4; }
.pinpad.is-busy { opacity: .6; pointer-events: none; }

/* ---- Pantalla de bloqueo ---- */
.lockscreen {
    position: fixed; inset: 0; z-index: 80;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    padding-top: calc(24px + var(--safe-top));
    padding-bottom: calc(24px + var(--safe-bottom));
    animation: fade .18s ease;
}
.lock-card {
    width: min(360px, 100%);
    display: grid; gap: 12px; justify-items: center;
    text-align: center;
}
.lock-avatar {
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--accent); color: var(--accent-ink);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; font-weight: 700;
}
.lock-card h2 { font-size: 1.15rem; }
.lock-sub { font-size: .88rem; color: var(--muted); margin-bottom: 6px; }
.lock-card .pinpad { margin-top: 4px; }
.lock-bio {
    margin-top: 8px;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 20px;
    border-radius: 999px;
    background: var(--accent); color: var(--accent-ink);
    font-weight: 700; font-size: .95rem;
}
.lock-bio:disabled { opacity: .55; }
.lock-alt {
    margin-top: 10px;
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--muted); font-weight: 600; font-size: .9rem;
    padding: 8px 12px;
}
body.locked { overflow: hidden; }

/* botón de huella en el login */
.passkey-btn { display: flex; gap: 8px; margin-top: -4px; }

/* ---- Catálogo ---- */
.catalog-tabs { margin-bottom: 14px; }
.cat-add { margin-bottom: 12px; }
.mod-picklist {
    display: grid; gap: 2px;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    overflow: hidden;
    max-height: 240px; overflow-y: auto;
}
.mod-pick {
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface);
}
.mod-pick + .mod-pick { border-top: 1px solid var(--line); }
.mod-pick input { width: 20px; height: 20px; flex: none; }
.mod-pick .grow { font-weight: 500; }

/* ---- Panel / Reportes ---- */
.dash-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.dash-head h1 { font-size: 1.35rem; }
.card-title { font-size: .95rem; margin-bottom: 10px; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.stat {
    padding: 14px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
}
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat.good .stat-value { color: var(--green); }
.stat.bad .stat-value { color: var(--red); }

.card + .card { margin-top: 12px; }
