/* app-inventarios · pantallas (tableta de 16" o menos; también funciona en vertical y en teléfono)
   Idea: la mitad verde es el "puesto de escaneo" (un número enorme que salta con cada bip);
   la mitad clara es la hoja de conteo, ordenada por marca. El amarillo solo avisa: producto desconocido o bip en espera. */
html, body, #app { height: 100%; }
body { overflow: hidden; }
#app { display: flex; flex-direction: column; }
#app.gate { display: grid; overflow: auto; }
.num { font-variant-numeric: tabular-nums; }

/* Barra de arriba */
.bar { display: flex; align-items: center; gap: .9rem; padding: .55rem 1rem; background: var(--white); border-bottom: 1px solid var(--line); flex: none; min-height: 56px; }
.bar-tenant { font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.bar-place { color: var(--ink-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-place strong { color: var(--black); font-weight: 600; }
.bar-mode { background: var(--green-soft); color: var(--green-dark); font-weight: 600; font-size: .85rem; padding: .2rem .65rem; border-radius: 99px; white-space: nowrap; }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; flex: none; }
.bar-who { color: var(--ink-2); font-size: .9rem; white-space: nowrap; }
.bar .btn { min-height: 44px; }

/* Empezar */
.start { flex: 1; overflow: auto; padding: clamp(1rem, 3vw, 2.2rem); }
.start-in { max-width: 980px; margin: 0 auto; display: grid; gap: 1.6rem; }
.start h1 { font-size: clamp(1.8rem, 3.2vw, 2.5rem); }
.start h2 { font-size: 1.05rem; font-weight: 600; letter-spacing: 0; margin-bottom: .6rem; }
.choices { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.choices-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.choice { text-align: left; background: var(--white); border: 2px solid var(--line); border-radius: 12px; padding: .9rem 1rem; cursor: pointer; min-height: 64px; display: grid; gap: .2rem; align-content: start; }
.choice:hover { border-color: var(--line-2); }
.choice[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); }
.choice-name { font-weight: 600; font-size: 1.05rem; }
.choice-sub { color: var(--ink-2); font-size: .9rem; line-height: 1.4; }
.start-go { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.start-go .btn { min-height: 54px; padding: .6rem 1.6rem; font-size: 1.05rem; }
.open-list { display: grid; gap: .5rem; }
.open-item { display: flex; align-items: center; gap: 1rem; background: var(--white); border: 1px solid var(--line); border-left: 5px solid var(--yellow); border-radius: 10px; padding: .7rem 1rem; }
.open-item div { flex: 1; min-width: 0; }
.open-item strong { display: block; }
.open-item span { color: var(--ink-2); font-size: .9rem; }
.empty { color: var(--ink-2); background: var(--white); border: 1px dashed var(--line-2); border-radius: 10px; padding: 1rem 1.1rem; max-width: 60ch; }

/* Conteo: puesto (verde) + hoja (clara) */
.count { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(320px, 40%) 1fr; }
.station { background: var(--green); color: var(--white); display: flex; flex-direction: column; padding: 1.1rem 1.3rem 1.6rem; min-height: 0; overflow: auto; }
.brand-row { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; padding-bottom: .9rem; border-bottom: 1px solid rgba(255, 255, 255, .18); }
.brand-row label { color: rgba(255, 255, 255, .7); }
.brand-name { font-weight: 800; font-size: 1.5rem; color: var(--yellow); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.01em; }
.brand-form { display: flex; gap: .5rem; flex: 1; }
.brand-form input { min-height: 46px; font-size: 1.05rem; }
.brand-form .btn { min-height: 46px; }
.brand-err { flex-basis: 100%; margin: 0; color: var(--yellow); font-weight: 600; }
.brand-err:empty { display: none; }
.last { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 1rem 0; min-height: 200px; }
.last-qty { font-weight: 800; font-size: clamp(5.5rem, 15vw, 11rem); line-height: .9; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.last-qty.bump { animation: bump .22s ease-out; }
@keyframes bump { from { transform: scale(1.12); color: var(--yellow); } to { transform: none; } }
.last-qty { transform-origin: left bottom; }
.last-name { font-weight: 600; font-size: clamp(1.2rem, 2.2vw, 1.7rem); line-height: 1.2; margin-top: .8rem; overflow-wrap: anywhere; }
.last-meta { color: rgba(255, 255, 255, .72); margin-top: .25rem; overflow-wrap: anywhere; }
.last-state { margin-top: .9rem; font-weight: 600; display: inline-block; align-self: flex-start; padding: .3rem .7rem; border-radius: 8px; background: rgba(255, 255, 255, .12); }
.last-state.warn { background: var(--yellow); color: var(--green-dark); }
.last-state.err { background: var(--late); color: var(--white); }
.last-idle { font-weight: 800; font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1.1; letter-spacing: -.02em; }
.last-idle + p { color: rgba(255, 255, 255, .75); max-width: 30ch; margin: .6rem 0 0; }
.reading { font-variant-numeric: tabular-nums; color: var(--yellow); font-weight: 600; min-height: 1.5em; overflow-wrap: anywhere; }
.pending { background: var(--yellow); color: var(--green-dark); border-radius: 8px; padding: .5rem .8rem; font-weight: 600; margin-bottom: .8rem; }
.manual { display: flex; gap: .5rem; align-items: end; }
.manual .stack { flex: 1; }
.manual label { color: rgba(255, 255, 255, .7); }
.manual input, .manual .btn { min-height: 46px; }
.station-foot { margin-top: .9rem; }
.station-foot .btn { color: rgba(255, 255, 255, .8); min-height: 44px; padding-left: 0; }
.station-foot .btn:hover { background: transparent; color: var(--yellow); }

.sheet { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.totals { display: flex; gap: clamp(1rem, 3vw, 2.4rem); padding: .8rem 1.3rem; border-bottom: 1px solid var(--line); flex: none; align-items: baseline; }
.total b { font-size: clamp(1.5rem, 2.6vw, 2.1rem); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-right: .35rem; }
.total span { color: var(--ink-2); }
.total.warn b { color: #8a6500; }
.rows { flex: 1; overflow: auto; padding: 0 1.3rem 3rem; overscroll-behavior: contain; }
.group-name { position: sticky; top: 0; background: var(--ivory); font-weight: 800; font-size: 1rem; padding: .9rem 0 .4rem; border-bottom: 2px solid var(--black); display: flex; justify-content: space-between; gap: 1rem; z-index: 1; }
.group-name span { font-variant-numeric: tabular-nums; }
.line { display: flex; align-items: center; gap: .8rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.line.unknown { box-shadow: inset 4px 0 0 var(--yellow); padding-left: .8rem; }
.line.fresh { background: var(--yellow-soft); }
.line-text { flex: 1; min-width: 0; }
.line-name { font-weight: 600; overflow-wrap: anywhere; }
.line-meta { color: var(--ink-2); font-size: .88rem; overflow-wrap: anywhere; }
.tag { display: inline-block; background: var(--yellow); color: var(--green-dark); font-weight: 600; font-size: .75rem; border-radius: 6px; padding: .05rem .4rem; margin-right: .4rem; }
.qty { display: flex; align-items: center; gap: .3rem; flex: none; }
.qty b { min-width: 3ch; text-align: center; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.qty button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--white); font-size: 1.3rem; font-weight: 600; cursor: pointer; line-height: 1; }
.qty button:hover { border-color: var(--green); }
.rows-note { color: var(--ink-2); font-size: .88rem; padding: 1rem 0; }
.rows .empty { margin-top: 1.2rem; }

/* Vertical o pantalla angosta: el puesto arriba (compacto), la hoja abajo */
@media (max-width: 860px), (orientation: portrait) {
  .count { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .station { padding: .8rem 1rem 1rem; overflow: visible; }
  .last { min-height: 0; padding: .7rem 0; flex-direction: row; align-items: center; gap: 1rem; justify-content: flex-start; flex-wrap: wrap; }
  .last-qty { font-size: clamp(3.4rem, 14vw, 5.5rem); }
  .last-name { margin-top: 0; }
  .last-info { flex: 1; min-width: 180px; }
  .last-state { margin-top: .4rem; }
  .bar-who, .bar-mode { display: none; }
  .station-foot { margin-top: .4rem; }
}
@media (max-width: 560px) {
  .bar { flex-wrap: wrap; row-gap: .3rem; }
  .manual { display: none; }
}

/* Código de 6 cifras de la cuenta FARO */
.mfa-code { text-align: center; font-size: 1.7rem; letter-spacing: .35em; font-variant-numeric: tabular-nums; min-height: 56px; }
