:root {
  color-scheme: dark;
  --canvas: #101720;
  --surface: #151e2a;
  --raised: #192432;
  --border: #2b3949;
  --text: #f0f4f8;
  --muted: #a6b3c3;
  --accent: #ffd084;
  --ink: #241b0e;
  --loading: #ffce72;
  --transit: #79bcff;
  --received: #79e2b1;
  --issue: #ff967d;
  font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--text); min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.shell { width: min(100% - 88px, 1440px); margin-inline: auto; }
.topbar { border-bottom: 1px solid var(--border); background: #131c27; }
.topbar-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 1rem; font-weight: 720; letter-spacing: .015em; }
.brand-icon { height: 31px; width: 31px; background: var(--accent); color: var(--ink); border-radius: 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.brand-icon i { width: 14px; height: 2px; background: currentColor; border-radius: 3px; }
.brand-icon i:nth-child(2) { width: 10px; }
.clock { display: flex; align-items: baseline; gap: 12px; color: var(--muted); font-size: .875rem; }
.clock time { color: var(--text); font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding-block: 38px 28px; }
.location-line { display: flex; align-items: center; gap: 9px; color: var(--accent); font-weight: 720; font-size: .875rem; letter-spacing: .13em; }
.location-line { flex-wrap: wrap; }
.location-mark { display: inline-block; width: 15px; height: 2px; background: var(--accent); }
h1 { font-size: clamp(2.25rem, 4.2vw, 3.7rem); line-height: 1.05; letter-spacing: -.045em; margin: 9px 0 7px; }
.page-head p { color: var(--muted); margin: 0; }
.page-actions, .board-actions, .dialog-foot > div { display: flex; align-items: center; gap: 9px; }
.page-actions { padding-bottom: 2px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 14px; white-space: nowrap; border: 1px solid transparent; border-radius: 7px; font-weight: 680; font-size: .925rem; }
.secondary { background: var(--surface); border-color: var(--border); }
.secondary:hover { background: #243245; }
.primary { background: var(--accent); color: var(--ink); }
.primary:hover { background: #ffe0a9; }
.plus { font-size: 1.32rem; line-height: .8; }
.fullscreen-icon { width: 15px; height: 15px; background:
  linear-gradient(currentColor, currentColor) left top / 5px 1.5px,
  linear-gradient(currentColor, currentColor) left top / 1.5px 5px,
  linear-gradient(currentColor, currentColor) right top / 5px 1.5px,
  linear-gradient(currentColor, currentColor) right top / 1.5px 5px,
  linear-gradient(currentColor, currentColor) left bottom / 5px 1.5px,
  linear-gradient(currentColor, currentColor) left bottom / 1.5px 5px,
  linear-gradient(currentColor, currentColor) right bottom / 5px 1.5px,
  linear-gradient(currentColor, currentColor) right bottom / 1.5px 5px;
  background-repeat: no-repeat;
}
.loading { --status: var(--loading); }
.transit { --status: var(--transit); }
.received { --status: var(--received); }
.issue { --status: var(--issue); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 24px; }
.stat { border: 1px solid var(--border); border-top: 2px solid color-mix(in srgb, var(--status) 65%, var(--border)); background: var(--surface); padding: 13px 16px 11px; border-radius: 8px; }
.stat > span { display: flex; align-items: center; gap: 8px; font-size: .875rem; color: var(--muted); font-weight: 640; }
.stat i, .badge i, .mode i { display: inline-block; width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--status); }
.stat strong { display: block; font-size: 2rem; margin-top: 2px; font-variant-numeric: tabular-nums; line-height: 1.3; }
.board { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 28px; }
.board-top, .filters, .board-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 18px; }
.board-top { min-height: 61px; }
.board-title { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
h2 { margin: 0; font-size: 1.25rem; line-height: 1.25; letter-spacing: -.015em; }
.mode { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 2px 7px; font-size: .785rem; font-weight: 700; white-space: nowrap; --status: var(--muted); }
.mode i { width: 6px; height: 6px; flex-basis: 6px; }
.mode.live { color: var(--received); --status: var(--received); }
.mode.demo { color: var(--accent); --status: var(--accent); }
.toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; font-size: .875rem; cursor: pointer; }
.toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch { width: 31px; height: 17px; border: 1px solid var(--muted); border-radius: 12px; background: var(--canvas); padding: 2px; }
.switch::before { content: ""; display: block; width: 11px; height: 11px; border-radius: 50%; background: var(--muted); }
.toggle input:checked + .switch { border-color: var(--accent); }
.toggle input:checked + .switch::before { transform: translateX(14px); background: var(--accent); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 3px; }
.link-button { background: transparent; border: 0; padding: 5px; color: var(--accent); font-size: .875rem; font-weight: 650; white-space: nowrap; }
.link-button:hover { text-decoration: underline; }
.filters { justify-content: flex-start; background: #121b26; border-block: 1px solid var(--border); padding-block: 9px; }
.select-wrap { position: relative; display: block; }
.select-wrap::after { position: absolute; content: ""; pointer-events: none; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; width: 6px; height: 6px; transform: translateY(-70%) rotate(45deg); right: 12px; top: 50%; }
.select-wrap select { appearance: none; width: 100%; padding-right: 29px; }
.status-filter { margin-left: auto; }
.warehouse-filter select, .status-filter select { background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding-block: 5px; padding-left: 9px; font-size: .875rem; }
.connection-error { margin: 0; padding: 10px 18px; color: var(--issue); border-bottom: 1px solid var(--border); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { color: var(--muted); font-weight: 650; font-size: .875rem; white-space: nowrap; background: #182331; padding: 9px 12px; }
td { border-top: 1px solid var(--border); padding: 11px 12px; height: 56px; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
tbody tr:hover { background: #1a2736; }
.load-id { color: var(--text); font-weight: 770; font-size: 1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.route { white-space: nowrap; font-weight: 680; }
.route span { color: var(--muted); margin-inline: 3px; }
.badge { display: inline-flex; align-items: center; gap: 9px; color: var(--status); background: color-mix(in srgb, var(--status) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--status) 26%, var(--border)); padding: 5px 9px; border-radius: 5px; white-space: nowrap; font-size: .875rem; font-weight: 730; }
.pulsing .badge:is(.loading, .transit, .issue) i { animation: pulse 2.25s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; box-shadow: 0 0 0 0 color-mix(in srgb, var(--status) 45%, transparent); } 55% { opacity: .42; box-shadow: 0 0 0 4px transparent; } }
@media (prefers-reduced-motion: reduce) { .pulsing .badge i { animation: none !important; } }
.quantity { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 720; }
.quantity small, .time-detail, .dash { color: var(--muted); font-size: .875rem; font-weight: 500; }
.time-cell { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: .925rem; }
.time-detail { display: block; line-height: 1.1; }
.details-button { color: var(--accent); background: transparent; border: 1px solid var(--border); border-radius: 5px; padding: 4px 8px; font-size: .875rem; font-weight: 650; }
.details-button:hover { background: var(--raised); }
.detail-column { width: 1%; text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 34px 15px !important; }
.board-foot { padding-block: 10px; color: var(--muted); border-top: 1px solid var(--border); font-size: .875rem; }
dialog { background: var(--surface); color: var(--text); width: min(690px, calc(100% - 24px)); max-height: calc(100% - 28px); overflow: auto; border: 1px solid var(--border); border-radius: 11px; padding: 0; }
dialog::backdrop { background: #080e15cc; }
.dialog-head, .dialog-foot { padding: 16px 20px; display: flex; gap: 15px; justify-content: space-between; align-items: flex-start; }
.dialog-head { border-bottom: 1px solid var(--border); }
.dialog-head p { color: var(--muted); margin: 4px 0 0; }
.close-button { font-size: 1.4rem; line-height: 1; border: 0; background: transparent; color: var(--muted); padding: 3px 6px; }
.dialog-body { padding: 15px 20px; }
.dialog-foot { align-items: center; justify-content: flex-end; border-top: 1px solid var(--border); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-body label:not(.choice) { display: block; font-weight: 650; font-size: .925rem; }
.dialog-body input:not([type="checkbox"]), .dialog-body textarea, .dialog-body select { display: block; width: 100%; padding: 8px 10px; margin-top: 4px; background: var(--canvas); border: 1px solid var(--border); border-radius: 6px; }
.dialog-body .select-wrap select { padding-right: 29px; }
.skid-line, .skid-detail { margin: 12px 0; padding: 10px 12px 12px; border: 1px solid var(--border); border-radius: 7px; min-width: 0; }
.skid-entry { margin-top: 17px; }
.skid-entry-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.skid-entry-head h3 { font-size: 1rem; margin: 0; }
.skid-entry-head .link-button { margin-right: auto; }
#product-types-error { margin-top: 4px; }
.product-types-status { margin: 4px 0 0; color: var(--received); font-size: .875rem; }
#skid-total { color: var(--accent); font-weight: 700; font-size: .925rem; }
#skid-total.over-limit { color: var(--issue); }
.skid-line { margin-block: 8px; }
.skid-line-fields { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .55fr) auto; align-items: end; gap: 8px; }
.skid-line-fields .remove-line { justify-self: start; margin-bottom: 4px; }
.skid-line-options { margin-top: 7px; }
.other-size { margin-top: 8px; }
.warehouse-actions { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-top: 4px; }
.optional-label, .field-help { color: var(--muted); font-size: .875rem; font-weight: 500; }
.field-help { margin: 6px 0 0; }
.skid-line-options summary { color: var(--muted); cursor: pointer; font-size: .875rem; }
.choices, .detail-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
@media (max-width: 500px) {
  .skid-line-fields { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(56px, .55fr); }
  .skid-line-fields .remove-line { grid-column: 1 / -1; margin: 0; }
}
.choices { margin-block: 9px; }
.choice { display: inline-flex; gap: 5px; align-items: center; font-weight: 540; font-size: .875rem; }
.choice input { accent-color: var(--accent); width: 16px; height: 16px; }
.notes-label { margin-top: 12px; }
.form-error { color: var(--issue); margin: 0 auto 0 0; font-size: .875rem; }
.skid-detail { display: grid; gap: 5px; }
.skid-detail p { margin: 0; color: var(--muted); overflow-wrap: anywhere; white-space: pre-wrap; }
.detail-meta { color: var(--muted); margin-bottom: 12px; }
.detail-meta > span { font-size: .875rem; }
.toast { position: fixed; z-index: 1; right: 20px; bottom: 20px; background: var(--raised); padding: 12px 18px; border: 1px solid var(--received); border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.wall-mode .shell { width: min(100% - 42px, 1700px); }
.wall-mode .page-head { padding-top: 21px; }
.wall-mode td { height: 65px; }
.wall-mode .load-id, .wall-mode .route, .wall-mode .badge { font-size: 1.05rem; }
@media (max-width: 900px) {
  .shell { width: calc(100% - 38px); }
  .time-column, .time-cell { display: none; }
  .page-head { padding-top: 25px; }
}
@media (max-width: 590px) {
  .shell, .wall-mode .shell { width: calc(100% - 22px); }
  .topbar-inner { min-height: 54px; }
  .clock { flex-direction: column; gap: 0; text-align: right; }
  .clock time { font-size: .92rem; }
  .clock span { font-size: .75rem; }
  .page-head { align-items: start; flex-direction: column; gap: 13px; padding-bottom: 16px; }
  .page-actions { padding: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 14px; }
  .stat { padding: 5px 10px; }
  .stat strong { font-size: 1.45rem; }
  .board-top { flex-wrap: wrap; gap: 8px; }
  .board-top, .filters, .board-foot { padding-inline: 9px; }
  .filters { gap: 6px; }
  th, td { padding-inline: 5px; }
  th:first-child, td:first-child { padding-left: 9px; }
  th:last-child, td:last-child { padding-right: 9px; }
  .skid-column, .quantity { display: none; }
  .badge { gap: 5px; padding-inline: 5px; font-size: .8rem; }
  .badge i { width: 6px; height: 6px; flex-basis: 6px; }
  .route, .load-id { font-size: .875rem; }
  .route span { margin: 0; }
  .details-button { padding-inline: 4px; font-size: .8rem; }
  .dialog-foot { flex-wrap: wrap; }
}

.view-nav { display: flex; align-items: center; gap: 4px; margin-inline: auto; }
.view-nav a { padding: 6px 10px; border: 1px solid transparent; border-radius: 5px; color: var(--muted); text-decoration: none; font-size: .875rem; font-weight: 650; white-space: nowrap; }
.view-nav a:hover, .view-nav a[aria-current="page"] { background: var(--raised); border-color: var(--border); color: var(--text); }
.view-nav a[aria-current="page"] { color: var(--accent); }
.history-search { display: flex; gap: 8px; padding: 2px 18px 14px; }
.history-search input { flex: 1; max-width: 430px; min-width: 0; background: var(--canvas); border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px; }
.history-search input::placeholder { color: var(--muted); }
.page-links { display: flex; align-items: center; gap: 7px; }
.page-links .button { min-height: 32px; padding: 2px 10px; }
.page-links .button:disabled { cursor: default; }
.detail-tools { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px 0; }
.detail-tools a { text-decoration: none; }
.shipping-fields { margin-block: 13px 10px; border: 1px solid var(--border); border-radius: 7px; padding: 9px 12px; }
.shipping-fields summary { cursor: pointer; font-weight: 650; }
.shipping-fields summary span { font-size: .875rem; color: var(--muted); font-weight: 500; margin-left: 6px; }
.shipping-fields .form-grid { margin-top: 10px; }
@media (max-width: 590px) {
  .topbar-inner { flex-wrap: wrap; gap: 4px 12px; padding-block: 7px; }
  .view-nav { order: 3; width: 100%; }
  .view-nav a { padding: 4px 7px; }
  .history-search { padding-inline: 9px; }
}

.account-page { max-width: 450px; margin: 0 auto; padding: 40px 16px 20px; }
.account-panel { margin-top: 16px; padding: 22px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.account-panel h1 { margin: 0 0 16px; font-size: 1.8rem; }
.account-panel h2 { font-size: 1.1rem; }
.account-panel a { color: var(--accent); }
.account-form { display: grid; gap: 12px; margin: 12px 0; }
.account-form label { display: grid; gap: 4px; font-weight: 650; }
.account-form input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--canvas); }
.account-message { margin: 0 0 10px; color: var(--accent); }
.account-email { margin: 0 0 14px; color: var(--muted); }
.account-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
@media (max-width: 590px) {
  .view-nav { flex-wrap: wrap; }
}
