:root {
  color-scheme: dark;
  --bg: #0e1420;
  --panel: #151e2d;
  --raised: #1b2738;
  --field: #101927;
  --line: #2b394d;
  --line-soft: #222e40;
  --text: #f1f5fb;
  --muted: #a3b3ca;
  --accent: #83c4ff;
  --green: #78ddbd;
  --amber: #f1c88e;
  --sidebar-width: 220px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 "Segoe UI", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea { border: 1px solid var(--line); border-radius: 8px; color: var(--text); }
button { cursor: pointer; background: var(--raised); padding: 8px 13px; min-height: 38px; font-weight: 600; }
button:hover { border-color: #547298; background: #22334b; }
button:disabled { cursor: wait; opacity: .55; }
:where(button, input, select, textarea, summary, a):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input, select, textarea { background: var(--field); padding: 9px 11px; max-width: 100%; min-width: 0; }
input::placeholder { color: #8397b1; }
input[type=search] { width: min(340px, 100%); }
input[type=checkbox] { accent-color: #85c5ff; width: 17px; height: 17px; margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(30px, 4vw, 42px); font-weight: 700; letter-spacing: -.045em; line-height: 1.08; }
h2 { font-size: 19px; font-weight: 670; letter-spacing: -.018em; margin: 27px 0 12px; }
p { line-height: 1.6; }
small, .muted { color: var(--muted); }
small { font-size: 12px; }
.primary { background: #84c5ff; color: #0a2238; border-color: transparent; font-weight: 750; }
.primary:hover { border-color: transparent; background: #a6d6ff; }
.text-button { background: transparent; border-color: transparent; color: var(--accent); }
.text-button:hover { background: #1a2a40; border-color: transparent; }

.sidebar { position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; width: var(--sidebar-width); padding: 25px 15px 16px; border-right: 1px solid var(--line-soft); background: #101826; overflow: auto; }
.brand { display: flex; align-items: center; gap: 11px; padding: 3px 8px; margin-bottom: 37px; }
.brand-mark { display: grid; place-items: center; flex: 0 0 37px; height: 37px; border: 1px solid #49779e; border-radius: 10px; background: linear-gradient(145deg, #204f78, #14243c); color: #c6e6ff; font-weight: 800; letter-spacing: -.08em; }
.brand-name { display: grid; font-size: 18px; font-weight: 800; letter-spacing: -.04em; line-height: 1.05; }
.brand-name small { display: block; margin-top: 4px; font-size: 11px; font-weight: 500; letter-spacing: 0; }
nav { display: grid; gap: 5px; }
nav button { min-width: 0; text-align: left; padding: 10px 12px; background: transparent; border-color: transparent; color: var(--muted); }
nav button:hover { border-color: transparent; }
nav button.active { color: #d4ebff; border-color: #2f5277; background: #1c3553; }
nav .help-link { color: var(--accent); border-color: var(--line); margin-top: 8px; }
nav .help-link:hover { border-color: var(--accent); }
.sidebar-status { margin-top: auto; padding: 12px 10px 2px; color: #c2d0e3; display: flex; align-items: center; gap: 8px; }
.sidebar-status small { display: block; }
main { margin-left: var(--sidebar-width); min-width: 0; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 0 clamp(16px, 3vw, 42px); border-bottom: 1px solid var(--line-soft); }
.breadcrumb { display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: 13px; }
.breadcrumb strong { color: var(--text); font-weight: 600; }
.identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.identity-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 650; }
.identity small { display: block; font-weight: 400; line-height: 1.3; }
.identity button { margin-left: 5px; background: transparent; min-height: 34px; }
#identity-shortcut { color: var(--accent); white-space: nowrap; }
#identity-shortcut[aria-current] { border-color: var(--accent); }
.avatar { flex: 0 0 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: #c8e6ff; background: #243a56; font-weight: 750; }
#content { max-width: 1640px; margin: 0 auto; padding: 32px clamp(16px, 3vw, 42px) 58px; }
.heading, .home-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 23px; }
.heading .primary, .home-heading .primary { white-space: nowrap; }
.heading p { margin-top: 9px; max-width: 70ch; }
.today-note { color: var(--muted); margin-bottom: 6px; font-size: 13px; }
.today-note::first-letter { text-transform: uppercase; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(245px, 1fr); gap: 17px; align-items: start; }
.home-side { display: grid; gap: 17px; }
#latest-handoff:empty { display: none; }
.handoff-card .queue-heading { margin-bottom: 4px; }
.handoff-card > .muted, .shift-handoffs .muted { font-size: 13px; }
.handoff-note { margin: 12px 0; padding: 9px 12px; background: var(--field); border-radius: 7px; white-space: pre-wrap; overflow-wrap: anywhere; }
.handoff-items { margin: 8px 0 0; padding: 0; list-style: none; }
.handoff-items li { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line-soft); padding-block: 4px; }
.handoff-items button { text-align: left; min-width: 0; padding-inline: 6px; overflow-wrap: anywhere; }
.handoff-items button small { display: block; margin-top: 2px; font-weight: 400; }
.handoff-warranty { padding-inline: 6px; }
.shift-handoffs details + details { border-top: 1px solid var(--line-soft); }
.shift-handoffs summary { cursor: pointer; padding: 9px 0; font-weight: 600; }
.work-queue, .shift-card, .quick-card, .panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px; padding: 19px; }
.work-queue h2, .shift-card h2, .quick-card h2, .panel h2:first-child { margin-top: 0; }
.queue-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 3px 8px; margin-bottom: 6px; }
.queue-heading h2 { margin: 0; }
.queue-row { width: 100%; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 12px 8px; min-height: 67px; text-align: left; background: transparent; border: 1px solid transparent; border-top-color: var(--line-soft); border-radius: 0; }
.queue-row:hover { background: var(--raised); border-color: var(--line); border-radius: 8px; }
.queue-row strong, .queue-row small { display: block; }
.queue-row small { font-weight: 400; margin-top: 3px; line-height: 1.4; }
.queue-row > :last-child { color: var(--accent); }
.bott-sync-line { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0 12px; }
.work-queue .bott-sync-line { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.bott-sync-line p { color: var(--muted); font-size: 12px; }
.bott-sync-line .stale { color: var(--amber); }
.bott-sync-line .text-button { min-height: 36px; font-size: 13px; }
.queue-count { min-width: 38px; padding: 3px 5px; border-radius: 8px; background: #1d3550; color: #c4e4ff; text-align: center; font-size: 20px; font-variant-numeric: tabular-nums; }
.queue-count.attention { color: var(--amber); background: #443321; }
.shift-card { background: linear-gradient(122deg, #192d47, #151e2d 79%); }
.shift-card .actions { margin-top: 14px; }
.shift-dot { display: inline-block; flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: #8194ae; vertical-align: 1px; }
.shift-card .shift-dot { margin-right: 8px; }
.shift-dot.live { background: var(--green); }
.quick-card button { display: flex; text-align: left; align-items: center; justify-content: space-between; gap: 8px; width: 100%; background: transparent; border-color: transparent; padding-inline: 8px; }
.quick-card button:hover { background: var(--raised); }
.quick-card button span { color: var(--accent); }
.section-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px; align-items: start; }
.menu-row { grid-template-columns: minmax(0,1fr) auto; min-height: 57px; }
.section-back { margin: -8px 0 12px -9px; }
.warehouse-sync { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr) auto; align-items: end; gap: 12px; }
.warehouse-sync label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.warehouse-sync .error { grid-column: 1/-1; }
.warehouse-product small { color: var(--muted); font-weight: 400; }
.help-layout { max-width: 760px; display: grid; gap: 24px; }
.help-group h2 { margin: 0 0 10px; }
.help-topic { border: 1px solid var(--line-soft); border-radius: 9px; background: var(--panel); }
.help-topic + .help-topic { margin-top: 7px; }
.help-topic summary { cursor: pointer; padding: 11px 14px; font-weight: 650; border-radius: 8px; }
.help-topic summary::marker { color: var(--accent); }
.help-topic[open] summary { border-bottom: 1px solid var(--line-soft); border-radius: 8px 8px 0 0; }
.help-answer { padding: 11px 14px; color: var(--muted); }
.help-answer ol, .help-answer ul { margin: 0; padding-left: 1.3rem; }
.help-answer li + li { margin-top: 6px; }
.help-answer button { margin: 6px 0 0 -7px; padding-inline: 7px; }

.segmented { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; width: fit-content; margin-bottom: 17px; padding: 4px; border-radius: 11px; background: #111b2a; border: 1px solid var(--line); }
.segmented button { background: transparent; border-color: transparent; color: var(--muted); min-height: 34px; padding: 5px 10px; }
.segmented button[aria-pressed="true"] { background: #2b4869; color: #e9f4ff; }
.segmented button span { padding: 1px 5px; margin-left: 4px; color: inherit; border-radius: 5px; background: #ffffff14; font-variant-numeric: tabular-nums; }
.toolbar, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.toolbar { margin: 16px 0; }
.actions button { padding: 5px 10px; font-size: 13px; min-height: 34px; }
.finance-actions { margin-bottom: 24px; }
.balance-card .queue-heading h3 { margin: 0; }
.balance-card h3 small { margin-left: 4px; color: var(--muted); font-weight: 400; }
.balance-card .queue-heading + .table-wrap { margin-top: 10px; }
.balance-grid .balance-card { margin-bottom: 0; }
.balance-grid + .section-note { margin-top: 12px; }
.table-wrap { overflow: auto; border: 1px solid var(--line-soft); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; color: #adc0d8; background: #1c293b; font-size: 12px; font-weight: 650; white-space: nowrap; }
td, th { padding: 10px 12px; vertical-align: top; }
td { border-top: 1px solid var(--line-soft); overflow-wrap: anywhere; }
td button { white-space: nowrap; }
td .actions { min-width: max-content; align-items: flex-start; flex-direction: column; }
tbody tr:nth-child(even) { background: #131d2b; }
tbody tr:hover { background: #19283b; }
.tag { display: inline-block; font-size: 12px; padding: 2px 7px; border-radius: 5px; background: #253d59; color: #bddfff; white-space: nowrap; }
.tag.green { color: var(--green); background: #173832; }
.tag.caution { color: var(--amber); background: #3a2e22; }
.order-table td > div > small { display: block; margin-top: 2px; }
.order-number { font-variant-numeric: tabular-nums; }
.order-open { min-height: 40px; background: transparent; color: var(--accent); }
.order-open span { margin-inline-start: 4px; }
.order-card { max-width: 980px; }
.order-card-heading { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.order-card-heading h1 { font-size: clamp(26px, 3.3vw, 38px); overflow-wrap: anywhere; }
.order-total { text-align: right; }
.order-total small, .order-total strong { display: block; }
.order-total strong { font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; }
.order-overview { display: grid; grid-template-columns: 1.4fr 1fr 1fr; border-block: 1px solid var(--line); margin-bottom: 16px; }
.order-overview > div { min-width: 0; padding: 12px 16px; overflow-wrap: anywhere; }
.order-overview > div:first-child { padding-inline-start: 0; }
.order-overview > div + div { border-inline-start: 1px solid var(--line-soft); }
.order-overview strong, .order-overview small { display: block; }
.order-overview strong { margin-block: 4px; }
.order-next { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; margin-bottom: 16px; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; }
.order-next small { color: var(--accent); }
.order-next.alert small { color: var(--amber); }
.order-next.done small { color: var(--green); }
.order-next h2 { margin: 4px 0; }
.order-next p { color: var(--muted); }
.order-next button { min-height: 44px; flex-shrink: 0; }
.order-check { margin-bottom: 16px; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; overflow: hidden; }
.order-check .order-next { margin: 0; border: 0; border-radius: 0; }
.order-check th, .order-check td { white-space: normal; }
.order-check tbody th { border-top: 1px solid var(--line-soft); background: transparent; font-size: inherit; }
.order-check-attention { color: var(--amber); font-weight: 650; }
.order-check-meta { margin: 0; padding: 10px 12px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }
.order-details { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px; overflow: hidden; }
.order-details details + details { border-top: 1px solid var(--line-soft); }
.order-details summary { cursor: pointer; padding: 12px 16px; font-weight: 650; }
.order-details summary:hover { background: var(--raised); }
.order-details summary:focus-visible { outline-offset: -3px; }
.order-detail-body { display: grid; gap: 12px; padding: 0 16px 14px; overflow-wrap: anywhere; }
.order-detail-body :where(ul,dl) { margin: 0; }
.order-detail-body .actions:empty { display: none; }
.order-breakdown { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 12px; max-width: 440px; color: var(--muted); }
.order-breakdown dd { text-align: right; color: var(--text); margin: 0; }
.order-events { padding: 0; list-style: none; }
.order-events li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; }
.order-events li + li { border-top: 1px solid var(--line-soft); }
.order-events small { display: block; }
.order-events time { flex-shrink: 0; color: var(--muted); font-size: 12px; text-align: right; }
.empty { text-align: center; padding: 34px 14px !important; color: var(--muted); }
.panel { margin-bottom: 16px; }
.category { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.category:last-child { border: 0; }
.stats { display: flex; gap: 8px; margin: 20px 0 24px; }
.stat { flex: 1; padding: 13px 16px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 9px; }
.stat strong { display: block; margin-top: 6px; font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; }
.warning { padding: 9px 12px; margin: 0 0 14px; border-left: 3px solid var(--amber); background: #34291e; border-radius: 5px; color: #f3d9b5; font-size: 13px; }
.section-note { margin: 0 0 12px; max-width: 82ch; font-size: 13px; }
.backup-panel { margin-top: 24px; }
.backup-panel button { margin-top: 12px; }
.calculation { margin-top: 4px; font-size: 12px; color: var(--muted); }
.calculation summary { cursor: pointer; color: var(--accent); }
.calculation dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
.calculation dt, .calculation dd { margin: 0; }
.calculation dd { color: var(--text); }
.error { color: #ffb5ae; white-space: normal; }
p.error:not(:empty), #error:not(:empty) { margin: 12px 0; }

dialog { background: var(--panel); border: 1px solid #435975; border-radius: 14px; color: var(--text); width: 570px; max-width: 94vw; max-height: 90dvh; padding: 21px; overflow: auto; }
dialog::backdrop { background: #070b12ce; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.dialog-head h2 { margin: 0; }
.dialog-head button { padding: 0 9px; min-height: 32px; font-size: 23px; }
#fields { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 13px; }
#fields label, .auth-fields label { display: grid; gap: 6px; color: #c2d0e3; font-size: 13px; }
#fields .wide { grid-column: 1/-1; }
#fields .confirm-delivery { display: flex; gap: 8px; align-items: center; }
#fields small, .form-help { font-size: 12px; color: var(--muted); }
.purchase-summary { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 12px; border-radius: 8px; background: var(--raised); }
.purchase-summary strong, .purchase-summary small { display: block; }
.purchase-summary div { overflow-wrap: anywhere; }
.purchase-summary div:last-child { text-align: right; }
.purchase-summary div:last-child strong { color: var(--accent); }
.form-section-title { margin: 0; }
.warehouse-units { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; max-height: min(220px,35vh); overflow: auto; padding: 8px; background: var(--field); border: 1px solid var(--line-soft); border-radius: 8px; }
#fields .warehouse-units label { display: flex; align-items: center; padding: 8px; min-height: 36px; cursor: pointer; }
.warehouse-units label:hover { background: var(--raised); border-radius: 6px; }
#submit { margin-top: 14px; }
#toast { position: fixed; bottom: 16px; right: 16px; max-width: min(470px, 90vw); z-index: 5; background: #203b3c; border: 1px solid #4d7973; border-radius: 9px; padding: 11px 16px; }
.auth { max-width: 470px; margin: min(12vh, 90px) auto 0; padding: 26px; }
.auth h1 { font-size: 30px; margin-bottom: 10px; }
.auth-fields { display: grid; gap: 14px; margin-top: 17px; }
.auth-fields button { justify-self: start; }

@media(max-width: 1000px) {
  .balance-grid { grid-template-columns: minmax(0,1fr); }
  :root { --sidebar-width: 172px; }
  .sidebar { padding-inline: 10px; }
}
@media(max-width: 820px) {
  .sidebar { position: static; width: auto; padding: 11px 14px 0; border-right: 0; border-bottom: 1px solid var(--line-soft); overflow: visible; display: block; }
  .brand { margin: 0 0 8px; padding: 0 4px; }
  .brand-mark { flex-basis: 30px; height: 30px; }
  nav { grid-template-columns: repeat(6,minmax(0, 1fr)); gap: 3px; margin-bottom: 6px; }
  nav:empty { display: none; }
  nav button { text-align: center; font-size: 13px; padding-inline: 3px; }
  nav .help-link { margin-top: 0; }
  main { margin: 0; }
  header { min-height: 54px; }
  .sidebar-status { display: none; }
  .home-grid { grid-template-columns: minmax(0,1.4fr) minmax(200px,1fr); gap: 12px; }
  .home-side { gap: 12px; }
  td { min-width: 84px; }
}
@media(max-width: 420px) {
  nav { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media(max-width: 550px) {
  #content { padding-top: 22px; }
  .home-grid, .section-grid { grid-template-columns: minmax(0,1fr); }
  .home-heading, .heading { align-items: flex-start; }
  .heading .primary, .home-heading .primary { margin-top: 2px; font-size: 13px; }
  .breadcrumb { gap: 5px; }
  .breadcrumb > span:first-child, .breadcrumb > span:nth-child(2), .avatar { display: none; }
  .identity-name { max-width: 118px; font-size: 12px; }
  .identity { gap: 5px; }
  .identity button { margin-left: 0; padding-inline: 7px; }
  .order-tools input { width: 100%; }
  .stats { flex-wrap: wrap; }
  .stat { min-width: 135px; }
  #fields { grid-template-columns: minmax(0,1fr); }
  .warehouse-sync { grid-template-columns: minmax(0,1fr); }
  td, th { padding: 8px 9px; }
  .work-queue, .shift-card, .quick-card, .panel { padding: 14px; }
  .queue-row { gap: 9px; }
  .auth { margin-top: 22px; padding: 20px; }
  .order-table { border: 0; overflow: visible; }
  .order-table table, .order-table tbody { display: block; }
  .order-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .order-table tr { display: block; margin-bottom: 10px; padding: 4px 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--panel); }
  .order-table td { display: grid; grid-template-columns: minmax(80px, 36%) minmax(0,1fr); gap: 8px; padding: 7px 0; min-width: 0; }
  .order-table td:first-child { border-top: 0; }
  .order-table td[data-label]::before { content: attr(data-label); font-size: 12px; color: var(--muted); }
  .order-table td.empty { display: block; padding: 16px 5px !important; }
  .order-table td .actions { flex-direction: row; min-width: 0; }
  .order-table td button { white-space: normal; }
  .order-card-heading { align-items: start; }
  .order-total { text-align: left; }
  .order-overview { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .order-overview > div:first-child { grid-column: 1/-1; border-bottom: 1px solid var(--line-soft); }
  .order-overview > div:nth-child(2) { padding-inline-start: 0; border-inline-start: 0; }
  .order-next { align-items: stretch; flex-direction: column; gap: 10px; }
  .order-next button { width: 100%; }
}
