:root {
  --ink: #1c2430;
  --muted: #5d6b7c;
  --line: #e2e6ee;
  --bg: #f4f6f8;
  --panel: #fff;
  --navy: #17233a;
  --accent: #1f4b99;
  --bad: #9d2c2c;
  --ok: #0f6b45;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.45 "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
body.signed {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
aside {
  background: linear-gradient(180deg, #11245f, #093272);
  color: #fff;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
aside[hidden] { display: none !important; }
.brand { font-weight: 800; font-size: 18px; letter-spacing: 0.04em; color: #FFD700; }
.brand-sub { margin-top: -14px; color: #b7c3d6; font-size: 13px; }
#nav { display: flex; flex-direction: column; gap: 4px; }
#nav button, #logout, button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 8px;
}
#nav button {
  text-align: left;
  background: transparent;
  color: #d5deec;
  padding: 9px 10px;
}
#nav button.on, #nav button:hover { background: rgba(255, 215, 0, 0.18); color: #FFD700; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
#who { color: #b7c3d6; font-size: 13px; }
#logout { background: transparent; color: #fff; border: 1px solid #3d4d68; padding: 8px 10px; }
main { padding: 28px 32px 48px; }
body.signed { background: #e9efeb; }
body.signed main { background: #e9efeb; }
body.signed h1 {
  background: linear-gradient(135deg, #11245f, #093272);
  color: #FFD700;
  margin: -28px -32px 16px;
  padding: 16px 32px;
  font-size: 28px;
  font-weight: 800;
}
h1 { margin: 0 0 6px; font-size: 26px; font-weight: 650; }
.lead { margin: 0 0 18px; color: var(--muted); max-width: 68ch; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid #FFD700;
  border-radius: 12px;
  padding: 10px 12px;
}
.stat:nth-child(2) { border-top-color: #17a2b8; }
.stat:nth-child(3) { border-top-color: #093272; }
.stat:nth-child(4) { border-top-color: #28a745; }
.stat b { display: block; font-size: 26px; color: #11245f; }
.panel h2 { color: #11245f; margin: 0 0 8px; }
.passbook { padding: 8px 10px; }
.passbook h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; margin-bottom: 6px; }
.passbook h2 select { width: auto; margin: 0; padding: 2px 6px; font-size: 12px; }
.passbook .sheet-tools { margin-bottom: 4px; }
.passbook .sheet-tools button { padding: 2px 8px; font-size: 12px; }
.pass-scroll { width: fit-content; max-width: 100%; min-width: 160px; min-height: 64px; max-height: 70vh; overflow: auto; resize: both; }
.passbook table { width: max-content; max-width: none; font-size: 12px; }
.passbook th, .passbook td { padding: 3px 8px; white-space: nowrap; vertical-align: middle; }
.passbook .bad { margin-top: 0; padding: 2px 8px; font-size: 12px; }
.pass-make-row { display: flex; align-items: center; gap: 8px; }
.pass-make-row label { margin: 0; font-size: 12px; }
.pass-make-row input { width: 72px; padding: 3px 6px; font-size: 13px; }
.pass-make-row input[type="email"],
.pass-make-row input[type="password"] { width: 220px; }
.pass-make .primary { margin-top: 0; padding: 4px 10px; font-size: 13px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.fact { background: #fff; border: 1px solid var(--line); border-top: 4px solid #FFD700; border-radius: 12px; padding: 10px 12px; }
.fact span { display: block; color: var(--muted); font-size: 12px; }
.fact b { color: #11245f; font-size: 15px; }
.stat span, .muted { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr auto; gap: 8px; align-items: center; margin: 8px 0; font-size: 13px; }
.bar { display: block; height: 8px; background: #e7edf5; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #11245f, #FFD700); }
label { display: block; margin: 4px 0 2px; font-size: 12px; color: var(--muted); }
input, select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
.primary, .ok, .warn, .bad {
  margin-top: 8px;
  padding: 6px 12px;
}
.primary { background: linear-gradient(135deg, #11245f, #093272); color: #FFD700; }
.ok { background: #e7f6ee; color: var(--ok); }
.warn { background: #fff4d8; color: #8a5a00; }
.bad { background: #fdecec; color: var(--bad); }
.err { color: var(--bad); min-height: 1.2em; margin: 8px 0 0; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.sheet-scroll { width: fit-content; max-width: 100%; min-width: 160px; min-height: 64px; max-height: 70vh; overflow: auto; resize: both; }
.sheet-scroll select { width: 280px; max-width: 42vw; }
.cell-input { width: 140px; max-width: 28vw; }
.tick { text-align: center; }
table.heads-center th { text-align: center; border: 1px solid #e6ebf5; }
.reject-line { display: flex; align-items: center; gap: 6px; }
.status-pair { display: flex; align-items: center; gap: 8px; }
.status-pair .ok, .status-pair button { margin-top: 0; }
th { background: #11245f; color: #FFD700; font-weight: 600; font-size: 12px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; background: #eef2f8; font-size: 12px; }
.auth {
  max-width: 380px;
  margin: 12vh auto 0;
}
body.gate { background: #e9efeb; }
body.gate main { padding: 0 0 48px; }
.hero {
  background: linear-gradient(135deg, #11245f, #093272);
  color: #f8f6f5;
  text-align: center;
  padding: 64px 20px 78px;
}
.hero.slim { padding: 22px 16px 36px; }
.hero .mark {
  color: #FFD700;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 13px;
}
.hero h1 {
  color: #FFD700;
  font-size: 52px;
  font-weight: 800;
  margin: 8px 0 12px;
  letter-spacing: 0.01em;
}
.hero.slim h1 { font-size: 32px; margin: 2px 0 0; }
.hero p { max-width: 40rem; margin: 0 auto; color: #f8f6f5; font-size: 17px; }
.doors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  max-width: 1100px;
  margin: -36px auto 0;
  padding: 0 20px 28px;
}
.door {
  background: #fff;
  border: 1px solid #e2e6ee;
  border-top: 4px solid #FFD700;
  border-radius: 16px;
  padding: 22px 14px;
  text-align: center;
  box-shadow: 0 10px 28px rgba(17, 36, 95, 0.14);
}
.door:hover { transform: translateY(-2px); }
.door b { display: block; color: #11245f; font-size: 16px; margin-bottom: 0; line-height: 1.3; }
.door span { display: block; color: #5d6b7c; font-size: 14px; line-height: 1.4; }
.gate-card { max-width: 640px; margin: -22px auto 0; padding: 8px 10px 10px; }
.gate-card .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 8px; }
.gate-card label { margin: 2px 0 1px; font-size: 11px; }
.gate-card input, .gate-card select { padding: 3px 6px; font-size: 13px; }
.reg-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 1100px;
  margin: 16px auto 0;
  padding: 0 20px 28px;
}
.reg-row .panel { margin: 0; padding: 8px 10px; }
.reg-row h2 { font-size: 16px; }
.reg-row .form-grid { gap: 0 8px; }
.reg-row label { margin: 2px 0 1px; }
.reg-row input, .reg-row select { padding: 4px 6px; }
.gate-card h2 { margin: 0 0 6px; color: #11245f; font-size: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.form-grid label { margin: 4px 0 2px; }
.form-grid input, .form-grid select { padding: 6px 8px; }
.request-card { max-width: 640px; margin-bottom: 12px; }
.profile-card { max-width: 640px; }
.pack-card { max-width: 460px; margin-bottom: 12px; }
.stock-pair { display: grid; grid-template-columns: 280px 280px; gap: 12px; margin-bottom: 12px; width: max-content; max-width: 100%; }
.stock-pair .pack-card { max-width: none; margin-bottom: 0; }
.pack-card .form-grid { grid-template-columns: 1fr; }
.thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; display: block; }
.ord-photo { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.ord-photo img, .ord-shot img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; margin-top: 0; }
.ord-shot { margin: 0; width: 120px; }
button.ord-shot { border: 0; padding: 0; background: transparent; cursor: pointer; text-align: left; }
button.ord-shot.on { outline: 3px solid #11245f; border-radius: 8px; }
.entry-form, .stock-edit { max-width: 640px; margin-bottom: 12px; padding: 8px 10px 10px; }
.entry-form h2, .stock-edit h2 { font-size: 16px; margin-bottom: 4px; }
.entry-form .form-grid, .stock-edit .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 8px; }
.entry-form label, .stock-edit label { margin: 2px 0 1px; font-size: 11px; }
.entry-form input, .entry-form select, .stock-edit input, .stock-edit select { padding: 3px 6px; font-size: 13px; }
.entry-form .primary, .stock-edit .primary { margin-top: 6px; }
.stock-edit .rule-note { font-size: 12px; margin-bottom: 6px; }
.stock-edit .ord-photo { gap: 8px; margin: 4px 0 8px; }
.pic-tile { width: 72px; }
.stock-edit .ord-shot,
.pic-tile .thumb,
.pic-tile img { width: 72px; height: 72px; }
.pic-tile .pic-x { display: block; width: 100%; margin-top: 4px; padding: 2px 0; font-size: 11px; }
.ord-shot figcaption { font-size: 12px; line-height: 1.3; margin-top: 4px; color: #243056; display: flex; flex-direction: column; gap: 2px; }
.ord-price { font-weight: 700; display: block; line-height: 1.25; }
.ord-price .etb { display: block; }
.ord-add { display: block; width: 100%; margin-top: 4px; padding: 4px 6px; border: 0; border-radius: 6px; background: #11245f; color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
body.signed .ord-shot figcaption { color: #d5e4f7; }
body.signed .ord-price { color: #ffd966; }
body.signed .ord-add { background: #d4a373; color: #0b2b26; }
.shop-link { text-align: center; margin: 8px 0 0; }
.shop-link a { color: #11245f; font-weight: 700; }
.inline-req { display: flex; gap: 4px; align-items: center; }
.inline-req select, .inline-req input { width: 120px; padding: 4px 6px; }
.inline-req button { margin-top: 0; white-space: nowrap; }
.ghost {
  margin-top: 12px;
  margin-left: 8px;
  padding: 9px 14px;
  background: #fff;
  color: #11245f;
  border: 1px solid #c9d2e3;
}
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; color: var(--ink); }
.check input { width: auto; margin-top: 3px; }
.sheet-panel { margin-bottom: 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sheet-head select { width: auto; margin: 0; padding: 2px 6px; font-size: 12px; }
.sheet-head .sheet-title { margin: 0; }
.sheet-title { color: #2a2f8f; }
.sheet-tools { display: flex; justify-content: flex-end; gap: 6px; margin: 0 0 8px; }
.sheet-head .sheet-tools { margin: 0; }
.sheet-actions { display: flex; align-items: flex-end; gap: 8px; margin-left: auto; }
.send-day { width: 170px; margin: 0; }
.send-day select { width: 100%; padding: 4px 6px; }
.gps-field button {
  margin-top: 6px;
  padding: 6px 10px;
  font-size: 12px;
  background: #fff;
  color: #11245f;
  border: 1px solid #c9d2e3;
}
.sheet-tools button {
  margin: 0;
  padding: 4px 10px;
  font-size: 12px;
  background: #fff;
  color: #11245f;
  border: 1px solid #c9d2e3;
}
.sheet-wrap { overflow-x: auto; }
table.sheet { min-width: 980px; }
table.sheet th { background: #3d3ce0; color: #fff; white-space: nowrap; }
table.sheet.inventory th { background: #11245f; color: #FFD700; }
table.sheet td { background: #fff; white-space: nowrap; }
table.sheet td.cash-ref-cell, table.sheet td.cash-slip-cell { white-space: normal; }
table.sheet td.cash-slip-cell a,
table.sheet td.cash-slip-cell a:link,
table.sheet td.cash-slip-cell a:visited,
table.sheet td.cash-slip-cell a:hover,
a.cash-slip-open,
a.cash-slip-open:link,
a.cash-slip-open:visited,
a.cash-slip-open:hover { color: #b47aff; }
.cash-pay { display: inline-flex; flex-direction: column; gap: 3px; align-items: stretch; max-width: 7.2rem; }
.cash-pay select.cash-menu, .cash-pay input.cash-ref { width: 7.2rem; max-width: 7.2rem; font-size: 12px; }
.cash-file-name { display: block; max-width: 7.2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
label.cash-slip-label { position: relative; display: block; height: 22px; overflow: hidden; border: 1px solid #6ea8ff; font-size: 11px; line-height: 22px; text-align: center; cursor: pointer; }
label.cash-slip-label input.cash-slip { position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
table.sheet.supplier { min-width: 0; width: 100%; table-layout: fixed; font-size: 12px; }
table.sheet.supplier th { background: #d7f4f8; color: #5b4aa3; white-space: normal; }
table.sheet.supplier td { white-space: normal; word-break: break-word; padding: 4px 5px; }
.pick-list { display: flex; flex-wrap: wrap; gap: 8px 14px; grid-column: 1 / -1; margin: 4px 0 8px; }
.pick-list label { display: flex; gap: 6px; align-items: center; margin: 0; font-weight: 600; }
.pick-list input { width: auto; }
.photo-list { display: grid; gap: 12px; margin-top: 12px; }
.photo-card { display: grid; grid-template-columns: 148px 1fr; gap: 12px; border: 1px solid #d5dced; border-radius: 10px; padding: 10px; background: #f7f9fd; }
.photo-card img, .photo-card .no-photo { width: 148px; height: 148px; object-fit: cover; border-radius: 8px; background: #e7edf6; }
.photo-card textarea { width: 100%; min-height: 92px; }
.photo-card .mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rule-note { margin: 0 0 12px; color: #243056; }
.pay-select, .sheet select { padding: 4px 6px; }
@media (max-width: 860px) {
  body.signed { grid-template-columns: 1fr; }
  #nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin-top: 8px; }
  .stats, .grid2, .doors { grid-template-columns: 1fr; }
  .stock-pair { grid-template-columns: minmax(0, 280px); }
  .hero { padding: 42px 16px 64px; }
  .hero.slim { padding: 18px 14px 32px; }
  .hero h1 { font-size: 36px; }
  .hero.slim h1 { font-size: 26px; }
  .form-grid, .facts, .reg-row, .photo-card .mini, .stock-edit .form-grid, .entry-form .form-grid, .gate-card .form-grid { grid-template-columns: 1fr; }
  .photo-card { grid-template-columns: 1fr; }
  main { padding: 18px 14px 32px; }
  body.signed h1 { margin: -18px -14px 14px; padding: 14px; }
}
#labelSheet { display: none; }
.print-acts { white-space: nowrap; }
.print-acts input { width: 4.2rem; padding: 4px 6px; }
.qr-label { width: 42mm; box-sizing: border-box; margin: 0; padding: 3mm; border: 0.35mm solid #111; display: flex; flex-direction: column; align-items: center; gap: 1.5mm; font: 8pt/1.2 "Segoe UI", sans-serif; text-align: center; background: #fff; }
.qr-label svg { width: 36mm; height: 36mm; display: block; }
.qr-label .txt { width: 36mm; }
.qr-label strong, .qr-label span { display: block; }
@page { size: A4 portrait; margin: 10mm; }
@page label { size: 42mm 56mm; margin: 0; }
@media print {
  aside, main { display: none !important; }
  #labelSheet { display: block !important; }
  #labelSheet.one .qr-label { page: label; break-after: page; page-break-after: always; }
  #labelSheet.one .qr-label:last-child { break-after: auto; page-break-after: auto; }
  #labelSheet.bulk { display: flex !important; flex-wrap: wrap; align-content: flex-start; gap: 4mm; }
  #labelSheet.bulk .qr-label { break-inside: avoid; page-break-inside: avoid; }
}

