:root {
  --ink: #17312f;
  --muted: #6c7d7b;
  --line: #dbe5e3;
  --surface: #ffffff;
  --background: #f3f7f6;
  --green: #0d5f57;
  --green-dark: #084840;
  --green-soft: #dcefeb;
  --blue: #2d6f98;
  --blue-soft: #e3f0f8;
  --orange: #b56322;
  --orange-soft: #f8e9dc;
  --red: #a83e3e;
  --shadow: 0 12px 30px rgba(29, 64, 60, .08);
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.login-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top right, #dcefeb 0, transparent 36%), var(--background); }
.login-card { width: min(480px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 24px 60px rgba(29, 64, 60, .15); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-brand > div { display: flex; flex-direction: column; }
.login-brand strong { font-size: 18px; }
.login-brand small, .login-help { color: var(--muted); }
.login-card h1 { margin-bottom: 10px; }
.login-card > p { margin-bottom: 24px; color: var(--muted); line-height: 1.65; }
.login-card .form-alert { margin-top: 0; }
.login-card .primary-button:disabled { opacity: .58; cursor: wait; }
.login-help { display: block; margin-top: 14px; text-align: center; line-height: 1.5; }
.qr-login-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qr-login-actions button { min-height: 50px; }
.qr-camera-box { position: relative; overflow: hidden; margin-top: 14px; border-radius: 14px; background: #102522; }
.qr-camera-box video { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.qr-scan-frame { position: absolute; inset: 16% 18% 27%; border: 3px solid white; border-radius: 15px; box-shadow: 0 0 0 999px rgba(7, 25, 22, .42); pointer-events: none; }
.qr-camera-status { position: absolute; left: 14px; right: 14px; bottom: 51px; padding: 8px 10px; border-radius: 8px; background: rgba(7, 25, 22, .8); color: white; text-align: center; font-size: 13px; font-weight: 800; }
.qr-camera-box > button { position: absolute; right: 12px; bottom: 10px; background: white; }
.qr-scanner-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-top: 14px; }
.qr-scanner-form label { margin: 0; }
.qr-scanner-form button { min-height: 44px; }
.password-login { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.password-login summary { color: var(--green); text-align: center; font-weight: 800; cursor: pointer; }
.password-login[open] summary { margin-bottom: 18px; }
.password-login .login-help { margin-bottom: 0; }

.topbar { height: 72px; display: flex; align-items: center; gap: 12px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--green); color: white; font-size: 22px; font-weight: 800; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.25; }
.brand-copy strong { font-size: 18px; }
.brand-copy span { color: var(--muted); font-size: 12px; margin-top: 3px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.operator-box { display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: center; margin-left: auto; padding: 7px 11px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbfa; }
.operator-box span { color: var(--muted); font-size: 11px; }
.operator-box strong { font-size: 14px; }
.operator-box small { grid-column: 2; color: var(--muted); font-size: 10px; }
.topbar-actions { margin-left: 6px; }
.demo-badge { padding: 6px 10px; border-radius: 999px; background: var(--orange-soft); color: var(--orange); font-size: 12px; font-weight: 700; }
.sync-status { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.sync-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sync-status.local { color: var(--orange); background: var(--orange-soft); }
.sync-status.syncing { color: var(--blue); background: var(--blue-soft); }
.sync-status.synced { color: var(--green); background: var(--green-soft); }
.sync-status.failed { color: var(--red); background: #f8e2e2; }
.sync-button:disabled { opacity: .55; cursor: wait; }
.logout-button { color: var(--red); }
.version-badge { padding: 6px 9px; border-radius: 999px; background: #edf3f2; color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.database-unavailable-banner { padding: 11px 24px; border-bottom: 1px solid #e5aaaa; background: #fff0f0; color: var(--red); text-align: center; font-size: 13px; font-weight: 800; }

.app-shell { display: grid; grid-template-columns: 190px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.side-nav { padding: 24px 14px; border-right: 1px solid var(--line); background: #f8fbfa; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 7px; border: 0; border-radius: 11px; background: transparent; color: #526865; text-align: left; font-weight: 700; }
.nav-item span { width: 24px; font-size: 20px; text-align: center; }
.nav-item:hover { background: #ebf3f1; }
.nav-item.active { color: white; background: var(--green); box-shadow: 0 8px 18px rgba(13, 95, 87, .22); }

main { width: min(1180px, 100%); padding: 36px clamp(20px, 4vw, 52px) 60px; margin: 0 auto; }
main.dashboard-wide { width: 100%; }
.page { display: none; }
.page.active { display: block; animation: appear .18s ease-out; }
@keyframes appear { from { opacity: 0; transform: translateY(5px); } }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 4vw, 38px); letter-spacing: -.03em; }
h2 { margin-bottom: 5px; }
.eyebrow { margin-bottom: 7px; color: var(--green); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 800; }

.primary-button, .text-button, .icon-button { border: 0; }
.primary-button { padding: 12px 17px; border-radius: 10px; background: var(--green); color: white; font-weight: 800; box-shadow: 0 7px 16px rgba(13, 95, 87, .18); }
.primary-button:hover { background: var(--green-dark); }
.primary-button.danger { background: var(--red); }
.primary-button.wide { width: 100%; margin-top: 4px; }
.text-button { padding: 6px; background: transparent; color: var(--green); font-weight: 800; }
.icon-button { width: 38px; height: 38px; border-radius: 50%; background: #edf3f2; color: var(--ink); font-size: 25px; }

.notice { display: flex; gap: 13px; align-items: flex-start; padding: 15px 17px; margin-bottom: 22px; border: 1px solid #bedbd5; border-radius: 13px; background: #eaf7f4; color: #2a5c57; font-size: 14px; line-height: 1.5; }
.notice-icon { flex: 0 0 auto; display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; background: var(--green); color: white; font-weight: 800; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; margin-bottom: 22px; }
.stats-grid.four { grid-template-columns: repeat(4, 1fr); }
.stat-card { position: relative; overflow: hidden; min-height: 156px; padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
.stat-card[type="button"] { width: 100%; text-align: left; transition: transform .16s ease, box-shadow .16s ease; }
.stat-card[type="button"]:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(29, 64, 60, .14); }
.stat-card[type="button"]:focus-visible { outline: 3px solid rgba(13, 95, 87, .25); outline-offset: 3px; }
.stat-card::after { content: ""; position: absolute; width: 110px; height: 110px; right: -30px; bottom: -35px; border-radius: 50%; background: currentColor; opacity: .08; }
.stat-card span, .stat-card small { display: block; color: var(--muted); }
.stat-card strong { display: block; margin: 13px 0 2px; font-size: 42px; line-height: 1; }
.stat-card.green { color: var(--green); border-top: 4px solid var(--green); }
.stat-card.blue { color: var(--blue); border-top: 4px solid var(--blue); }
.stat-card.orange { color: var(--orange); border-top: 4px solid var(--orange); }
.stat-card.red { color: var(--red); border-top: 4px solid var(--red); }
.history-tabs .stat-card { min-height: 132px; }
.history-tabs .stat-card.active { outline: 3px solid currentColor; outline-offset: -3px; box-shadow: 0 14px 32px rgba(29, 64, 60, .16); }
.history-panel { margin-top: 0 !important; }
.completed-order-heading { margin-top: 10px; border-top: 1px solid var(--line); }

.panel { border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.panel + .panel { margin-top: 22px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px 12px; }
.panel-heading p { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 650px; }
th, td { padding: 14px 20px; border-top: 1px solid #edf1f0; text-align: left; white-space: nowrap; }
th { color: var(--muted); background: #fbfcfc; font-size: 12px; letter-spacing: .03em; }
td { font-size: 14px; }
.stock-number { font-size: 17px; font-weight: 800; }
.pill { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.pill.in { color: var(--green); background: var(--green-soft); }
.pill.out { color: var(--red); background: #f8e2e2; }
.pill.low { color: var(--orange); background: var(--orange-soft); }
.pill.ok { color: var(--green); background: var(--green-soft); }
.pill.pending { color: var(--orange); background: var(--orange-soft); }
.pill.done { color: var(--blue); background: var(--blue-soft); }
.pill.adjust { color: #6a4c93; background: #eee7f7; }
.low-row td { background: #fff0f0; color: #722f2f; }
.low-row:hover td { background: #ffe5e5; }
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: #edf7f5; }
.clickable-row.low-row:hover td { background: #ffe5e5; }
.location-chips { display: flex; flex-wrap: wrap; gap: 5px; min-width: 230px; }
.location-chip { display: inline-flex; padding: 4px 7px; border-radius: 7px; background: #eef3f2; color: #4d6562; font-size: 11px; }
.empty-state { padding: 42px 20px; color: var(--muted); text-align: center; }
.pagination { position: sticky; left: 0; display: flex; align-items: center; justify-content: center; gap: 12px; min-width: 650px; padding: 13px 18px; border-top: 1px solid var(--line); background: #fbfcfc; color: var(--muted); font-size: 13px; font-weight: 800; }
.pagination button:disabled { opacity: .42; cursor: not-allowed; }

.form-layout { display: grid; grid-template-columns: minmax(0, 680px) minmax(220px, 1fr); gap: 20px; align-items: start; }
.action-form { padding: 24px; overflow: visible; }
label { display: block; margin-bottom: 17px; color: #425956; font-size: 13px; font-weight: 800; }
input, select, textarea { width: 100%; margin-top: 7px; padding: 12px 13px; border: 1px solid #cddbd8; border-radius: 10px; background: white; color: var(--ink); outline: none; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(13,95,87,.12); }
.scan-input { padding: 15px; border-width: 2px; font-size: 18px; font-weight: 800; letter-spacing: .03em; }
.product-preview { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: -4px 0 17px; padding: 15px; border-radius: 12px; background: #f2f6f5; color: var(--muted); }
.product-preview.found { border: 1px solid #bfded8; background: #edf8f6; color: var(--ink); }
.movement-product-info { min-width: 0; }
.movement-product-info > small { display: block; margin-top: 3px; color: var(--muted); }
.preview-locations { margin-top: 10px; }
.preview-locations > small { display: block; margin-bottom: 5px; color: var(--muted); font-weight: 700; }
.preview-location-list { display: flex; flex-wrap: wrap; gap: 6px; }
.location-choice { padding: 6px 9px; border: 1px solid #9fc8c1; border-radius: 8px; background: white; color: var(--green); font-size: 12px; font-weight: 800; }
.location-choice.active { background: var(--green); color: white; }
.location-preview { min-height: 54px; display: flex; align-items: center; margin: -4px 0 17px; padding: 12px 15px; border-radius: 12px; background: #f2f6f5; color: var(--muted); }
.location-preview.found { border: 1px solid #c8d9ed; background: #eef5fb; color: var(--ink); }
.preview-stock { font-size: 22px; color: var(--green); font-weight: 900; }
.help-card { padding: 22px; border: 1px solid #c9e1dd; border-radius: 16px; background: var(--green-soft); color: #315d58; line-height: 1.7; }
.help-card ol { padding-left: 20px; margin-bottom: 0; }
.help-card.warning { border-color: #ebc9ad; background: var(--orange-soft); color: #74451e; }
.help-card p { margin: 10px 0 0; }
.toolbar { padding: 17px 20px; border-bottom: 1px solid var(--line); }
.toolbar input, .toolbar select { margin: 0; }
.filters { display: grid; grid-template-columns: 1fr 180px; gap: 12px; }
.product-filters { display: grid; grid-template-columns: minmax(240px, 1fr) 160px 180px; gap: 12px; }
.alert-panel { margin-bottom: 22px; border-color: #e7bcbc; }
.error-panel { border-color: #e7bcbc; }
.print-notice { margin-top: -8px; }

.orders-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.orders-grid .panel + .panel { margin-top: 0; }
.order-builder { padding-bottom: 20px; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: 10px; align-items: end; padding: 8px 20px 0; }
.inline-form label { margin: 0; }
.secondary-button { min-height: 44px; padding: 10px 14px; border: 1px solid var(--green); border-radius: 10px; background: white; color: var(--green); font-weight: 800; }
.secondary-button.danger { border-color: var(--red); color: var(--red); }
.secondary-button.danger:hover { background: #fff1f1; }
.compact-list { padding: 10px 20px; }
.compact-list.padded { padding-top: 0; }
.compact-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.compact-row:last-child { border-bottom: 0; }
.compact-row small { color: var(--muted); }
.draft-quantity-editor { display: flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; }
.draft-quantity-editor input { width: 76px; margin: 0; padding: 8px 9px; text-align: center; }
.remove-button { border: 0; background: transparent; color: var(--red); font-weight: 800; }
.product-delete-actions { display: grid; grid-template-columns: auto auto; gap: 5px; min-width: 125px; }
.product-delete-actions small { grid-column: 1 / -1; color: var(--red); font-weight: 800; }
.compact-button { min-height: 34px; padding: 7px 9px; box-shadow: none; font-size: 12px; }
.order-note { padding: 0 20px; }
.order-import-tools { margin: 0 20px 16px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.order-import-tools > div:first-child { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.order-import-tools small { color: var(--muted); }
.order-import-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.order-import-actions .secondary-button { text-decoration: none; }
.order-import-preview { margin-top: 10px; max-height: 280px; overflow: auto; }
.order-import-preview table { min-width: 620px; }
.order-import-tools #confirmOrderImport { margin-top: 10px; }
.order-builder > .wide { width: calc(100% - 40px); margin-left: 20px; }
.order-list { padding: 8px 20px 20px; }
.order-scan-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 0 20px 4px; }
.order-scan-form label { margin: 0; }
.order-card { padding: 14px; margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfc; }
.order-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.order-card p { margin: 4px 0; color: var(--muted); font-size: 13px; }
.order-card button { margin-top: 8px; }
.order-card .barcode-svg { max-width: 230px; margin: 9px 0 4px; }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.delete-confirmation { margin-top: 12px; padding: 12px; border: 1px solid #e7a8a8; border-radius: 10px; background: #fff6f6; color: var(--red); }
.delete-confirmation span { display: block; margin-top: 3px; font-size: 13px; }
.delete-confirmation .order-actions { margin-top: 4px; }
.picking-panel { margin-top: 22px; }
.picking-form { display: grid; grid-template-columns: minmax(0, 1fr) 140px auto; gap: 12px; align-items: end; padding: 0 20px 22px; }
.picking-form label { margin: 0; }
.hidden { display: none !important; }
.error-text { color: var(--red); font-weight: 800; }

dialog { width: min(820px, calc(100% - 30px)); max-height: calc(100vh - 30px); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 30px 80px rgba(18, 45, 42, .3); }
.wide-dialog { width: min(1040px, calc(100% - 30px)); }
dialog::backdrop { background: rgba(16, 34, 32, .55); backdrop-filter: blur(3px); }
.modal-card { padding: 24px; }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-alert { margin: -8px 0 18px; padding: 12px 14px; border: 1px solid #e6aaaa; border-radius: 10px; background: #fff0f0; color: var(--red); font-weight: 800; }
.form-alert.success { border-color: #9bcac2; background: #eaf7f4; color: var(--green); }
.location-category-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(150px, 1fr); gap: 14px; align-items: start; }
.location-fieldset { min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.location-fieldset legend { margin-bottom: 8px; font-size: 13px; font-weight: 800; }
.location-parts { display: grid; grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: center; }
.location-parts input { min-width: 0; margin: 0; text-align: center; text-transform: uppercase; }
.location-parts span { color: var(--muted); font-weight: 900; pointer-events: none; }
.field-help { display: block; margin-top: 7px; color: var(--muted); font-weight: 500; }
.barcode-preview-card { margin: 2px 0 18px; padding: 14px; border: 1px dashed #aac8c3; border-radius: 12px; background: #f7fbfa; text-align: center; }
.barcode-preview-card > span { display: block; margin-bottom: 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
.barcode-preview-empty { padding: 15px; color: var(--muted); font-size: 13px; }
.product-modal { padding: 18px 22px 20px; }
.product-modal .modal-heading { margin-bottom: 12px; }
.product-modal label { margin-bottom: 10px; }
.product-modal input, .product-modal select, .product-modal textarea { margin-top: 4px; padding: 9px 11px; }
.product-modal .form-alert { margin: 0 0 10px; padding: 9px 12px; }
.product-modal .location-fieldset { margin-bottom: 10px; }
.product-modal .field-help { margin-top: 4px; }
.product-modal .barcode-preview-card { margin: 0 0 10px; padding: 7px 10px; }
.product-modal .barcode-preview-card > span { margin-bottom: 4px; }
.product-modal .barcode-preview-empty { padding: 6px; }
.product-modal .barcode-svg { max-height: 52px; }
.product-modal .primary-button { padding: 10px 16px; }
.import-modal { padding: 22px; }
.import-modal .modal-heading { margin-bottom: 14px; }
.import-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.download-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; margin: 0; text-decoration: none; }
.file-picker { min-width: min(380px, 100%); margin: 0; }
.file-picker input { margin-top: 5px; padding: 7px 9px; background: #f8fbfa; }
.import-notice { margin-bottom: 14px; }
.import-status { margin-bottom: 12px; padding: 12px 14px; border-radius: 10px; background: #eef3f2; color: var(--muted); font-size: 14px; font-weight: 800; }
.import-status.success { border: 1px solid #9bcac2; background: #eaf7f4; color: var(--green); }
.import-status.error { border: 1px solid #e6aaaa; background: #fff0f0; color: var(--red); }
.import-preview { max-height: 390px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 12px; }
.import-preview table { min-width: 800px; }
.import-preview .error-row td { background: #fff0f0; color: #7a3131; }
.import-preview .ok-row td { background: #f5fbf9; }
.import-modal .primary-button:disabled { opacity: .45; cursor: not-allowed; }
.barcode-svg, .qr-svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.barcode-cell, .qr-cell { min-width: 112px; }
.qr-cell { cursor: pointer; }
.qr-cell:hover { background: #e1f2ef !important; }
.qr-code { display: inline-grid; place-items: center; min-width: 72px; min-height: 72px; }
.qr-code.compact { min-width: 58px; min-height: 58px; }
.qr-code svg { display: block; width: 72px; height: 72px; }
.qr-code.compact svg { width: 58px; height: 58px; }
.location-editor { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.location-editor-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; gap: 12px; align-items: center; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.location-editor-row:last-child { border-bottom: 0; }
.location-editor-row label { margin: 0; }
.location-editor-row input { margin: 0; }
.location-editor-row.pending-delete { opacity: .6; background: #fff2f2; }
.location-editor-row.pending-delete > strong { text-decoration: line-through; }
.location-editor-row .remove-button:disabled { color: var(--muted); opacity: .55; cursor: not-allowed; }
.transfer-location-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.transfer-location-summary > div { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f5f9f8; }
.transfer-location-summary span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 800; }
.transfer-location-summary strong { font-size: 20px; }
.transfer-location-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.transfer-location-actions button { margin: 0; }
.new-location-fields { display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 12px; margin-top: 14px; }
.photo-link { display: inline-flex; padding: 6px 10px; border-radius: 8px; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 800; text-decoration: none; }
.photo-link:hover { text-decoration: underline; }
.photo-empty { color: var(--muted); font-size: 12px; }
.current-file { margin-bottom: 14px; padding: 11px 13px; border-radius: 10px; background: #f2f6f5; color: var(--muted); font-size: 13px; }
.file-links { display: flex; flex-wrap: wrap; gap: 6px; }
.file-links > span { align-self: center; margin-right: 2px; }
.file-delete-button { padding: 6px 10px; border: 1px solid #d99b9b; border-radius: 8px; background: #fff2f2; color: var(--red); font-size: 12px; font-weight: 800; }
.file-delete-button:hover { background: #ffe5e5; }
.note-cell { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: 360px; padding: 13px 17px; border-radius: 11px; background: #193b37; color: white; box-shadow: 0 12px 30px rgba(0,0,0,.2); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }
.database-unavailable main form { opacity: .58; }

@media (max-width: 800px) {
  .topbar { height: 64px; padding: 0 14px; }
  .brand-copy span, .topbar .text-button { display: none; }
  .operator-box { margin-left: auto; padding: 6px 9px; }
  .operator-box span, .operator-box small { display: none; }
  .operator-box strong { grid-column: 1 / -1; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { margin-left: 0; }
  .topbar-actions .demo-badge { display: none; }
  .topbar-actions .sync-button, .topbar-actions .logout-button { display: inline-block; }
  .topbar-actions { gap: 7px; }
  .sync-status { padding: 5px 7px; font-size: 10px; }
  .location-category-grid { grid-template-columns: 1fr; }
  .location-parts { gap: 5px; }
  .app-shell { display: block; padding-bottom: 72px; }
  .side-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(7, 1fr); padding: 7px; border: 0; border-top: 1px solid var(--line); background: white; }
  .nav-item { flex-direction: column; gap: 2px; padding: 6px 2px; margin: 0; border-radius: 9px; font-size: 11px; text-align: center; }
  .nav-item span { font-size: 19px; }
  main { padding: 24px 14px 40px; }
  .page-heading { align-items: center; }
  .stats-grid, .stats-grid.four, .form-layout, .orders-grid { grid-template-columns: 1fr; }
  .orders-grid .panel + .panel { margin-top: 0; }
  .picking-form { grid-template-columns: 1fr; }
  .stat-card { min-height: 125px; }
  .filters, .product-filters { grid-template-columns: 1fr; }
  .location-editor-row { grid-template-columns: minmax(0, 1fr) 100px; }
  .location-editor-row .remove-button { grid-column: 1 / -1; justify-self: end; }
}

@media (max-width: 480px) {
  .login-gate { padding: 14px; }
  .login-card { padding: 22px; }
  .topbar .brand-copy { display: none; }
  .operator-box strong { max-width: 74px; }
  .topbar-actions .text-button { padding: 5px 3px; font-size: 12px; }
  .qr-login-actions, .qr-scanner-form { grid-template-columns: 1fr; }
  .page-heading .primary-button { padding: 10px 12px; font-size: 13px; }
  .page-actions { width: 100%; }
  .page-actions > * { flex: 1; }
  .two-columns { grid-template-columns: 1fr; gap: 0; }
  .inline-form { grid-template-columns: 1fr; }
  .order-scan-form { grid-template-columns: 1fr; }
  th, td { padding-left: 14px; padding-right: 14px; }
}

