:root {
  color-scheme: dark;
  --bg: #000;
  --surface: #0b0b0b;
  --surface-2: #141414;
  --line: #303030;
  --soft-line: #222;
  --text: #f5f5f2;
  --muted: #a6a6a2;
  --red: #e10b17;
  --green: #61c995;
  --amber: #e4b45c;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
button, input, textarea { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand > div { display: grid; gap: 1px; }
.brand strong { font-size: 16px; }
.brand small { color: var(--muted); font-size: 11px; }
.brand-mark { width: 39px; height: 39px; flex: none; display: grid; place-items: center; color: #fff; border: 1px solid var(--red); border-radius: 50%; font-size: 12px; font-weight: 850; letter-spacing: .08em; }
.shell { width: min(1180px, 92vw); margin: 0 auto; padding: 25px 0 100px; }
.summary { margin: 0 0 26px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.summary article { min-height: 90px; padding: 16px 18px; display: flex; align-items: flex-end; justify-content: space-between; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.summary span { color: var(--muted); font-size: 12px; }
.summary strong { font-size: 30px; line-height: 1; }
.summary .summary-collect { border-color: rgba(225,11,23,.6); background: rgba(225,11,23,.09); }
.summary .summary-pack { border-color: rgba(228,180,92,.6); background: rgba(228,180,92,.09); }
.summary .summary-done { border-color: rgba(97,201,149,.6); background: rgba(97,201,149,.09); }

.controls { margin-bottom: 17px; display: flex; justify-content: space-between; gap: 15px; align-items: center; }
.tabs { display: flex; gap: 7px; overflow-x: auto; padding: 2px; }
.tab { padding: 9px 11px; white-space: nowrap; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 12px; font-weight: 700; }
.tab span { margin-left: 5px; color: #ddd; }
.tab-collect, .tab-open { border-color: rgba(225,11,23,.45); }
.tab-pack { border-color: rgba(228,180,92,.45); }
.tab-done { border-color: rgba(97,201,149,.45); }
.tab-open.active, .tab-collect.active { color: #fff; border-color: var(--red); background: rgba(225,11,23,.16); }
.tab-pack.active { color: #fff; border-color: var(--amber); background: rgba(228,180,92,.16); }
.tab-done.active { color: #fff; border-color: var(--green); background: rgba(97,201,149,.16); }
.search { width: min(330px, 100%); }
.search input { width: 100%; padding: 10px 12px; color: #fff; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: var(--surface); }
.search input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(225,11,23,.12); }
.error-banner { margin-bottom: 14px; padding: 12px 14px; color: #ffc0bd; border: 1px solid rgba(225,11,23,.5); border-radius: 8px; background: rgba(225,11,23,.1); }

.orders { display: grid; gap: 16px; }
.order-card { overflow: hidden; border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: 11px; background: var(--surface); transition: border-color .2s; }
.order-card.stage-pack { border-left-color: var(--amber); }
.order-card.stage-done { border-left-color: var(--green); }
.order-header { padding: 18px 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--soft-line); }
.customer-name { margin: 0; font-size: 24px; font-weight: 850; letter-spacing: -.025em; }
.order-number { margin: 1px 0 0; color: var(--muted); font-size: 11px; font-weight: 750; }
.paid-line { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.order-total { display: grid; justify-items: end; gap: 7px; }
.stage-badge { padding: 4px 8px; color: #ffb9bc; border: 1px solid rgba(225,11,23,.35); border-radius: 99px; background: rgba(225,11,23,.08); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.stage-pack .stage-badge { color: #f2cd8d; border-color: rgba(228,180,92,.35); background: rgba(228,180,92,.08); }
.stage-done .stage-badge { color: #9be1bc; border-color: rgba(97,201,149,.35); background: rgba(97,201,149,.08); }

.delivery-grid { padding: 14px 20px; border-bottom: 1px solid var(--soft-line); background: #080808; }
.detail-label { color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .11em; }
.delivery-grid p { margin: 4px 0 0; font-size: 13px; }
.missing-shipping p { padding: 8px 10px; color: #ffc0bd; border: 1px solid rgba(225,11,23,.4); border-radius: 7px; background: rgba(225,11,23,.09); font-weight: 750; }
.duplicate-warning { margin: 14px 20px 0; padding: 11px 13px; color: #ffe2a8; border: 1px solid rgba(228,180,92,.65); border-left: 5px solid var(--amber); border-radius: 8px; background: rgba(228,180,92,.12); }
.duplicate-warning strong { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.duplicate-warning p { margin: 3px 0 0; color: #f4e5c8; font-size: 12px; }
.customer-note { margin: 14px 20px 0; padding: 11px 13px; color: #f3d7a3; border-left: 3px solid var(--amber); background: rgba(228,180,92,.08); }
.customer-note strong { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.customer-note p { margin: 4px 0 0; color: #e6ddd0; white-space: pre-wrap; }
.customer-note.empty-note { color: var(--muted); border-left-color: #404040; background: #101010; }
.customer-note.empty-note p { color: var(--muted); }
.items { padding: 16px 20px; display: grid; gap: 10px; }
.order-item { min-width: 0; display: grid; grid-template-columns: 116px minmax(0,1fr) auto; align-items: center; gap: 15px; padding: 10px; border: 1px solid var(--soft-line); border-radius: 9px; background: #080808; }
.item-image { height: 96px; position: relative; display: block; overflow: hidden; border-radius: 6px; background: #030303; }
.item-image img, .image-placeholder { width: 100%; height: 100%; display: grid; place-items: center; object-fit: cover; color: #777; border: 1px solid #242424; font-weight: 900; }
.item-copy { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.item-copy > small { color: var(--muted); font-size: 10px; }
.shelf-location { margin-top: 6px; padding: 4px 7px; color: #fff; border: 1px solid #4a4a4a; border-radius: 5px; background: #161616; font-size: 11px; }
.item-title { width: 100%; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.item-title a, .item-title strong { font-size: 14px; font-weight: 800; text-decoration: none; }
.item-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.product-link, .missing-link { margin-top: 8px; color: #fff; font-size: 11px; font-weight: 750; text-underline-offset: 3px; }
.missing-link { color: var(--muted); font-weight: 400; }
.item-picked { min-width: 104px; padding: 10px 12px; display: flex; align-items: center; gap: 9px; cursor: pointer; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.item-picked input { position: absolute; opacity: 0; pointer-events: none; }
.item-picked input:focus-visible + .checkmark { outline: 3px solid rgba(225,11,23,.35); }
.item-picked input:checked + .checkmark { color: #08120d; border-color: var(--green); background: var(--green); }
.item-picked strong { font-size: 11px; }

.workflow { padding: 18px 20px; display: flex; justify-content: space-between; gap: 18px; align-items: center; border-top: 1px solid var(--soft-line); background: #060606; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check-step { min-width: 0; padding: 11px; display: flex; align-items: center; gap: 10px; cursor: pointer; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.check-step:hover { border-color: #5d5d5d; }
.check-step input { position: absolute; opacity: 0; pointer-events: none; }
.checkmark { width: 28px; height: 28px; flex: none; display: grid; place-items: center; color: transparent; border: 2px solid #676767; border-radius: 6px; font-weight: 900; }
.check-step input:focus-visible + .checkmark { outline: 3px solid rgba(225,11,23,.35); }
.check-step input:checked + .checkmark { color: #fff; border-color: var(--red); background: var(--red); }
.check-step > span:last-child { min-width: 0; display: grid; }
.check-step strong { font-size: 12px; }
.check-step small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.packed-step { min-width: 140px; min-height: 66px; }
.disabled-step { cursor: not-allowed; opacity: .42; }
.print-button { min-height: 42px; padding: 10px 13px; color: #fff; border: 1px solid #5a5a5a; border-radius: 8px; background: #171717; font-size: 11px; font-weight: 800; white-space: nowrap; }
.print-button:hover { border-color: #fff; background: #222; }

.print-receipt-shell { position: fixed; left: -10000px; top: 0; width: 210mm; min-height: 297mm; display: flex; justify-content: center; align-items: center; color: #111; background: #fff; }
.print-receipt { width: 190mm; margin: 0 auto; padding: 5mm 0; color: #111; background: #fff; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 1.35; }
.receipt-header { padding: 0 3mm 5mm; display: grid; grid-template-columns: 54mm 1fr; align-items: center; gap: 10mm; border-bottom: 2px solid #111; }
.receipt-logo { width: 50mm; height: auto; display: block; }
.receipt-company { padding: 3mm; display: grid; gap: 1px; border-bottom: 1px solid #999; }
.receipt-company strong { font-size: 11px; }
.receipt-company span { color: #444; font-size: 8.5px; }
.receipt-title { display: grid; justify-items: end; text-align: right; }
.receipt-title h1 { margin: 0; font-size: 25px; letter-spacing: .09em; }
.receipt-title strong { margin-top: 1mm; font-size: 15px; }
.receipt-title span { color: #555; font-size: 10px; }
.receipt-meta { padding: 3mm; display: grid; grid-template-columns: 1fr 1fr; gap: 5mm; border-bottom: 1px solid #999; }
.receipt-meta div, .receipt-summary div { display: grid; gap: 1px; }
.receipt-meta span, .receipt-summary span { color: #666; font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.receipt-products { padding-top: 3mm; }
.receipt-table-head, .receipt-row { display: grid; grid-template-columns: minmax(0,1fr) 32mm; align-items: center; gap: 4mm; }
.receipt-table-head { padding: 2.2mm 3mm; color: #fff; background: #111; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.receipt-table-head span:last-child, .receipt-price { text-align: right; }
.receipt-row { min-height: 25mm; padding: 2.5mm 3mm; border-bottom: 1px solid #bbb; break-inside: avoid; }
.receipt-product { min-width: 0; display: grid; grid-template-columns: 28mm minmax(0,1fr); align-items: center; gap: 4mm; }
.receipt-product img, .receipt-image-placeholder { width: 28mm; height: 20mm; display: grid; place-items: center; object-fit: cover; border: 1px solid #aaa; color: #777; font-size: 10px; font-weight: 900; }
.receipt-product div { min-width: 0; display: grid; gap: 1px; }
.receipt-product strong { overflow-wrap: anywhere; font-size: 12px; }
.receipt-product small { color: #555; font-size: 8.5px; }
.receipt-price { font-size: 13px; }
.receipt-summary { padding: 4mm 3mm; display: flex; justify-content: flex-end; border-bottom: 1px solid #999; }
.receipt-grand-total { min-width: 40mm; text-align: right; }
.receipt-grand-total strong { font-size: 19px; }
.receipt-delivery { padding: 4mm 3mm; display: grid; grid-template-columns: .9fr 1.4fr; gap: 8mm; border-bottom: 1px solid #999; }
.receipt-delivery > div:first-child { display: grid; align-content: start; gap: 1px; }
.receipt-delivery > div:first-child > strong { margin-bottom: 2px; text-transform: uppercase; font-size: 9px; }
.receipt-notes { display: grid; gap: 2mm; }
.receipt-note { padding: 2mm; border-left: 2px solid #111; background: #f0f0f0; break-inside: avoid; }
.receipt-note strong { font-size: 9px; text-transform: uppercase; }
.receipt-note p { margin: 1mm 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.receipt-tax-note { margin: 4mm 3mm; display: grid; gap: 1px; color: #333; font-size: 9px; }
.print-receipt footer { padding-top: 3mm; border-top: 1px solid #111; font-size: 8px; text-align: center; }

.empty-state { padding: 55px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: 11px; text-align: center; }
.empty-state strong { color: #ddd; }
.empty-state p { margin: 4px 0 0; font-size: 12px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: min(390px, calc(100vw - 40px)); padding: 12px 15px; color: #fff; border: 1px solid #444; border-radius: 9px; background: #191919; box-shadow: 0 18px 45px rgba(0,0,0,.5); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }

.login-page { display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); padding: 35px; border: 1px solid var(--line); border-left: 5px solid var(--red); border-radius: 11px; background: var(--surface); box-shadow: 0 30px 90px rgba(0,0,0,.45); }
.login-card .brand-mark { margin-bottom: 20px; }
.eyebrow { margin: 0; color: var(--red); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .16em; }
.login-card h1 { margin: 4px 0 10px; font-size: 35px; line-height: 1.1; letter-spacing: -.04em; }
.login-card > p:not(.eyebrow) { color: var(--muted); }
.login-card form { margin-top: 24px; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; color: #d0d0cc; font-size: 12px; }
.login-card input { width: 100%; padding: 11px 12px; color: #fff; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: #050505; }
.login-card input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(225,11,23,.12); }
.primary { padding: 11px 15px; color: #fff; border: 1px solid var(--red); border-radius: 7px; background: var(--red); font-weight: 800; }
.primary:disabled { opacity: .55; cursor: wait; }
.form-error { min-height: 20px; margin: 0; color: #ff858b; font-size: 12px; }

@media (max-width: 760px) {
  .shell { width: min(94vw, 1180px); }
  .controls { align-items: stretch; flex-direction: column; }
  .search { width: 100%; }
  .workflow { grid-template-columns: 1fr; }
  .print-button { width: 100%; }
}

@media (max-width: 560px) {
  .brand-mark { width: 35px; height: 35px; }
  .shell { padding-top: 14px; }
  .summary { grid-template-columns: 1fr; gap: 7px; }
  .summary article { min-height: 58px; padding: 12px 15px; }
  .summary strong { font-size: 24px; }
  .tabs { width: 100%; }
  .order-header { padding: 15px; }
  .customer-name { font-size: 20px; }
  .delivery-grid { padding: 13px 15px; grid-template-columns: 1fr; gap: 12px; }
  .customer-note { margin: 12px 15px 0; }
  .items { padding: 13px 15px; }
  .order-item { grid-template-columns: 96px minmax(0,1fr); gap: 11px; }
  .item-picked { grid-column: 1 / -1; justify-content: center; }
  .item-image { height: 88px; }
  .workflow { padding: 15px; }
  .checks { grid-template-columns: 1fr; }
}

@page { size: A4 portrait; margin: 10mm; }

@media print {
  html, body { width: 210mm; min-height: 297mm; margin: 0; background: #fff !important; color: #111 !important; }
  body.printing-receipt > *:not(#printReceipt) { display: none !important; }
  .print-receipt-shell { position: static; left: auto; width: 190mm; height: 277mm; min-height: 277mm; margin: 0; align-items: center; background: #fff; }
  .print-receipt { width: 190mm; margin: 0; padding: 0; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
