/* WMS styles. Phone-first; the floor app is designed for gloves, glare and one hand. */
:root {
  --blue: #1d4ed8; --blue-dark: #1e3a8a; --green: #15803d; --green-bg: #dcfce7;
  --red: #b91c1c; --red-bg: #fee2e2; --amber: #b45309; --amber-bg: #fef3c7;
  --ink: #111827; --muted: #4b5563; --line: #d1d5db; --bg: #f3f4f6; --card: #fff;
  --radius: 12px; --tap: 56px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-size: 18px; line-height: 1.45; }
h1 { font-size: 1.6rem; margin: .4em 0 .6em; line-height: 1.2; }
h2 { font-size: 1.25rem; margin: 1.2em 0 .5em; }
h3 { font-size: 1.05rem; margin: 1em 0 .4em; }
a { color: var(--blue); }
p { margin: .5em 0; }
.muted { color: var(--muted); font-size: .9em; }
.narrow { max-width: 560px; margin: 0 auto; padding: 12px 14px 80px; }
.wide { max-width: 1200px; margin: 0 auto; padding: 16px 18px 80px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1 1 200px; }
.spacer { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* Forms */
label { display: block; font-weight: 600; }
label > input, label > select, label > textarea { display: block; width: 100%; margin-top: 6px; font-weight: 400; }
input, select, textarea, button, .button {
  font: inherit; font-size: 1rem; border-radius: 10px; border: 2px solid var(--line);
  padding: 10px 12px; min-height: 48px; background: #fff; color: var(--ink);
}
textarea { min-height: 120px; font-family: ui-monospace, monospace; font-size: .9rem; }
input:focus, select:focus, textarea:focus { outline: 3px solid #93c5fd; border-color: var(--blue); }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 400; }
label.check input { width: 26px; height: 26px; min-height: 0; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
legend { font-weight: 700; padding: 0 6px; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none; font-weight: 600; background: #fff; border-color: #9ca3af;
}
button.primary, .button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
button.danger, .button.danger { background: #fff; color: var(--red); border-color: var(--red); }
button.ghost { border-color: transparent; background: transparent; min-height: 40px; }
button.big, .button.big { width: 100%; min-height: var(--tap); font-size: 1.15rem; }
button.huge, .button.huge { width: 100%; min-height: 72px; font-size: 1.3rem; }
button:disabled { opacity: .6; cursor: wait; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
form.inline { display: inline; }

/* Feedback */
.banner, .result { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; font-weight: 600; }
.banner.ok, .result.ok { background: var(--green-bg); color: #14532d; border: 2px solid var(--green); }
.banner.err, .result.err { background: var(--red-bg); color: #7f1d1d; border: 2px solid var(--red); }
.result { font-size: 1.15rem; padding: 18px; }
.result strong { display: block; font-size: 1.3rem; }
.banner-icon .icon, .result-icon .icon { width: 30px; height: 30px; flex: none; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; background: #e5e7eb; color: #374151; }
.badge.ok { background: var(--green-bg); color: #14532d; }
.badge.err { background: var(--red-bg); color: #7f1d1d; }
.badge.warn { background: var(--amber-bg); color: #78350f; }
.badge.info { background: #dbeafe; color: var(--blue-dark); }
.empty { color: var(--muted); padding: 20px; text-align: center; border: 2px dashed var(--line); border-radius: var(--radius); }
.icon { width: 24px; height: 24px; vertical-align: middle; }

/* Sign-in */
body.bare { background: linear-gradient(#e0e7ff, var(--bg) 320px); }
body.bare main { padding-top: 8vh; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.person { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 8px; background: #fff; border: 2px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.1rem; min-height: 120px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-size: 1.3rem; }
.pin-input { font-size: 2rem; letter-spacing: .4em; text-align: center; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { min-height: 68px; font-size: 1.6rem; }

/* Floor app */
.floorbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; background: var(--blue-dark); color: #fff; padding: 6px 10px; }
.floorbar .home { color: #fff; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 10px; background: rgba(255,255,255,.12); }
.floorbar .who { flex: 1; font-weight: 700; color: #fff; }
.floorbar button { color: #fff; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.tile { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; min-height: 128px; border-radius: 16px; background: #fff; border: 2px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.2rem; text-align: center; padding: 10px; }
.tile .icon { width: 40px; height: 40px; color: var(--blue); }
.tile-wide { grid-column: span 2; min-height: 84px; flex-direction: row; }
.tile small { display: block; font-weight: 600; color: var(--muted); font-size: .85rem; }
.scan { margin: 12px 0; }
.scan-label { display: block; font-size: 1.3rem; font-weight: 800; margin-bottom: 8px; }
.scan-row { display: flex; gap: 8px; }
.scan-input { flex: 1; font-size: 1.5rem; min-height: 64px; text-transform: uppercase; font-family: ui-monospace, monospace; border-width: 3px; }
.camera { min-width: 64px; min-height: 64px; }
.camera-view { width: 100%; border-radius: var(--radius); margin-top: 8px; background: #000; max-height: 50vh; object-fit: cover; }
.go { font-size: 2.6rem; font-weight: 900; letter-spacing: .02em; font-family: ui-monospace, monospace; margin: 4px 0; }
.big-number { font-size: 2rem; font-weight: 800; }
.pallet-card { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.pallet-card .ref { font-family: ui-monospace, monospace; font-size: 1.5rem; font-weight: 800; }
.pallet-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 8px 0 0; }
.pallet-card dt { color: var(--muted); }
.pallet-card dd { margin: 0; font-weight: 600; }
.list-big { list-style: none; padding: 0; margin: 0; }
.list-big a { display: block; background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 10px 0; color: var(--ink); text-decoration: none; }
.list-big a strong { font-size: 1.15rem; }
progress { width: 100%; height: 16px; margin: 8px 0; accent-color: var(--green); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choices button { min-height: var(--tap); }
details.more summary { cursor: pointer; font-weight: 700; padding: 10px 0; min-height: 44px; }

/* Office */
.officebar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; background: #fff; border-bottom: 1px solid var(--line); padding: 8px 16px; }
.brand { font-weight: 900; text-decoration: none; color: var(--blue-dark); font-size: 1.2rem; }
.menu summary { list-style: none; cursor: pointer; font-weight: 700; padding: 8px 12px; border: 2px solid var(--line); border-radius: 10px; }
.menu summary::-webkit-details-marker { display: none; }
.menu nav { position: absolute; left: 10px; right: 10px; top: 58px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; display: grid; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.menu nav a { padding: 12px; text-decoration: none; color: var(--ink); border-radius: 8px; font-weight: 600; }
.menu nav a[aria-current="page"] { background: #dbeafe; color: var(--blue-dark); }
.who { color: var(--ink); text-decoration: none; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--ink); }
.stat b { display: block; font-size: 1.8rem; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
th { background: #f9fafb; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.mono { font-family: ui-monospace, monospace; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 12px 0; }
.filters label { font-size: .85rem; }
.secret { font-family: ui-monospace, monospace; background: #111827; color: #f9fafb; padding: 12px; border-radius: 10px; word-break: break-all; user-select: all; }
.desknav { display: none; gap: 4px; }
.desknav a { padding: 8px 10px; text-decoration: none; color: var(--ink); border-radius: 8px; font-weight: 600; }
.desknav a[aria-current="page"] { background: #dbeafe; color: var(--blue-dark); }
@media (min-width: 900px) {
  .desknav { display: flex; }
  details.menu { display: none; }
}

/* Labels: print one per page */
.label-sheet { background: #fff; }
.label { width: 100mm; height: 150mm; padding: 6mm; border: 1px dashed #999; margin: 10px auto; display: flex; flex-direction: column; gap: 3mm; page-break-after: always; break-after: page; }
.label .lref { font: 900 22mm/1 ui-monospace, monospace; text-align: center; }
.label .lcust { font-size: 9mm; font-weight: 800; text-align: center; }
.label .lmeta { font-size: 4.5mm; }
.label svg { width: 100%; height: auto; }
.label-sheet .noprint { text-align: center; margin: 12px; }
.finish { margin-top: 36px; padding-top: 16px; border-top: 2px dashed var(--line); }
.choices + * { margin-top: 12px; }
@media print {
  @page { size: 100mm 150mm; margin: 0; }
  body { background: #fff; }
  .noprint, header { display: none !important; }
  .label { border: 0; margin: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
