/* ══════════════════════════════════════════════════════════════════════════
   ALMACÉN  ·  Flomay Química S.L.
   --------------------------------------------------------------------------
   Hecha para el móvil y la tablet de la nave, no para el escritorio: se
   entra de pie, se mira un momento y se apunta algo. Por eso:

     · Las pestañas van ABAJO, que es donde llega el pulgar, y el botón de
       dar parte flota encima de ellas: se avisa desde donde se esté.
     · Nada de tablas anchas: todo son fichas que caben de un vistazo.
     · Los botones no bajan de 44 px de alto — con guantes no se acierta en
       nada más pequeño.
     · Los campos escriben a 16 px: por debajo, iOS hace zoom solo al tocar.

   Los colores de estado (bien / ojo / bajo mínimo) están comprobados con el
   validador de la guía de gráficas: se distinguen entre sí también con
   daltonismo, y aun así NUNCA van solos — llevan icono y palabra.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
    --tinta:      #0f172a;
    --tinta-2:    #475569;
    --tinta-3:    #94a3b8;
    --linea:      #e2e8f0;
    --linea-2:    #eef2f7;
    --fondo:      #eef2f7;
    --papel:      #ffffff;
    --navy:       #1e3a5f;

    /* Paleta comprobada (validate_palette, modo claro sobre blanco):
       la serie en azul, y los tres estados con separación suficiente. */
    --serie:      #2563eb;
    --bien:       #0f9d63;
    --ojo:        #ca8a04;
    --bajo:       #dc2626;

    --alto-cab:   58px;
    --alto-pest:  62px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
/* El atributo hidden trae display:none del navegador, que pierde contra
   cualquier display puesto aquí. Sin esto, un botón con display:flex sigue
   viéndose por mucho que se le ponga hidden. */
[hidden] { display: none !important; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    background: var(--fondo);
    color: var(--tinta);
    font-size: 15px;
    line-height: 1.45;
    /* Con las pestañas fijas abajo, el contenido necesita ese hueco */
    padding-bottom: calc(var(--alto-pest) + env(safe-area-inset-bottom, 0px));
    -webkit-font-smoothing: antialiased;
}

/* ── LA CABECERA ─────────────────────────────────────────────────────────── */
.alm-cab {
    position: sticky; top: 0; z-index: 50;
    height: var(--alto-cab);
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 0 12px;
    background: var(--navy); color: #fff;
}
.alm-cab-izq { display: flex; align-items: center; gap: 10px; min-width: 0; }
.alm-logo { height: 30px; border-radius: 5px; background: #fff; padding: 3px; }
.alm-titulo { font-size: 17px; font-weight: 800; line-height: 1.1; }
.alm-fecha { font-size: 11.5px; opacity: .75; }
.alm-cab-der { display: flex; gap: 8px; }
.alm-btn-icono {
    width: 40px; height: 40px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; border-radius: 10px; cursor: pointer;
    background: rgba(255,255,255,.14); color: #fff; font-size: 15px;
    text-decoration: none;
}
.alm-btn-icono:active { background: rgba(255,255,255,.28); }

/* ── LOS PANELES ─────────────────────────────────────────────────────────── */
.alm-panel { display: none; }
.alm-panel.activo { display: block; }
/* Abajo sobra sitio a propósito: el botón de dar parte flota encima y si
   no, tapa la última ficha. */
.alm-lista { padding: 10px 10px 76px; display: flex; flex-direction: column; gap: 9px; }
.alm-cargando, .alm-vacio {
    padding: 34px 16px; text-align: center; color: var(--tinta-3); font-size: 14px;
}
.alm-vacio i { display: block; font-size: 28px; margin-bottom: 10px; opacity: .5; }

/* La barra de cada panel: filtros y resumen */
.alm-barra {
    position: sticky; top: var(--alto-cab); z-index: 40;
    display: flex; gap: 6px; align-items: center;
    padding: 8px 10px; overflow-x: auto; scrollbar-width: none;
    background: var(--papel); border-bottom: 1px solid var(--linea);
}
.alm-barra::-webkit-scrollbar { display: none; }
/* La de Preparar lleva dos renglones: el buscador y los filtros */
.alm-barra.doble {
    flex-direction: column; align-items: stretch; gap: 8px; overflow: visible;
}
.alm-chips {
    display: flex; gap: 6px; align-items: center;
    overflow-x: auto; scrollbar-width: none;
}
.alm-chips::-webkit-scrollbar { display: none; }
.alm-chip {
    flex-shrink: 0; padding: 8px 13px; min-height: 38px;
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--linea); border-radius: 9px;
    background: #fff; color: var(--tinta-2);
    font-family: inherit; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.alm-chip.activo { background: var(--navy); border-color: var(--navy); color: #fff; }
.alm-chip b { font-variant-numeric: tabular-nums; }
.alm-resumen {
    margin-left: auto; flex-shrink: 0; padding-left: 10px;
    font-size: 12px; color: var(--tinta-3); white-space: nowrap;
}

/* ── LAS FICHAS ──────────────────────────────────────────────────────────── */
.ficha {
    background: var(--papel); border: 1px solid var(--linea);
    border-radius: 12px; overflow: hidden;
}
.ficha-cab {
    display: flex; align-items: center; gap: 9px;
    padding: 11px 12px; width: 100%;
    background: none; border: none; font: inherit; text-align: left;
    color: inherit; cursor: pointer;
}
.ficha-tit { flex: 1; min-width: 0; }
.ficha-tit b { display: block; font-size: 14.5px; font-weight: 700; line-height: 1.25; }
.ficha-tit small { display: block; font-size: 12px; color: var(--tinta-3); margin-top: 1px; }
.ficha-cifra {
    flex-shrink: 0; text-align: right; font-variant-numeric: tabular-nums;
}
.ficha-cifra b { display: block; font-size: 17px; font-weight: 800; line-height: 1.1; }
.ficha-cifra small { font-size: 11px; color: var(--tinta-3); }
.ficha-flecha { flex-shrink: 0; color: var(--tinta-3); font-size: 13px; transition: transform .15s; }
.ficha.abierta .ficha-flecha { transform: rotate(90deg); }
.ficha-detalle { display: none; padding: 0 12px 11px; }
.ficha.abierta .ficha-detalle { display: block; }

/* Los estados: SIEMPRE con icono y palabra, nunca solo el color */
.estado {
    display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
    padding: 3px 9px; border-radius: 7px;
    font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.estado i { font-size: 10.5px; }
.estado.bien { background: #e7f6ef; color: var(--bien); }
.estado.ojo  { background: #fdf6e3; color: #8a5a04; }
.estado.bajo { background: #fdeaea; color: var(--bajo); }
.estado.gris { background: var(--linea-2); color: var(--tinta-2); }

/* ── PREPARAR ────────────────────────────────────────────────────────────── */
.semana-tit {
    display: flex; align-items: center; gap: 8px; margin: 6px 2px 0;
    font-size: 12px; font-weight: 800; color: var(--navy);
    text-transform: uppercase; letter-spacing: .05em;
}
.semana-tit span { margin-left: auto; font-weight: 600; color: var(--tinta-3);
    text-transform: none; letter-spacing: 0; }
.formato-tit {
    display: flex; align-items: center; gap: 7px; margin: 8px 2px 2px;
    font-size: 12.5px; font-weight: 700; color: var(--tinta-2);
}
.formato-tit i { color: var(--serie); }
.ficha.hecho { background: #f6fbf8; border-color: #bfe6d4; }
.ficha.hecho .ficha-tit b { text-decoration: line-through; color: var(--tinta-3); }
.para-quien {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 0; border-top: 1px dashed var(--linea);
    font-size: 13px;
}
.para-quien:first-child { border-top: none; }
.para-quien .dia {
    flex-shrink: 0; min-width: 62px; font-weight: 700; color: var(--serie);
    font-size: 12px; text-transform: capitalize;
}
.para-quien .quien { flex: 1; min-width: 0; }
.para-quien .cuanto { flex-shrink: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

.btn-grande {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 46px; margin-top: 10px;
    border: none; border-radius: 10px; cursor: pointer;
    font-family: inherit; font-weight: 700; font-size: 14.5px; color: #fff; background: var(--serie);
}
.btn-grande:active { filter: brightness(.92); }
.btn-grande.hecho { background: var(--bien); }
.btn-grande.plano {
    background: #fff; color: var(--tinta-2); border: 1px solid var(--linea);
}

/* ── STOCK ───────────────────────────────────────────────────────────────── */
.barra-nivel {
    height: 8px; border-radius: 5px; background: var(--linea-2);
    overflow: hidden; margin-top: 8px;
}
.barra-nivel > div { height: 100%; border-radius: 5px; }
.barra-nivel > div.bien { background: var(--bien); }
.barra-nivel > div.ojo  { background: var(--ojo); }
.barra-nivel > div.bajo { background: var(--bajo); }
/* ── PREPARAR: LAS HERRAMIENTAS ──────────────────────────────────────────── */
.prep-tools {
    background: var(--papel); border: 1px solid var(--linea);
    border-radius: 12px; padding: 11px 12px;
    display: flex; flex-direction: column; gap: 9px;
}
.prep-cuenta { font-size: 13.5px; color: var(--tinta-2); }
.prep-cuenta b { color: var(--tinta); font-variant-numeric: tabular-nums; }
.prep-botones { display: flex; flex-wrap: wrap; gap: 7px; }
.prep-tool {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 40px; padding: 0 12px; flex: 1 1 auto; justify-content: center;
    border: 1px solid var(--linea); border-radius: 9px; cursor: pointer;
    background: #fff; color: var(--tinta-2);
    font-family: inherit; font-weight: 700; font-size: 13px; white-space: nowrap;
}
.prep-tool:active { background: var(--linea-2); }
.prep-tool.activo { border-color: var(--serie); color: var(--serie); }

/* Quién se lo lleva: sin conductor puesto, se avisa */
.prep-quien-lleva {
    display: inline-flex; align-items: center; gap: 5px; margin-top: 2px;
    color: var(--tinta-3); font-size: 11.5px;
}
.prep-quien-lleva.pendiente { color: var(--ojo); font-weight: 700; }

/* ── BUSCAR: CUÁNTO HAY Y DÓNDE ESTÁ ─────────────────────────────────────── */
.alm-buscador { position: relative; flex: 1; display: flex; align-items: center; }
.alm-buscador > i {
    position: absolute; left: 12px; color: var(--tinta-3); font-size: 14px; pointer-events: none;
}
.alm-buscador input {
    width: 100%; min-height: 44px; padding: 10px 40px 10px 36px;
    border: 1.5px solid var(--linea); border-radius: 10px;
    background: #fff; color: var(--tinta);
    /* 16 px o iOS hace zoom solo al tocar el campo */
    font-family: inherit; font-weight: 600; font-size: 16px;
    -webkit-appearance: none; appearance: none;
}
.alm-buscador input::-webkit-search-cancel-button { display: none; }
.alm-buscador input:focus { outline: none; border-color: var(--serie); }
.alm-borrar {
    position: absolute; right: 5px; width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: 8px; background: none;
    color: var(--tinta-3); font-size: 15px; cursor: pointer;
}
/* El sitio donde está: es lo que se viene a mirar, así que se ve */
.donde-principal {
    display: flex; align-items: center; gap: 7px;
    margin: 2px 0 8px; padding: 9px 11px; border-radius: 9px;
    background: color-mix(in srgb, var(--serie) 9%, #fff);
    color: var(--serie); font-size: 14px;
}
.donde-principal b { color: var(--tinta); font-size: 15px; }
.alm-sobran { padding: 16px 12px; font-size: 13px; }
/* El formato del artículo (IBC, Garrafa, Saco, Cisterna...) */
.et-formato {
    display: inline-block; padding: 1px 6px; margin-right: 2px;
    border-radius: 5px; background: var(--linea-2); color: var(--tinta-2);
    font-size: 11px; font-weight: 700;
}

/* ── LO QUE SALE ─────────────────────────────────────────────────────────── */
.sal-quien {
    display: inline-flex; align-items: center; gap: 5px; margin-top: 4px;
    font-size: 12px; font-weight: 600; color: var(--tinta-2);
}
.sal-quien.pendiente { color: var(--ojo); }
.et-cisterna {
    margin-left: 5px; padding: 1px 6px; border-radius: 5px;
    background: var(--linea-2); color: var(--tinta-2);
    font-size: 10.5px; font-weight: 700; text-transform: uppercase;
}

/* ── ENTRADAS ────────────────────────────────────────────────────────────── */
.ent-sec {
    display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
    padding: 2px 8px; border-radius: 6px;
    background: color-mix(in srgb, var(--sec-color) 13%, #fff);
    color: var(--sec-color);
    font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em;
}
.ent-linea {
    display: flex; justify-content: space-between; gap: 10px;
    padding: 7px 0; border-top: 1px dashed var(--linea); font-size: 13px;
}
.ent-linea:first-child { border-top: none; }
.ent-linea b { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── NIVELES ─────────────────────────────────────────────────────────────── */
.tanque-cifra { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.tanque-litros {
    font-size: 26px; font-weight: 800; line-height: 1;
    font-variant-numeric: tabular-nums; color: var(--tinta);
}
.tanque-unidad { font-size: 13px; color: var(--tinta-3); font-weight: 600; }
.tanque-pct { margin-left: auto; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tanque-cuando { font-size: 11.5px; color: var(--tinta-3); margin-top: 4px; }
.tanque-grafica { height: 96px; margin-top: 10px; }
.tanque-sinlectura {
    padding: 10px 0 2px; color: var(--tinta-3); font-size: 13px; font-style: italic;
}
.apunte {
    display: flex; gap: 8px; margin-top: 10px; align-items: stretch;
}
.apunte input {
    flex: 1; min-width: 0; min-height: 48px; padding: 10px 12px;
    border: 1.5px solid var(--linea); border-radius: 10px;
    /* 16 px o iOS hace zoom solo al tocar el campo */
    font-family: inherit; font-weight: 700; font-size: 16px; color: var(--tinta);
    text-align: right; font-variant-numeric: tabular-nums;
}
.apunte input:focus { outline: none; border-color: var(--serie); }
.apunte .sufijo {
    display: flex; align-items: center; padding: 0 4px;
    color: var(--tinta-3); font-size: 13px; font-weight: 700;
}
.apunte button {
    flex-shrink: 0; min-width: 96px; min-height: 48px;
    border: none; border-radius: 10px; cursor: pointer;
    background: var(--serie); color: #fff; font-family: inherit; font-weight: 700; font-size: 14.5px;
}
.apunte button:active { filter: brightness(.92); }
.apunte button:disabled { opacity: .5; }

/* ── LAS PESTAÑAS DE ABAJO ───────────────────────────────────────────────── */
.alm-pestanas {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: flex; height: var(--alto-pest);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--papel); border-top: 1px solid var(--linea);
}
.alm-pestana {
    flex: 1; position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: none; background: none; cursor: pointer;
    color: var(--tinta-3); font-family: inherit; font-weight: 600; font-size: 11px;
}
/* Con seis pestañas cada una se queda en 65 px en un móvil de 390: el
   rótulo se aprieta un punto para que no se parta en dos renglones. */
.alm-pestana i { font-size: 18px; }
@media (max-width: 430px) {
    .alm-pestana { font-size: 10px; gap: 2px; }
    .alm-pestana i { font-size: 17px; }
    .alm-cuenta { transform: translateX(16px); }
}
.alm-pestana.activa { color: var(--serie); }
.alm-pestana.activa::before {
    content: ''; position: absolute; top: 0; left: 22%; right: 22%;
    height: 3px; border-radius: 0 0 3px 3px; background: var(--serie);
}
.alm-cuenta {
    position: absolute; top: 6px; right: 50%; transform: translateX(22px);
    min-width: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--tinta-3); color: #fff;
    font-size: 10px; font-weight: 800; line-height: 18px; text-align: center;
}
.alm-cuenta:empty { display: none; }
.alm-cuenta.aviso { background: var(--bajo); }

/* ── DAR PARTE: flota encima de las pestañas ─────────────────────────────── */
.alm-flotante {
    position: fixed; right: 12px; z-index: 65;
    bottom: calc(var(--alto-pest) + env(safe-area-inset-bottom, 0px) + 12px);
    display: flex; align-items: center; gap: 8px;
    min-height: 46px; padding: 0 16px;
    border: none; border-radius: 24px; cursor: pointer;
    background: var(--bajo); color: #fff;
    font-family: inherit; font-weight: 700; font-size: 14px;
    box-shadow: 0 6px 18px rgba(220,38,38,.35);
}
.alm-flotante:active { filter: brightness(.92); }
/* Con una hoja abierta estorba */
body.con-hoja .alm-flotante { display: none; }
body.con-hoja { overflow: hidden; }

/* ── LAS HOJAS QUE TAPAN LA PANTALLA ─────────────────────────────────────── */
.alm-hoja {
    position: fixed; inset: 0; z-index: 80;
    background: var(--fondo); overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.alm-hoja[hidden] { display: none; }
.alm-hoja-cab {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: center; justify-content: space-between;
    height: var(--alto-cab); padding: 0 12px;
    background: var(--navy); color: #fff; font-size: 16px;
}
.alm-hoja .alm-barra { top: var(--alto-cab); }
.alm-btn-icono.oscuro { background: rgba(255,255,255,.16); }

/* ── LO QUE SE HA FABRICADO ──────────────────────────────────────────────── */
.fab-total {
    padding: 4px 2px 2px; color: var(--tinta-2); font-size: 13.5px;
}
.fab-total b { color: var(--tinta); font-size: 17px; font-variant-numeric: tabular-nums; }
.fab-cab {
    display: flex; align-items: center; gap: 10px; padding: 11px 12px 6px;
}
/* El color de cada producto es el que tiene puesto en su ficha */
.fab-punto {
    flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--pro-color) 14%, #fff);
    color: var(--pro-color); font-size: 15px;
}
.fab-lineas { padding: 0 12px 10px; }
.fab-aviso {
    display: flex; align-items: center; gap: 7px; margin-top: 8px;
    padding: 8px 10px; border-radius: 8px;
    background: color-mix(in srgb, var(--ojo) 12%, #fff);
    color: var(--ojo); font-size: 12.5px; font-weight: 600;
}

/* El formulario: se toca con guantes, así que todo grande */
.fab-productos {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px;
}
.fab-producto {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; min-height: 78px; padding: 10px 6px;
    border: 1.5px solid var(--linea); border-radius: 11px; cursor: pointer;
    background: #fff; color: var(--tinta-2);
    font-family: inherit; font-weight: 700; font-size: 12px; text-align: center;
}
.fab-producto i { font-size: 21px; color: var(--pro-color); }
.fab-producto span { line-height: 1.2; }
.fab-producto.activo {
    border-color: var(--pro-color); border-width: 2px; color: var(--tinta);
    background: color-mix(in srgb, var(--pro-color) 9%, #fff);
}
/* "Otro producto": se distingue de los de la lista con el borde a rayas,
   que es lo que se ve sin leer */
.fab-producto.otro { border-style: dashed; }
.fab-producto.otro.activo { border-style: solid; }
#fabOtro {
    width: 100%; margin-top: 8px; padding: 11px 12px;
    border: 1.5px solid var(--serie); border-radius: 10px;
    background: #fff; color: var(--tinta);
    /* 16 px o iOS hace zoom solo al tocar el campo */
    font-family: inherit; font-weight: 600; font-size: 16px;
}
#fabOtro:focus { outline: none; border-color: var(--serie); }

.fab-formatos { display: flex; flex-wrap: wrap; gap: 8px; }
.fab-formato {
    display: inline-flex; align-items: center; gap: 7px;
    min-height: 46px; padding: 0 14px;
    border: 1.5px solid var(--linea); border-radius: 10px; cursor: pointer;
    background: #fff; color: var(--tinta-2);
    font-family: inherit; font-weight: 700; font-size: 14px;
}
.fab-formato i { color: var(--tinta-3); }
.fab-formato.activo {
    border-color: var(--serie); border-width: 2px;
    background: color-mix(in srgb, var(--serie) 9%, #fff); color: var(--serie);
}
.fab-formato.activo i { color: var(--serie); }

.fab-contador { display: flex; align-items: stretch; gap: 10px; }
.fab-mas-menos {
    flex-shrink: 0; width: 58px; min-height: 58px;
    border: 1.5px solid var(--linea); border-radius: 11px; cursor: pointer;
    background: #fff; color: var(--tinta); font-size: 17px;
}
.fab-mas-menos:active { background: var(--linea-2); }
.fab-contador input {
    flex: 1; min-width: 0; min-height: 58px; padding: 10px;
    border: 1.5px solid var(--linea); border-radius: 11px;
    background: #fff; color: var(--tinta);
    /* Grande de verdad: es la cifra que se comprueba de un vistazo */
    font-family: inherit; font-weight: 800; font-size: 24px;
    text-align: center; font-variant-numeric: tabular-nums;
    -moz-appearance: textfield; appearance: textfield;
}
.fab-contador input::-webkit-outer-spin-button,
.fab-contador input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fab-contador input:focus { outline: none; border-color: var(--serie); }
.fab-cuenta {
    padding: 2px; color: var(--tinta-3); font-size: 13px; font-style: italic;
}
.fab-cuenta.lleno { color: var(--tinta-2); font-style: normal; }
.fab-cuenta b { color: var(--tinta); font-size: 15px; font-variant-numeric: tabular-nums; }

.parte-campo select {
    width: 100%; min-height: 50px; padding: 10px 12px;
    border: 1.5px solid var(--linea); border-radius: 10px;
    background: #fff; color: var(--tinta);
    /* 16 px o iOS hace zoom solo al tocar el campo */
    font-family: inherit; font-weight: 600; font-size: 16px;
}
.parte-campo select:focus { outline: none; border-color: var(--serie); }

/* ── EL PARTE QUE SE ENVÍA ───────────────────────────────────────────────── */
/* El formulario del parte */
.parte-campo { display: flex; flex-direction: column; gap: 7px; }
.parte-campo > label { font-size: 13px; font-weight: 700; color: var(--tinta-2); }
.parte-campo > label small { font-weight: 600; color: var(--tinta-3); }
.parte-tipos { display: flex; flex-wrap: wrap; gap: 7px; }
.parte-campo textarea,
.parte-campo input[type=text] {
    width: 100%; padding: 11px 12px;
    border: 1.5px solid var(--linea); border-radius: 10px;
    background: #fff; color: var(--tinta);
    /* 16 px o iOS hace zoom solo al tocar el campo */
    font-family: inherit; font-weight: 600; font-size: 16px;
    resize: vertical;
}
.parte-campo textarea:focus,
.parte-campo input[type=text]:focus { outline: none; border-color: var(--serie); }
.parte-foto-btn {
    display: flex; align-items: center; justify-content: center; gap: 9px;
    width: 100%; min-height: 52px;
    border: 1.5px dashed var(--linea); border-radius: 10px; cursor: pointer;
    background: #fff; color: var(--tinta-2);
    font-family: inherit; font-weight: 700; font-size: 15px;
}
.parte-foto-vista img {
    display: block; width: 100%; max-height: 340px; object-fit: contain;
    background: var(--linea-2);
    border-radius: 10px; border: 1px solid var(--linea);
}
.parte-quitar-foto {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    width: 100%; min-height: 44px; margin-top: 8px;
    border: 1px solid var(--linea); border-radius: 10px; cursor: pointer;
    background: #fff; color: var(--bajo);
    font-family: inherit; font-weight: 700; font-size: 14px;
}
.btn-grande.principal { min-height: 54px; font-size: 16px; margin-top: 4px; }
.parte-nota {
    display: flex; gap: 8px; padding: 2px 2px 8px;
    color: var(--tinta-3); font-size: 12.5px; line-height: 1.45;
}
.parte-nota b { color: var(--tinta-2); }

/* ── EL AVISO DE ABAJO ───────────────────────────────────────────────────── */
.alm-aviso {
    position: fixed; left: 12px; right: 12px; z-index: 90;
    bottom: calc(var(--alto-pest) + env(safe-area-inset-bottom, 0px) + 12px);
    padding: 13px 15px; border-radius: 11px;
    background: var(--navy); color: #fff; font-size: 14px; font-weight: 600;
    box-shadow: 0 8px 24px rgba(15,23,42,.28);
    opacity: 0; transform: translateY(12px); pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}
.alm-aviso.visible { opacity: 1; transform: none; }
.alm-aviso.mal { background: var(--bajo); }
.alm-aviso.bien { background: var(--bien); }

/* ── TABLET: dos columnas, que hay sitio ─────────────────────────────────── */
@media (min-width: 700px) {
    .alm-lista { padding: 14px 14px 82px; gap: 12px; }
    .alm-titulo { font-size: 19px; }
    /* Las fichas de stock, entradas y niveles se reparten en dos columnas;
       las de preparar no, que llevan sus títulos de semana en medio. */
    #listaBuscar, #listaEntradas, #listaNiveles {
        display: grid; grid-template-columns: repeat(2, 1fr); align-items: start;
    }
    /* El botón de apuntar es el primero de la lista: ocupa el ancho entero */
    #listaFabricacion {
        display: grid; grid-template-columns: repeat(2, 1fr); align-items: start;
    }
    #listaFabricacion > .btn-grande, #listaFabricacion > .fab-total,
    #listaFabricacion > .alm-vacio { grid-column: 1 / -1; }
    .tanque-grafica { height: 118px; }
}

@media (min-width: 1100px) {
    #listaBuscar, #listaEntradas, #listaNiveles,
    #listaFabricacion { grid-template-columns: repeat(3, 1fr); }
    /* En el HTML las pestañas van al final (para el móvil, donde se quieren
       abajo). Aquí se recolocan: cabecera, pestañas y luego el contenido. */
    body { display: flex; flex-direction: column; min-height: 100vh; }
    .alm-cab      { order: 1; }
    .alm-pestanas { order: 2; }
    .alm-cuerpo   { order: 3; }
    .alm-pestanas {
        /* En pantalla grande no hay pulgar: las pestañas suben arriba */
        position: sticky; top: var(--alto-cab); bottom: auto;
        border-top: none; border-bottom: 1px solid var(--linea);
    }
    .alm-pestana.activa::before { top: auto; bottom: 0; border-radius: 3px 3px 0 0; }
    body { padding-bottom: 0; }
    .alm-barra { top: calc(var(--alto-cab) + var(--alto-pest)); }
    .alm-aviso { bottom: 20px; left: auto; right: 20px; max-width: 380px; }
    .alm-flotante { bottom: 20px; right: 20px; }
    /* La hoja se queda en el centro; la sombra enorme hace de fondo oscuro
       sin necesidad de otro elemento por detrás. */
    .alm-hoja {
        inset: 28px auto 28px 50%; transform: translateX(-50%);
        width: min(680px, calc(100vw - 56px));
        border-radius: 16px; overflow: hidden auto;
        box-shadow: 0 0 0 100vmax rgba(15,23,42,.5), 0 20px 50px rgba(15,23,42,.3);
    }
    .alm-hoja .alm-lista { padding: 16px; }
}

/* ── EN PAPEL ────────────────────────────────────────────────────────────── */
@media print {
    /* Se imprime la lista y nada más: fuera cabecera, pestañas, filtros y
       botones, que en papel no sirven de nada. */
    .alm-cab, .alm-pestanas, .alm-flotante, .alm-barra, .alm-aviso,
    .prep-tools, .ficha-flecha, .btn-grande, .alm-hoja { display: none !important; }
    .alm-panel { display: none !important; }
    .alm-panel.activo { display: block !important; }
    body { padding: 0; background: #fff; font-size: 11pt; }
    .alm-lista { padding: 0; display: block; }
    /* Todo abierto: en papel no se despliega nada */
    .ficha-detalle { display: block !important; }
    .ficha {
        border: none; border-bottom: 1px solid #d8dee7; border-radius: 0;
        break-inside: avoid; page-break-inside: avoid;
    }
    .ficha-cab { padding: 6px 0; }
    .ficha-detalle { padding: 0 0 8px; }
    .semana-tit, .formato-tit { break-after: avoid; page-break-after: avoid; }
    .para-quien { border-color: #eceff4; }
}

@media (prefers-reduced-motion: reduce) {
    .alm-aviso, .ficha-flecha { transition: none; }
}
