:root {
  color-scheme: light dark;
  --canvas: light-dark(#f5f6fb, #171922);
  --paper: light-dark(#fff, #20232f);
  --quiet: light-dark(#fafbfe, #252836);
  --ink: light-dark(#20233a, #f1f2fc);
  --muted: light-dark(#535a75, #b0b5cb);
  --line: light-dark(#dce0ee, #3a3e52);
  --violet: light-dark(#5938bd, #c4b4ff);
  --violet-on: light-dark(#fff, #241840);
  --violet-wash: light-dark(#eee8ff, #392e57);
  --green: light-dark(#176246, #9ce5ba);
  --green-wash: light-dark(#e1f3e9, #233e34);
  --amber: light-dark(#845114, #f4c688);
  --amber-wash: light-dark(#fff1d8, #443825);
  --slot-green: light-dark(#71c49e, #58a883);
  --slot-amber: light-dark(#e7b477, #926f45);
  --slot-hold: light-dark(#b8bcd0, #6d738c);
  --shadow: 0 12px 28px light-dark(#23164612, #08061044);
  font: 14px/1.48 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
*, *::before, *::after { box-sizing: border-box; }
:root[data-theme="dark"] { color-scheme:dark; }
:root[data-theme="light"] { color-scheme:light; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(28px, 4vw, 38px); line-height: 1.08; letter-spacing: -.05em; }
h2 { font-size: 17px; letter-spacing: -.025em; }
h3 { font-size: 15px; }
input, select, button { min-width: 0; font: inherit; color: inherit; }
button, select, input {
  min-height: 38px; border: 1px solid var(--line); border-radius: 9px;
  padding: 7px 10px; background: var(--paper);
}
button { cursor: pointer; font-weight: 600; }
button:hover { border-color: var(--violet); }
button:disabled { cursor: default; opacity: .65; }
input::placeholder { color: var(--muted); }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
a { color: var(--violet); }
.accent { color: var(--violet); background: var(--violet-wash); border-color: transparent; }
.primary { background: var(--violet); color: var(--violet-on); border-color: var(--violet); }
.shell { max-width: 1376px; margin: 0 auto; padding-inline: 32px; }
.app-header { position: sticky; top: 0; z-index: 1; border-bottom: 1px solid var(--line); background: var(--paper); }
.header-inner, .header-tools, .brand, .main-nav, .toolbar { display: flex; align-items: center; gap: 10px; }
.header-inner { min-height: 66px; flex-wrap: wrap; gap: 12px 28px; }
.brand { font-size: 20px; font-weight: 760; letter-spacing: -.05em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--violet); color: var(--violet-on); font-size: 18px; }
.main-nav { gap: 5px; }
.main-nav a { text-decoration: none; color: var(--ink); padding: 9px 15px; border-radius: 8px; }
.main-nav a[aria-current] { background: var(--violet-wash); color: var(--violet); font-weight: 710; }
.nav-count { margin-left: 3px; padding: 0 5px; border-radius: 5px; font-size: 11px; background: var(--violet-wash); color: var(--violet); }
.header-tools { margin-left: auto; flex-wrap: wrap; gap: 8px 15px; }
.theme-switch {
  display: inline-grid; place-items: center; flex: none;
  width: 46px; height: 44px; padding: 0; border: 0; border-radius: 999px;
  background: transparent; touch-action: manipulation;
}
.theme-track {
  display: block; position: relative; width: 42px; height: 24px; border-radius: 999px;
  background: light-dark(#b8bdca, #545863);
  box-shadow: inset 0 0 0 1px light-dark(#36415b24, #ffffff0c);
}
.theme-thumb {
  display: grid; place-items: center; position: absolute; left: 2px; top: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: light-dark(#fff, #17191d);
  box-shadow: 0 1px 3px #11182733;
  transition: transform 180ms cubic-bezier(.2,.7,.2,1);
}
.theme-thumb::before, .theme-thumb::after {
  content: ""; grid-area: 1 / 1; border-radius: 50%;
  transition: opacity 140ms ease;
}
/* The centre and eight rays of the sun share one colour. */
.theme-thumb::before {
  width: 14px; height: 14px; color: #925e16;
  background: radial-gradient(circle, currentColor 3px, transparent 3.3px),
              repeating-conic-gradient(from -7deg, currentColor 0 14deg, transparent 14deg 45deg);
  mask: radial-gradient(circle, #000 3.3px, transparent 3.5px 4.3px, #000 4.6px 6.6px, transparent 7px);
}
.theme-thumb::after {
  width: 12px; height: 12px; color: #fafbff; opacity: 0;
  background: radial-gradient(circle 5.6px at 30% 25%, transparent 95%, currentColor 106%);
}
:root[data-theme="dark"] .theme-thumb { transform: translateX(18px); }
:root[data-theme="dark"] .theme-thumb::before { opacity: 0; }
:root[data-theme="dark"] .theme-thumb::after { opacity: 1; }
.theme-switch:focus-visible { outline: none; }
.theme-switch:focus-visible .theme-track { outline: 2px solid var(--violet); outline-offset: 3px; }
@media (hover: hover) {
  .theme-switch:hover .theme-track { box-shadow: 0 0 0 3px light-dark(#56428d14, #cec6ff18); }
}
@media (prefers-reduced-motion: reduce) {
  .theme-thumb, .theme-thumb::before, .theme-thumb::after { transition: none; }
}
@media (forced-colors: active) {
  .theme-track { forced-color-adjust: none; background: Canvas; outline: 1px solid ButtonText; }
  .theme-thumb { background: ButtonText; }
  .theme-thumb::before, .theme-thumb::after { color: Canvas; }
  .theme-switch:focus-visible .theme-track { outline-color: Highlight; }
}
.demo-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.demo-label i, .legend i { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; background: var(--violet); }
main { padding-top: 28px; padding-bottom: 20px; }
.page-title, .section-head, .panel-head, .tile-top, .tile-bottom, .modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.page-title { flex-wrap: wrap; margin-bottom: 19px; }
.page-title p { margin-top: 5px; color: var(--muted); }
.toolbar { flex-wrap: wrap; }
.metrics { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 23px; }
.metric, .panel, .tile { border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.metric { padding: 11px 15px; }
.metric strong { display: block; font-size: 25px; letter-spacing: -.04em; line-height: 1.18; }
.metric span, .muted, .legend, .tile-bottom, .demo-footer { color: var(--muted); }
.metric span, .muted, .legend, .tile-bottom { font-size: 12px; }
.metric.green strong { color: var(--green); }
.metric.amber strong { color: var(--amber); }
.count { display: inline-grid; place-items: center; min-width: 23px; margin-left: 4px; padding: 1px 6px; color: var(--violet); background: var(--violet-wash); font-size: 12px; border-radius: 7px; }
.section-head { flex-wrap: wrap; }
.legend { display: flex; flex-wrap: wrap; gap: 7px 15px; margin: 11px 0; }
.legend .free, .slot[data-state="free"] { background: var(--slot-green); }
.legend .cooldown, .slot[data-state="cooldown"] { background: var(--slot-amber); }
.legend .hold, .slot[data-state="hold"] { background: var(--slot-hold); }
.legend .booked, .slot[data-state="booked"] { background: var(--violet); }
.account-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { display: block; min-width: 0; padding: 15px; text-align: left; }
.tile:hover { box-shadow: var(--shadow); }
.tile-name { overflow-wrap: anywhere; font-size: 16px; font-weight: 720; letter-spacing: -.02em; }
.tile-store { font-size: 12px; color: var(--muted); font-weight: 460; }
.capacity { background: var(--green-wash); color: var(--green); white-space: nowrap; padding: 3px 8px; border-radius: 7px; }
.capacity[data-free="0"] { background: var(--amber-wash); color: var(--amber); }
.slot-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin: 17px 0 12px; }
.slot { height: 11px; border-radius: 4px; }
.tile-bottom { flex-wrap: wrap; align-items: start; font-weight: 470; }
.tile-bottom strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.dispatch-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(252px, 305px); grid-template-areas: "queue deliveries"; gap: 14px; align-items: start; }
.queue { grid-area: queue; }
.upcoming-deliveries { grid-area: deliveries; }
.panel { min-width: 0; }
.panel-head { padding: 13px 15px; flex-wrap: wrap; }
.queue-tools { padding: 0 15px 14px; }
.queue-tools > input { width: 100%; }
.queue-filters { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; align-items: end; }
label { font-size: 12px; color: var(--muted); }
.queue-filters label, .schedule-period label { display: grid; gap: 3px; min-width: 0; }
.queue-filters select, .queue-filters input, .schedule-period select { font-size: 13px; }
input[type="number"] { width: 80px; }
#account-filter:empty { display: none; }
#account-filter { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.text-button { min-height: 0; padding: 0; color: var(--violet); border: 0; background: transparent; border-radius: 3px; text-align: left; }
.queue-table { overflow-x: auto; border-top: 1px solid var(--line); border-radius: 0 0 13px 13px; }
table { border-collapse: collapse; width: 100%; min-width: 645px; font-size: 13px; }
caption { text-align: left; }
thead th { padding: 9px 11px; color: var(--muted); background: var(--quiet); text-align: left; font-weight: 590; white-space: nowrap; }
tbody td { padding: 10px 11px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody td:nth-child(n+4) { white-space: nowrap; }
.queue-group th { padding: 8px 11px; border-block: 1px solid var(--line); background: var(--quiet); text-align: left; }
.queue-group strong { font-size: 17px; font-weight: 750; }
.queue-group span { color: var(--muted); font-weight: 480; margin-left: 6px; }
.queue-table tr[data-tone="ready"] { background-color: color-mix(in srgb, var(--green-wash) 45%, var(--paper)); }
.queue-table tr[data-tone="waiting"] { background-color: color-mix(in srgb, var(--amber-wash) 45%, var(--paper)); }
#dispatch-summary { grid-template-columns: repeat(auto-fit, minmax(min(100%, 125px), 1fr)); }
.exclusion-form { display: grid; gap: 12px; }
.exclusion-form label { display: grid; gap: 4px; }
.exclusion-form textarea { font: inherit; font-size: 14px; padding: 8px 10px; resize: vertical; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.row-secondary { display: block; color: var(--muted); font-size: 11px; }
.queue-client, .queue-product { overflow-wrap: anywhere; }
.queue-deal { color: var(--violet); width: fit-content; }
.queue-action { width: 1%; text-align: right; }
.queue-actions { display: flex; flex-direction: column; align-items: end; gap: 4px; }
.queue-delivery-button { min-height: 32px; padding: 5px 8px; font-size: 12px; white-space: nowrap; }
.queue-delivery-button.accent { border-color: color-mix(in srgb, var(--violet) 22%, transparent); }
.queue-delivery-button.accent:enabled:hover { border-color: var(--violet); }
.queue-delivery-button:disabled { color: var(--muted); background: var(--quiet); border-color: transparent; }
.queue-manual { font-size: 11px; }
.queue-mobile-label { display: none; }
.badge { display: inline-block; padding: 3px 6px; border-radius: 6px; font-size: 11px; font-weight: 680; line-height: 1.2; }
.badge.ready, .badge.sent { color: var(--green); background: var(--green-wash); }
.badge.waiting, .badge.soon, .badge.client_wait, .badge.manual_check, .badge.partial { color: var(--amber); background: var(--amber-wash); }
.badge.unknown, .badge.priority { color: var(--violet); background: var(--violet-wash); }
.schedule-period { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; padding: 0 14px 12px; }
.schedule-period select { flex: 1 1 120px; }
.schedule-period select, .schedule-period input { min-height: 32px; padding: 4px 7px; }
.schedule-list { max-height: min(55vh, 430px); overflow-y: auto; border-radius: 0 0 13px 13px; }
.schedule-item { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 9px 14px; background: transparent; overflow-wrap: anywhere; }
.schedule-item:last-child { border-radius: 0 0 13px 13px; }
.schedule-item:hover { background: var(--violet-wash); }
.schedule-list .schedule-item:focus-visible { outline-offset: -3px; }
.schedule-times { text-align: right; white-space: nowrap; }
.schedule-countdown { color: var(--violet); }
.time { font-variant-numeric: tabular-nums; }
.empty { padding: 14px; color: var(--muted); }
.demo-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 14px; margin-top: 19px; font-size: 12px; }
.workspace-login { max-width: 510px; padding: 24px; }
.workspace-login p { margin: 8px 0; }
.workspace-login form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-top: 17px; }
.workspace-login label { flex: 1 1 215px; display: grid; gap: 5px; }
.signin-page { min-height: 100dvh; display: grid; place-items: center; }
.signin-page main { width: min(100%, 490px); }
.signin-page .workspace-login p:empty { display: none; }
.signin-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.signin-preferences { min-height:32px; padding-top:8px; text-align:right; font-size:12px; }
.access-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.access-form label { display: grid; gap: 4px; flex: 1 1 180px; }
.issued-access { margin-top: 8px; }
.issued-access input { min-width: 0; }
.workspace-status { margin-bottom: 15px; padding: 8px 11px; border-radius: 8px; color: var(--violet); background: var(--violet-wash); }
dialog { width: min(94vw, 540px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: #20183378; }
.modal-head { padding: 13px 17px; border-bottom: 1px solid var(--line); }
.icon-button { min-width: 38px; font-size: 19px; padding: 0 8px; }
#modal-body { padding: 14px 17px 17px; }
.modal-list { list-style: none; padding: 0; margin: 10px 0 14px; }
.modal-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 1px; border-bottom: 1px solid var(--line); }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 13px; }
.sheet-preview { display: flex; gap: 9px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.sheet-preview.done { background: var(--green-wash); color: var(--green); }
.sheet-preview input { min-height: 0; }
.sheet-preview > div { min-width: 0; display: grid; gap: 1px; }
.deal-link { display: block; overflow-wrap: anywhere; font-size: 12px; }
.chat-preview { background: var(--violet-wash); border-radius: 8px; padding: 9px 11px; margin-top: 8px; }
.request-tools { padding: 0 15px 13px; }
.request-tools input { flex: 1 1 210px; }
.request-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 10px 18px; border-top: 1px solid var(--line); padding: 14px 15px; }
.request-heading, .request-actions, .request-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 11px; }
.request-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.request-text { margin-top: 8px; }
.request-age { color: var(--muted); text-align: right; white-space: nowrap; }
.request-age.long { color: var(--amber); }
.request-age strong { font-size: 18px; display: block; color: inherit; }
.request-actions { grid-column: 1 / -1; }
.request-actions button { min-height: 32px; }
.request-actions .text-button { min-height: 0; }
.request-last { color: var(--muted); font-size: 13px; margin-top: 3px; }
.schedule-modal-list .schedule-item:first-child { border-top: 0; }
.main-nav { flex-wrap:wrap; }
.tool-row { display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; }
#tracker-dialog h3, .manage-panel h3 { margin:16px 0 8px; }
#tracker-dialog [role="status"]:not(:empty), .manage-panel [role="status"]:not(:empty) { padding:8px 0; color:var(--muted); }
.history-scroll { max-height:55vh; overflow:auto; }
.history-scroll li, .rank-list button { align-items:center; }
.history-scroll li>div { min-width:0; overflow-wrap:anywhere; }
.history-scroll li>button { flex-shrink:0; }
.account-tools, .manage-panel, .load-panel { padding:15px; }
.account-tools { background:var(--quiet); border:1px solid var(--line); border-radius:10px; }
.account-tools label,.manage-panel .toolbar label { display:grid; gap:4px; }
.account-tools .toolbar,.manage-panel .toolbar { flex-wrap:wrap; margin-block:9px; }
.compact-metrics { display:flex; flex-wrap:wrap; gap:7px; margin-block:12px; }
.compact-metrics .metric { flex:1; padding:9px 12px; }
.rank-list { display:grid; gap:3px; }
.rank-list button { display:flex; justify-content:space-between; gap:8px; text-align:left; }
.rank-list button span { font-size:12px; color:var(--muted); }
.load-panel { margin-bottom:12px; }
.load-panel summary { cursor:pointer; font-weight:700; }
.load-panel .toolbar { margin-block:10px; }
.load-grid { display:grid; gap:6px; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); }
.load-grid button { text-align:left; }
.management-nav { flex-wrap:wrap; margin-bottom:12px; }
.management-nav [aria-pressed="true"] { background:var(--violet-wash); color:var(--violet); }
.manage-panel { overflow-wrap:anywhere; }
.manage-table { max-width:100%; overflow:auto; margin:10px 0; }
.manage-table table { min-width:0; width:100%; }
.manage-table th,.manage-table td { white-space:normal; }
.stats-accounts { max-height:36vh; overflow:auto; }
.stats-accounts table { font-variant-numeric:tabular-nums; }
.stats-accounts th,.stats-accounts td { padding:7px; }
.stats-accounts thead th { position:sticky; top:0; background:var(--quiet); }
.stats-accounts :is(td,th):not(:first-child) { text-align:right; }
.epic-measurement,.friend-time-form,.missing-profit { margin-block:12px; }
.epic-measurement summary,.friend-time-form summary,.missing-profit summary { cursor:pointer; font-weight:650; }
.epic-measurement [data-epic-report] { white-space:pre-line; }
.friend-time-form form { justify-content:flex-start; padding-block:8px; }
.price-line { display:grid; grid-template-columns:minmax(90px,1.3fr) repeat(2,minmax(56px,1fr)) minmax(45px,auto); align-items:center; gap:5px; padding:5px 0; }
.price-head { color:var(--muted); font-size:12px; }
.price-line input { width:100%; }
@media(max-width:610px){.price-line{font-size:12px;}.price-line button{padding-inline:5px;}.compact-metrics .metric{min-width:85px;}}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 1080px) {
  .shell { padding-inline: 24px; }
  .account-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dispatch-grid { grid-template-columns: minmax(0, 1fr) 254px; }
}
@media (max-width: 960px) {
  .dispatch-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "deliveries" "queue"; }
  .schedule-list { max-height: 220px; }
}
@media (max-width: 700px) {
  .queue-table { overflow-x: visible; }
  .queue-table table { display: block; min-width: 0; }
  .queue-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .queue-table tbody, .queue-group { display: block; }
  .queue-group th { display: block; }
  .queue-table tr[data-row] {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 10px;
    grid-template-areas: "client state" "product product" "eta slot" "action action";
    padding: 10px 12px; border-top: 1px solid var(--line);
  }
  .queue-table td { display: block; padding: 0; border: 0; }
  .queue-client { grid-area: client; }
  .queue-state { grid-area: state; text-align: right; }
  .queue-product { grid-area: product; }
  .queue-eta { grid-area: eta; }
  .queue-slot { grid-area: slot; text-align: right; }
  .queue-action { grid-area: action; width: auto; margin-top: 3px; }
  .queue-actions { flex-flow: row wrap; align-items: center; justify-content: flex-end; gap: 6px 10px; }
  .queue-mobile-label { display: block; color: var(--muted); }
}
@media (max-width: 610px) {
  .shell { padding-inline: 15px; }
  .header-inner { padding-block: 10px; gap: 7px 13px; }
  .header-tools { margin-left: 0; }
  .main-nav a { padding: 8px 10px; }
  main { padding-top: 19px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 10px; }
  .tile-name { font-size: 14px; }
  .capacity { padding: 2px 5px; }
  .slot-strip { margin-block: 12px 8px; }
}
@media (max-width: 440px) {
  .tile-top { gap: 4px; }
  .queue-filters label { max-width: 100%; }
  .request-item { grid-template-columns: minmax(0, 1fr); }
  .request-age { display: flex; align-items: baseline; gap: 6px; text-align: left; }
  .request-age strong { font-size: 14px; }
}
