/* Depósito — móvil primero. Alto contraste: el depósito tiene poca luz y
   el operador mira la pantalla de reojo, con una mano ocupada. */
:root {
  --fondo: #0b1220;
  --panel: #16203a;
  --panel-2: #1e2b4d;
  --borde: #2c3d68;
  --texto: #eef2ff;
  --tenue: #9fb0d6;
  --primario: #2f6df6;
  --ok: #16a34a;
  --alerta: #dc2626;
  --aviso: #d97706;
  --radio: 14px;
  --toque: 52px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--fondo); color: var(--texto);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: contain;
}

.oculto { display: none !important; }

.vista {
  min-height: 100%;
  padding: env(safe-area-inset-top) 0 calc(16px + env(safe-area-inset-bottom));
}

/* ---- barras ---- */
.barra {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--panel); border-bottom: 1px solid var(--borde);
}
.barra .titulo { flex: 1; font-weight: 700; font-size: 17px; }
.barra input {
  flex: 1; min-width: 0; height: 42px;
  background: var(--panel-2); color: var(--texto);
  border: 1px solid var(--borde); border-radius: 10px; padding: 0 12px;
  font-size: 16px;   /* 16px o menos hace que iOS haga zoom al enfocar */
}
.acciones { display: flex; gap: 6px; margin-left: auto; }

button {
  font: inherit; color: var(--texto); cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--borde);
  border-radius: 10px;
}
.icono {
  width: 44px; height: 44px; font-size: 20px; line-height: 1;
  display: grid; place-items: center;
}
.primario {
  background: var(--primario); border-color: transparent; color: #fff;
  font-weight: 700; min-height: var(--toque); width: 100%; border-radius: 12px;
}
.secundario { min-height: 46px; width: 100%; margin-top: 10px; }

/* ---- login ---- */
.login-caja { max-width: 380px; margin: 12vh auto 0; padding: 0 20px; }
.login-caja h1 { margin: 0; font-size: 34px; letter-spacing: -0.5px; }
.login-caja .sub { margin: 4px 0 26px; color: var(--tenue); }
label { display: block; margin-bottom: 14px; color: var(--tenue); font-size: 14px; }
label input {
  display: block; width: 100%; height: var(--toque); margin-top: 6px;
  background: var(--panel); color: var(--texto);
  border: 1px solid var(--borde); border-radius: 12px; padding: 0 14px;
  font-size: 16px;
}
.error { color: #fecaca; background: #7f1d1d; padding: 10px 12px;
         border-radius: 10px; margin-top: 12px; }

/* ---- pestañas ---- */
.pestanas { display: flex; gap: 6px; padding: 10px 12px; }
.pestanas button {
  flex: 1; min-height: 46px; display: flex; align-items: center;
  justify-content: center; gap: 6px; font-weight: 600;
}
.pestanas .activa { background: var(--primario); border-color: transparent; }
.cuenta {
  background: rgba(0,0,0,.28); border-radius: 999px; padding: 1px 8px;
  font-size: 13px; font-variant-numeric: tabular-nums;
}

/* ---- listas ---- */
.lista { padding: 0 12px 24px; display: flex; flex-direction: column; gap: 10px; }
.tarjeta {
  background: var(--panel); border: 1px solid var(--borde);
  border-radius: var(--radio); padding: 12px 14px; text-align: left;
  width: 100%; display: block;
}
.tarjeta .fila1 { display: flex; align-items: baseline; gap: 8px; }
.tarjeta .comp { font-weight: 700; }
.tarjeta .num { color: var(--tenue); font-variant-numeric: tabular-nums; }
.tarjeta .cli { margin-top: 2px; color: var(--tenue);
                overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tarjeta .meta { margin-top: 8px; display: flex; gap: 10px; align-items: center;
                 font-size: 13px; color: var(--tenue); }
.chip { background: var(--panel-2); border-radius: 999px; padding: 2px 10px; }
.chip.vieja { background: #78350f; color: #fde68a; }
.chip.mia { background: #14532d; color: #bbf7d0; }

/* ---- ítems ---- */
.item {
  background: var(--panel); border: 1px solid var(--borde);
  border-radius: var(--radio); padding: 12px 14px;
}
.item.resuelto { opacity: .55; }
.item .cab { display: flex; gap: 12px; align-items: flex-start; }
.item .cant {
  font-size: 30px; font-weight: 800; line-height: 1; min-width: 62px;
  text-align: center; font-variant-numeric: tabular-nums;
}
.item .cant small { display: block; font-size: 11px; font-weight: 500;
                    color: var(--tenue); margin-top: 3px; }
.item .cod { font-weight: 700; font-size: 15px; }
.item .nom { color: var(--tenue); font-size: 14px; margin-top: 2px; }
.sugerencias { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sug {
  min-height: 48px; padding: 0 14px; font-weight: 700; font-size: 16px;
  background: var(--ok); border-color: transparent;
}
.sug small { display: block; font-weight: 500; font-size: 11px; opacity: .85; }
.sug.otra { background: var(--panel-2); border-color: var(--borde); }
.sug.no { background: transparent; border-color: var(--borde);
          color: var(--tenue); font-weight: 500; }
.estado-item { margin-top: 10px; font-size: 13px; color: var(--tenue); }
.estado-item b { color: var(--texto); }

.cliente { padding: 10px 14px 0; color: var(--tenue); }
.pie { padding: 14px; }
.vacio { text-align: center; color: var(--tenue); margin-top: 40px; }

/* ---- avisos ---- */
.aviso {
  position: sticky; top: 0; z-index: 20; padding: 8px 12px;
  background: var(--alerta); color: #fff; font-size: 14px; text-align: center;
}
.aviso.cola { background: var(--aviso); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #111827; border: 1px solid var(--borde); color: var(--texto);
  padding: 12px 18px; border-radius: 999px; z-index: 40; max-width: 90vw;
}

/* ---- hoja inferior ---- */
.hoja {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 30;
  display: flex; align-items: flex-end;
}
.hoja-caja {
  width: 100%; background: var(--panel); border-radius: 18px 18px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 84vh; overflow: auto;
}
.hoja-titulo { font-weight: 700; font-size: 18px; margin-bottom: 12px; }
.hoja .opcion {
  width: 100%; min-height: var(--toque); margin-bottom: 8px; text-align: left;
  padding: 0 14px; display: flex; justify-content: space-between;
  align-items: center; font-weight: 600;
}
.hoja input[type="number"], .hoja input[type="text"] {
  width: 100%; height: var(--toque); font-size: 20px; text-align: center;
  background: var(--panel-2); color: var(--texto);
  border: 1px solid var(--borde); border-radius: 12px; margin-bottom: 10px;
}

/* ---- escáner ---- */
.escaner { position: fixed; inset: 0; background: #000; z-index: 50;
           display: flex; flex-direction: column; }
.escaner video { flex: 1; width: 100%; object-fit: cover; }
.escaner-pie { padding: 16px calc(16px + env(safe-area-inset-bottom)); }
.escaner-pie p { text-align: center; margin: 0 0 12px; }
