/* picking.vastrapolymers.com — señalética de almacén */
:root {
  --floor: #E7E8E3;
  --surface: #FAFAF7;
  --ink: #1B2229;
  --ink-2: #4A535C;
  --line: #CDD0C8;
  --tape: #F5C400;
  --kraft: #A8773F;
  --kraft-bg: #F1E6D6;
  --teal: #127C86;
  --teal-bg: #DCEFF0;
  --go: #2C8A4B;
  --go-bg: #E1F1E6;
  --stop: #C8372D;
  --stop-bg: #F8E1DE;
  --radius-s: 4px;
  --radius-m: 8px;
  --cond: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  --body: 'Barlow', 'Segoe UI', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--floor);
  color: var(--ink);
  font: 16px/1.45 var(--body);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--tape); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--cond); font-weight: 700; margin: 0; line-height: 1.1; }

/* ---------- buttons ---------- */
.btn {
  border: 2px solid var(--ink); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: var(--radius-s); cursor: pointer;
  font-family: var(--cond); font-size: 1.05rem; font-weight: 600; letter-spacing: .02em;
  min-height: 44px;
}
.btn:hover { background: #2B343D; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: rgba(27,34,41,.06); }
.btn.go { background: var(--go); border-color: var(--go); }
.btn.go:hover { background: #247540; }
.btn.stop { background: transparent; color: var(--stop); border-color: var(--stop); }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: .95rem; }
.btn.block { width: 100%; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--ink); color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 20px 10px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--cond); font-size: 1.45rem; font-weight: 700; }
.brand-mark { width: 28px; height: 22px; background: var(--kraft); position: relative; border-radius: 2px; }
.brand-mark::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--tape); }
.tabs { display: flex; gap: 4px; }
.tab {
  background: transparent; border: 0; color: #C9CED3; padding: 8px 12px; cursor: pointer;
  font-family: var(--cond); font-size: 1.1rem; font-weight: 600; border-bottom: 3px solid transparent;
}
.tab[aria-current="page"] { color: #fff; border-bottom-color: var(--tape); }
.topbar .spacer { flex: 1; }
.topbar input[type="date"] {
  background: #2B343D; border: 1px solid #3C4650; color: #fff; border-radius: var(--radius-s);
  padding: 6px 10px; color-scheme: dark;
}
.who { color: #C9CED3; font-size: .95rem; }
.who button { background: none; border: 0; color: var(--tape); cursor: pointer; padding: 4px 6px; }

main { padding: 20px; max-width: 1400px; margin: 0 auto; }
.page-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: 2rem; }
.page-head p { margin: 0; color: var(--ink-2); }
.lag-note { font-size: .92rem; color: var(--ink-2); }

/* ---------- board: bays ---------- */
.bays { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.bay { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; display: flex; flex-direction: column; }
.bay-head { display: flex; align-items: center; gap: 14px; padding: 14px 16px 12px; }
.bay-code {
  font-family: var(--cond); font-weight: 700; font-size: 2.6rem; line-height: 1;
  background: var(--ink); color: var(--tape); padding: 4px 10px 2px; border-radius: var(--radius-s);
}
.bay-label { font-family: var(--cond); font-size: 1.4rem; font-weight: 600; }
.bay-label small { display: block; font-family: var(--body); font-size: .85rem; font-weight: 400; color: var(--ink-2); }

/* Estado del pull: cinta de piso */
.band {
  padding: 7px 16px; font-family: var(--cond); font-weight: 600; font-size: 1.05rem;
  display: flex; align-items: center; gap: 8px;
}
.band.partial {
  color: var(--ink);
  background: repeating-linear-gradient(-45deg, var(--tape) 0 14px, #FFE27A 14px 28px);
}
.band.complete { background: var(--go); color: #fff; }
.band.big { font-size: 1.35rem; padding: 12px 18px; }
.band .sub { font-family: var(--body); font-weight: 500; font-size: .9rem; opacity: .85; }

.reps { padding: 6px 16px 2px; }
.rep { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.rep:last-child { border-bottom: 0; }
.rep-name { font-family: var(--cond); font-size: 1.25rem; font-weight: 600; }
.rep-meta { grid-column: 1; font-size: .9rem; color: var(--ink-2); }
.rep-hint { color: #8A6A00; font-weight: 600; }
.done-toggle {
  grid-row: 1 / span 2; grid-column: 2;
  border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px;
  font-family: var(--cond); font-size: 1rem; font-weight: 600; cursor: pointer; min-height: 40px; color: var(--ink-2);
}
.done-toggle[aria-pressed="true"] { background: var(--go); border-color: var(--go); color: #fff; }
.done-toggle.hint { border-color: var(--tape); color: var(--ink); }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 8px; }
.metric { padding: 10px 12px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric b { display: block; font-family: var(--cond); font-size: 1.9rem; line-height: 1; font-weight: 700; }
.metric span { font-size: .85rem; color: var(--ink-2); }
.metric.ready b { color: var(--kraft); }
.metric.held b { color: var(--teal); }
.progress { height: 6px; background: var(--floor); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ink); }

.bay-foot { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.pull-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 3px 8px; font-size: .88rem; background: #fff; cursor: pointer;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tape); }
.chip.en_proceso .dot { background: var(--teal); }
.chip.completado .dot { background: var(--go); }
.chip.t-COMPLETO { border-color: var(--go); }
.empty-note { color: var(--ink-2); font-size: .9rem; }

/* ---------- quantities ---------- */
.qty { display: inline-flex; align-items: baseline; gap: 5px; border-radius: var(--radius-s); padding: 2px 9px; font-family: var(--cond); font-weight: 700; }
.qty b { font-size: 1.5rem; line-height: 1.1; }
.qty small { font-size: .85rem; font-weight: 600; }
.qty.cj { background: var(--kraft-bg); color: #6E4A1F; }
.qty.dsp { background: var(--teal-bg); color: var(--teal); }
.qty.ret { background: transparent; color: var(--ink-2); border: 1px dashed var(--line); }
.qty.sob { background: var(--stop-bg); color: var(--stop); }

/* ---------- drawer / modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(27,34,41,.45); z-index: 40; display: flex; justify-content: flex-end; }
.drawer {
  background: var(--surface); width: min(760px, 100%); height: 100%; display: flex; flex-direction: column;
  box-shadow: -8px 0 24px rgba(27,34,41,.18); animation: slideIn .18s ease-out;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.drawer-head { padding: 18px 20px 12px; display: flex; align-items: center; gap: 12px; }
.drawer-head h2 { font-size: 1.7rem; flex: 1; }
.drawer-body { flex: 1; overflow: auto; padding: 0 20px 20px; }
.drawer-foot { padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.drawer-foot .spacer { flex: 1; }
.x { background: none; border: 0; font-size: 1.8rem; line-height: 1; cursor: pointer; padding: 4px 8px; color: var(--ink-2); }

.opts { display: grid; gap: 10px; margin: 14px 0; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-m); background: #fff; }
.opt input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--go); }
.opt p { margin: 2px 0 0; font-size: .9rem; color: var(--ink-2); }
.field { display: grid; gap: 4px; }
.field label { font-weight: 600; font-size: .92rem; }
.field input, .field select { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; min-height: 44px; }

.summary-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.notice { padding: 10px 12px; border-radius: var(--radius-s); background: #FFF4C2; border-left: 4px solid var(--tape); font-size: .95rem; margin: 10px 0; }
.notice.stop { background: var(--stop-bg); border-left-color: var(--stop); }

table.grid { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); }
table.grid th { text-align: left; font-family: var(--cond); font-weight: 600; font-size: 1rem; padding: 8px 10px; border-bottom: 2px solid var(--ink); background: var(--surface); position: sticky; top: 0; }
table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid td.n { text-align: right; white-space: nowrap; }
.code { color: var(--ink-2); font-size: .82rem; }
.wrap-x { overflow-x: auto; }

/* ---------- picker ---------- */
.pull-list { display: grid; gap: 12px; max-width: 760px; }
.pull-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; cursor: pointer; text-align: left; padding: 0; width: 100%; }
.pull-card:hover { border-color: var(--ink-2); }
.pull-card .pc-body { padding: 12px 16px 14px; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: center; }
.pc-code { font-family: var(--cond); font-weight: 700; font-size: 2.2rem; line-height: 1; grid-row: span 2; }
.pc-title { font-family: var(--cond); font-weight: 600; font-size: 1.3rem; }
.pc-meta { font-size: .9rem; color: var(--ink-2); }
.pc-status { grid-row: span 2; text-align: right; font-family: var(--cond); font-weight: 600; }
.status-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .95rem; background: var(--floor); }
.status-pill.en_proceso { background: var(--teal-bg); color: var(--teal); }
.status-pill.completado { background: var(--go-bg); color: var(--go); }
.pull-card.done { opacity: .6; }

.pick-lines { display: grid; gap: 8px; max-width: 900px; margin: 14px 0 110px; }
.pick-line {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px 14px; cursor: pointer; text-align: left; width: 100%;
}
.pick-line .box { width: 36px; height: 36px; border: 3px solid var(--ink); border-radius: var(--radius-s); display: grid; place-items: center; font-size: 1.4rem; font-weight: 700; }
.pick-line.picked { background: var(--go-bg); border-color: #B8DCC3; }
.pick-line.picked .box { background: var(--go); border-color: var(--go); color: #fff; }
.pick-line.picked .pl-name { text-decoration: line-through; text-decoration-color: rgba(27,34,41,.35); }
.pl-name { font-weight: 600; font-size: 1.02rem; }
.pl-qty { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pick-line.return { border-color: var(--stop); }

.sticky-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  background: var(--ink); color: #fff; padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex; gap: 14px; align-items: center;
}
.sticky-foot .count { font-family: var(--cond); font-size: 1.4rem; font-weight: 700; }
.sticky-foot .spacer { flex: 1; }
.sticky-foot .btn.go { min-width: 200px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); background: var(--surface); border-radius: var(--radius-m); overflow: hidden; border: 1px solid var(--line); }
.login-card .band { font-size: 1rem; }
.login-card form { padding: 22px; display: grid; gap: 14px; }
.login-card h1 { font-size: 2.2rem; }
.err { color: var(--stop); font-weight: 600; min-height: 1.2em; }

/* ---------- users ---------- */
.two-col { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; display: grid; gap: 12px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--radius-s);
  font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw;
}
#toast.show { opacity: 1; }
#toast.err { background: var(--stop); }

.loading { padding: 40px; text-align: center; color: var(--ink-2); }

@media (max-width: 760px) {
  main { padding: 14px; }
  .topbar { padding-left: 14px; padding-right: 14px; gap: 10px; }
  .bays { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .pick-line { grid-template-columns: 40px 1fr; }
  .pl-qty { grid-column: 2; justify-content: flex-start; }
  .sticky-foot .btn.go { min-width: 0; flex: 1; }
  .hide-sm { display: none; }
  .band { display: block; }
  .band .sub { display: block; }
  .pc-title { font-size: 1.15rem; }
}

@media print {
  .topbar, .sticky-foot, .no-print, #toast { display: none !important; }
  body { background: #fff; }
  main { padding: 0; }
  .pick-line { break-inside: avoid; border-color: #999; }
  .band.partial { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
