/* Suministros de emergencia — modo noche
   Paleta inspirada en la señalización fotoluminiscente de evacuación:
   fondo azul noche y un único acento verde fosforescente para lo que importa (cantidades y acciones). */

@font-face { font-family: 'Barlow'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/barlow-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/barlow-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/barlow-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/barlow-condensed-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/barlow-condensed-latin-700-normal.woff2') format('woff2'); }

:root {
  --night: #0c1220;
  --deck: #121a2b;
  --deck-2: #19233a;
  --rule: #26324d;
  --ink: #e8edf5;
  --ink-2: #9ba8bf;
  --ink-3: #6b7893;
  --glow: #d4f28c;
  --glow-ink: #13200a;
  --glow-soft: rgba(212, 242, 140, 0.14);
  --expired: #ff6b5e;
  --soon: #ffb648;
  --fresh: #6fb79a;
  --none: #4a5878;

  --sans: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --cond: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--night); }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--night);
  color: var(--ink);
  font: 400 16px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body:has(dialog[open]) { overflow: hidden; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); pointer-events: none; }

/* ---------- Botones y campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: none;
  font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--glow); color: var(--glow-ink); }
.btn-primary:hover { background: #e0f7a6; }
.btn-ghost { background: var(--deck-2); border-color: var(--rule); color: var(--ink); }
.btn-ghost:hover { border-color: #3a4868; }
.btn-danger { background: transparent; border-color: rgba(255, 107, 94, .45); color: var(--expired); }
.btn-danger:hover { background: rgba(255, 107, 94, .1); }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: var(--r-sm); border: 0; background: transparent; color: var(--ink-2);
}
.icon-btn:hover { background: var(--deck-2); color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field + .field, .field-row + .field, .field + .field-row { margin-top: 18px; }
.field-label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

input[type=text], input[type=password], input[type=search], input[type=number], input[type=date], input:not([type]), select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px;
  background: var(--deck-2); border: 1px solid var(--rule); border-radius: var(--r-sm);
  font-size: 16px; color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--glow); box-shadow: 0 0 0 3px var(--glow-soft); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input[type=date] { min-width: 0; }
input[type=date]:disabled { opacity: .45; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

.form-error { color: var(--expired); font-size: 14px; min-height: 0; }
.form-error:empty { display: none; }
.form-error:not(:empty) { margin-top: 14px; }

.stepper { display: grid; grid-template-columns: 46px 1fr 46px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--deck-2); overflow: hidden; }
.stepper input { border: 0; border-radius: 0; background: transparent; text-align: center; font: 700 22px/1 var(--cond); color: var(--glow); padding: 0; }
.stepper input:focus { box-shadow: none; }
.stepper .step { display: grid; place-items: center; border: 0; background: transparent; color: var(--ink); }
.stepper .step:hover { background: #222d47; }
.stepper:focus-within { border-color: var(--glow); box-shadow: 0 0 0 3px var(--glow-soft); }

.switch { display: inline-flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 15px; color: var(--ink-2); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 40px; height: 24px; border-radius: 99px; background: var(--deck-2); border: 1px solid var(--rule); transition: background-color .15s; flex: none; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-2); transition: transform .15s, background-color .15s; }
.switch input:checked + .switch-track { background: var(--glow-soft); border-color: var(--glow); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: var(--glow); }
.switch input:checked ~ span:last-child { color: var(--ink); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--glow); outline-offset: 2px; }

/* ---------- Acceso ---------- */
.lock {
  min-height: 100dvh; display: grid; place-items: center;
  padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b));
}
.lock-card { width: min(380px, 100%); }
.lock-mark { width: 52px; height: 52px; color: var(--glow); stroke-width: 1.4; filter: drop-shadow(0 0 10px rgba(212, 242, 140, .35)); }
.lock-title { font: 700 34px/1.05 var(--cond); margin: 18px 0 8px; letter-spacing: .005em; }
.lock-sub { color: var(--ink-2); margin-bottom: 26px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 50px; }
.pw-wrap .icon-btn { position: absolute; right: 1px; top: 1px; height: 44px; }
.lock .btn-block { margin-top: 18px; min-height: 50px; font-size: 16px; }
.lock-conn { margin-top: 18px; font-size: 14px; color: var(--ink-3); display: flex; gap: 8px; align-items: baseline; }
.lock-conn::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; transform: translateY(-1px); }
.lock-conn.is-on::before { background: var(--glow); box-shadow: 0 0 8px var(--glow); }
.lock-conn.is-off::before { background: var(--soon); }
.lock-conn:empty { display: none; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + var(--safe-t)) calc(12px + var(--safe-r)) 8px calc(16px + var(--safe-l));
  background: rgba(12, 18, 32, .92);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 9px; font: 600 21px/1 var(--cond); margin-right: auto; letter-spacing: .01em; }
.brand-mark { width: 24px; height: 24px; color: var(--glow); }

.pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 12px;
  border-radius: 99px; border: 1px solid var(--rule); background: var(--deck);
  font-size: 13.5px; font-weight: 500; color: var(--ink-2); max-width: 52vw;
}
.pill-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.pill.is-ok .dot { background: var(--glow); box-shadow: 0 0 8px var(--glow); }
.pill.is-pending .dot { background: var(--soon); }
.pill.is-off .dot { background: var(--expired); }
.pill.is-off { color: var(--ink); }
.pill.is-busy .dot { background: transparent; border: 2px solid var(--glow); border-right-color: transparent; width: 10px; height: 10px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.offline-bar {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px calc(6px + var(--safe-r)) 8px calc(16px + var(--safe-l));
  background: #2a2111; color: #f6dca8; font-size: 14px; border-bottom: 1px solid #4a3a17;
}
.offline-bar p { flex: 1; padding-top: 4px; }
.offline-bar strong { color: #ffe7b3; }
.offline-bar .icon-btn { color: #f6dca8; width: 36px; height: 36px; }
.offline-bar .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.update-bar {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
  top: calc(8px + var(--safe-t)); width: min(560px, calc(100vw - 16px));
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 10px 10px 16px; border-radius: var(--r-md);
  background: var(--deck-2); border: 1px solid var(--glow); box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}
.update-bar p { flex: 1 1 100%; font-weight: 500; padding: 2px 0; }
#updateLater { margin-left: auto; }
.update-bar .btn { min-height: 40px; }

/* ---------- Contenido ---------- */
.main {
  width: 100%; max-width: 1240px; margin: 0 auto;
  padding: 22px calc(16px + var(--safe-r)) calc(110px + var(--safe-b)) calc(16px + var(--safe-l));
}
.overview { margin-bottom: 16px; }
.overview-title { font: 700 38px/1 var(--cond); letter-spacing: .005em; }
.overview-sum { margin-top: 6px; color: var(--ink-2); font-size: 15.5px; }
.overview-sum b { color: var(--ink); font-weight: 600; }

.toolbar { display: flex; gap: 10px; align-items: stretch; }
.search { position: relative; flex: 1; min-width: 0; }
.search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 40px; }
.search input::-webkit-search-cancel-button { filter: invert(.7); }
.sort { position: relative; flex: none; }
.sort-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sort select { width: auto; min-width: 128px; }

.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 14px calc(-16px - var(--safe-l)) 16px; padding: 2px calc(16px + var(--safe-l));
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px;
  border-radius: 99px; border: 1px solid var(--rule); background: transparent; color: var(--ink-2);
  font-size: 14.5px; font-weight: 500;
}
.chip-n { font: 700 16px/1 var(--cond); color: var(--ink); font-variant-numeric: tabular-nums; }
.chip[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--night); }
.chip[aria-pressed=true] .chip-n { color: var(--night); }
.chip.c-expired .chip-n { color: var(--expired); }
.chip.c-soon .chip-n { color: var(--soon); }
.chip.c-expired[aria-pressed=true] .chip-n, .chip.c-soon[aria-pressed=true] .chip-n { color: var(--night); }

.cat-chips { margin-top: -6px; }
.cat-chips .chip { min-height: 32px; font-size: 13.5px; }
.loc-chips { margin-top: -6px; }
.loc-chips .chip { min-height: 32px; font-size: 13.5px; }
.loc-chips .chip .ico { width: 15px; height: 15px; }
.lock-note { margin-top: 12px; font-size: 13.5px; color: var(--ink-3); }
.tag-cat { color: var(--ink-3); }
.tag-loc { color: var(--ink-3); display: inline-flex; align-items: center; gap: 4px; }
.tag-loc .ico { width: 13px; height: 13px; opacity: .85; }
.detail-cat { color: var(--ink-2); font-size: 14.5px; margin: -4px 0 10px; }
.detail-loc { display: inline-flex; align-items: center; gap: 4px; }
.detail-loc .ico { width: 14px; height: 14px; }
.field-opt { color: var(--ink-3); font-weight: 400; }

/* ---------- Lista ---------- */
.list { display: grid; gap: 10px; }
.row {
  --stripe: var(--none);
  position: relative; display: flex; align-items: center; gap: 4px;
  background: var(--deck); border: 1px solid var(--rule); border-radius: var(--r-md);
  padding: 8px 8px 8px 14px; min-width: 0;
}
.row::before {
  content: ''; position: absolute; left: 5px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px;
  background: var(--stripe);
}
.row.s-expired { --stripe: var(--expired); }
.row.s-soon { --stripe: var(--soon); }
.row.s-ok { --stripe: var(--fresh); }
.row-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  border: 0; background: none; padding: 2px; text-align: left; border-radius: var(--r-sm);
}
.thumb {
  position: relative; flex: none; width: 60px; height: 60px; border-radius: var(--r-sm);
  background: var(--deck-2); display: grid; place-items: center; overflow: hidden; color: var(--ink-3);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ico { width: 26px; height: 26px; stroke-width: 1.4; }
.thumb-count {
  position: absolute; right: 3px; bottom: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: rgba(8, 12, 22, .82); color: var(--ink); font: 600 11.5px/18px var(--sans); text-align: center;
}
.row-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-title { font-weight: 600; font-size: 16.5px; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.row-desc { color: var(--ink-3); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 1px; }
.tag { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.tag-expired { color: var(--expired); }
.tag-soon { color: var(--soon); }
.tag-out { color: var(--expired); background: rgba(255, 107, 94, .12); padding: 0 7px; border-radius: 5px; }

.qty { flex: none; display: flex; align-items: center; }
.qbtn {
  width: 40px; height: 44px; border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--ink-2); display: grid; place-items: center;
}
.qbtn:hover:not(:disabled) { background: var(--deck-2); color: var(--ink); }
.qbtn:disabled { opacity: .3; cursor: default; }
.qbtn .ico { width: 18px; height: 18px; stroke-width: 2.2; }
.qnum {
  min-width: 34px; text-align: center; font: 700 26px/1 var(--cond); font-variant-numeric: tabular-nums;
  color: var(--glow); text-shadow: 0 0 14px rgba(212, 242, 140, .35);
}
.row.is-out .qnum { color: var(--expired); text-shadow: none; }
.qnum.pulse { animation: pulse .35s ease-out; }
@keyframes pulse { 0% { transform: scale(1.28); } 100% { transform: scale(1); } }

.empty { text-align: left; padding: 30px 4px; max-width: 520px; }
.empty h2 { font: 700 26px/1.1 var(--cond); margin-bottom: 8px; }
.empty p { color: var(--ink-2); margin-bottom: 18px; }

.fab {
  position: fixed; right: calc(18px + var(--safe-r)); bottom: calc(18px + var(--safe-b)); z-index: 9;
  width: 62px; height: 62px; border-radius: 50%; border: 0;
  background: var(--glow); color: var(--glow-ink); display: grid; place-items: center;
  box-shadow: 0 0 0 6px rgba(212, 242, 140, .08), 0 10px 28px rgba(0, 0, 0, .45);
}
.fab .ico { width: 28px; height: 28px; stroke-width: 2.2; }
.wide-only { display: none; }

/* ---------- Hojas (diálogos) ---------- */
dialog { color: var(--ink); }
.sheet {
  padding: 0; border: 0; background: var(--deck);
  width: 100%; max-width: 100%; max-height: 94dvh;
  margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0;
  border-top: 1px solid var(--rule);
  overflow: hidden;
}
.sheet::backdrop { background: rgba(3, 6, 14, .72); }
.sheet[open] { animation: sheet-up .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-inner { display: flex; flex-direction: column; max-height: 94dvh; }
.sheet-head {
  display: flex; align-items: center; gap: 8px; padding: 14px 10px 10px 20px; border-bottom: 1px solid var(--rule); flex: none;
}
.sheet-head h2 { flex: 1; min-width: 0; font: 600 24px/1.15 var(--cond); overflow-wrap: anywhere; }
.sheet-body { padding: 18px 20px 20px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot {
  display: flex; gap: 10px; justify-content: flex-end; flex: none;
  padding: 12px 20px calc(12px + var(--safe-b)); border-top: 1px solid var(--rule); background: var(--deck);
}
.sheet-foot .btn { flex: 1; }
.sheet-small .sheet-body { padding-top: 22px; }
.confirm-title { font: 600 24px/1.15 var(--cond); margin-bottom: 8px; }
.confirm-text { color: var(--ink-2); }

/* Lotes en el formulario */
.lots-head { display: flex; align-items: center; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; }
.lots-head .switch { margin-top: 0; }
.lots-edit { display: flex; flex-direction: column; gap: 8px; }
.lot-edit { display: grid; grid-template-columns: minmax(124px, 150px) minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.lot-edit.no-exp { grid-template-columns: minmax(124px, 150px) auto; }
.lot-edit .stepper { grid-template-columns: 40px 1fr 40px; }
.lot-noexp { color: var(--ink-2); }
.lot-del-ph { width: 44px; height: 1px; }
.btn-add-lot { align-self: flex-start; margin-top: 4px; }
.field-hint { color: var(--ink-3); font-size: 13.5px; }

/* Fotos en el formulario */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.photo-grid:empty { display: none; }
.pg-item { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--deck-2); border: 1px solid var(--rule); }
.pg-item img { width: 100%; height: 100%; object-fit: cover; }
.pg-item.is-busy { display: grid; place-items: center; color: var(--ink-3); font-size: 12.5px; text-align: center; padding: 6px; }
.pg-item.is-missing { display: grid; place-items: center; color: var(--ink-3); font-size: 12px; text-align: center; padding: 6px; }
.pg-del {
  position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: rgba(8, 12, 22, .85); color: var(--ink); display: grid; place-items: center;
}
.pg-del .ico { width: 16px; height: 16px; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.photo-grid:empty + .photo-actions { margin-top: 0; }

/* Ficha */
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: -4px -20px 18px; padding: 0 20px; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery button { flex: none; width: min(78%, 340px); aspect-ratio: 4 / 3; padding: 0; border: 0; border-radius: var(--r-md); overflow: hidden; background: var(--deck-2); scroll-snap-align: start; }
.gallery button:only-child { width: 100%; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery .g-missing { display: grid; place-items: center; color: var(--ink-3); font-size: 14px; }
.detail-qty { display: flex; align-items: center; gap: 14px; padding: 6px 0 14px; }
.detail-qty .qbtn { width: 52px; height: 52px; border: 1px solid var(--rule); background: var(--deck-2); color: var(--ink); }
.detail-qty .qbtn .ico { width: 22px; height: 22px; }
.detail-qty .qnum { font-size: 60px; min-width: 64px; }
.detail-qty .unit { color: var(--ink-2); font-size: 15px; margin-left: -4px; }
.detail-exp { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--deck-2); font-weight: 500; }
.detail-exp::before { content: ''; width: 4px; align-self: stretch; border-radius: 4px; background: var(--none); flex: none; }
.detail-exp.s-expired::before { background: var(--expired); }
.detail-exp.s-soon::before { background: var(--soon); }
.detail-exp.s-ok::before { background: var(--fresh); }
.detail-exp small { color: var(--ink-2); font-weight: 400; font-size: 14px; }
.detail-desc { margin-top: 16px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); max-width: 68ch; }
.detail-meta { margin-top: 18px; font-size: 13.5px; color: var(--ink-3); }

/* Lotes en la ficha */
.detail-total { display: flex; align-items: baseline; gap: 10px; padding: 2px 0 12px; }
.detail-total .qnum { font-size: 56px; min-width: 0; text-align: left; }
.detail-total .unit { color: var(--ink-2); font-size: 15px; }
.detail-total.is-out .qnum { color: var(--expired); text-shadow: none; }
.lots { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lot {
  --stripe: var(--none);
  position: relative; display: flex; align-items: center; gap: 4px;
  padding: 6px 4px 6px 18px; border-radius: var(--r-sm); background: var(--deck-2);
}
.lot::before { content: ''; position: absolute; left: 7px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--stripe); }
.lot.s-expired { --stripe: var(--expired); }
.lot.s-soon { --stripe: var(--soon); }
.lot.s-ok { --stripe: var(--fresh); }
.lot-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lot-date { font-weight: 600; }
.lot-state { font-size: 13.5px; color: var(--ink-2); }
.lot.s-expired .lot-state { color: var(--expired); }
.lot.s-soon .lot-state { color: var(--soon); }
.lot .qnum { font-size: 24px; min-width: 30px; }
.lot.s-empty .qnum { color: var(--ink-3); text-shadow: none; }
.lot .qbtn:hover:not(:disabled) { background: #222d47; }
.lot-del { color: var(--ink-3); width: 40px; }
.lot-del:hover { color: var(--expired); background: transparent; }
.lots + .btn-add-lot { margin-top: 10px; }

/* Barra para eliminar lo caducado */
.bulk-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 12px; border-radius: var(--r-md);
  border: 1px solid rgba(255, 107, 94, .35); background: rgba(255, 107, 94, .07);
}
.qty-multi { padding: 0 14px; }
.tag-lots { color: var(--ink-2); background: var(--deck-2); padding: 0 7px; border-radius: 5px; }
.choose-list { margin-top: 12px; }
.menu-item.is-danger .ico, .menu-item.is-danger strong { color: var(--expired); }
.choose-list .menu-item .ico { color: var(--ink-2); }
.choose-list .menu-item.is-danger .ico { color: var(--expired); }

/* Menú */
.menu { padding-top: 8px; }
.menu-sec { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.menu-sec:last-child { border-bottom: 0; }
.menu-sec h3 { font: 600 19px/1.2 var(--cond); margin-bottom: 4px; }
.menu-note { color: var(--ink-3); font-size: 14px; margin-bottom: 8px; }
.menu-item {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 11px 10px; margin: 0 -10px; width: calc(100% + 20px);
  border: 0; border-radius: var(--r-sm); background: none;
}
.menu-item:hover:not(:disabled) { background: var(--deck-2); }
.menu-item:disabled { opacity: .4; cursor: default; }
.menu-item .ico { color: var(--glow); width: 22px; height: 22px; }
.menu-item span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.menu-item strong { font-weight: 600; }
.menu-item small { color: var(--ink-2); font-size: 13.5px; }

/* Visor de fotos */
.lightbox {
  padding: 0; border: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none;
  background: #04070d; color: var(--ink);
}
.lightbox::backdrop { background: #04070d; }
.lb-track { display: flex; width: 100%; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.lb-track::-webkit-scrollbar { display: none; }
.lb-slide { flex: none; width: 100%; height: 100%; scroll-snap-align: center; display: grid; place-items: center; padding: calc(56px + var(--safe-t)) 0 calc(48px + var(--safe-b)); }
.lb-slide img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-close { position: absolute; top: calc(8px + var(--safe-t)); right: calc(8px + var(--safe-r)); background: rgba(20, 28, 44, .8); color: var(--ink); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(20, 28, 44, .8); color: var(--ink); display: none; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-count { position: absolute; left: 0; right: 0; bottom: calc(14px + var(--safe-b)); text-align: center; color: var(--ink-2); font-size: 14px; }

/* Aviso flotante */
.toast {
  position: fixed; inset: auto auto calc(96px + var(--safe-b)) 50%; transform: translateX(-50%);
  margin: 0; max-width: min(92vw, 460px); padding: 12px 16px; border-radius: var(--r-md);
  background: #e8edf5; color: #0c1220; border: 0; font-weight: 500; font-size: 15px;
  display: none; align-items: center; gap: 14px;
}
.toast.show { display: flex; }
.toast:popover-open { display: flex; }
.toast button { border: 0; background: none; color: #3a5a00; font-weight: 700; padding: 4px 2px; }

/* Impresión */
.print-area { display: none; }

/* ---------- Pantallas grandes ---------- */
@media (min-width: 720px) {
  .list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-row { gap: 18px; }
}
@media (min-width: 900px) {
  .fab { display: none; }
  .wide-only { display: inline-flex; }
  .topbar { padding-left: calc(28px + var(--safe-l)); padding-right: calc(24px + var(--safe-r)); gap: 12px; }
  .main { padding: 36px 28px 60px; }
  .overview { display: flex; align-items: baseline; gap: 18px; margin-bottom: 22px; }
  .overview-title { font-size: 46px; }
  .overview-sum { margin: 0; font-size: 16.5px; }
  .chips { margin: 16px 0 20px; padding: 2px 0; flex-wrap: wrap; overflow: visible; }
  .cat-chips { margin-top: -10px; }
  .thumb { width: 68px; height: 68px; }
  .sheet {
    margin: auto; width: min(600px, 92vw); max-height: 88dvh;
    border-radius: var(--r-lg); border: 1px solid var(--rule);
  }
  .sheet-inner { max-height: 88dvh; }
  .sheet-small { width: min(440px, 92vw); }
  .sheet-foot .btn { flex: none; min-width: 120px; }
  .sheet[open] { animation-name: sheet-in; }
  .lb-nav { display: grid; }
  .toast { bottom: 28px; }
}
@keyframes sheet-in { from { transform: translateY(12px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@media (pointer: fine) {
  .touch-only { display: none; }
}
@media (max-width: 380px) {
  .field-row { grid-template-columns: 1fr; }
  .brand span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  html, body { background: #fff !important; color: #000 !important; }
  body > *:not(#printArea) { display: none !important; }
  .print-area { display: block !important; }
  @page { margin: 14mm; }
}
.detail-qty.is-out .qnum { color: var(--expired); text-shadow: none; }
