:root {
  color-scheme: light;
  --ink: #20170d;
  --muted: #755d3c;
  --line: #e7c879;
  --paper: #ffffff;
  --panel: #fff4cf;
  --brand: #d95f00;
  --brand-strong: #963500;
  --sun-gold: #ffbf1f;
  --orange-gold: #ff8a00;
  --rainbow-shimmer: linear-gradient(90deg, #ff7a00, #ffd84d, #fff8c5, #75f0ff, #b56cff, #ff7a00);
  --gold: #ffd45c;
  --black-line: #1c1309;
  --white-line: rgba(255,255,255,.94);
  font-family: Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 0; }
body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(115deg, rgba(255,255,255,.85) 0 9%, transparent 9.2% 100%),
    repeating-linear-gradient(112deg, rgba(255,255,255,.55) 0 1px, transparent 1px 44px),
    linear-gradient(180deg, #fff6c9 0%, #ffc56d 42%, #fff1b1 100%);
  color: var(--ink);
  overflow-x: hidden;
}
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}
body::before {
  z-index: -2;
  background:
    linear-gradient(104deg, transparent 0 13%, rgba(255,255,255,.88) 13.2% 13.65%, transparent 13.85% 100%),
    linear-gradient(109deg, transparent 0 31%, rgba(255,212,92,.86) 31.2% 31.55%, transparent 31.8% 100%),
    linear-gradient(116deg, transparent 0 69%, rgba(28,19,9,.36) 69.15% 69.36%, transparent 69.58% 100%),
    repeating-linear-gradient(96deg, rgba(255,255,255,.2) 0 1px, transparent 1px 28px);
}
body::after {
  z-index: -1;
  background:
    linear-gradient(100deg, transparent 0 18%, var(--white-line) 18.2% 18.55%, transparent 18.8% 100%),
    linear-gradient(111deg, transparent 0 54%, rgba(255,138,0,.62) 54.2% 54.6%, transparent 54.8% 100%),
    linear-gradient(118deg, transparent 0 77%, rgba(28,19,9,.42) 77.12% 77.34%, transparent 77.58% 100%),
    linear-gradient(90deg, rgba(255,122,0,.11), rgba(255,216,77,.11), rgba(117,240,255,.08), rgba(181,108,255,.08));
}
button, input, select, textarea { font: inherit; max-width: 100%; }
.app-shell { position: relative; z-index: 0; width: 100%; min-height: 100vh; min-height: 100svh; }
.topbar, .nav, .content, .auth-panel { width: 100%; max-width: none; margin-inline: auto; padding-inline: clamp(10px, 2vw, 24px); }
.topbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px 0 12px; }
.brand { min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 1.05rem; font-weight: 700; text-decoration: none; }
.brand-logo { width: min(210px, 42vw); height: 48px; object-fit: contain; object-position: left center; }
.brand span { white-space: nowrap; }
.profile-name { color: var(--muted); }
.live-sync-banner { min-height: 34px; padding: 5px 10px; border: 1px solid var(--black-line); border-radius: 999px; background: var(--rainbow-shimmer); color: #2a1500; cursor: pointer; font-weight: 700; box-shadow: inset 0 1px 0 var(--white-line), 0 0 0 2px rgba(255,191,31,.24); }
.live-sync-banner[hidden] { display: none; }
.nav { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 16px; }
.nav-link { padding: 9px 12px; border: 1px solid rgba(28,19,9,.2); border-bottom-color: var(--gold); border-radius: 6px; background: rgba(255,255,255,.84); color: var(--ink); text-decoration: none; box-shadow: inset 0 1px 0 var(--white-line), 0 1px 0 rgba(255,138,0,.18); }
.nav-link.active { border-color: var(--black-line); background: var(--rainbow-shimmer); color: #231504; box-shadow: inset 0 0 0 1px rgba(255,255,255,.48), 0 0 0 2px rgba(255,191,31,.34); font-weight: 700; }
.content { min-width: 0; padding-bottom: 32px; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-panel { width: min(420px, 100%); padding: 28px; border: 1px solid var(--black-line); border-top-color: var(--gold); border-radius: 8px; background: rgba(255,255,255,.9); box-shadow: 0 12px 32px rgb(23 33 43 / 10%), inset 0 1px 0 var(--white-line); }
.login-logo { display: block; width: min(300px, 100%); height: auto; margin: 0 0 14px; }
.eyebrow { margin: 0 0 8px; color: var(--brand); font-size: .78rem; font-weight: 700; letter-spacing: .08em; }
.auth-panel h1 { margin: 0 0 20px; }
.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; gap: 6px; }
.login-form input { min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
.login-form button { min-height: 44px; border: 0; border-radius: 6px; background: linear-gradient(135deg, var(--orange-gold), var(--sun-gold)); color: #2a1500; cursor: pointer; font-weight: 700; }
#print-root { display: none; }
.pickup-page { width: 100%; max-width: none; min-width: 0; display: grid; gap: 10px; }
.pickup-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pickup-heading h1 { margin: 0; font-size: 1.35rem; }
.pickup-status { color: var(--brand); font-size: .9rem; }
.hotel-search-label { display: grid; gap: 4px; font-size: .9rem; font-weight: 700; }
.hotel-search, .pickup-dry-custom input { min-height: 38px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); }
.pickup-categories { min-width: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.pickup-categories button, .pickup-item, .quantity-keypad button, .pickup-add, .pickup-save, .pickup-dry-custom button { min-height: 36px; border: 1px solid rgba(28,19,9,.22); border-bottom-color: var(--gold); border-radius: 5px; background: rgba(255,255,255,.9); color: var(--ink); cursor: pointer; box-shadow: inset 0 1px 0 var(--white-line), 0 1px 0 rgba(255,138,0,.14); }
.pickup-categories button { padding: 4px 2px; font-size: .84rem; }
.pickup-categories button.active, .pickup-save, .pickup-add { border-color: var(--black-line); background: var(--rainbow-shimmer); color: #241300; font-weight: 700; }
.pickup-body { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.pickup-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); align-content: start; gap: 6px; }
.pickup-item { padding: 5px 7px; text-align: left; font-size: .88rem; }
.pickup-entry { display: grid; gap: 7px; align-content: start; }
.pickup-selected { min-height: 24px; font-weight: 700; }
.pickup-quantity { min-height: 42px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); font-size: 1.35rem; text-align: right; }
.quantity-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.quantity-keypad button:last-child { grid-column: span 2; }
.pickup-dry-custom { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.pickup-quantity-modal[hidden] { display: none; }
.pickup-quantity-modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(58, 28, 0, .38);
  backdrop-filter: blur(4px);
}
.quantity-dialog {
  width: min(360px, 100%);
  padding: 16px;
  border: 2px solid var(--black-line);
  border-top-color: var(--gold);
  border-left-color: var(--white-line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,244,207,.97));
  box-shadow: 0 24px 70px rgba(104,55,0,.3), inset 0 1px 0 var(--white-line);
}
.quantity-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.quantity-dialog-head p { margin: 0 0 4px; color: var(--muted); font-size: .78rem; }
.quantity-close { width: 36px; height: 36px; border: 1px solid var(--black-line); border-radius: 999px; background: var(--paper); cursor: pointer; }
.quantity-price-row { display: grid; gap: 5px; margin: 8px 0; font-weight: 700; }
.quantity-price-row input { min-height: 38px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; }
.quantity-keypad button { min-height: 54px; font-size: 1.25rem; font-weight: 700; }
.quantity-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.quantity-dialog-actions button { min-height: 42px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); cursor: pointer; }
.pickup-lines { display: grid; gap: 4px; margin: 0; padding-left: 22px; }
.pickup-lines li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pickup-lines button { border: 0; background: transparent; color: #b42318; font-size: 1.25rem; cursor: pointer; }
.pickup-empty { margin: 0; color: var(--muted); }
.pickup-history { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--black-line); border-top-color: var(--gold); border-radius: 6px; background: rgba(255,255,255,.86); box-shadow: inset 0 1px 0 var(--white-line); }
.pickup-history-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pickup-history h2 { margin: 0; font-size: 1rem; }
.pickup-history-controls { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pickup-history-controls button, .pickup-history-controls input { min-height: 34px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); color: var(--ink); }
.pickup-history-controls button { padding: 4px 10px; cursor: pointer; background: linear-gradient(135deg, rgba(255,138,0,.16), rgba(255,212,92,.35)); }
.pickup-history-list { display: grid; gap: 6px; }
.pickup-history-card { border: 1px solid var(--line); border-left: 4px solid var(--orange-gold); border-radius: 6px; background: rgba(255,255,255,.92); overflow: hidden; }
.pickup-history-card summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; cursor: pointer; }
.pickup-history-card summary span { color: var(--muted); font-size: .82rem; }
.pickup-history-card ul { display: grid; gap: 4px; margin: 0; padding: 0 10px 10px; list-style: none; }
.pickup-history-card li { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid rgba(231,200,121,.55); padding-top: 5px; }
.factory-page { min-width: 0; display: grid; gap: 10px; }
.factory-heading, .factory-receipt-summary, .factory-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.factory-heading h1 { margin: 0; font-size: 1.35rem; }
.factory-language, .factory-statuses { display: flex; flex-wrap: wrap; gap: 5px; }
.factory-language button, .factory-detail-toggle, .factory-actions button, .return-bag button { min-height: 34px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); cursor: pointer; }
.factory-language button.active { background: linear-gradient(135deg, var(--orange-gold), var(--sun-gold)); border-color: var(--brand-strong); color: #2a1500; font-weight: 700; }
.factory-receipts { display: grid; gap: 8px; }
.factory-receipt { border: 1px solid var(--line); border-radius: 6px; background: var(--paper); overflow: hidden; }
.factory-receipt-summary { padding: 10px; }
.factory-receipt-summary small { display: block; color: var(--muted); margin-top: 3px; }
.factory-status { min-height: 30px; border: 1px solid transparent; border-radius: 5px; padding: 4px 7px; cursor: pointer; }
.factory-status.waiting { background: #fde68a; color: #713f12; }
.factory-status.working { background: #fecaca; color: #991b1b; }
.factory-status.ready { background: #bbf7d0; color: #166534; }
.factory-status.active { outline: 2px solid var(--ink); }
.factory-detail { border-top: 1px solid var(--line); padding: 10px; }
.factory-table-wrap { overflow-x: auto; }
.factory-detail table, .return-bag table { width: 100%; border-collapse: collapse; }
.factory-detail th, .factory-detail td, .return-bag th, .return-bag td { padding: 7px; border-bottom: 1px solid var(--line); text-align: left; }
.factory-detail input, .factory-detail textarea { width: 100%; padding: 6px; border: 1px solid var(--line); border-radius: 4px; }
.factory-note { display: grid; gap: 5px; margin: 10px 0; font-weight: 700; }
.factory-note textarea { min-height: 64px; font-weight: 400; }
.return-bag { margin: 12px 0; padding: 10px; background: var(--panel); }
.return-bag h2 { margin: 0 0 8px; font-size: 1rem; }
.factory-feedback { color: var(--brand); min-height: 20px; }
.owner-page { min-width: 0; display: grid; gap: 12px; overflow-x: auto; }
.owner-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.owner-heading h1, .paper-form h2 { margin: 0; font-size: 1.35rem; }
.price-columns, .billing-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.paper-form { min-width: 0; display: grid; gap: 10px; padding: 14px; border: 1px solid var(--black-line); border-top-color: var(--gold); border-radius: 6px; background: rgba(255,255,255,.92); overflow-x: auto; box-shadow: inset 0 1px 0 var(--white-line), 0 8px 24px rgba(155,76,0,.08); }
.paper-form form, .paper-form label { display: grid; gap: 6px; }
.quote-sheet-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 10px; align-items: start; }
.quote-sheet-column { display: grid; gap: 10px; min-width: 0; }
.price-group { min-width: 0; border: 2px solid var(--black-line); border-top-color: var(--gold); padding: 0; overflow-x: auto; background: rgba(255,255,255,.88); }
.price-group h3 { margin: 0; padding: 7px 8px; border-bottom: 1px solid var(--black-line); background: linear-gradient(90deg, rgba(255,138,0,.28), rgba(255,212,92,.36), rgba(255,255,255,.88)); color: #9b2c13; font-size: 1rem; text-align: center; }
.price-group table { width: 100%; min-width: 0; border-collapse: collapse; }
.owner-table, .report-detail table { width: 100%; min-width: 640px; border-collapse: collapse; }
.owner-table { min-width: 640px; }
.price-group th, .price-group td, .owner-table th, .owner-table td, .report-detail th, .report-detail td { padding: 7px; border-bottom: 1px solid var(--line); text-align: left; }
.price-group th { background: rgba(255,191,31,.18); color: var(--muted); font-size: .82rem; }
.price-index { width: 42px; color: var(--muted); text-align: center; }
.price-number { text-align: right; font-weight: 700; }
.price-group input, .paper-form select, .billing-grid select { width: 100%; min-height: 34px; padding: 5px; border: 1px solid var(--line); border-radius: 4px; }
.price-group input { text-align: right; }
.owner-actions, .period-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.owner-actions button, .period-tabs button, .owner-table button { min-height: 34px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); cursor: pointer; }
.owner-actions button:first-child, .period-tabs button.active { border-color: var(--brand-strong); background: linear-gradient(135deg, var(--orange-gold), var(--sun-gold)); color: #2a1500; font-weight: 700; }
.owner-feedback { color: var(--brand); min-height: 20px; }
.billing-receipts { display: grid; gap: 7px; margin: 12px 0; }
.billing-receipt-option { display: flex; align-items: center; gap: 7px; padding: 7px; border: 1px solid transparent; border-radius: 6px; background: rgba(255,255,255,.7); }
.billing-receipt-option.needs-price, .needs-price { border-color: var(--black-line); background: linear-gradient(90deg, rgba(255,138,0,.22), rgba(255,212,92,.45), rgba(255,255,255,.92)); box-shadow: inset 4px 0 0 var(--orange-gold); }
.billing-price-badge { margin-left: auto; padding: 2px 7px; border: 1px solid var(--brand-strong); border-radius: 999px; background: var(--rainbow-shimmer); color: #2a1500; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.billing-price-alert { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--black-line); border-left: 5px solid var(--orange-gold); border-radius: 6px; background: linear-gradient(135deg, rgba(255,138,0,.2), rgba(255,255,255,.96)); }
.billing-price-alert h3, .billing-price-alert p { margin: 0; }
.billing-special-price-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 8px; align-items: center; }
.billing-special-price-row input { min-height: 34px; padding: 5px; border: 1px solid var(--line); border-radius: 5px; text-align: right; }
.billing-price-alert button { min-height: 36px; border: 1px solid var(--brand-strong); border-radius: 5px; background: linear-gradient(135deg, var(--orange-gold), var(--sun-gold)); color: #2a1500; font-weight: 700; cursor: pointer; }
.billing-preview dl { margin: 0; }
.billing-preview dl div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.billing-preview dd { margin: 0; }
@media (max-width: 760px) {
  .price-columns, .billing-grid { grid-template-columns: 1fr; }
  .owner-heading { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 620px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding-top: 14px; }
  .brand { flex: 1 1 100%; }
  .brand-logo { width: min(190px, 58vw); height: 42px; }
  .live-sync-banner { order: 3; width: 100%; }
  .nav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 10px; -webkit-overflow-scrolling: touch; }
  .nav-link { flex: 0 0 auto; white-space: nowrap; }
  .pickup-body { grid-template-columns: 1fr; }
  .pickup-entry { grid-template-columns: 1fr; }
  .pickup-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .pickup-categories { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .pickup-categories button { flex: 0 0 auto; min-width: 76px; padding-inline: 8px; font-size: .76rem; white-space: nowrap; }
  .pickup-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pickup-dry-custom { grid-template-columns: 1fr; }
  .pickup-history-head, .pickup-history-card summary { align-items: flex-start; flex-direction: column; }
  .pickup-history-controls { justify-content: flex-start; }
  .pickup-lines li { align-items: flex-start; flex-wrap: wrap; }
  .factory-heading, .factory-receipt-summary, .factory-actions { align-items: flex-start; flex-direction: column; }
  .quote-sheet-grid { grid-template-columns: 1fr; }
  .price-group table { min-width: 420px; }
  .owner-table, .report-detail table { min-width: 560px; }
  .billing-receipt-option { align-items: flex-start; flex-wrap: wrap; }
  .billing-price-badge { margin-left: 0; }
  .billing-special-price-row { grid-template-columns: 1fr; }
}

@page a4 { size: A4; margin: 0; }
@page receipt-58 { size: 58mm auto; margin: 0; }
@page receipt-80 { size: 80mm auto; margin: 0; }
@media print {
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  .print-a4 { page: a4; width: 210mm; min-height: 297mm; padding: 16mm; }
  .print-receipt-58 { page: receipt-58; width: 58mm; padding: 4mm; }
  .print-receipt-80 { page: receipt-80; width: 80mm; padding: 5mm; }
}
