/* Dispatch: the timeline Gantt, its legend, segment popovers and the two-step gap fill. Board: Dispatch*.dc.html */
.pui-dispatch-card { overflow: hidden; padding: 0; gap: 0; }
.pui-dispatch-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.pui-dispatch-search { flex: 1 1 260px; max-width: 360px; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--input); border-radius: 8px; background: var(--card); color: var(--muted-foreground); box-sizing: border-box; }
.pui-dispatch-search input { border: 0; outline: 0; box-shadow: none; flex: 1; min-width: 0; height: 100%; padding: 0; background: transparent; font: 400 14px var(--font-sans); color: var(--foreground); }
.pui-dispatch-search:focus-within { outline: 2px solid var(--ring); }
.pui-dispatch-kbd { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; font: 500 11px var(--font-mono); color: var(--muted-foreground); background: var(--card); }
.pui-dispatch-zoom { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted-foreground); }
.pui-dispatch-zoom select, .pui-dispatch-zoom [role="combobox"], .pui-dispatch-zoom button { height: 32px; width: 96px; }

/* Needs you */
.pui-dispatch-needs-label { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); margin-right: 4px; }
.cn-button.pui-dispatch-chip, button.pui-dispatch-chip { height: 32px; padding: 0 12px; gap: 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--foreground); font: 500 13px var(--font-sans); }
.pui-dispatch-chip[aria-pressed="true"] { border-color: var(--primary); background: var(--tone-info-bg); color: var(--foreground); }
.pui-dispatch-chip .cn-badge { height: 20px; }

/* Board view table */
.pui-dispatch-boardcard.cn-card { padding: 0; gap: 0; overflow: hidden; }
.pui-dispatch-boardcard th { font-size: 12px; font-weight: 500; color: var(--muted-foreground); height: 38px; padding: 0 12px; white-space: nowrap; background: var(--card); }
.pui-dispatch-boardcard td { padding: 10px 12px; vertical-align: middle; }
.pui-dispatch-window { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.pui-dispatch-window-label { padding: 0 8px; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.pui-dispatch-zone { font-size: 12px; color: var(--muted-foreground); margin-left: auto; }
.pui-dispatch-scroll { overflow-x: auto; }
.pui-dispatch-grid { min-width: 1060px; }

.pui-dispatch-head { display: flex; background: var(--card); border-bottom: 1px solid var(--border); }
.pui-dispatch-corner { flex: 0 0 210px; box-sizing: border-box; padding: 0 14px; height: 38px; display: flex; align-items: center; font-size: 12px; color: var(--muted-foreground); border-right: 1px solid var(--border); }
.pui-dispatch-days { flex: 1; min-width: 0; display: grid; }
.pui-dispatch-day { box-sizing: border-box; padding: 0 8px; height: 38px; display: flex; align-items: center; font-size: 12px; color: var(--muted-foreground); border-left: 1px solid var(--border); white-space: nowrap; overflow: hidden; }
.pui-dispatch-day--today { color: var(--foreground); font-weight: 600; background: var(--tone-info-bg); }

.pui-dispatch-row { display: flex; border-bottom: 1px solid var(--border); min-height: 56px; }
.pui-dispatch-labelwrap { flex: 0 0 210px; display: flex; min-width: 0; }
.pui-dispatch-labelwrap > * { flex: 1; }
.pui-dispatch-label { flex: 1; box-sizing: border-box; padding: 8px 14px; display: flex; flex-direction: column; justify-content: center; gap: 1px; border-right: 1px solid var(--border); background: var(--card); min-width: 0; }
.pui-dispatch-label a { color: var(--primary); text-decoration: none; }
.pui-dispatch-label a.pui-dispatch-sub { color: var(--muted-foreground); font-size: 12px; font-weight: 400; }
.pui-dispatch-label a:hover { text-decoration: underline; }
.pui-dispatch-name { font-weight: 600; font-size: 14px; }
.pui-dispatch-sub { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pui-dispatch-flags { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 4px; }
.pui-dispatch-track { flex: 1; min-width: 0; position: relative; background: var(--card); }
.pui-dispatch-gridline { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--border); pointer-events: none; }
.pui-dispatch-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--brand-orange, oklch(0.72 0.18 50)); z-index: 10; pointer-events: none; }

/* A bar. The trigger fills its absolutely positioned hover-card wrapper. */
.pui-dispatch-bar { position: relative; box-sizing: border-box; display: flex; align-items: center; width: 100%; height: 100%; padding: 0 8px; border-radius: 6px; border: 1px solid transparent; font: 500 12px/1.2 var(--font-sans); overflow: hidden; white-space: nowrap; text-decoration: none; text-align: left; cursor: default; }
a.pui-dispatch-bar, button.pui-dispatch-bar { cursor: pointer; }
a.pui-dispatch-bar:hover { text-decoration: none; }
.pui-dispatch-bar-text { position: relative; z-index: 2; overflow: hidden; text-overflow: ellipsis; }
.pui-dispatch-layer { position: absolute; top: 0; bottom: 0; }
.pui-dispatch-bar--pre { background: var(--tone-info-bg); color: var(--tone-info-fg); border-color: oklch(0.85 0.05 250); }
.pui-dispatch-bar--tr { background: var(--tone-info-fg); color: #fff; }
.pui-dispatch-bar--un { background: var(--tone-success-fg); color: #fff; }
.pui-dispatch-bar--det { background: var(--destructive); color: #fff; }
.pui-dispatch-bar--done { background: var(--muted); color: var(--muted-foreground); border-color: var(--border); }
.pui-dispatch-bar--trip { background: var(--primary); color: var(--primary-foreground); }
.pui-dispatch-bar--gap { background: var(--card); color: var(--tone-warning-fg); border: 1.5px dashed oklch(0.7 0.12 70); }
.pui-dispatch-bar--gap:hover { background: var(--tone-warning-bg); }
.pui-dispatch-bar--past { background: var(--muted); color: var(--muted-foreground); border: 1px dashed var(--input); }
.pui-dispatch-bar--pm { background: repeating-linear-gradient(45deg, var(--tone-neutral-bg), var(--tone-neutral-bg) 6px, var(--card) 6px, var(--card) 12px); color: var(--tone-neutral-fg); border-color: var(--input); }
.pui-dispatch-bar--other { background: var(--muted); color: var(--foreground); }

/* Legend */
.pui-dispatch-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--border); }
.pui-dispatch-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted-foreground); }
.pui-dispatch-swatch { display: inline-block; width: 18px; height: 10px; border-radius: 3px; flex: none; box-sizing: border-box; }
.pui-dispatch-swatch--pre { background: var(--tone-info-bg); border: 1px solid oklch(0.85 0.05 250); }
.pui-dispatch-swatch--tr { background: var(--tone-info-fg); }
.pui-dispatch-swatch--un { background: var(--tone-success-fg); }
.pui-dispatch-swatch--det { background: var(--destructive); }
.pui-dispatch-swatch--gap { border: 1.5px dashed oklch(0.7 0.12 70); }
.pui-dispatch-swatch--past { background: var(--muted); border: 1px dashed var(--input); }
.pui-dispatch-swatch--pm { background: repeating-linear-gradient(45deg, var(--tone-neutral-bg), var(--tone-neutral-bg) 4px, var(--card) 4px, var(--card) 8px); border: 1px solid var(--input); }
.pui-dispatch-swatch--now { width: 2px; background: var(--brand-orange, oklch(0.72 0.18 50)); }

/* Segment popover: the hover card takes the board's 12/14 padding, 10px radius and per-kind width. */
.cn-hover-card-content:has(.pui-dispatch-pop) { width: max-content; max-width: min(320px, calc(100vw - 32px)); padding: 12px 14px; border-radius: 10px; }
.pui-dispatch-pop { display: flex; flex-direction: column; gap: 8px; font-size: 13px; width: 260px; max-width: 100%; }
.pui-dispatch-pop[data-testid="load-bar-hover"], .pui-dispatch-pop[data-testid="trip-bar-hover"] { width: 300px; }
.pui-dispatch-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pui-dispatch-pop-title { font-weight: 600; }
.pui-dispatch-pop-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; }
.pui-dispatch-pop-row > :first-child { color: var(--muted-foreground); white-space: nowrap; flex: none; }
.pui-dispatch-pop-split { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; border-top: 1px solid var(--border); }
.pui-dispatch-pop-note { font-size: 12px; color: var(--muted-foreground); }
.pui-dispatch-pop-time { font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }

/* Gap fill dialog: 460px, two steps, header / body / footer as the boards draw them. */
.pui-dispatch-dialog .cn-dialog,
.pui-dispatch-dialog.cn-dialog { width: min(460px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); overflow-y: auto; padding: 0; gap: 0; border-radius: 14px; }
.pui-dispatch-dialog .cn-dialog-header { padding: 20px 56px 0 24px; gap: 4px; }
.pui-dispatch-dialog .cn-dialog-title { font-size: 17px; line-height: 1.45; }
.pui-dispatch-dialog .cn-dialog-description { font-size: 13px; line-height: 1.45; }
.pui-dispatch-dialog .cn-dialog > .sc-vstack { padding: 16px 24px; }
.pui-dispatch-dialog .cn-dialog-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pui-dispatch-dialog .cn-dialog > [data-slot="dialog-close"] { top: 20px; right: 20px; }
.pui-dispatch-picks { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow: auto; }
.cn-button.pui-dispatch-pick { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 6px; height: auto; padding: 12px 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); text-align: left; white-space: normal; font-weight: 400; color: var(--foreground); }
.cn-button.pui-dispatch-pick:hover { background: var(--accent); border-color: var(--input); }
.pui-dispatch-pick > .sc-group { gap: 6px !important; }
.pui-dispatch-pick-top { display: flex; justify-content: space-between; gap: 8px; }
.pui-dispatch-route { display: block; font-weight: 500; }
.pui-dispatch-pick-summary { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--muted); }
.pui-dispatch-see-all { font-size: 13px; }
.pui-dispatch-field-group { flex: none; max-width: none; width: 100%; }
.pui-dispatch-cell { display: flex; align-items: center; gap: 8px; }

/* A button used as a bar must beat the button variants. */
.cn-button.pui-dispatch-bar { height: 100%; width: 100%; justify-content: flex-start; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; }
.cn-button.pui-dispatch-bar.pui-dispatch-bar--gap { background: var(--card); color: var(--tone-warning-fg); border: 1.5px dashed oklch(0.7 0.12 70); }
.cn-button.pui-dispatch-bar.pui-dispatch-bar--gap:hover { background: var(--tone-warning-bg); }

.pui-dispatch-dialog label, .pui-dispatch-dialog [data-slot="label"] { font-size: 13px; font-weight: 500; }
.pui-dispatch-cell .cn-avatar, .pui-dispatch-cell [data-slot="avatar"] { width: 28px; height: 28px; font-size: 11px; }

/* Shared shell fix: SharpCompose centres a layer with `translate: -50% -50%`, which makes the layer the containing block
   of any `position: fixed` child. The report-a-bug dialog is fixed to the viewport, so it collapsed to 2 x 2 px. */
.sc-layer-center:has(> .pui-bug) { translate: none; }

/* Month zoom: narrow columns show the day number centred. */
.pui-dispatch-day--compact { padding: 0 2px; justify-content: center; font-size: 11px; }
