/* ============================================================
   Sitio de Bodega — tablet-first (galpón, manos ocupadas, conteo).
   Color índigo para diferenciarlo del portal chofer (verde). Botones
   grandes, campos numéricos cómodos, layout de 2 columnas en tablet.
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
    --brand: #4338ca; --brand-d: #3730a3;   /* índigo bodega */
    --green: #1a9e6f; --green-d: #158a60;
    --red: #e17055; --red-d: #d15f45;
    --amber: #d97706;
    --blue: #0984e3;
    --ink: #1e293b; --muted: #64748b; --line: #e6eaf0; --bg: #f4f6f9;
}
html, body { background: var(--bg); color: var(--ink); font-family: 'Inter', system-ui, sans-serif; }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
.material-symbols-rounded { font-variation-settings: 'FILL' 0, 'wght' 400; vertical-align: middle; }

/* Header sticky */
#bodega-header {
    position: sticky; top: 0; z-index: 10;
    background: var(--brand); color: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: calc(env(safe-area-inset-top) + 14px) 20px 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.hd-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.hd-left > .material-symbols-rounded { font-size: 30px; flex: 0 0 auto; }
.hd-left > div { min-width: 0; }
.hd-title { font-weight: 800; font-size: 1.1rem; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-sub { font-size: 0.82rem; opacity: .9; margin-top: 2px; }
.hd-right { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }
.hd-logo { height: 36px; width: auto; object-fit: contain; opacity: .97; }
.hd-logout { background: rgba(255,255,255,.18); border: none; color: #fff; width: 44px; height: 44px; border-radius: 12px; font-size: 22px; cursor: pointer; display: grid; place-items: center; }

#bodega-main { padding: 20px 18px 48px; max-width: 980px; margin: 0 auto; }
.b-loading { text-align: center; color: var(--muted); padding: 56px 0; }

/* Selector de jornada (lista de turnos abiertos del día) */
.shift-list { display: grid; gap: 12px; }
.shift-item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 18px 20px;
    cursor: pointer; text-align: left; width: 100%; font: inherit; color: var(--ink);
}
.shift-item.sel { border-color: var(--brand); background: #eef0ff; }
.shift-item .si-main { font-weight: 700; font-size: 1.05rem; }
.shift-item .si-sub { color: var(--muted); font-size: 0.84rem; margin-top: 3px; }
.shift-item .si-badge { font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #eef0ff; color: var(--brand); }

/* Secciones (carga / conteo / cuadratura) en tarjetas */
.b-section { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin-bottom: 18px; box-shadow: 0 1px 4px rgba(16,24,40,.04); }
.b-section h2 { font-size: 1.1rem; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.b-section h2 .material-symbols-rounded { color: var(--brand); font-size: 24px; }
.b-section .b-hint { color: var(--muted); font-size: 0.86rem; margin-bottom: 16px; }

/* Grilla de formatos (conteo por formato: lleno/vacío) */
.fmt-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 720px) { .fmt-grid { grid-template-columns: 1fr 1fr; } }
.fmt-row {
    display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px;
    border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
}
.fmt-row .fmt-name { font-weight: 700; }
.fmt-row .fmt-name small { display: block; color: var(--muted); font-weight: 400; font-size: 0.76rem; }
.fmt-row .fmt-exp { font-size: 0.82rem; color: var(--muted); text-align: right; }
.fmt-row .fmt-exp b { color: var(--ink); }

/* Stepper numérico grande (táctil) */
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 46px; height: 46px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-size: 22px; font-weight: 700; cursor: pointer; color: var(--brand); }
.stepper input { width: 72px; height: 46px; border: 2px solid var(--line); border-radius: 12px; text-align: center; font-size: 1.15rem; font-weight: 700; font-family: inherit; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Diferencia resaltada */
.diff { font-weight: 800; }
.diff.neg { color: var(--red); }   /* faltante */
.diff.pos { color: var(--amber); } /* sobrante */
.diff.zero { color: var(--green); }

/* Campo de texto / número genérico */
.b-field { margin-bottom: 14px; }
.b-field label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; }
.b-field input, .b-field textarea, .b-field select {
    width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 13px; font-size: 1rem; font-family: inherit; outline: none;
}
.b-field input:focus, .b-field textarea:focus, .b-field select:focus { border-color: var(--brand); }

/* Botones grandes */
.btn-xl { width: 100%; border: none; border-radius: 14px; color: #fff; font-size: 1.1rem; font-weight: 700; padding: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; }
.btn-xl:active { transform: translatey(1px); }
.btn-xl:disabled { opacity: .5; cursor: default; }
.btn-xl .material-symbols-rounded { font-size: 24px; }
.btn-brand { background: var(--brand); } .btn-brand:active { background: var(--brand-d); }
.btn-green { background: var(--green); } .btn-green:active { background: var(--green-d); }
.btn-ghost { background: #fff; color: var(--ink); border: 2px solid var(--line); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }

/* Resultado de cuadratura (banner) */
.recon-result { border-radius: 14px; padding: 16px; margin-top: 14px; font-weight: 700; text-align: center; }
.recon-result.balanced { background: #d1fae5; color: #047857; }
.recon-result.diff { background: #fff4ec; color: var(--red-d); border: 1px solid #ffd3c6; }

/* Empty / gate */
.b-empty, .b-gate { text-align: center; color: var(--muted); padding: 56px 20px; }
.b-empty .material-symbols-rounded, .b-gate .material-symbols-rounded { font-size: 56px; color: #cbd5e1; display: block; margin-bottom: 12px; }

/* Toast */
.b-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(80px); background: #1e293b; color: #fff; padding: 15px 22px; border-radius: 12px; font-size: 0.95rem; font-weight: 600; opacity: 0; transition: all .25s; z-index: 60; max-width: 90%; text-align: center; }
.b-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.b-toast.err { background: var(--red); }
