/* Redesigned Dispatch board screen (redesign track S1). Scope every rule under .screen[data-screen="<page id>"] and use --rt-* tokens only. */
/* "#app" in front so the older board rules in style.css (steel heading, compact cards) do not win. */
#app .screen[data-screen="dispatch"] .dsp-small{font-size:var(--rt-text-sm,13px)}
#app .screen[data-screen="dispatch"] .standing-palette{margin:0 0 14px}
/* Count tiles and the status legend: both light up their loads and fade the rest. */
#app .screen[data-screen="dispatch"] .ui-tiles{margin:0 0 12px}
#app .screen[data-screen="dispatch"] .ui-tile:focus-visible,#app .screen[data-screen="dispatch"] .ui-chips button:focus-visible{outline:3px solid var(--rt-focus);outline-offset:2px}
#app .screen[data-screen="dispatch"] .dsp-legend{display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin:0 0 10px}
#app .screen[data-screen="dispatch"] .dsp-legend .ui-chips{align-items:center}
#app .screen[data-screen="dispatch"] .dsp-dot{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:5px;vertical-align:-1px;background:var(--st-plan);border:1px solid var(--rt-panel)}
#app .screen[data-screen="dispatch"] .dsp-dot.st-accepted{background:var(--st-accepted)}#app .screen[data-screen="dispatch"] .dsp-dot.st-progress{background:var(--st-progress)}#app .screen[data-screen="dispatch"] .dsp-dot.st-done{background:var(--st-done)}#app .screen[data-screen="dispatch"] .dsp-dot.st-stop{background:var(--st-stop)}

#app .screen[data-screen="dispatch"] .dsp-select[aria-pressed=true]{box-shadow:inset 0 0 0 2px var(--rt-brand)}
#app .screen[data-screen="dispatch"] .selection-actions{margin:0 0 10px}
/* The board. */
#app .screen[data-screen="dispatch"] .dsp-board-wrap{border:1px solid var(--rt-line);border-radius:var(--rt-r);background:var(--rt-panel);max-height:72vh;overflow:auto}
#app .screen[data-screen="dispatch"] .dsp-board-wrap:focus-visible{outline:3px solid var(--rt-focus);outline-offset:2px}
#app .screen[data-screen="dispatch"] .dsp-board{border-collapse:separate;border-spacing:0;width:100%;min-width:960px;table-layout:fixed}
#app .screen[data-screen="dispatch"] .dsp-board col.dsp-col-truck{width:160px}
#app .screen[data-screen="dispatch"] .dsp-board thead th{position:sticky;top:0;z-index:2;background:var(--rt-paper);color:var(--rt-muted);border:0;border-bottom:1px solid var(--rt-line);padding:8px;line-height:1.3;text-align:left;font-size:calc(var(--v2-size,16px)*.8125);font-weight:600;box-shadow:none}
#app .screen[data-screen="dispatch"] .dsp-board thead th b{display:block;color:var(--rt-ink);font-size:calc(var(--v2-size,16px)*.875);white-space:nowrap}
/* The date and the count are two lines (a hidden ", " keeps them apart when read aloud or copied). */
#app .screen[data-screen="dispatch"] .dsp-board thead th .dsp-day-count{display:block;white-space:nowrap}
#app .screen[data-screen="dispatch"] .dsp-board thead th.day-today{background:var(--rt-brand-tint);box-shadow:inset 0 -3px var(--rt-brand)}
#app .screen[data-screen="dispatch"] .dsp-board thead th.day-today::after{content:none}
#app .screen[data-screen="dispatch"] .dsp-board thead th.day-today .dsp-day-count{color:var(--rt-brand-ink);font-weight:650}
#app .screen[data-screen="dispatch"] .dsp-board th:first-child,#app .screen[data-screen="dispatch"] .dsp-board td:first-child{position:sticky;left:0;z-index:1;background:var(--rt-panel);border-right:1px solid var(--rt-line)}
#app .screen[data-screen="dispatch"] .dsp-board thead th:first-child{z-index:3;background:var(--rt-paper)}
#app .screen[data-screen="dispatch"] .dsp-board td{border:0;border-bottom:1px solid var(--rt-line-soft);border-right:1px solid var(--rt-line-soft);vertical-align:top;padding:4px;height:72px;background:transparent}
#app .screen[data-screen="dispatch"] .dsp-board td.day-today{background:color-mix(in srgb,var(--rt-brand-tint) 45%,transparent)}
#app .screen[data-screen="dispatch"] .dsp-board td.dsp-wkend{background:var(--rt-paper)}
#app .screen[data-screen="dispatch"] .dsp-board tbody tr:hover>td{background-color:transparent}
#app .screen[data-screen="dispatch"] .dsp-board tbody tr:hover>td:first-child{box-shadow:none}
#app .screen[data-screen="dispatch"] .dsp-board td.drop-over{outline:2px dashed var(--rt-brand);outline-offset:-3px;background:var(--rt-brand-tint)}
#app .screen[data-screen="dispatch"] .dsp-board td:first-child{padding:8px 10px}
#app .screen[data-screen="dispatch"] .dsp-board td:first-child .unit{display:block;font-size:calc(var(--v2-size,16px)*1.25);font-weight:700!important;letter-spacing:-.02em;line-height:1.1;color:var(--rt-ink)}
#app .screen[data-screen="dispatch"] .dsp-unit-sub{display:block;margin:0;font-size:calc(var(--v2-size,16px)*.78125);color:var(--rt-muted)}
#app .screen[data-screen="dispatch"] .dsp-defects{display:inline-flex;align-items:center;gap:4px;margin-top:6px;padding:2px 9px;min-height:0;border:1px solid var(--rt-warn-edge);border-radius:999px;background:var(--rt-warn-bg);color:var(--rt-warn);font-size:calc(var(--v2-size,16px)*.78125);font-weight:600}
/* Out of service: a red bar across the top of the row, the reason in the truck cell, booked loads in red. */
#app .screen[data-screen="dispatch"] .dsp-board tr.dsp-oos>td{box-shadow:inset 0 4px 0 var(--rt-stop)}
#app .screen[data-screen="dispatch"] .dsp-board tr.dsp-oos>td:first-child{box-shadow:inset 0 4px 0 var(--rt-stop),inset 4px 0 0 var(--rt-stop);background:var(--rt-stop-bg)}
#app .screen[data-screen="dispatch"] .dsp-oos-note{display:flex;gap:5px;align-items:flex-start;margin:6px 0 0;color:var(--rt-stop);font-size:calc(var(--v2-size,16px)*.78125);font-weight:650;line-height:1.3}
#app .screen[data-screen="dispatch"] .dsp-oos-note .ui-icon,#app .screen[data-screen="dispatch"] .dsp-flag .ui-icon,#app .screen[data-screen="dispatch"] .dsp-defects .ui-icon{flex:none;width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2}
#app .screen[data-screen="dispatch"] .dsp-oos-cell{display:block;padding:4px;color:var(--rt-stop);font-size:calc(var(--v2-size,16px)*.78125);font-weight:600}
#app .screen[data-screen="dispatch"] .dsp-dim-row>td:not(:first-child){opacity:.35}
/* Loads: the left edge colour is the status (the --st-* tones from style.css). */
/* Every day column gets the same share of the width (the table is table-layout:fixed); a card and "+ Add load" stop at
   18 reading-size units so a wide column does not stretch a card into a long bar with short text. */
#app .screen[data-screen="dispatch"] .dsp-board .dsp-load,#app .screen[data-screen="dispatch"] .dsp-board .dsp-add{max-width:calc(var(--v2-size,16px)*18)}
#app .screen[data-screen="dispatch"] .dsp-load{margin:0 0 4px;transition:opacity .15s}
#app .screen[data-screen="dispatch"] .dsp-load>.dsp-card{display:block;width:100%;margin:0;padding:4px 8px;text-align:left;font-size:calc(var(--v2-size,16px)*.78125);line-height:1.25;background:var(--rt-panel);color:var(--rt-ink);border:1px solid var(--rt-line);border-left:4px solid var(--st);border-radius:6px;box-shadow:none;cursor:pointer}
#app .screen[data-screen="dispatch"] .dsp-load>.dsp-card:hover{border-color:var(--rt-brand);border-left-color:var(--st)}
#app .screen[data-screen="dispatch"] .dsp-load>.dsp-card:focus-visible{outline:3px solid var(--rt-focus);outline-offset:1px}
#app .screen[data-screen="dispatch"] .dsp-load.st-progress>.dsp-card{background:var(--rt-warn-bg)}
#app .screen[data-screen="dispatch"] .dsp-load.st-done>.dsp-card{background:var(--rt-ok-bg)}
#app .screen[data-screen="dispatch"] .dsp-load.st-stop>.dsp-card{background:var(--rt-stop-bg);border-color:var(--rt-stop-edge);border-left-color:var(--rt-stop)}
#app .screen[data-screen="dispatch"] .dsp-load.dsp-dim{opacity:.25}
#app .screen[data-screen="dispatch"] .dsp-load.dsp-dim:focus-within{opacity:.7}
#app .screen[data-screen="dispatch"] .dsp-route{display:block;font-size:calc(var(--v2-size,16px)*.84375);font-weight:650;color:var(--rt-ink);overflow-wrap:anywhere}
#app .screen[data-screen="dispatch"] .dsp-route span{color:inherit}
#app .screen[data-screen="dispatch"] .dsp-who,#app .screen[data-screen="dispatch"] .dsp-meta,#app .screen[data-screen="dispatch"] .dsp-time{display:block;color:var(--rt-muted);overflow-wrap:anywhere}
#app .screen[data-screen="dispatch"] .dsp-time{font-variant-numeric:tabular-nums}
#app .screen[data-screen="dispatch"] .dsp-swap{color:var(--rt-ink);font-weight:600}
#app .screen[data-screen="dispatch"] .dsp-flag{display:flex;gap:4px;align-items:center;margin-top:2px;color:var(--rt-warn);font-weight:600}
#app .screen[data-screen="dispatch"] .dsp-flag.dsp-stop{color:var(--rt-stop)}
#app .screen[data-screen="dispatch"] .dsp-load.checkable>.dsp-card{padding-right:34px}
#app .screen[data-screen="dispatch"] .dsp-load.selectable>.dsp-card{padding-left:30px}
#app .screen[data-screen="dispatch"] .dsp-load.has-action>.dsp-card{padding-bottom:36px}
#app .screen[data-screen="dispatch"] .card-check{top:5px;right:5px;width:26px;height:26px;display:grid;place-items:center}
#app .screen[data-screen="dispatch"] .card-check .ui-icon{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2.5}
/* "+ Add load" stays quiet until the cell is hovered or the button has the keyboard (it stays in the tab order). */
#app .screen[data-screen="dispatch"] .dsp-add{display:flex;align-items:center;justify-content:center;gap:4px;width:100%;min-height:30px;padding:5px;border:1px dashed var(--rt-line);border-radius:6px;background:none;color:var(--rt-muted);font-size:calc(var(--v2-size,16px)*.78125);opacity:0}
#app .screen[data-screen="dispatch"] .dsp-board td:hover .dsp-add,#app .screen[data-screen="dispatch"] .dsp-add:focus,#app .screen[data-screen="dispatch"] .dsp-add:focus-visible{opacity:1}
/* Touch screens cannot hover: there the button always shows, at touch size. */
@media (hover:none){#app .screen[data-screen="dispatch"] .dsp-add{opacity:1;min-height:var(--rt-touch,44px)}}
#app .screen[data-screen="dispatch"] .dsp-add:hover{border-color:var(--rt-brand);color:var(--rt-brand-ink)}
#app .screen[data-screen="dispatch"] .dsp-add:focus-visible{outline:3px solid var(--rt-focus);outline-offset:1px}
#app .screen[data-screen="dispatch"] .dsp-add .ui-icon,#app .screen[data-screen="dispatch"] .dsp-add-phone .ui-icon{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2}
/* Unassigned & unscheduled. */
#app .screen[data-screen="dispatch"] .dsp-unassigned{margin-top:22px}
#app .screen[data-screen="dispatch"] .dsp-unassigned .unassigned{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:8px;min-height:64px;padding:10px;border:1px dashed var(--rt-line);border-radius:var(--rt-r);background:var(--rt-paper)}
#app .screen[data-screen="dispatch"] .dsp-unassigned .unassigned.drop-over{border-color:var(--rt-brand);background:var(--rt-brand-tint)}
/* Phones and tablets up to 1000px: one day at a time. */
#app .screen[data-screen="dispatch"] .dsp-day-truck.dsp-oos{border-top:4px solid var(--rt-stop)}
#app .screen[data-screen="dispatch"] .dsp-add-phone{display:flex;align-items:center;justify-content:center;gap:4px;width:100%;min-height:var(--rt-touch-phone,48px);margin-top:6px;border:1px dashed var(--rt-line);background:none;color:var(--rt-muted)}
@media (max-width:700px){#app .screen[data-screen="dispatch"] .ui-tiles{grid-template-columns:repeat(2,minmax(0,1fr))}#app .screen[data-screen="dispatch"] .ui-tile b{font-size:calc(var(--v2-size,16px)*1.5)}#app .screen[data-screen="dispatch"] .dsp-load>.dsp-card{font-size:calc(var(--v2-size,16px)*.875);padding:10px 12px}}
@media (prefers-reduced-motion:reduce){#app .screen[data-screen="dispatch"] .dsp-load{transition:none}}
