/* Ledgerline product layout */
body { min-height: 100dvh; overflow-x: hidden; }
.muted { color: var(--ll-color-text-muted); }

/* Intro strip */
.intro { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; padding: 10px 24px; background: var(--ll-color-text); color: var(--ll-color-surface); font-size: var(--ll-type-sm-size); line-height: var(--ll-type-sm-line); }
.intro p { flex: 1 1 420px; }
.intro nav { display: flex; gap: 18px; }
.intro a { color: var(--ll-color-surface); font-weight: 500; display: inline-flex; align-items: center; min-height: 32px; }
@media (max-width: 600px) { .intro { padding: 10px 16px; } .intro nav a { min-height: 44px; } }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 24px; background: color-mix(in srgb, var(--ll-color-bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--ll-color-border); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ll-color-text); text-decoration: none; min-height: 44px; flex: none; }
.brand-mark { width: 28px; height: 28px; }
.bm-paper { fill: var(--ll-color-surface); stroke: var(--ll-color-border-strong); }
.bm-rule { stroke: var(--ll-color-accent); stroke-width: 1.6; }
.bm-margin { stroke: var(--ll-color-margin); stroke-width: 1.4; }
.brand-word { font-family: var(--ll-font-mono); font-weight: 500; letter-spacing: .12em; font-size: 14px; }
.live { display: flex; align-items: center; gap: 8px; padding-left: 14px; margin-left: 4px; border-left: 1px solid var(--ll-color-border); min-width: 0; }
.live-text { display: grid; line-height: 1.15; min-width: 0; }
#liveLabel { font-size: var(--ll-type-xs-size); font-weight: 600; }
.live-sub { font-size: var(--ll-type-xs-size); color: var(--ll-color-text-muted); white-space: nowrap; }
.live.is-stale #liveLabel { color: var(--ll-color-warn-fg); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; position: relative; }
.controls { display: flex; align-items: center; gap: 16px; }
.role-field { display: flex; align-items: center; gap: 8px; }
.role-field label { font-size: var(--ll-type-xs-size); color: var(--ll-color-text-muted); font-weight: 500; white-space: nowrap; }
.role-field .select { width: auto; min-width: 150px; min-height: 36px; }
.ctrl-group { display: flex; align-items: center; gap: 8px; }
.ctrl-label { font-size: var(--ll-type-xs-size); color: var(--ll-color-text-muted); font-weight: 500; }
.top-settings { display: none; }
@media (max-width: 1360px) {
  .top-settings { display: inline-flex; }
  .controls { display: none; position: absolute; top: calc(100% + 10px); right: 0; z-index: 35; width: min(340px, calc(100vw - 32px)); flex-direction: column; align-items: stretch; gap: 16px; padding: 18px; background: var(--ll-color-surface-raised); border: 1px solid var(--ll-color-border); border-radius: var(--ll-radius-lg); box-shadow: var(--ll-elevation-2); }
  .controls.is-open { display: flex; }
  .role-field { display: grid; }
  .role-field .select { width: 100%; min-height: 44px; }
  .ctrl-group { display: grid; gap: 6px; }
  .ctrl-group .seg { width: 100%; }
  .ctrl-group .seg button { flex: 1; justify-content: center; min-height: 40px; }
}
.lab { position: absolute; top: calc(100% + 10px); right: 0; z-index: 35; width: min(360px, calc(100vw - 32px)); background: var(--ll-color-surface-raised); border: 1px solid var(--ll-color-border); border-radius: var(--ll-radius-lg); box-shadow: var(--ll-elevation-2); overflow: hidden; }
.lab-head { padding: 16px 18px 10px; border-left: 4px double var(--ll-color-margin); }
.lab-head h2 { font-size: var(--ll-type-lg-size); font-weight: 600; }
.lab-head p { color: var(--ll-color-text-muted); font-size: var(--ll-type-sm-size); margin-top: 2px; }
.lab-list { padding: 4px 18px 8px; display: grid; }
.lab-list .switch + .switch { border-top: 1px solid var(--ll-color-rule); }
.lab-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px 16px; background: var(--ll-color-surface); border-top: 1px solid var(--ll-color-border); }
@media (max-width: 760px) {
  .topbar { padding: 8px 16px; gap: 8px; }
  .brand-word { display: none; }
  .live { padding-left: 10px; margin-left: 0; }
  .top-settings span, .lab-btn span { display: none; }
  .top-settings, .lab-btn { width: 44px; padding: 0; }
  .lab, .controls { position: fixed; top: auto; left: 12px; right: 12px; width: auto; }
  .lab { top: 70px; max-height: calc(100dvh - 90px); overflow: auto; }
  .controls { top: 70px; }
}
@media (max-width: 359px) { .live-sub { display: none; } }

/* Shell */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: calc(100dvh - 100px); }
.sidenav { position: sticky; top: 61px; align-self: start; height: calc(100dvh - 113px); min-height: 360px; display: flex; flex-direction: column; gap: 2px; padding: 20px 12px; border-right: 1px solid var(--ll-color-border); }
.sidenav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--ll-radius-md); color: var(--ll-color-text-muted); text-decoration: none; font-weight: 500; }
.sidenav a:hover { background: var(--ll-color-surface-sunken); color: var(--ll-color-text); }
.sidenav a[aria-current="page"] { background: var(--ll-color-surface); color: var(--ll-color-text); box-shadow: inset 3px 0 0 var(--ll-color-margin), var(--ll-elevation-1); }
.nav-count { margin-left: auto; font-size: var(--ll-type-xs-size); color: var(--ll-color-text-muted); font-variant-numeric: tabular-nums; }
.nav-count--alert { min-width: 24px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--ll-color-danger-bg); color: var(--ll-color-danger-fg); font-weight: 600; display: inline-grid; place-items: center; }
.nav-count--alert.is-zero { background: var(--ll-color-ok-bg); color: var(--ll-color-ok-fg); }
.sidenav-foot { margin-top: auto; padding: 12px; display: grid; gap: 4px; color: var(--ll-color-text-muted); font-size: var(--ll-type-xs-size); }
.sidenav-foot .overline { margin-bottom: 2px; }
.kbd-btn { justify-content: flex-start; margin: 10px -12px 0; color: var(--ll-color-text-muted); }
@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidenav { position: sticky; top: 61px; z-index: 20; height: auto; min-height: 0; flex-direction: row; padding: 6px 12px; border-right: 0; border-bottom: 1px solid var(--ll-color-border); background: var(--ll-color-bg); overflow-x: auto; }
  .sidenav a { flex: 1 0 auto; justify-content: center; }
  .sidenav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--ll-color-margin), var(--ll-elevation-1); }
  .nav-count { margin-left: 4px; }
  .sidenav-foot { display: none; }
}
@media (max-width: 760px) { .sidenav { top: 60px; padding: 6px 8px; gap: 4px; } .sidenav a { padding: 0 10px; gap: 8px; } }
@media (max-width: 400px) { .sidenav a .ic, #navShip { display: none; } .sidenav a { padding: 0 8px; } }

main { min-width: 0; padding: 24px 28px 0; outline: none; transition: padding-right var(--ll-motion-base) var(--ll-motion-ease); }
@media (min-width: 1280px) { body.panel-open main { padding-right: 488px; } }
@media (max-width: 760px) { main { padding: 16px 16px 0; } }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.view-head h1 { font-size: var(--ll-type-xl-size); line-height: var(--ll-type-xl-line); font-weight: 600; letter-spacing: -.01em; margin-top: 4px; text-wrap: balance; }
#view-overview .view-head h1 { font-size: clamp(22px, 2.4vw, 28px); line-height: 1.2; font-weight: 500; letter-spacing: -.02em; }
.view-head h1 .muted { font-weight: 400; }
.refresh-btn { flex: none; }
.refresh-btn.is-spinning .ic { animation: ll-spin .8s linear infinite; }
@media (max-width: 520px) { .refresh-btn { width: 44px; padding: 0; font-size: 0; gap: 0; } .refresh-btn .ic { width: 18px; height: 18px; } }

.banners { display: grid; gap: 10px; }
.banners:not(:empty) { margin-bottom: 18px; }

/* Cards */
.card { background: var(--ll-color-surface); border: 1px solid var(--ll-color-border); border-radius: var(--ll-radius-md); min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 6px; }
.card-head h2 { font-size: var(--ll-type-md-size); font-weight: 600; }
.card-sub { color: var(--ll-color-text-muted); font-size: var(--ll-type-xs-size); line-height: var(--ll-type-xs-line); margin-top: 2px; }
.card-head .btn { flex: none; margin: -6px -8px 0 0; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { position: relative; padding: 16px 18px 14px 26px; display: grid; gap: 4px; align-content: start; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 4px; border-left: 1px solid var(--ll-color-margin); border-right: 1px solid var(--ll-color-margin); opacity: .6; }
.kpi-label { display: flex; align-items: center; gap: 6px; }
.kpi-label .ic { color: var(--ll-color-text-muted); width: 16px; height: 16px; }
.kpi-fig { font-size: clamp(22px, 2.3vw, var(--ll-type-2xl-size)); line-height: var(--ll-type-2xl-line); font-weight: 500; letter-spacing: var(--ll-type-2xl-track); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-fig small { font-size: 15px; color: var(--ll-color-text-muted); font-weight: 400; letter-spacing: 0; }
.kpi-fig:has(.total) { padding-bottom: 6px; }
.kpi-sub { font-size: var(--ll-type-xs-size); line-height: var(--ll-type-xs-line); color: var(--ll-color-text-muted); }
.kpi-sub b { font-weight: 600; }
.kpi-sub .up { color: var(--ll-color-ok-fg); }
.kpi-sub .down { color: var(--ll-color-danger-fg); }
.kpi-spark { position: absolute; right: 14px; top: 16px; width: 76px; height: 28px; }
.kpi-spark path { fill: none; stroke: var(--ll-color-data-1); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kpi-spark circle { fill: var(--ll-color-data-1); stroke: var(--ll-color-surface); stroke-width: 2; }
.kpi-bar { display: flex; gap: 2px; height: 6px; margin-top: 6px; border-radius: 3px; overflow: hidden; }
.kpi-bar i { display: block; background: var(--ll-color-data-1); }
.kpi-bar i.off { background: var(--ll-color-surface-sunken); }
.kpi-bar i.d2 { background: var(--ll-color-data-2); }
.kpi-bar i.d3 { background: var(--ll-color-data-3); }
.kpi a, .kpi button.kpi-link { font-size: var(--ll-type-xs-size); font-weight: 500; }
.kpi .fig-short { display: none; }
@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .kpi { padding: 14px 12px 12px 22px; } .kpi::before { left: 8px; } .kpi-spark { display: none; } .kpi .fig-full { display: none; } .kpi .fig-short { display: inline; } }
@media (max-width: 359px) { .kpis { grid-template-columns: minmax(0, 1fr); } .kpi .fig-full { display: inline; } .kpi .fig-short { display: none; } }

/* Overview grid */
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 12px; margin-bottom: 28px; }
@media (max-width: 1180px) { .ov-grid { grid-template-columns: minmax(0, 1fr); } }
.chart { padding: 8px 18px 16px; position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--ll-color-text-subtle); font-size: 11px; font-family: var(--ll-font-sans); }
.chart .lbl-strong { fill: var(--ll-color-text); font-weight: 500; }
.chart .grid line { stroke: var(--ll-color-data-grid); stroke-width: 1; }
.chart .grid line.base { stroke: var(--ll-color-border-strong); }
.chart .bar-done { fill: var(--ll-color-data-1); }
.chart .bar-booked { fill: url(#hatch); stroke: var(--ll-color-data-1); stroke-width: 1.25; }
.chart .now-line { stroke: var(--ll-color-margin); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart .now-text { fill: var(--ll-color-margin); font-weight: 600; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:focus { outline: none; }
.chart .hit:focus-visible + .hit-ring, .chart .hit-ring.is-on { stroke: var(--ll-color-focus); stroke-width: 2; }
.chart .hit-ring { fill: none; stroke: transparent; pointer-events: none; }
.chart .seg-1 { fill: var(--ll-color-data-1); }
.chart .seg-2 { fill: var(--ll-color-data-2); }
.chart .seg-3 { fill: var(--ll-color-data-3); }
.chart .zone-row:hover .zone-name, .chart .zone-row.is-on .zone-name { fill: var(--ll-color-accent); text-decoration: underline; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0 18px; font-size: var(--ll-type-xs-size); color: var(--ll-color-text-muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--ll-color-data-1); }
.legend i.booked { background: repeating-linear-gradient(135deg, var(--ll-color-data-1) 0 1.5px, transparent 1.5px 4px); box-shadow: inset 0 0 0 1.25px var(--ll-color-data-1); }
.legend i.l2 { background: var(--ll-color-data-2); }
.legend i.l3 { background: var(--ll-color-data-3); }
.tip { position: absolute; z-index: 5; pointer-events: none; min-width: 150px; padding: 8px 10px; border-radius: var(--ll-radius-md); background: var(--ll-color-surface-raised); border: 1px solid var(--ll-color-border); box-shadow: var(--ll-elevation-2); font-size: var(--ll-type-xs-size); line-height: 1.45; color: var(--ll-color-text); transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }
.tip b { display: block; font-size: var(--ll-type-sm-size); margin-bottom: 2px; }
.tip .row { display: flex; justify-content: space-between; gap: 14px; }
.tip .row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--ll-color-text-muted); }
.tip i { width: 8px; height: 8px; border-radius: 2px; background: var(--ll-color-data-1); display: inline-block; }
.tip i.l2 { background: var(--ll-color-data-2); } .tip i.l3 { background: var(--ll-color-data-3); }
.data-table { margin: 4px 18px 16px; border: 1px solid var(--ll-color-border); border-radius: var(--ll-radius-md); overflow: auto; max-height: 320px; }
.data-table table { width: 100%; border-collapse: collapse; font-size: var(--ll-type-sm-size); }
.data-table th, .data-table td { padding: 6px 12px; border-bottom: 1px solid var(--ll-color-rule); text-align: left; white-space: nowrap; }
.data-table th { background: var(--ll-color-surface-sunken); font-weight: 500; font-size: var(--ll-type-xs-size); position: sticky; top: 0; }
.data-table .num { text-align: right; }

/* Needs you now */
.needs-list, .rider-list { padding: 4px 8px 10px; }
.needs-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px; border-bottom: 1px solid var(--ll-color-rule); }
.needs-item:last-child { border-bottom: 0; }
.needs-item .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.needs-item .m { color: var(--ll-color-text-muted); font-size: var(--ll-type-xs-size); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-ic { width: 32px; height: 32px; border-radius: var(--ll-radius-md); display: grid; place-items: center; color: var(--ll-color-surface); background: var(--ll-color-data-1); }
.type-ic.t-address { background: var(--ll-color-data-2); }
.type-ic.t-payment { background: var(--ll-color-data-3); }
.type-ic .ic { width: 16px; height: 16px; stroke-width: 2.2; }
.age { font-size: var(--ll-type-xs-size); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.age.is-breach { color: var(--ll-color-danger-fg); }
.age.is-near { color: var(--ll-color-warn-fg); }
.rider-item { display: grid; grid-template-columns: minmax(0, 1fr) 120px 44px; gap: 12px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--ll-color-rule); font-size: var(--ll-type-sm-size); }
.rider-item:last-child { border-bottom: 0; }
.rider-item .n { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rider-item .z { color: var(--ll-color-text-muted); font-size: var(--ll-type-xs-size); }
.load { height: 8px; border-radius: 4px; background: var(--ll-color-surface-sunken); overflow: hidden; display: flex; gap: 2px; }
.load i { background: var(--ll-color-data-1); display: block; border-radius: 0 4px 4px 0; }
.load i.over { background: var(--ll-color-danger-fg); }
.rider-item.is-unassigned { background: var(--ll-color-warn-bg); border-radius: var(--ll-radius-md); border: 0; margin-bottom: 4px; }
.rider-item.is-unassigned .n { color: var(--ll-color-warn-fg); }
.needs-empty { padding: 28px 12px; }
.rider-item a.num { display: inline-flex; align-items: center; justify-content: flex-end; min-height: 24px; }
@media (pointer: coarse) { .rider-item a.num { min-height: 44px; } }
.rider-item .n { display: flex; align-items: center; gap: 6px; }
.needs-side { display: grid; justify-items: end; gap: 4px; }
@media (max-width: 560px) {
  .needs-item { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .needs-item .t { white-space: normal; }
  .needs-side { grid-column: 2; grid-template-columns: 1fr auto; align-items: center; justify-items: start; margin-top: -4px; }
  .needs-side .btn { margin-right: -10px; }
}
.chart-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 14px 0 0; background: var(--ll-color-rule); border-top: 1px solid var(--ll-color-rule); }
.chart-stats div { background: var(--ll-color-surface); padding: 10px 0 0; }
.chart-stats dt { font-size: var(--ll-type-xs-size); color: var(--ll-color-text-muted); }
.chart-stats dd { font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
@media (max-width: 560px) { .chart-stats { grid-template-columns: 1fr 1fr; } .chart-stats div { padding: 8px 0; } }

/* Saved views and toolbar */
.views-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; min-width: 0; }
.saved { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; padding: 2px; mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); padding-right: 24px; }
.saved::-webkit-scrollbar { display: none; }
.saved button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: var(--ll-radius-md); border: 1px solid transparent; background: none; color: var(--ll-color-text-muted); font-weight: 500; white-space: nowrap; }
.saved button:hover { color: var(--ll-color-text); background: var(--ll-color-surface-sunken); }
.saved button[aria-pressed="true"] { background: var(--ll-color-surface); border-color: var(--ll-color-border); color: var(--ll-color-text); box-shadow: var(--ll-elevation-1); }
.saved .mine { font-style: normal; font-size: 10px; padding: 1px 5px; border-radius: 3px; background: var(--ll-color-accent-soft); color: var(--ll-color-accent); text-transform: uppercase; letter-spacing: .05em; }
.saved .del { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: -6px; border-radius: 4px; }
.saved .del:hover { background: var(--ll-color-danger-bg); color: var(--ll-color-danger-fg); }
.views-bar > .btn { flex: none; }
@media (pointer: coarse) { .saved button { min-height: 44px; } }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.search { flex: 1 1 320px; max-width: 420px; }
@media (min-width: 901px) { .toolbar .filters { display: contents; } .filter-selects { flex: 1 1 auto; } .chips { order: 3; flex-basis: 100%; } }
@media (pointer: coarse) { .search .kbd { display: none; } .search .input { padding-right: 12px; } }
.search .input { padding-right: 40px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; flex: 1 1 600px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-selects { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-selects .select { min-height: 36px; width: auto; max-width: 200px; }
.filters-btn { display: none; }
.filter-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--ll-color-accent); color: var(--ll-color-accent-fg); font-size: 11px; display: inline-grid; place-items: center; }
@media (max-width: 900px) {
  .search { max-width: none; flex: 1 1 200px; }
  .filters-btn { display: inline-flex; }
  .filters { display: none; flex-basis: 100%; padding: 14px; border: 1px solid var(--ll-color-border); background: var(--ll-color-surface); border-radius: var(--ll-radius-md); }
  .filters.is-open { display: flex; }
  .filter-selects { width: 100%; }
  .filter-selects .field { flex: 1 1 140px; }
  .filter-selects .select { max-width: none; width: 100%; min-height: 44px; }
}
.result-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; margin-bottom: 8px; color: var(--ll-color-text-muted); font-size: var(--ll-type-sm-size); flex-wrap: wrap; }
.result-tools { display: flex; gap: 6px; flex-wrap: wrap; }
#reorderBtn { color: var(--ll-color-accent); }

/* Bulk bar */
.bulk { position: sticky; bottom: 16px; z-index: 15; order: 9; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 10px 10px 18px; margin: 0 0 10px; background: var(--ll-color-text); color: var(--ll-color-surface); border-radius: var(--ll-radius-lg); box-shadow: var(--ll-elevation-3); }
.bulk p { font-weight: 600; margin-right: auto; }
.bulk-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bulk .btn { --b-bg: transparent; --b-fg: var(--ll-color-surface); --b-bd: color-mix(in srgb, var(--ll-color-surface) 35%, transparent); }
.bulk .btn:hover { --b-bg: color-mix(in srgb, var(--ll-color-surface) 12%, transparent); }
.bulk .btn--quiet { color: var(--ll-color-surface); --b-bd: transparent; }
.bulk .btn--primary { --b-bg: var(--ll-color-surface); --b-fg: var(--ll-color-text); --b-bd: var(--ll-color-surface); }
.bulk .btn--primary:hover { --b-bg: var(--ll-color-surface-sunken); }
.bulk .btn[aria-disabled="true"] { --b-bg: transparent; --b-fg: color-mix(in srgb, var(--ll-color-surface) 55%, transparent); --b-bd: color-mix(in srgb, var(--ll-color-surface) 20%, transparent); }
.bulk .btn[aria-disabled="true"] .ic:not(.ic-lock) { display: none; }
@media (max-width: 760px) { .bulk { padding: 10px; } .bulk p { width: 100%; padding-left: 6px; } .bulk-actions { width: 100%; } .bulk-actions .btn { flex: 1 1 auto; } }

/* Shipments list */
#view-shipments { container-type: inline-size; container-name: ship; display: flex; flex-direction: column; }
#view-shipments > .ship-list { order: 8; }
#view-shipments > .pager { order: 10; }
.ship-list .tbl-wrap { max-height: max(440px, calc(100dvh - 290px)); }
.tbl .c-id { width: 1%; }
.tbl .c-rec { max-width: 260px; min-width: 180px; }
.tbl .c-rec .cell-2 { max-width: 260px; }
.tbl .c-merch { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.tbl .c-rider .cell-2 { max-width: 170px; min-width: 132px; }
.tbl .unassigned { color: var(--ll-color-warn-fg); font-weight: 500; display: inline-flex; gap: 4px; align-items: center; }
.tbl tfoot .c-label { color: var(--ll-color-text-muted); font-weight: 500; font-size: var(--ll-type-xs-size); }
.tbl .queued { font-size: 11px; color: var(--ll-color-warn-fg); font-weight: 600; }
@container ship (max-width: 1480px) { .p4 { display: none; } }
@container ship (max-width: 1300px) { .p3 { display: none; } }
@container ship (max-width: 1060px) { .p2 { display: none; } }
@container ship (max-width: 880px) { .p1 { display: none; } }
@container ship (max-width: 740px) { .c-due { display: none; } .tbl .c-rec, .tbl .c-rec .cell-2 { max-width: 190px; min-width: 150px; } }
.cards { display: grid; gap: 8px; }
.scard { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); background: var(--ll-color-surface); border: 1px solid var(--ll-color-border); border-radius: var(--ll-radius-md); overflow: hidden; }
.scard::before { content: ''; position: absolute; left: 44px; top: 0; bottom: 0; width: 4px; border-left: 1px solid var(--ll-color-margin); border-right: 1px solid var(--ll-color-margin); opacity: .5; pointer-events: none; }
.scard.is-selected { background: var(--ll-color-surface-selected); }
.scard.is-flash { animation: ll-flash 1.6s var(--ll-motion-ease); }
.scard .check-hit { margin: 0; width: 44px; height: 56px; }
.scard-main { display: grid; gap: 4px; padding: 12px 14px 12px 16px; text-align: left; border: 0; background: none; min-width: 0; }
.scard-main:focus-visible { outline-offset: -3px; }
.scard-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.scard-id { font-family: var(--ll-font-mono); font-weight: 500; color: var(--ll-color-accent); font-size: 13px; }
.scard-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scard-meta { color: var(--ll-color-text-muted); font-size: var(--ll-type-xs-size); line-height: var(--ll-type-xs-line); }
.scard-cod { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.skel-row td { height: var(--ll-density-row); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 28px; flex-wrap: wrap; }
.pager-pages { display: flex; align-items: center; gap: 4px; }
.pager-pages .btn[aria-current="page"] { --b-bg: var(--ll-color-text); --b-fg: var(--ll-color-surface); --b-bd: var(--ll-color-text); }
.pager .size { display: flex; align-items: center; gap: 8px; color: var(--ll-color-text-muted); font-size: var(--ll-type-sm-size); }
.pager .size .select { width: auto; min-height: 36px; }
@media (max-width: 520px) { .pager { justify-content: center; } .pager .size { width: 100%; justify-content: center; } .pager-pages .pg-num { display: none; } }

/* Exceptions */
.exc-bar { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--ll-color-border); }
.exc-bar .tabs { border-bottom: 0; flex: 1; min-width: 0; }
.exc-zone { flex: none; padding-bottom: 6px; }
.exc-zone .select { min-height: 36px; width: auto; }
@media (max-width: 760px) { .exc-bar { flex-direction: column; align-items: stretch; gap: 0; } .exc-zone { padding: 8px 0; } .exc-zone .select { width: 100%; min-height: 44px; } }
.exc-list { display: grid; gap: 8px; padding-bottom: 28px; }
.exc { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 16px; background: var(--ll-color-surface); border: 1px solid var(--ll-color-border); border-radius: var(--ll-radius-md); position: relative; overflow: hidden; transition: opacity var(--ll-motion-slow) var(--ll-motion-ease-exit), transform var(--ll-motion-slow) var(--ll-motion-ease-exit); }
.exc.is-breach { border-color: color-mix(in srgb, var(--ll-color-danger-fg) 45%, var(--ll-color-border)); }
.exc.is-leaving { opacity: 0; transform: translateX(24px); }
.exc.is-queued { background: var(--ll-color-warn-bg); }
.exc-main { display: grid; gap: 4px; min-width: 0; }
.exc-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.exc-title h2 { font-size: var(--ll-type-md-size); font-weight: 600; }
.exc-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--ll-color-text-muted); font-size: var(--ll-type-xs-size); }
.exc-meta span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.exc-money { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--ll-type-sm-size); font-variant-numeric: tabular-nums; margin-top: 2px; }
.exc-money .diff { color: var(--ll-color-danger-fg); font-weight: 600; }
.exc-side { display: grid; gap: 8px; justify-items: end; }
.sla { width: 120px; height: 4px; border-radius: 2px; background: var(--ll-color-surface-sunken); overflow: hidden; }
.sla i { display: block; height: 100%; background: var(--ll-color-text-muted); }
.is-near .sla i, .sla.is-near i { background: var(--ll-color-warn-fg); }
.sla.is-breach i { background: var(--ll-color-danger-fg); }
.perm-note { font-size: var(--ll-type-xs-size); color: var(--ll-color-text-muted); display: inline-flex; gap: 4px; align-items: center; }
@media (max-width: 640px) { .exc { grid-template-columns: auto minmax(0, 1fr); gap: 12px; } .exc-side { grid-column: 1 / -1; grid-template-columns: auto minmax(40px, 1fr) auto; gap: 12px; align-items: center; justify-items: stretch; } .exc-side .sla { width: 100%; } }
@media (min-width: 1600px) { .exc-list { grid-template-columns: 1fr 1fr; } }

/* Panel content */
.panel-top { display: flex; align-items: center; gap: 10px; }
.panel-top .btn:last-child { margin-left: auto; margin-right: -10px; }
.panel h2 { font-size: var(--ll-type-xl-size); line-height: var(--ll-type-xl-line); font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.panel h2 .mono { font-size: .8em; color: var(--ll-color-text-muted); font-weight: 400; display: block; letter-spacing: 0; }
.panel-tags { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.psec { display: grid; gap: 10px; }
.psec > h3 { font-size: var(--ll-type-2xs-size); text-transform: uppercase; letter-spacing: .05em; color: var(--ll-color-text-muted); font-weight: 500; padding-bottom: 6px; border-bottom: 3px double var(--ll-color-border); }
.kv { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 8px 14px; font-size: var(--ll-type-sm-size); }
.kv dt { color: var(--ll-color-text-muted); }
.kv dd { overflow-wrap: anywhere; min-width: 0; }
.timeline { position: relative; display: grid; gap: 0; }
.tl { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 12px; padding-bottom: 16px; font-size: var(--ll-type-sm-size); }
.tl::before { content: ''; position: absolute; left: 9px; top: 16px; bottom: -2px; width: 2px; background: var(--ll-color-rule); }
.tl:last-child::before { display: none; }
.tl:last-child { padding-bottom: 0; }
.tl-dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--ll-color-surface-raised); border: 2px solid var(--ll-color-border-strong); position: relative; z-index: 1; }
.tl-dot .ic { width: 11px; height: 11px; stroke-width: 3; }
.tl.is-done .tl-dot { background: var(--ll-color-text); border-color: var(--ll-color-text); color: var(--ll-color-surface); }
.tl.is-bad .tl-dot { background: var(--ll-color-danger-fg); border-color: var(--ll-color-danger-fg); color: var(--ll-color-surface); }
.tl.is-next .tl-dot { border-style: dashed; }
.tl-text b { font-weight: 500; display: block; }
.tl-text span { color: var(--ll-color-text-muted); font-size: var(--ll-type-xs-size); }
.tl-time { font-variant-numeric: tabular-nums; color: var(--ll-color-text-muted); font-size: var(--ll-type-xs-size); }
.rider-card { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--ll-color-border); border-radius: var(--ll-radius-md); }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--ll-color-accent-soft); color: var(--ll-color-accent); font-weight: 600; font-size: 14px; }
.rider-card .n { font-weight: 600; }
.rider-card .m { color: var(--ll-color-text-muted); font-size: var(--ll-type-xs-size); }
.reassign { display: flex; gap: 8px; align-items: flex-end; }
.reassign .field { flex: 1; }
.pod { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pod-box { border: 1px solid var(--ll-color-border); border-radius: var(--ll-radius-md); padding: 10px; display: grid; gap: 6px; font-size: var(--ll-type-xs-size); color: var(--ll-color-text-muted); background: var(--ll-color-surface); }
.pod-box svg { width: 100%; height: 74px; }
.pod-sig path { fill: none; stroke: var(--ll-color-text); stroke-width: 1.8; stroke-linecap: round; }
.pod-sig line { stroke: var(--ll-color-rule); }
.pod-photo rect.bg { fill: var(--ll-color-surface-sunken); }
.pod-photo .door { fill: var(--ll-color-border); }
.pod-photo .parcel { fill: var(--ll-color-data-2); }
.pod-photo .pinm { fill: var(--ll-color-margin); }
.pod-none { padding: 14px; border: 1px dashed var(--ll-color-border-strong); border-radius: var(--ll-radius-md); color: var(--ll-color-text-muted); font-size: var(--ll-type-sm-size); }
.notes { display: grid; gap: 8px; }
.note { padding: 10px 12px; border-left: 3px solid var(--ll-color-rule); background: var(--ll-color-surface); font-size: var(--ll-type-sm-size); border-radius: 0 var(--ll-radius-sm) var(--ll-radius-sm) 0; }
.note small { display: block; color: var(--ll-color-text-muted); font-size: var(--ll-type-xs-size); margin-bottom: 2px; }
.note.is-new { border-left-color: var(--ll-color-accent); }
.note-form { display: grid; gap: 8px; }
.note-form .textarea { min-height: 64px; }
.note-form .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cod-line { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--ll-type-sm-size); padding: 4px 0; }
.cod-line.sum { font-weight: 600; border-top: 1px solid var(--ll-color-border); padding-top: 8px; margin-top: 4px; }
.panel-scrim { position: fixed; inset: 0; z-index: 39; background: rgba(12, 16, 22, .45); }
@media (max-width: 760px) { .panel { width: 100vw; border-left: 0; } .kv { grid-template-columns: 96px minmax(0, 1fr); } }

/* Modal content */
.opt-list { display: grid; gap: 8px; }
.opt { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 12px 14px; border: 1px solid var(--ll-color-border); border-radius: var(--ll-radius-md); cursor: pointer; align-items: start; }
.opt:has(input:checked) { border-color: var(--ll-color-accent); background: var(--ll-color-accent-soft); }
.opt:has(input:disabled) { cursor: not-allowed; color: var(--ll-color-text-subtle); background: var(--ll-color-surface-sunken); }
.opt .check { min-height: 0; margin-top: 1px; }
.opt b { font-weight: 600; display: block; }
.opt span.d { font-size: var(--ll-type-xs-size); color: var(--ll-color-text-muted); }
.opt .slot { margin-top: 8px; }
.err-summary { padding: 12px 14px; border-radius: var(--ll-radius-md); background: var(--ll-color-danger-bg); color: var(--ll-color-danger-fg); font-size: var(--ll-type-sm-size); }
.err-summary ul { margin-top: 4px; padding-left: 18px; list-style: disc; }
.err-summary a { color: inherit; }
.ctx { display: grid; gap: 4px; padding: 12px 14px; background: var(--ll-color-surface); border: 1px solid var(--ll-color-border); border-radius: var(--ll-radius-md); font-size: var(--ll-type-sm-size); }
.ctx .q { font-style: italic; color: var(--ll-color-text-muted); }
.money-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.money-grid div { padding: 10px 12px; border: 1px solid var(--ll-color-border); border-radius: var(--ll-radius-md); display: grid; gap: 2px; }
.money-grid span { font-size: var(--ll-type-xs-size); color: var(--ll-color-text-muted); }
.money-grid b { font-variant-numeric: tabular-nums; font-weight: 600; font-size: var(--ll-type-lg-size); }
.money-grid .bad b { color: var(--ll-color-danger-fg); }
@media (max-width: 420px) { .money-grid { grid-template-columns: 1fr 1fr; } .money-grid .bad { grid-column: 1 / -1; } }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; align-items: center; font-size: var(--ll-type-sm-size); }
.shortcuts dt { display: flex; gap: 4px; }

/* Footer */
.footer { margin: 40px 0 0; padding: 24px 0 32px; border-top: 3px double var(--ll-color-border-strong); display: grid; gap: 10px; font-size: var(--ll-type-sm-size); color: var(--ll-color-text-muted); }
.footer b { color: var(--ll-color-text); letter-spacing: .06em; font-family: var(--ll-font-mono); font-weight: 500; }
.footer nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.footer nav a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 500; }
.footer-small { font-size: var(--ll-type-xs-size); max-width: 80ch; }
.view[hidden] + .footer { margin-top: 0; }
.opt .d .ic, .field-hint > .ic, .perm-note .ic { display: inline-block; vertical-align: -2px; }
