/* Soft surfaces, Identity Rail load windows, date field, collapsible dashboard */

/* ===================================================================================
   Soft surfaces (Tinted Bands, refined): tints, spacing and type instead of outlines.
   One layer for the whole app — cards, panels, tables, toolbars, forms, windows, chips.
   =================================================================================== */
:root { --soft-fill: #eef0f4; --soft-fill-2: #e6e9ee; --soft-line: rgba(16,24,40,.055); --soft-shadow: 0 1px 2px rgba(16,24,40,.04), 0 2px 8px -2px rgba(16,24,40,.05); --soft-tint: #f6f7f9; }
:root[data-theme="dark"] { --soft-fill: #181b20; --soft-fill-2: #20242a; --soft-line: rgba(255,255,255,.045); --soft-shadow: none; --soft-tint: #121418; }

/* panels & cards: no outline — the white (or raised dark) surface on the page tint is enough */
.dsx-card, .folder-card, .table-responsive, .nx-sec, .load-card, .modal, .modal.confirm-modal { border-color: transparent !important; box-shadow: var(--soft-shadow); }
.modal { box-shadow: 0 24px 60px -12px rgba(16,24,40,.28), 0 8px 24px -6px rgba(16,24,40,.12); }
:root[data-theme="dark"] .modal { box-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 24px 60px -12px rgba(0,0,0,.7); }
.load-card { background: var(--bg-card); }
.load-card[data-status] { border-top: 0; }
.load-card:hover { box-shadow: 0 2px 4px rgba(16,24,40,.05), 0 8px 20px -6px rgba(16,24,40,.12); }
:root[data-theme="dark"] .load-card:hover { background: var(--soft-fill); }
.load-card.stale-highlight { border-color: transparent !important; box-shadow: var(--soft-shadow); background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 9%, var(--bg-card)), color-mix(in srgb, var(--danger) 4%, var(--bg-card))); }
.load-card-route { background: var(--soft-tint); border-color: transparent; }
.folder-card:hover { background: var(--soft-tint); }
.toolbar, .dock { border-color: transparent !important; }
.modal-header { border-bottom-color: transparent !important; }
.modal-footer { border-top-color: transparent !important; }

/* fields: soft fill, no outline; focus brings the primary edge + ring back */
.form-control, .ss-selected, .date-range-filter, .view-toggle, .wc-toggle, .extra-roles { background-color: var(--soft-fill); border-color: transparent !important; box-shadow: none !important; }
:root:not([data-theme="dark"]) .form-control, :root:not([data-theme="dark"]) .ss-selected { box-shadow: none !important; }
.form-control:focus, .ss-selected:focus-visible, .searchable-select:has(.ss-dropdown.active) .ss-selected, .date-range-filter:focus-within { background-color: var(--input-bg); border-color: var(--primary) !important; box-shadow: var(--focus-ring) !important; }
.form-control.error, .ss-selected.error, .form-control.time-bad { border-color: var(--danger) !important; }
.date-range-filter .form-control, .date-range-filter input { background: transparent !important; }
.ss-locked .ss-selected { background: transparent; border: 1px dashed var(--border-strong) !important; }
.view-toggle-btn.active { background: var(--bg-card); box-shadow: 0 1px 2px rgba(16,24,40,.10) !important; }
:root[data-theme="dark"] .view-toggle-btn.active { background: var(--soft-fill-2); box-shadow: none !important; }
.dock-team-select, .dock-theme { border-color: transparent !important; background-color: rgba(255,255,255,.07); }
.ss-dropdown { border-color: transparent !important; }
:root[data-theme="dark"] .ss-dropdown { box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 16px 40px -8px rgba(0,0,0,.7); }

/* buttons: secondary = soft fill, danger = soft red tint; primary stays solid */
.btn-outline { background-color: var(--soft-fill) !important; border-color: transparent !important; }
.btn-outline:hover:not(:disabled) { background-color: var(--soft-fill-2) !important; }
.btn-danger { border-color: transparent !important; background-color: color-mix(in srgb, var(--danger) 8%, transparent); }
.btn-danger:hover:not(:disabled) { background-color: color-mix(in srgb, var(--danger) 14%, transparent); }

/* chips, badges, codes: tint only */
.cp { border-color: transparent; background: var(--soft-fill); }
.cp:hover { border-color: transparent; background: color-mix(in srgb, var(--primary) 12%, var(--bg-card)); color: var(--primary); }
.cp.copied, .cp.copied:hover { border-color: transparent !important; }
.badge, .notes-badge, .stale-badge, .role-chip, .tm-code, .dsx-notes, .dsx-notes-n { border-color: transparent !important; }
.role-chip, .tm-code { background: var(--soft-fill); }
.card-status-select { border-color: transparent !important; border-width: 0 !important; background-color: color-mix(in srgb, currentColor 9%, var(--bg-card)) !important; }

/* tables: no frame, no column lines; rows separated by the faintest line, header on a tint */
.data-table th { border-bottom-color: transparent !important; background: var(--soft-tint); }
.data-table td { border-bottom-color: var(--soft-line) !important; }
.data-table tbody tr:last-child td { border-bottom-color: transparent !important; }

/* statistics: tinted heads / totals instead of rules */
.dsx-rest { border-left-color: transparent !important; }

.db-tabs { border-bottom-color: transparent !important; }
/* notes & comments window */
.nx-ls { border-right-color: transparent !important; background: var(--soft-tint); }
.nx-lt, .nx-sh, .nx-sf { border-color: transparent !important; }
.nx-it { border-bottom-color: var(--soft-line) !important; }

/* ===== Tinted Bands windows (Add / Edit / View): bands separate, controls go borderless ===== */
#modalOverlay .modal-footer { border-top-color: transparent; background: var(--tb-sub); }
#viewModalOverlay .modal-footer { border-top-color: transparent; background: var(--tb-bg); }
#loadForm .tb .form-control, #loadForm .tb .ss-selected { border-color: transparent; }

:root[data-theme="dark"] #loadForm .tb .form-control, :root[data-theme="dark"] #loadForm .tb .ss-selected { background: var(--tb-fill); box-shadow: none; }
#loadForm .tb .form-control:focus, #loadForm .tb .searchable-select:has(.ss-dropdown.active) .ss-selected, #loadForm .tb .ss-selected:focus-visible { border-color: var(--tb-primary); box-shadow: 0 0 0 3px var(--tb-ring); }
#loadForm .tb .form-control:disabled { border-color: transparent; background: transparent; box-shadow: inset 0 0 0 1px var(--tb-line); }
#loadForm .tb .tb-lst select { border-color: transparent; background: var(--tb-fill); }
.tb .alx-seg button[aria-checked="true"], .tb .t12-ap button[aria-checked="true"] { box-shadow: 0 1px 2px rgba(16,24,40,.10), 0 1px 1px rgba(16,24,40,.04); }
:root[data-theme="dark"] .tb .alx-seg button[aria-checked="true"], :root[data-theme="dark"] .tb .t12-ap button[aria-checked="true"] { background: var(--tb-hover); box-shadow: none; }

.tb-asap { box-shadow: none; background: var(--tb-fill); }

.tb .tb-asap:has(input:checked) { box-shadow: none; color: var(--tb-amber); background: color-mix(in srgb, var(--tb-amber) 16%, transparent); }
.tb-asap:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--tb-ring); }
.tb-add { border-color: transparent; background: var(--tb-psoft); }
.tb-add:hover { background: color-mix(in srgb, var(--tb-primary) 14%, transparent); }
.tb-flist .attachment-row { border-bottom: 0; border-radius: 15px; }
.tb-flist .attachment-row:hover { background: var(--tb-fill); }
.tb-flist:empty::before { border-bottom: 0; }
.tb-drop { border: 0; background: var(--tb-bg); box-shadow: 0 1px 2px rgba(16,24,40,.05); }
:root[data-theme="dark"] .tb-drop { background: var(--tb-fill); box-shadow: none; }
.tb-drop:hover, .tb-drop:has(input:focus-visible) { background: var(--tb-psoft); }
.tb .ss-dropdown { box-shadow: 0 12px 32px -6px rgba(0,0,0,.24), 0 2px 6px rgba(0,0,0,.06); }

/* ===== Tinted bands, no frames ===== */

#modalOverlay .modal-footer .btn-outline:not(.tb-ghost), #viewModalOverlay .modal-footer .btn-outline:not(.tb-ghost) { background-color: var(--tb-fill) !important; border-color: transparent !important; }
#modalOverlay .modal-footer { background: var(--tb-bg); box-shadow: 0 -1px 0 var(--tb-line); }
#viewModalOverlay .modal-footer { box-shadow: 0 -1px 0 var(--tb-line); }
.dsx-notes { border-color: transparent !important; background: var(--soft-fill); }
.dsx-notes:hover { background: var(--soft-fill-2); }
.st-badge { border-color: transparent !important; }
.tm-type-opt { border-color: transparent !important; background: var(--soft-fill); }
.tm-type-opt:has(input:checked) { background: color-mix(in srgb, var(--primary) 10%, var(--bg-card)); }

/* ===== Concept 3 "Identity Rail" — Add / Edit / View Load (approved Round 5 image) =====
   A tinted rail on the left carries the load as a whole (Load #, status, figures, actions); the main area holds the details. */

.irv-rc { margin-top: 4px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }

/* dispatcher split under the figures */
.ir-split { margin-top: 12px; }
.ir-split .alx-split { margin: 0; }
.ir-sl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; margin-top: 9px; font-size: 12px; }
.ir-sl[hidden] { display: none; }
.ir-sl span { font-weight: 600; color: var(--tb-text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ir-sl b { font-weight: 700; color: var(--tb-success); white-space: nowrap; }
.ir-solo b { color: var(--tb-faint); font-weight: 500; }

/* ---- main area ---- */

.ir-x { position: absolute !important; top: 12px; right: 12px; z-index: 3; }

/* Team & Broker: one row */

#loadForm .ir .tb-teamf > select, #loadForm .ir .tb-teamf > select:disabled { opacity: 0 !important; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; pointer-events: none; }
/* Route: trip type + distance in the header, one aligned row per stop */
.ir-trip { gap: 8px; }

.ir-mi { display: block; width: 96px; margin: 0; }
.ir-mi .form-control { width: 100%; }

.ir .ir-t12 { display: grid !important; grid-template-columns: 92px 70px 72px; gap: 8px; align-items: center; }
.ir .ir-t12 > .tb-tctl { grid-column: auto; grid-row: auto; }
.ir .ir-t12 > .t12-ap { grid-column: auto; grid-row: auto; display: grid; grid-template-columns: 1fr 1fr; width: 70px; }
.ir .ir-t12 > .tb-asap { grid-column: auto; grid-row: auto; width: 72px; padding: 0; }

/* lower area: three columns on a tinted band */

.ir .tb-add { height: 28px; margin-top: 8px; padding: 0 10px; border: 0; border-radius: 15px; background: var(--tb-psoft); color: var(--tb-primary); font-size: 12px; font-weight: 600; gap: 6px; }
.ir .tb-add:hover { background: color-mix(in srgb, var(--tb-primary) 14%, transparent); }

#loadForm .ir textarea.form-control { height: 62px; min-height: 62px; }
.ir .tb-solov { gap: 7px; }
.ir .tb-solov b { font-size: 15px; font-weight: 700; color: var(--tb-success); }
.ir .tb-pp.tb-ro { padding-left: 0; }
#modalOverlay .ir #companyFinHint { margin-top: 10px; }
/* attachments */
.ir .tb-flist { display: flex; flex-direction: column; margin-bottom: 6px; }
.ir .tb-flist .attachment-row { height: 26px; padding: 0 4px; font-size: 12.5px; gap: 9px; border: 0; }
.ir .tb-flist:empty::before { height: 26px; border: 0; font-size: 12.5px; content: 'No files attached yet'; }

/* hide old Concept 2 pieces that no longer exist in this layout */
.ir .tb-oo { display: none !important; }

/* ---- View Load ---- */

.irv-kv { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.irv-k { font-size: 11px; font-weight: 600; color: var(--tb-muted); white-space: nowrap; }
.irv-v { font-size: 13.5px; font-weight: 600; color: var(--tb-text); min-width: 0; overflow-wrap: anywhere; }

.irv-gid { font-size: 14px; font-weight: 500; color: var(--tb-text); user-select: text; }
.irv-empty { color: var(--tb-faint); font-weight: 500; font-size: 13px; }

.irv-va { font-size: 13px; overflow-wrap: anywhere; }
.irv-vc { font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.irv-vd { margin-top: 1px; font-size: 12px; color: var(--tb-muted); }

.irv-pod { font-size: 13.5px; font-weight: 500; color: var(--tb-muted); }
.irv-pod.on { color: var(--tb-success); font-weight: 600; }
.irv-notes { display: flex; flex-direction: column; gap: 10px; }
.irv-p { margin: 0; font-size: 13px; font-weight: 500; line-height: 1.45; white-space: pre-wrap; }
.irv-files { display: flex; flex-direction: column; }
.irv-f { display: flex; align-items: center; gap: 7px; height: 26px; font-size: 12.5px; font-weight: 500; text-decoration: none; color: var(--tb-text); min-width: 0; }
.irv-f > span { flex: 1; min-width: 0; color: var(--tb-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.irv-f em { font-style: normal; font-size: 11.5px; font-weight: 400; color: var(--tb-faint); white-space: nowrap; }
.irv-f .ic { color: var(--tb-faint); font-size: 13px; flex: none; }
.irv-f .ic:first-child { color: var(--tb-muted); }
.irv-f:hover > span { text-decoration: underline; }
.irv-lg { display: grid; grid-template-columns: 96px 100px minmax(0, 1fr); gap: 10px; padding: 3px 0; font-size: 12px; line-height: 1.4; }
.irv-lg time { color: var(--tb-faint); white-space: nowrap; }
.irv-lg b { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.irv-lg span { min-width: 0; color: var(--tb-muted); overflow-wrap: anywhere; }
.irv-log:not(.open) .irv-lg:nth-child(n+9) { display: none; }
.irv-more { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; padding: 0; border: 0; background: none; font: 600 12px var(--font); color: var(--tb-primary); cursor: pointer; }
.irv-more .ic { font-size: 12px; transition: transform .15s; }
.irv-log.open .irv-more .ic { transform: rotate(180deg); }

/* ---- desktop: fixed window 1320 × 800, rail + main side by side, nothing to scroll ---- */
@media (min-width: 1100px) {

    .ir { flex: 1; min-height: 0; display: grid; grid-template-columns: 244px minmax(0, 1fr); }

}

/* ---- below 1100 px: the rail becomes a top strip, the actions stay pinned at the bottom, groups stack ---- */
@media (max-width: 1099px) {

    .ir { display: flex; flex-direction: column; }

    #viewRailInfo { order: 0; background: var(--tb-rail); padding: 16px 56px 14px 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: start; }
    #viewRailInfo > * { grid-column: 1; }

    .ir-x { top: calc(10px + env(safe-area-inset-top)); right: 10px; }

    .ir .tb-teamf .alx-seg { display: flex; width: 100%; }
    .ir .tb-teamf .alx-seg button { flex: 1; padding: 0 6px; }

    .ir .ir-t12 { grid-template-columns: minmax(0, 1fr) 76px 76px; }
    .ir .ir-t12 > .t12-ap, .ir .ir-t12 > .tb-asap { width: auto; }

}
@media (max-width: 899px) {

    #viewRailInfo { padding-top: calc(14px + env(safe-area-inset-top)); }
}
@media (max-width: 639px) {

    .ir .ir-trip { width: 100%; margin-left: 0; flex-wrap: wrap; }

    .irv-lg { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 2px; }
    .irv-lg span { grid-column: 1 / -1; }

}

/* broker name: copies the Gmail Search ID — looks like the plain name, no link styling */
.nm-copy { display: inline; padding: 0; margin: 0; border: 0; background: none; font: inherit; color: inherit; text-align: inherit; cursor: pointer; border-radius: 7px; transition: color .15s, background-color .15s; }
.nm-copy:hover { color: var(--primary); }
.nm-copy:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.nm-copy.copied { color: var(--success); }
.load-list .cell-name > .nm-copy { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top; }
.ln-plain { font: inherit; color: inherit; }

/* click-to-copy values (Load #, RC #, driver name → phone, broker name → Gmail Search ID): plain text */
.nm-copy { max-width: 100%; }
.nm-copy.nm-ln { font-weight: inherit; }
.nm-copy.nm-rc { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.nm-copy.nm-rc:hover { color: var(--primary); }
.nm-copy.copied, .nm-copy.copied:hover { color: var(--success); }
.nm-sep { color: var(--text-muted); margin: 0 4px; }
.list-rc { margin-top: 1px; }
.list-rc > .nm-copy { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.load-list .cell-driver > .nm-copy { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top; }
/* hover: a thin line on the left in the load's status color (red when overdue) — mouse only, never on touch */
.load-card { position: relative; }
.load-card.stale-highlight, .load-list tbody tr.stale-row { --hl: var(--danger); }
.load-card::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 7px 7px 0; background: var(--hl, var(--st)); opacity: 0; transition: opacity .15s; pointer-events: none; }
.load-list tbody tr > td:first-child { transition: box-shadow .15s; }
@media (hover: hover) and (pointer: fine) {
    .load-card:hover::before { opacity: 1; }
    .load-list tbody tr[style*="--st"]:hover > td:first-child { box-shadow: inset 3px 0 0 var(--hl, var(--st)); }
}

/* every window's close X turns red on hover (light and dark) */
.modal-close:hover, .modal-close:focus-visible { color: var(--danger) !important; background: color-mix(in srgb, var(--danger) 12%, transparent) !important; }
.modal-close:hover .ic, .modal-close:focus-visible .ic { color: var(--danger) !important; }
.modal-close .ic { transition: color .15s; }

/* ---- Add / Edit / View: three columns — 1 Drivers · Financial · Dispatchers  2 Payment Status · Notes  3 Attachments · Activity Log ---- */

.ir-dph { font-size: 11.5px; font-weight: 500; color: var(--tb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0; text-transform: none; }
.ir-dph.none { color: var(--tb-faint); font-style: italic; }

/* column 3: the Activity Log fills what is left and scrolls inside itself, so the window keeps its size */

#formLog > .irv-log { overflow: visible; }
.ir-flog .irv-lg { grid-template-columns: 88px minmax(0, 1fr); gap: 2px 10px; }

/* View: column contents */

.irv-drv { min-width: 0; }
.irv-drv > .irv-k { display: block; }
.irv-dn { display: block; margin-top: 2px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }

.irv-pod-row { margin-top: 12px; }

/* ---- One dropdown style everywhere (the look of the load-status dropdowns: soft fill, no outline, 8 px corners) ---- */
:root { --dd-bg: #eceef1; --dd-hover: #e3e6ea; }
:root[data-theme="dark"] { --dd-bg: #27292e; --dd-hover: #30333a; }
select.form-control, .ss-selected, #teamSwitcher, #loadForm .ir input.form-control, #loadForm .ir textarea.form-control, #quickAddOverlay .form-control {
    background-color: var(--dd-bg) !important; border-color: transparent !important; box-shadow: none !important; border-radius: 17px !important;
    font-family: var(--font); font-size: 13px; font-weight: 500;
}
select.form-control:hover:not(:disabled), .ss-selected:hover, #loadForm .ir input.form-control:hover:not(:disabled):not(:focus), #loadForm .ir textarea.form-control:hover:not(:disabled):not(:focus) { background-color: var(--dd-hover) !important; }
select.form-control:focus-visible, .ss-selected:focus-visible, .searchable-select:has(.ss-dropdown.active) > .ss-selected, #teamSwitcher:focus-visible, #loadForm .ir input.form-control:focus, #loadForm .ir textarea.form-control:focus, #quickAddOverlay .form-control:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent) !important; }
.ss-selected.error, #loadForm .ir .form-control.error, #loadForm .ir .form-control.time-bad { box-shadow: 0 0 0 1.5px var(--danger) !important; }
select.form-control, .ss-selected { height: var(--control-h); padding-left: 10px; }
#teamSwitcher { background-color: rgba(255, 255, 255, .08) !important; color: #f1f3f5; }
#teamSwitcher:hover { background-color: rgba(255, 255, 255, .13) !important; }
/* one menu style for every searchable dropdown (Broker, Driver, Dispatcher, State, Owner Operator, …) */
.ss-dropdown { border-radius: 20px !important; border: 0 !important; box-shadow: 0 0 0 1px var(--border), 0 12px 32px -6px rgba(0, 0, 0, .28) !important; }
.ss-option { font-size: 13px; border-radius: 14px; }
.ss-option:hover { background: var(--dd-hover); color: var(--text-main); }
.ss-option.highlighted, .ss-option.selected { background: var(--primary-soft); color: var(--primary); }
@media (pointer: coarse) { .ss-option { font-size: 15px; } }
/* compact rhythm so a load with several stops, two drivers and two dispatchers still fits the 800 px window */

/* ===== work159: roles ===== */
.dock-team-one { display: none; }
body.single-team .dock-team-select { display: none !important; }
body.single-team .dock-team-one { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 17px; background: rgba(255, 255, 255, .08); color: #f1f3f5; font-size: 13px; font-weight: 600; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.user-teams.needs-teams { color: var(--danger); font-weight: 600; }
.user-teams.needs-teams .ic { margin-right: 5px; font-size: 13px; vertical-align: -2px; }
.irv-hidden-note { font-size: 12.5px; color: var(--tb-muted); padding: 2px 0 4px; }
.irv-dp-hid { color: var(--tb-faint) !important; font-weight: 500 !important; }
/* ===== work161: Add / Edit / View Load on every screen =====
   ≥1100 px  laptop / desktop: rail on the left, three columns (the approved Identity Rail)
   ≥1680 px  large monitors: the same window, a little larger
   640–1099  tablets / small laptops: rail becomes a top strip, two columns, Attachments + Activity Log side by side
   <640 px   phones: one column, fields stacked in a logical order, actions pinned at the bottom
   touch screens: 44 px controls, 16 px text in fields (no zoom-in on iPhone), bigger tap areas */
@media (min-width: 1680px) and (min-height: 940px) {

    .ir { grid-template-columns: 264px minmax(0, 1fr); }
}

/* ---- tablets and small laptops ---- */
@media (max-width: 1099px) {

    #viewRailInfo { padding-left: 18px; }

    /* route: one block per stop — Address · City · State, then Date · Time */

    .ir .ir-t12 { grid-template-columns: minmax(0, 1fr) 84px 84px; }

    /* View */

}

/* ---- phones ---- */
@media (max-width: 639px) {
    #modalOverlay, #viewModalOverlay { padding: 0; }

    #viewRailInfo { padding-left: 16px; padding-right: 52px; }

    .ir .tb-teamf .alx-seg button { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
    /* route: Address / City + State / Date / Time + AM·PM + ASAP */

    .ir .ir-t12 { grid-template-columns: minmax(0, 1fr) 88px 80px; }
    .ir .ir-trip { width: 100%; margin-left: 0; flex-wrap: nowrap; }

    .ir-mi { width: 112px !important; flex: none; }

    /* the close X stays on top of the scrolling form, on its own chip so it never sits on a field */
    #modalOverlay .ir-x, #viewModalOverlay .ir-x { position: fixed !important; top: calc(8px + env(safe-area-inset-top)); right: 8px; z-index: 30; background: var(--tb-rail) !important; box-shadow: 0 1px 6px rgba(0, 0, 0, .14); border-radius: 50%; }

    /* attachments: the drop zone wraps its words instead of running off the edge */
    .tb-drop { white-space: normal; flex-wrap: wrap; justify-content: center; text-align: center; min-width: 0; }

    /* the pinned action bar: Save · Copy · Delete on one row; View: two rows */

}
@media (max-width: 359px) {

    .ir .ir-t12 { grid-template-columns: minmax(0, 1fr) 80px; }
    .ir .ir-t12 > .tb-asap { grid-column: 1 / -1; width: 100%; }

    .ir-mi { width: 104px !important; }

    .ir .tb-teamf .alx-seg { height: auto; min-height: 48px; }
    .ir .tb-teamf .alx-seg button { font-size: 12.5px; white-space: normal; line-height: 1.15; text-overflow: clip; height: auto; min-height: 40px; padding: 4px; }

}
/* phones held sideways: short screen — the summary strip scrolls away with the form instead of staying on top */
@media (max-height: 520px) and (max-width: 1099px) {
    #modalOverlay, #viewModalOverlay { padding: 0; }

}
/* ---- touch screens (phones, tablets, touch laptops): comfortable tap sizes, no zoom-in on fields ---- */
@media (pointer: coarse) {

    .ir .tb-add { height: 38px; padding: 0 14px; font-size: 13px; }
    .ir .tb-rm { width: 36px !important; height: 36px; display: inline-flex; align-items: center; justify-content: center; }

    .ir .tb-drop { min-height: 48px; }
    .tb-flist .btn, .tb-flist button { min-width: 40px; min-height: 40px; }
    .ss-option { min-height: 44px; display: flex; align-items: center; }

}
/* phones and tablets: 44 px fields, 16 px text (iPhone / iPad do not zoom in on a field with 16 px text) */
@media (pointer: coarse) and (max-width: 1099px) {

    #loadForm .ir input.form-control, #loadForm .ir select.form-control, #loadForm .ir textarea.form-control, #loadForm .ir .ss-selected,
    #loadForm .ir .ss-search, #quickAddOverlay .form-control { font-size: 16px !important; }

    #loadForm .ir .ss-selected > span { font-size: 16px; }

    .ir-mi { width: 112px; }
    #modalOverlay .ir-x, #viewModalOverlay .ir-x { width: 42px; height: 42px; }
    .ir .alx-seg button, .ir .t12-ap button { min-height: 40px; }
    .ir .alx-seg { min-height: 44px; }
}
/* touch laptops and large tablets in landscape keep the desktop window: slightly taller controls, wider AM / PM */
@media (pointer: coarse) and (min-width: 1100px) {

    .ir .t12-ap { height: var(--control-h); padding: 1px; }

    .ir .ir-t12 { grid-template-columns: 84px 84px 66px; }
    .ir .ir-t12 > .tb-asap { width: 66px; }
    .ir .ir-t12 > .t12-ap { width: 84px; }
    .ir .t12-ap button { min-width: 40px; min-height: 0; height: 100%; }
    .ir .alx-seg button { min-height: 38px; }

    #modalOverlay .ir-x, #viewModalOverlay .ir-x { width: 38px; height: 38px; top: 8px; right: 8px; }
}

/* safe areas (iPhone notch / home bar) */
@supports (padding: max(0px)) {
    @media (max-width: 639px) {
        #viewRailInfo { padding-top: max(16px, env(safe-area-inset-top)); }
    }
}
/* very small phones (320 px): the pickup-date filter on the boards shrinks instead of pushing the page sideways */
@media (max-width: 399px) {
    .date-range-filter { min-width: 0; max-width: 100%; padding-left: 8px; }
    .date-range-filter input[type="date"] { width: 0; flex: 1 1 0; min-width: 0; font-size: 14px; }
    .date-range-filter input[type="date"]::-webkit-date-and-time-value { text-align: left; }
}

/* touch tablets in landscape (1100–1279 px): the desktop window, but each stop gets two comfortable lines */
@media (pointer: coarse) and (min-width: 1100px) and (max-width: 1279px) {

    .ir .ir-t12 { grid-template-columns: minmax(0, 1fr) 84px 72px; }
    .ir .ir-t12 > .tb-asap { width: auto; }

    /* the field labels the header row used to give, shown on the first stop only */
}

/* ===== work164: one date field everywhere — type MM/DD/YYYY or pick from the calendar ===== */
input.dtf-src { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden; clip-path: inset(50%); }
.dtf-host { position: relative; }
.dtf { display: inline-flex; align-items: center; gap: 2px; min-width: 0; }
.dtf-in { font-variant-numeric: tabular-nums; letter-spacing: .01em; font-family: var(--font); }
.dtf-in::placeholder { color: var(--text-faint); letter-spacing: 0; }
.dtf-btn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 26px; height: 26px; padding: 0; margin: 0; border: 0; border-radius: 14px; background: transparent; color: var(--text-muted); cursor: pointer; }
.dtf-btn .ic { font-size: 15px; }
.dtf-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--primary); }
.dtf-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.dtf-btn:disabled { cursor: not-allowed; opacity: .45; }
.dtf-btn[aria-expanded="true"] { color: var(--primary); background: var(--primary-soft); }
/* Add / Edit Load: the button sits where the calendar icon always was */
#loadForm .tb .dtf-btn.tb-fi { pointer-events: auto; left: 4px; width: 28px; height: 28px; color: var(--tb-faint); z-index: 2; }
#loadForm .tb .dtf-btn.tb-fi:hover:not(:disabled) { color: var(--tb-primary, var(--primary)); background: var(--tb-fill, var(--bg-hover)); }
#loadForm .tb .tb-ctl:has(> .dtf-btn) > .dtf-in { padding-left: 34px; }
/* the boards' date filters (Active / Finished / Statistics): compact, no box of their own */
.date-range-filter > .ic-calendar { display: none; }
.date-range-filter { padding-left: 8px; }
.date-range-filter .dtf-in { border: 0 !important; background: none !important; box-shadow: none !important; outline: none; padding: 0 2px; height: 100%; width: 86px; font-size: 12.5px; color: var(--text-main); }
.date-range-filter .dtf { height: 100%; }
/* Excel export dialog: a normal field with the button inside on the right */
.dtf.dtf-boxed { display: flex; width: 100%; }
.dtf.dtf-boxed .dtf-in { flex: 1 1 auto; min-width: 0; padding-right: 36px; }
.dtf.dtf-boxed .dtf-btn { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); }
/* a date that is not valid: red outline and a short message under the field */
input.dtf-in.dtf-bad, #loadForm .ir input.form-control.dtf-in.dtf-bad, .date-range-filter input.dtf-in.dtf-bad { box-shadow: 0 0 0 1.5px var(--danger) !important; border-radius: 14px; }
.dtf-err { position: absolute; left: 0; top: calc(100% + 5px); z-index: 40; max-width: min(300px, 90vw); width: max-content; padding: 6px 9px; border-radius: 17px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 500; line-height: 1.35; white-space: normal; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .35); pointer-events: none; }
.dtf-err::before { content: ''; position: absolute; left: 14px; top: -4px; width: 8px; height: 8px; background: inherit; transform: rotate(45deg); }
.dtf-err[hidden] { display: none !important; }
/* the calendar */
.dtf-cal { position: fixed; z-index: 5000; width: 296px; padding: 12px; border-radius: 27px; background: var(--bg-card); color: var(--text-main); box-shadow: 0 0 0 1px var(--border), 0 18px 48px -12px rgba(0, 0, 0, .35); font-family: var(--font); }
.dtf-cal[hidden] { display: none !important; }
.dtf-head { display: grid; grid-template-columns: 34px minmax(0, 1fr) 82px 34px; gap: 6px; align-items: center; margin-bottom: 8px; }
.dtf-nav { width: 34px; height: 34px; border: 0; border-radius: 17px; background: transparent; color: var(--text-main); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.dtf-nav:hover { background: var(--bg-hover); }
.dtf-nav .ic { font-size: 16px; }
.dtf-next .ic { transform: rotate(180deg); }
.dtf-head select { height: 34px; min-width: 0; padding: 0 6px; border: 0; border-radius: 17px; background: var(--dd-bg, var(--bg-hover)); color: var(--text-main); font: 600 13px var(--font); cursor: pointer; }
.dtf-wk, .dtf-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.dtf-wk span { text-align: center; font-size: 11px; font-weight: 600; color: var(--text-faint); padding: 4px 0; }
.dtf-grid button { height: 36px; border: 0; border-radius: 17px; background: transparent; color: var(--text-main); font: 500 13px var(--font); font-variant-numeric: tabular-nums; cursor: pointer; }
.dtf-grid button:hover { background: var(--bg-hover); }
.dtf-grid button:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.dtf-grid button.dtf-now { color: var(--primary); font-weight: 700; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 45%, transparent); }
.dtf-grid button.dtf-sel { background: var(--primary); color: #fff; font-weight: 700; }
.dtf-foot { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.dtf-foot button { flex: 1; height: 34px; border: 0; border-radius: 17px; background: var(--bg-hover); color: var(--text-main); font: 600 12.5px var(--font); cursor: pointer; }
.dtf-foot .dtf-today { color: var(--primary); }
.dtf-foot button:hover { filter: brightness(.97); }
:root[data-theme="dark"] .dtf-cal { background: #1d1f24; box-shadow: 0 0 0 1px #2c2f36, 0 18px 48px -12px rgba(0, 0, 0, .7); }
:root[data-theme="dark"] .dtf-foot button, :root[data-theme="dark"] .dtf-nav:hover, :root[data-theme="dark"] .dtf-grid button:hover { background: #2a2d33; }
:root[data-theme="dark"] .dtf-grid button.dtf-sel { color: #0b1220; }
/* phones: the calendar opens as a sheet at the bottom of the screen, with large touch targets */
.dtf-cal.dtf-sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto; border-radius: 28px 28px 0 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
.dtf-cal.dtf-sheet .dtf-grid button { height: 44px; font-size: 15px; }
.dtf-cal.dtf-sheet .dtf-head { grid-template-columns: 44px minmax(0, 1fr) 96px 44px; }
.dtf-cal.dtf-sheet .dtf-nav, .dtf-cal.dtf-sheet .dtf-head select, .dtf-cal.dtf-sheet .dtf-foot button { height: 44px; font-size: 15px; }
.dtf-back { position: fixed; inset: 0; z-index: 4999; background: rgba(0, 0, 0, .35); }
.dtf-back[hidden] { display: none; }
@media (pointer: coarse) {
    .dtf-btn { width: 36px; height: 36px; }
    #loadForm .tb .dtf-btn.tb-fi { width: 36px; height: 36px; left: 2px; }
    #loadForm .tb .tb-ctl:has(> .dtf-btn) > .dtf-in { padding-left: 40px; }
    .dtf-grid button { height: 40px; }
    .date-range-filter .dtf-in { font-size: 15px; width: 100px; }
}
@media (max-width: 399px) { .date-range-filter .dtf-in { width: 0; flex: 1 1 0; min-width: 0; } .date-range-filter .dtf { flex: 1 1 0; min-width: 0; } }
@media (min-width: 900px) and (max-width: 1100px) { .date-range-filter .dtf { flex: 1 1 0; min-width: 0; } .date-range-filter .dtf-in { width: 0; flex: 1 1 0; min-width: 0; } }
/* ===== work165: Active Loads — collapsible dashboard panel ===== */
#loadsView > header { align-items: center; }
.dsx-ctl { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.dsx-toggle { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 10px; border: 0; border-radius: 17px; background: transparent; color: var(--text-muted); font: 500 12.5px var(--font); cursor: pointer; white-space: nowrap; transition: background-color .15s, color .15s; }
.dsx-toggle:hover { background: var(--bg-hover); color: var(--text-main); }
.dsx-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.dsx-toggle .ic { font-size: 15px; transition: transform .2s ease; transform: rotate(180deg); }
.dsx-toggle[aria-expanded="false"] .ic { transform: none; }
.dsx-notes-mini { margin-left: 0; height: 30px; }
.dsx-notes-mini[hidden] { display: none !important; }
/* the panel folds up: height goes to zero, the cards fade; nothing is re-calculated */
.dsx-clip { display: grid; grid-template-rows: 1fr; flex-shrink: 0; }
.dsx-clip > .dsx-clip-in { min-height: 0; overflow: hidden; }
.dsx-clip.dsx-anim { transition: grid-template-rows .22s ease; }
.dsx-clip.dsx-anim > .dsx-clip-in > .dsx { transition: opacity .18s ease, margin-bottom .22s ease; }
.dsx-clip.collapsed { grid-template-rows: 0fr; }
.dsx-clip.collapsed > .dsx-clip-in > .dsx { opacity: 0; margin-bottom: 0; }
@media (prefers-reduced-motion: reduce) { .dsx-clip.dsx-anim, .dsx-clip.dsx-anim > .dsx-clip-in > .dsx, .dsx-toggle .ic { transition: none; } }
@media (max-width: 599px) {
    .dsx-toggle .dsx-toggle-lab, .dsx-notes-mini .dsx-mini-lab { display: none; }
    .dsx-toggle { padding: 0; width: 36px; justify-content: center; }
}
@media (pointer: coarse) { .dsx-toggle, .dsx-notes-mini { height: 40px; min-width: 40px; } }
