.boot { min-height: 100dvh; display: grid; place-items: center; }

/* Shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100dvh; background: var(--ink); color: #fff; display: flex; flex-direction: column;
  padding: 20px 14px; gap: 18px; overflow-y: auto;
}
.side .brand { padding: 4px 8px 10px; display: flex; align-items: center; justify-content: space-between; }
.side .logo-mark { color: #fff; height: 32px; }
.side nav { display: grid; gap: 2px; }
.side nav .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: #8b8d95; padding: 14px 12px 6px; font-weight: 700; }
.side nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; text-decoration: none;
  color: #c9cad0; font-weight: 600; font-size: 14.5px; position: relative;
}
.side nav a svg { width: 19px; height: 19px; opacity: .85; }
.side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side nav a.on { background: rgba(255, 255, 255, .1); color: #fff; }
.side nav a.on::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--red); }
.side nav a .count { margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: 11.5px; padding: 1px 8px; font-weight: 750; }
.side .me { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .08); padding: 14px 8px 0; display: grid; gap: 10px; }
.side .me .who { font-weight: 700; }
.side .me .who small { display: block; color: #8b8d95; font-weight: 500; text-transform: capitalize; }
.side .me .row { display: flex; gap: 8px; }
.side .me .btn { background: rgba(255, 255, 255, .08); color: #fff; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #8b8d95; font-weight: 600; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #6b6f78; }
.live.on i { background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .18); }

.main { min-width: 0; padding: 26px 30px 60px; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; font-weight: 850; font-stretch: 92%; letter-spacing: -0.02em; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 6px; }
.card-h h2 { font-size: 16px; font-weight: 800; }
.card-b { padding: 10px 18px 18px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; display: grid; gap: 4px; text-decoration: none; position: relative; overflow: hidden; }
.kpi .k { font-size: 12.5px; color: var(--ink-3); font-weight: 650; }
.kpi .v { font-size: 34px; font-weight: 850; font-stretch: 88%; letter-spacing: -0.03em; line-height: 1.05; }
.kpi .s { font-size: 12.5px; color: var(--ink-2); }
.kpi.hot { background: var(--red); color: #fff; }
.kpi.hot .k, .kpi.hot .s { color: rgba(255, 255, 255, .82); }
.kpi.hot::after {
  content: ''; position: absolute; right: -20px; top: -10px; width: 120px; height: 140px; opacity: .14;
  background: repeating-linear-gradient(-18deg, #fff 0 6px, transparent 6px 16px);
}

.dash { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
.dash-col { display: grid; gap: 18px; }

/* Order rows */
.olist { display: grid; }
.orow {
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: center; padding: 12px 18px;
  border-top: 1px solid var(--line-2); cursor: pointer; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%;
}
.orow:hover { background: #fbfaf8; }
.orow .code { font-weight: 800; font-size: 13.5px; }
.orow .route { min-width: 0; }
.orow .route b { font-weight: 700; }
.orow .route .line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orow .route .sub { color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orow .end { text-align: right; display: grid; gap: 4px; justify-items: end; }
.orow .end .age { font-size: 12px; color: var(--ink-3); }
.age.warn { color: var(--st-pool) !important; font-weight: 700; }
.age.bad { color: var(--red) !important; font-weight: 700; }
.arrow { color: var(--ink-3); padding: 0 4px; }

/* Table */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tbody tr { cursor: pointer; }
table.t tbody tr:hover td { background: #fbfaf8; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t .sub { color: var(--ink-3); font-size: 12.5px; }

/* Filters */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: none; padding: 8px 12px; border-radius: 999px; font-weight: 650; font-size: 13.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.tabs button.on { background: var(--ink); color: #fff; }
.tabs button .n { opacity: .6; margin-left: 4px; font-weight: 600; }
.search { position: relative; flex: 1; min-width: 200px; }
.search input { padding-left: 38px; min-height: 40px; border-radius: 999px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; color: var(--ink-3); }

/* People cards */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.person { padding: 16px; display: grid; gap: 12px; cursor: pointer; }
.person.off { opacity: .55; }
.person .top { display: flex; gap: 12px; align-items: center; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; flex: none; position: relative;
}
.avatar.duty::after { content: ''; position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; background: #22c55e; border: 2.5px solid #fff; }
.person .name { font-weight: 750; font-size: 16px; }
.person .meta { color: var(--ink-3); font-size: 13px; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats3 div { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.stats3 b { display: block; font-size: 18px; font-weight: 800; font-stretch: 90%; }
.stats3 small { color: var(--ink-3); font-size: 11.5px; font-weight: 600; }

/* Order detail */
.od-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.od-head h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.legs { display: grid; gap: 0; border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; }
.leg { padding: 14px 16px 14px 44px; position: relative; display: grid; gap: 2px; }
.leg + .leg { border-top: 1.5px dashed var(--line); }
.leg::before { content: ''; position: absolute; left: 17px; top: 18px; width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--ink); background: #fff; }
.leg.drop::before { background: var(--red); border-color: var(--red); }
.leg .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 750; color: var(--ink-3); }
.leg .who { font-weight: 750; }
.leg a { color: var(--ink); font-weight: 650; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kv div { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.kv small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 650; }
.kv b { font-size: 16px; }
.timeline { display: grid; gap: 0; }
.tl { display: grid; grid-template-columns: 70px 1fr; gap: 10px; padding: 7px 0; font-size: 14px; }
.tl time { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.tl b { font-weight: 700; }
.proof { width: 100%; max-height: 280px; object-fit: cover; border-radius: 12px; }
.assign-row { display: flex; gap: 8px; }
.assign-row select { flex: 1; }
.od-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.note-box { background: var(--st-pool-bg); color: #6b4300; border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.note-box.fail { background: var(--st-failed-bg); color: #7a2906; }

/* Order form */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.fs { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; }
.fs legend { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; color: var(--red); padding: 0; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.fs legend::after { content: ''; flex: 1; height: 1.5px; background: var(--line-2); }
.dlg-scroll { grid-auto-rows: max-content; max-height: calc(100dvh - 180px); overflow-y: auto; padding-right: 4px; margin-right: -4px; }

/* Week chart */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 150px; padding-top: 10px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bar i { display: block; width: 70%; max-width: 34px; border-radius: 6px 6px 3px 3px; background: var(--ink); min-height: 3px; }
.bar.today i { background: var(--red); }
.bar span { font-size: 11.5px; color: var(--ink-3); font-weight: 650; }
.bar em { font-style: normal; font-size: 12px; font-weight: 750; }

.cash-group { padding: 0; overflow: hidden; }
.cash-group .gh { display: flex; align-items: center; gap: 12px; padding: 16px 18px; }
.cash-group .gh .tot { margin-left: auto; text-align: right; }
.cash-group .gh .tot b { font-size: 22px; font-weight: 850; font-stretch: 90%; }

.fab { display: none; }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .25s; }
  .shell.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; background: var(--ink); color: #fff;
    padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
  }
  .topbar .logo-mark { color: #fff; height: 26px; }
  .topbar .btn { background: rgba(255, 255, 255, .1); color: #fff; }
  .topbar .live { margin-left: auto; }
  .main { padding: 18px 14px 100px; }
  .page-head h1 { font-size: 25px; }
  .page-head .actions .hide-m { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .v { font-size: 28px; }
  .kpi.hot { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr 1fr; }
  .fab {
    display: inline-flex; position: fixed; right: 16px; bottom: calc(18px + var(--safe-b)); z-index: 40;
    min-height: 56px; padding: 0 22px; font-size: 16px; box-shadow: 0 12px 30px -8px rgba(229, 17, 43, .7);
  }
  table.t.cards thead { display: none; }
  table.t.cards, table.t.cards tbody, table.t.cards tr, table.t.cards td { display: block; }
  table.t.cards tr { padding: 12px 14px; border-bottom: 1px solid var(--line-2); display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
  table.t.cards td { padding: 0; border: 0; }
  table.t.cards td[data-hide-m] { display: none; }
  table.t.cards td.num { text-align: right; }
}
.orow .end .age { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .orow { padding: 12px 14px; gap: 4px 10px; } .orow .end .age { max-width: 96px; } }
@media (max-width: 560px) { .dlg-scroll { max-height: calc(92dvh - 170px - var(--safe-b)); } }
.side { overflow-x: hidden; }
.side .me .row .btn { flex: 1; padding: 0 8px; }
.side .me .row .btn svg { width: 15px; height: 15px; }

/* ---- Delivery zones ---------------------------------------------------------- */
.ztag {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px; padding: 2px 7px; border-radius: 6px;
  font: 800 12px/1.4 ui-monospace, 'JetBrains Mono', Consolas, monospace; letter-spacing: .02em; vertical-align: middle; white-space: nowrap;
}
.ztag.sm { min-width: 0; font-size: 10.5px; padding: 1px 5px; }
.ztag.none { background: var(--line-2); color: var(--ink-3); }
.zstrip { display: flex; gap: 6px; padding: 4px 18px 14px; overflow-x: auto; scrollbar-width: thin; }
.zs {
  flex: none; display: grid; justify-items: center; gap: 0; min-width: 52px; padding: 7px 8px 6px; border-radius: 12px; text-decoration: none;
  background: color-mix(in srgb, var(--h) 14%, #fff); box-shadow: inset 0 -3px 0 var(--h);
}
.zs b { font: 900 12px/1.2 ui-monospace, Consolas, monospace; }
.zs span { font-size: 18px; font-weight: 850; color: var(--ink); }
.zs.quiet { opacity: .42; }
.lane { border-top: 1px solid var(--line-2); }
.lane-h {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 9px; padding: 10px 18px; font-size: 14px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--zc) 12%, #fff), #fff 70%);
}
.lane-h .muted { margin-left: auto; font-size: 12.5px; }
.lane-rows { position: relative; }
.lane-rows::before { content: ''; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 3px; border-radius: 3px; background: var(--zc); }
.lane-rows .orow { border-top-color: transparent; }
.leg.drop::before { background: var(--zc, var(--red)); border-color: var(--zc, var(--red)); }
.leg .lbl .ztag { margin-right: 4px; }

.zpick { display: grid; gap: 10px; }
.zpick-g small { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); margin-bottom: 5px; }
.zpick-g > div { display: flex; flex-wrap: wrap; gap: 6px; }
.zopt { position: relative; cursor: pointer; }
.zopt input { position: absolute; opacity: 0; pointer-events: none; }
.zopt span {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px 7px 7px; border-radius: 10px; border: 1.5px solid var(--line);
  font-size: 13.5px; font-weight: 650; background: #fff; transition: .12s;
}
.zopt span b { background: var(--bg); color: var(--fg); padding: 1px 6px; border-radius: 6px; font: 800 11.5px/1.4 ui-monospace, Consolas, monospace; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.zopt input:checked + span { border-color: var(--ink); background: var(--ink); color: #fff; }
.zopt input:focus-visible + span { outline: 2px solid var(--red); }
.ztable td { vertical-align: middle; }
.ztable tr.off td { opacity: .5; }
.ztable tbody tr { cursor: default; }
.ztable tbody tr:hover td { background: none; }
.swatch { width: 44px; height: 38px; border: 1.5px solid var(--line); border-radius: 10px; padding: 2px; background: #fff; cursor: pointer; }
.dash > *, .dash-col > * { min-width: 0; }

/* ---- Job types, origin, approvals, clients ---------------------------------- */
.kpis { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
.kpi.pendk { background: #a21caf; color: #fff; }
.kpi.pendk .k, .kpi.pendk .s { color: rgba(255, 255, 255, .85); }
.side nav a .count.pend { background: #a21caf; margin-left: auto; }
.side nav a .count.pend + .count { margin-left: 6px; }
.tabs .count.pend { background: #a21caf; color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; margin-left: 4px; }
.tabs button.tab-pend:not(.on) { color: #a21caf; }
.tabs button svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.orow .sub .jt, .orow .sub .src { font-size: 10.5px; padding: 1px 6px; }
.orow .sub .jt svg { width: 11px; height: 11px; }
td .sub .jt, td .sub .src { font-size: 10.5px; padding: 1px 6px; }
td .sub .jt svg { width: 11px; height: 11px; }
.pend-row { border-bottom: 1px solid var(--line-2); }
.pend-row .orow { border-bottom: 0; }
.pend-act { display: flex; align-items: center; gap: 8px; padding: 0 16px 12px; flex-wrap: wrap; font-size: 13px; }
.pend-act > span { margin-right: auto; }
.pend-mini { display: flex; gap: 6px; margin-top: 6px; }
.note-box.pend { background: #fae8ff; color: #701a75; }
.origin { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); }
.origin .jt { flex: none; }
.origin.jtype-b2c { background: #f4f8ff; border-color: #d6e3fb; }
.origin.jtype-post { background: #fffaf0; border-color: #f3dcae; }
.origin.jtype-c2c { background: #f1fbf6; border-color: #c9ecd9; }
.refchip { display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; padding: 4px 10px; border-radius: 8px; background: #fff6e3; border: 1.5px dashed #e7b45a; color: #9a4a07; font-size: 12.5px; width: fit-content; }
.refchip b { color: #5c2d04; }
.jtpick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.jtc { position: relative; cursor: pointer; }
.jtc input { position: absolute; opacity: 0; inset: 0; }
.jtc > span { display: grid; gap: 4px; height: 100%; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; transition: border-color .15s, background .15s; }
.jtc i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.jtc i svg { width: 20px; height: 20px; }
.jtc b { font-size: 14.5px; line-height: 1.2; }
.jtc small { color: var(--ink-3); font-size: 12px; line-height: 1.35; }
.jtc-b2c i { background: #e6efff; color: #1d4fb8; }
.jtc-post i { background: #fff1d6; color: #9a4a07; }
.jtc-c2c i { background: #dcf5e9; color: #0a7a51; }
.jtc-b2c.on > span { border-color: #1d4fb8; background: #f4f8ff; }
.jtc-post.on > span { border-color: #c06a10; background: #fffaf0; }
.jtc-c2c.on > span { border-color: #0a7a51; background: #f1fbf6; }
.jtc input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (max-width: 640px) {
  .jtpick { grid-template-columns: 1fr; }
  .jtc > span { grid-template-columns: auto 1fr; column-gap: 12px; }
  .jtc i { grid-row: span 2; width: 30px; height: 30px; }
  .jtc > span { padding: 9px 12px; align-items: center; }
  .jtc:not(.on) small { display: none; }
  .jtc:not(.on) i { grid-row: auto; }
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chipbtn { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 650; cursor: pointer; }
.chipbtn.on { background: #9a4a07; border-color: #9a4a07; color: #fff; }
.portal-box { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 12px; background: #f4f8ff; border: 1.5px solid #d6e3fb; }
tr.off { opacity: .55; }
.main-wrap { min-width: 0; }
.filters > .tabs { min-width: 0; max-width: 100%; }
.filters > .search { min-width: 0; }
