/* ==========================================================================
   Site.css
   Raveno Behavior & Responsive Layout Adjustments

   Purpose:
   - Responsive/sidebar behavior
   - Component layout frameworks (Stops editor, Shipment Details, Tools split-pane)

   Notes:
   - Theme colors + data-entry sizing tokens live in Base.css
   - This file focuses on layout and component behavior

   STANDING CONVENTION (Ken, S127): no light-gray/muted text color on new UI.
   Body text on a light background stays full-strength black/near-black
   (the default inherited color, or an explicit dark value like #212529/#333).
   Muted grays (Bootstrap .text-muted, --bs-secondary-color, #6c757d and
   similar) read as illegible rather than "subtle" and Ken has had to ask for
   this fix repeatedly (S112 request-log labels, S127 checklist completed-task
   text and empty-state text, Forbo import modal). If something genuinely
   needs de-emphasis, use a non-color cue instead (strikethrough, italics,
   font-weight, an icon) or confirm the exact shade with Ken first -- don't
   default to a muted gray class when writing new markup or CSS.
   ========================================================================== */


/* ==========================================================================
   1) Sidebar Behavior
   ========================================================================== */
.sidebar {
    transition: margin-left .3s ease, transform .3s ease, opacity .3s ease;
}

    /* Collapsed state (desktop toggle / mobile default) */
    .sidebar.collapsed {
        transform: translateX(-100%);
        opacity: 0;
    }

/* Sidebar brand logo (Session 112): DM Delivers replaces the former ezTechDirect
   icon+text brand per Ken's direction. Source asset is 400x78 (native), far wider
   than the sidebar can hold at any width in its 220-420px resizable range
   (Session 108); constrained to a fixed display width with height:auto to
   preserve aspect ratio, and max-width:100% as a safety net at the sidebar's
   narrowest resize setting. */
/* Sidebar brand panel (Session 112, Ken follow-up): the logo above sits in its
   own solid-white panel because its transparent background got lost against the
   sidebar's dark navy (--secondary, #202940) -- the menu below stays on the
   usual dark background, unaffected. This is a SIBLING of .navbar in the markup
   (not nested inside it), so only .sidebar's own box model needs accounting for:
   .sidebar has no top or left padding, so this panel already touches those two
   edges by default; .sidebar DOES have pe-4 (1.5rem) padding-right, which this
   panel's negative right margin cancels so the white background bleeds all the
   way to the true right edge (matching how the navy fills edge-to-edge
   everywhere else in the sidebar, e.g. behind the resize handle) rather than
   leaving a navy sliver in the top-right corner. padding-right is widened by
   that same 1.5rem to keep the logo's own visual inset from the edge unchanged
   despite the wider box. margin-bottom reproduces the old mb-3 gap that used to
   sit between the brand link and the first nav item (now navy, from the
   underlying .sidebar/.navbar background showing through). */
.sm-sidebar-brand-panel {
    background: var(--white);
    margin: 0 -1.5rem 1rem 0;
    padding: 1.25rem 3rem 1.25rem 1.5rem;
}

.sm-sidebar-logo {
    width: 160px;
    max-width: 100%;
    height: auto;
    display: block;
}

/* When sidebar is collapsed, content takes full width */
.content.expanded {
    margin-left: 0 !important;
    width: 100% !important;
    transition: margin-left .3s ease;
}


/* ==========================================================================
   2) Dropdown Menu Readability (Dark Theme)
   ========================================================================== */
.dropdown-menu .dropdown-header {
    color: var(--light) !important;
    text-shadow: 0 0 4px rgba(0,0,0,0.6);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.03rem;
    opacity: 0.9;
}

.dropdown-item {
    padding-left: 1.75rem; /* indent subitems */
}

.dropdown-divider {
    border-color: rgba(255, 255, 255, 0.15);
    margin: 0.4rem 0; /* visual separation between groups */
}

/* Page-bar dropdown divider: render as a solid visible line, not a faint gap */
.sm-page-bar .dropdown-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.55);
    margin: 0.3rem 0;
    opacity: 1;
}

.dropdown-header::after {
    content: "";
    display: block;
    width: 40%;
    height: 2px;
    margin-top: 0.25rem;
    background-color: var(--primary);
    opacity: 0.7;
}


/* Mobile sidebar behavior */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        opacity: 0;
    }

        .sidebar.active {
            transform: translateX(0);
            opacity: 1;
        }

    .content {
        margin-left: 0;
    }
}


/* ==========================================================================
   3) Sidebar Navigation Links
   ========================================================================== */
.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1rem;
    color: var(--light);
    border-radius: .375rem;
}

    .sidebar .nav-link:hover {
        color: var(--white);
        background: rgba(255,255,255,.05);
    }

    .sidebar .nav-link.active {
        color: var(--primary);
        background: rgba(88,103,221,.18);
        border-left: 4px solid var(--primary);
        padding-left: calc(1rem - 4px);
    }


/* ==========================================================================
   4) Navbar Styling
   ========================================================================== */
.navbar {
    background-color: var(--secondary);
    box-shadow: 0 0 15px rgba(0,0,0,.5);
}

    .navbar .nav-link:hover,
    .navbar .nav-link.active {
        color: var(--primary);
    }

    /* Navbar search/input styling (white field on dark background) */
    .navbar .form-control {
        background-color: #ffffff !important;
        color: #000000 !important;
        border: 1px solid rgba(0,0,0,.2);
    }

        .navbar .form-control:focus {
            background-color: #ffffff !important;
            border-color: var(--primary);
            color: #000000;
            box-shadow: 0 0 0 .2rem rgba(88,103,221,.25);
        }

/* Sidebar toggle icon/button */
.sidebar-toggler {
    cursor: pointer;
    color: var(--white);
    font-size: 1.25rem;
    background: transparent;
    border: none;
    margin-right: 1rem;
}

    .sidebar-toggler:hover {
        color: var(--primary);
    }


/* ==========================================================================
   5) Forms & Inputs (Visual, Not Sizing)
   --------------------------------------------------------------------------
   Sizing is handled by Base.css tokens; this section controls appearance.
   ========================================================================== */
.form-control {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 1px solid rgba(0,0,0,.2);
}

    .form-control:focus {
        background-color: #ffffff !important;
        border-color: var(--primary);
        color: #000000;
        box-shadow: 0 0 0 .2rem rgba(88,103,221,.25);
    }

    .form-control::placeholder {
        color: #666666;
        opacity: 1;
    }


/* ==========================================================================
   6) Cards & Tables
   ========================================================================== */
.table th,
.table td {
    vertical-align: middle;
    padding: .75rem 1rem;
}

.table-hover tbody tr:hover {
    background: rgba(255,255,255,.06);
}

/* Visible gridlines inside dark cards */
.card-default .table,
.card-default .table thead th,
.card-default .table tbody tr,
.card-default .table td {
    border-color: #000 !important;
}

    .card-default .table thead th {
        border-bottom: 2px solid #000 !important;
    }


/* ==========================================================================
   7) Back to Top Button
   ========================================================================== */
.back-to-top {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    width: 45px;
    height: 45px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

    .back-to-top.show {
        display: flex;
    }

    .back-to-top:hover {
        background: var(--primary-light);
    }


/* ==========================================================================
   8) Layout Width (Sidebar + Content)
   --------------------------------------------------------------------------
   Desktop: content accounts for fixed sidebar width.
   Mobile: content goes full width.
   ========================================================================== */
.content {
    margin-left: var(--sidebar-width);
    overflow-x: clip; /* clip (not hidden) — avoids creating a scroll container, which would break position:sticky on sm-system-bar and sm-page-bar-slot */
}

@media (min-width: 993px) {
    .content {
        width: calc(100% - var(--sidebar-width));
    }
}

@media (max-width: 992px) {
    .content {
        margin-left: 0;
    }
}


/* ==========================================================================
   9) Dark Cards + Tables (Theme Consistency)
   ========================================================================== */
body, .content {
    background-color: var(--dark) !important;
}

.card-default, .bg-secondary {
    background-color: var(--secondary) !important;
}

    .card-default .table,
    .card-default .table thead th,
    .card-default .table tbody tr {
        background-color: var(--secondary) !important;
        color: var(--white);
    }

        .card-default .table thead th {
            font-weight: 600;
            text-transform: uppercase;
        }

    .card-default .form-check-input {
        background-color: transparent;
        border: 1px solid rgba(255,255,255,.5);
    }

    .card-default .badge {
        font-weight: 500;
    }

    /* Buttons inside cards: slightly smaller so tables don't feel chunky */
    .card-default .btn {
        font-size: 0.8rem;
    }


/* ==========================================================================
   10) Charts
   ========================================================================== */
.chartjs-render-monitor,
canvas {
    background-color: transparent !important;
}


/* ==========================================================================
   11) Navigation Dropdowns (Navbar + Sidebar)
   ========================================================================== */
.navbar .dropdown-menu,
.sidebar .dropdown-menu {
    background-color: var(--secondary) !important;
    color: var(--white);
    border: 1px solid rgba(255,255,255,.1);
    box-shadow: 0 0 10px rgba(0,0,0,.4);
}

    .navbar .dropdown-item,
    .sidebar .dropdown-menu .dropdown-item {
        color: var(--white) !important;
        font-weight: 500;
    }

        .navbar .dropdown-item:hover,
        .navbar .dropdown-item:focus,
        .sidebar .dropdown-menu .dropdown-item:hover,
        .sidebar .dropdown-menu .dropdown-item:focus {
            color: var(--primary) !important;
            background-color: rgba(255,255,255,.08) !important;
        }

        .sidebar .dropdown-menu .dropdown-item.active {
            color: var(--primary) !important;
            background-color: rgba(88,103,221,.18) !important;
            border-left: 3px solid var(--primary);
        }

        .sidebar .dropdown-menu .dropdown-item i {
            color: var(--white) !important;
            opacity: 0.9;
        }

/* Notification bell feed renders inside the dark system-bar dropdown (#sm-notif-menu),
   so its message, timestamp, deep links, per-item close and the "mark all read" control
   must use the same readable light text. The default dropdown-item-text / .text-muted /
   link colours are dark, which is unreadable (dark-on-dark) here. The feed lives in the
   system bar, NOT the sidebar .navbar, so the selector is scoped to the menu id. */
#sm-notif-menu .sm-notif-feed-item,
#sm-notif-menu .sm-notif-feed-item .text-muted,
#sm-notif-menu .sm-notif-clear-all {
    color: var(--white) !important;
}

    #sm-notif-menu .sm-notif-feed-item a,
    #sm-notif-menu .sm-notif-feed-item .sm-notif-mark-read {
        color: var(--white) !important;
    }

    #sm-notif-menu .sm-notif-feed-item a {
        text-decoration: underline;
    }


/* System Admin sidebar submenus (Logs / Testing) -- Session 108.
   Nested Bootstrap collapse panels inside the System Admin dropdown-menu,
   not a hover flyout -- a right-side flyout would be clipped by the
   sidebar's overflow-y:auto regardless of --sidebar-width. */
.sm-submenu-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
}
.sm-submenu-chevron {
    transition: transform .15s ease;
    font-size: .75rem;
}
.sm-submenu-toggle[aria-expanded="true"] .sm-submenu-chevron {
    transform: rotate(90deg);
}
.sm-submenu {
    background-color: rgba(0,0,0,.15);
}
.sm-submenu-item {
    padding-left: 2.75rem !important;
    font-size: .92rem;
}

/* Sidebar width drag handle (Session 108). Sits on the right edge of .sidebar,
   same visual/interaction pattern as .sm-detail-resize-handle (Shipment List)
   and .sm-search-resize-handle. Width itself is set via the --sidebar-width
   custom property (Base.css :root) -- sidebar-resize.js only ever writes that
   one variable, never a hardcoded style, so Base.css stays the single source
   of truth for the default. */
.sm-sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    background: transparent;
    z-index: 1031; /* above .sidebar's own z-index: 1030 */
}
.sm-sidebar-resize-handle:hover,
.sm-sidebar-resize-handle.dragging {
    background: rgba(88,103,221,.35); /* var(--primary) at low opacity */
}
/* Dragging: disable the sidebar's own width transition so the handle tracks
   the mouse 1:1 instead of easing behind it. */
body.sm-sidebar-resizing .sidebar {
    transition: none !important;
}
body.sm-sidebar-resizing {
    cursor: col-resize !important;
    user-select: none;
}


.bg-success {
    background-color: var(--success) !important;
    color: var(--white);
}

.bg-danger {
    background-color: var(--danger) !important;
    color: var(--white);
}

.bg-warning {
    background-color: var(--warning) !important;
    color: var(--dark);
}

.bg-info {
    background-color: var(--info) !important;
    color: var(--white);
}

.bg-primary {
    background-color: var(--primary) !important;
    color: var(--white);
}


/* ==========================================================================
   14) Full Height Layout + Footer Stick
   --------------------------------------------------------------------------
   Ensures layout stretches to viewport height and footer sits at bottom when
   content is short.
   ========================================================================== */
html, body {
    height: 100%;
}

/* Outer wrapper containing sidebar + content */
.container-fluid.position-relative.d-flex.p-0 {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    align-items: stretch;
}

/* Right-hand content column */
.content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 100vh;
}

    /* Footer within .content: push to bottom */
    .content > .container-fluid.pt-4.px-4:last-child {
        margin-top: auto;
        width: 100%;
        padding-left: var(--bs-gutter-x);
        padding-right: var(--bs-gutter-x);
        border-top: 1px solid rgba(255,255,255,0.1);
    }


/* ==========================================================================
   15) Logon Form Disabled Fade
   ========================================================================== */
form[asp-action="LogOn"][disabled],
form[asp-action="LogOn"] input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* ==========================================================================
   16) Stops Editor Component
   --------------------------------------------------------------------------
   Principles:
   - Single horizontal scroll surface at the panel level (#stops-editor-container)
   - Deterministic grid rows with minmax + 1fr scaling
   - No per-row overflow scroll
   ========================================================================== */

/* Stop header (clickable collapsible row) */
.stop-editor .stop-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

/* Header labels: normalized to global label tokens */
.stop-header .stop-hdr-lbl {
    white-space: nowrap;
    font-size: var(--ui-label-font-size);
    line-height: var(--ui-label-line-height);
    font-weight: 500;
}

/* Elastic header fields: share remaining space */
.stop-header .stop-hdr-name,
.stop-header .stop-hdr-loc-name {
    flex: 1 1 0;
    min-width: 140px;
}

/* Fixed-width location type dropdown (keeps header stable) */
.stop-header .stop-hdr-loc-type {
    flex: 0 0 190px;
}

/* Collapse behavior */
.stop-editor.collapsed .stop-body {
    display: none;
}

.stop-editor:not(.collapsed) .stop-summary {
    display: none;
}

/* Fixed stops (start/end) are always expanded and not meant to collapse */
.stop-editor.stop-fixed .stop-header {
    cursor: default;
}

.stop-editor.stop-fixed .stop-details {
    display: block !important;
}

/* Panel-level scroll surface for the Stops editor */
#stops-editor-container {
    display: block;
    min-height: 0;
    /* Single horizontal scroll surface for the entire Stops panel */
    overflow-x: auto;
    overflow-y: visible;
    max-height: none;
    padding-right: 0;
}

/* Do not create a nested scroll region inside Stops */
#additional-stops-list {
    overflow: visible;
    max-height: none;
    padding-right: 0;
}

/* Sticky add buttons (visible while scrolling the page) */
.stops-add-buttons {
    position: sticky;
    bottom: 0;
    background: var(--bs-body-bg);
    padding: 0.75rem 0;
    z-index: 5;
    border-top: 1px solid rgba(0,0,0,.1);
}

/* Visual grouping for additional stops */
.additional-stops-lane {
    background: rgba(0, 123, 255, 0.06);
    border: 1px solid rgba(0, 123, 255, 0.15);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
}

.additional-stop-item {
    padding: 6px 0;
}

.additional-stop-separator {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    margin: 8px 0;
}

/* Stops editor internal wrapper: no independent scrolling */
.stop-form-wrap {
    overflow-x: visible !important;
    overflow-y: visible !important;
    padding-bottom: 6px !important;
}

/* Base stop grid behavior:
   - Deterministic columns per row template
   - Children can shrink in minmax() tracks via min-width: 0 */
.stop-grid {
    display: grid;
    align-items: center;
    white-space: nowrap;
    row-gap: 3px;
    column-gap: 10px;
    overflow-x: visible;
    overflow-y: visible;
}

    .stop-grid > * {
        min-width: 0;
    }

    /* Label alignment within the stop grid */
    .stop-grid > .lbl {
        justify-self: end;
        text-align: right;
        padding-right: 6px;
        white-space: nowrap;
    }

    /* Minimum widths for compact utility fields */
    .stop-grid input[placeholder="Intl"] {
        min-width: 60px;
    }

    .stop-grid input[placeholder="Ext"] {
        min-width: 70px;
    }

    .stop-grid input[type="time"] {
        min-width: 110px;
    }

/* Stop Editor scoped label behavior:
   Labels hug content; no fixed widths */
.stop-editor .stop-grid > .lbl,
.stop-editor .stop-grid > label,
.stop-editor .stop-grid .stop-label {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    justify-self: end;
    text-align: right;
    padding-right: 6px;
    white-space: nowrap;
}

/* Stop editor scoped grid:
   Slightly looser vertical rhythm within the expanded stop body */
.stop-editor .stop-grid {
    display: grid;
    align-items: center;
    white-space: nowrap;
    row-gap: 4px; /* overrides base row-gap for readability */
    column-gap: 10px;
    overflow-x: visible;
    overflow-y: visible;
}

    /* Row templates (authoritative) */
    .stop-editor .stop-grid.grid-row-1 {
        grid-template-columns: max-content minmax(120px, 160px) max-content minmax(260px, 1fr) !important;
    }

    .stop-editor .stop-grid.grid-row-2,
    .stop-editor .stop-grid.grid-row-4 {
        grid-template-columns: max-content minmax(220px, 1fr) max-content minmax(220px, 1fr) !important;
    }

    .stop-editor .stop-grid.grid-row-3 {
        grid-template-columns: max-content minmax(180px, 1fr) max-content minmax(90px, 120px) max-content minmax(90px, 120px) max-content minmax(216px, 1fr) !important;
    }

    .stop-editor .stop-grid.grid-row-5 {
        grid-template-columns: max-content minmax(140px, 170px) max-content minmax(150px, 180px) minmax(90px, 90px) minmax(70px, 90px) max-content minmax(110px, 1fr) !important;
    }

    .stop-editor .stop-grid.grid-row-6 {
        grid-template-columns: max-content minmax(110px, 120px) max-content minmax(110px, 120px) max-content minmax(160px, 2000px) !important;
    }

        .stop-editor .stop-grid.grid-row-6 .stop-appt-dt {
            min-width: 120px;
        }


/* ==========================================================================
   17) Panel Horizontal Scroll Standard
   ========================================================================== */
.panel-scroll-x {
    overflow-x: auto;
    overflow-y: visible;
    min-width: 0;
}


/* ==========================================================================
   18) Shipment Details Grid Framework (Workstation Standard)
   ========================================================================== */
.shipment-details-grid {
    display: grid;
    row-gap: 4px;
    column-gap: 12px;
    white-space: nowrap;
}

.shipment-details-row {
    display: grid;
    align-items: center;
    column-gap: 10px;
}

    .shipment-details-row > .lbl {
        justify-self: end;
        text-align: right;
        white-space: nowrap;
        padding-right: 6px;
    }

    .shipment-details-row > * {
        min-width: 0;
    }

    /* Inputs/selects fill their tracks */
    .shipment-details-row input[type="text"],
    .shipment-details-row input[type="date"],
    .shipment-details-row input[type="number"],
    .shipment-details-row select {
        width: 100%;
    }

    /* Checkbox cells: flex-centre the input vertically and pull close to label.
       The grid column-gap (10px) is correct for text inputs but feels wide
       for a small checkbox — negative margin closes that gap. */
    .shipment-details-row .chk {
        display: flex;
        align-items: center;
        margin-left: -6px;
    }

    /* Row templates */
    .shipment-details-row.row-0 {
        grid-template-columns: max-content auto;
        margin-bottom: 8px;
    }

    /* Record layout toggle -- tighten padding for 4 buttons */
    #record-layout-group .btn {
        font-size: 0.8rem;
        padding: 0.22rem 0.45rem;
    }

    .shipment-details-row.row-1 {
        grid-template-columns: max-content minmax(10.5rem, 10.5rem) max-content minmax(14ch, 14ch) max-content minmax(14ch, 14ch) max-content minmax(10.5rem, 10.5rem);
    }

    /* row-6pair: Code | Name | Branch Code | Branch | Currency | Hold lbl | Hold chk | Date lbl | Date input
       Date input always visible; disabled until checkbox is checked (JS sets disabled attribute).
       Name column uses a fixed ceiling (300px) so client-name and carrier-name render
       identically across both rows despite differing label widths ("Branch Code" vs "Terminal Code").
       Branch/Terminal Code column matches the Code column max (9ch). */
    .shipment-details-row.row-6pair {
        grid-template-columns:
            max-content minmax(9ch, 9ch)      /* Code  + code select */
            max-content minmax(200px, 300px)  /* Name  + name select (fixed ceiling = consistent across rows) */
            max-content minmax(9ch, 9ch)      /* Branch/Terminal Code + select (matches Code column) */
            max-content minmax(140px, 220px)  /* Branch/Terminal + select */
            max-content minmax(4ch, 9ch)      /* Currency + select */
            max-content minmax(26px, 26px)    /* Hold lbl + chk (fixed chk width) */
            max-content minmax(9rem, 9rem);   /* Date lbl + date input (hidden until checked) */
    }

    .shipment-details-row.row-4 {
        grid-template-columns: max-content minmax(14ch, 14ch) max-content minmax(10.5rem, 10.5rem) max-content minmax(180px, 1fr) max-content minmax(180px, 1fr) max-content minmax(180px, 1fr);
    }

    .shipment-details-row.row-service {
        grid-template-columns: max-content minmax(260px, 420px);
    }

    /* row-requirements: Loading Requirements | Delivery Requirements — each ~half width */
    .shipment-details-row.row-requirements {
        grid-template-columns: max-content 1fr max-content 1fr;
    }

@media (max-width: 768px) {
    .shipment-details-row {
        grid-template-columns: max-content 1fr !important;
        white-space: normal;
        row-gap: 6px;
    }

    .shipment-details-grid {
        white-space: normal;
    }
}

.shipment-section-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1f4e79;
    background: rgba(0, 123, 255, 0.06);
    border: 1px solid rgba(0, 123, 255, 0.15);
    border-radius: 4px;
    padding: 2px 8px;
    line-height: 1.2;
    white-space: nowrap;
    display: inline-block;
}

.is-locked,
.form-control:disabled,
.form-select:disabled,
input:disabled,
select:disabled {
    background-color: #f4f4f4 !important;
    color: #666 !important;
}

/* DM Load Number — highlighted so it stands out as the primary shipment key */
.dm-load-number-display {
    background-color: #fffde7 !important;
    color: #333 !important;
    font-weight: 600;
}


/* ==========================================================================
   19) Shipment Workbench (Main + Tools Split-Pane)
   ========================================================================== */
.shipment-workbench {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-height: 0;
}

.shipment-workbench-main {
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 0.75rem;
    position: relative; /* required: new-shipment overlay uses position:absolute */
}

.shipment-tools-shell {
    --tools-width: 650px;
    flex: 0 0 auto;
    position: sticky;
    top: 1rem;
    height: calc(100vh - 2rem);
    display: flex;
    align-items: stretch;
    z-index: 5;
}

.shipment-tools-handle {
    width: 2.75rem;
    border: 1px solid rgba(0,0,0,.125);
    border-right: none;
    border-top-left-radius: .375rem;
    border-bottom-left-radius: .375rem;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 .125rem .25rem rgba(0,0,0,.075);
}

    .shipment-tools-handle span {
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        font-weight: 600;
        letter-spacing: .04em;
    }

.shipment-tools-pane {
    container-type: inline-size;
    container-name: tools-panel;
    position: relative; /* required: overlay uses position:absolute; do NOT set this via JS */
    width: var(--tools-width);
    min-width: 415px;  /* prevent resizer collapsing below usable content width */
    max-width: 70vw;
    border: 1px solid rgba(0,0,0,.125);
    border-top-right-radius: .375rem;
    border-bottom-right-radius: .375rem;
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 .125rem .25rem rgba(0,0,0,.075);
}

.shipment-tools-resizer {
    width: 8px;
    cursor: col-resize;
    background: transparent;
    position: absolute;
    left: 0;   /* pane has position:relative -- 0 places drag seam at the pane's left border */
    top: 0;
    bottom: 0;
    z-index: 10;
}
.shipment-tools-resizer:hover,
.shipment-tools-resizer:active {
    background: rgba(13,110,253,.2);
}

body.tools-resizing {
    cursor: col-resize !important;
    user-select: none;
}

.shipment-tools-card {
    border: 0;
    border-radius: 0;
}

.shipment-tools-body {
    overflow: auto;
    min-height: 0;
}

/* Tools pane tab nav -- match grid detail panel sizing */
#shipment-tools-tabs .nav-link {
    font-size: 0.78rem;
    padding: 5px 10px;
    white-space: nowrap;
}

.shipment-tools-shell.tools-closed .shipment-tools-pane {
    width: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    display: none;
}

.shipment-tools-shell.tools-closed .shipment-tools-resizer {
    display: none;
}

@media (max-width: 991.98px) {
    .shipment-workbench {
        display: block;
    }

    .shipment-workbench-main {
        padding-right: 0;
    }

    .shipment-tools-shell {
        position: static;
        height: auto;
        margin-top: 1rem;
    }

    .shipment-tools-handle span {
        writing-mode: horizontal-tb;
        transform: none;
    }

    .shipment-tools-handle {
        width: 100%;
        border-right: 1px solid rgba(0,0,0,.125);
        border-top-right-radius: .375rem;
        border-bottom-left-radius: 0;
        justify-content: flex-start;
        padding: .5rem .75rem;
    }

    .shipment-tools-pane {
        width: 100%;
        max-width: none;
        border-top-left-radius: 0;
    }

    .shipment-tools-resizer {
        display: none;
    }
}


/* =====================================================================
   PRODUCTS PANEL (Buttons appended to Row 1)
   ---------------------------------------------------------------------
   Goal:
   - Keep the default product fields layout stable.
   - Put BOTH buttons at the end of ROW 1, in this order:
       [Advanced] [Delete]
   - Row 2 has NO button column anymore.
   - No right-locking / no extra action column tricks.
   - Panel scrolls horizontally when needed (no overlap).
   ===================================================================== */

#products-editor-container.products-scroll {
    max-height: 520px;
    overflow-y: auto;
    overflow-x: auto;
}

.products-editor {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-block {
    padding: 10px;
}

/* =========================
   Row 1 (always visible)
   Pieces | Weight | Actual Class | Billed Class | Package Type | Advanced | Delete
   ========================= */
.product-grid-row-1 {
    display: grid;
    align-items: center;
    column-gap: 10px;

    grid-template-columns:
        140px                 /* Pieces */
        160px                 /* Weight */
        minmax(140px, 160px)  /* Actual Class */
        minmax(140px, 160px)  /* Billed Class */
        minmax(240px, 300px)  /* Package Type */
        1fr                   /* spacer — pushes button group to right edge */
        auto;                 /* button group (Advanced + Delete together) */

    min-width: 1100px;        /* scroll instead of overlap */
}

.product-grid-row-1 .product-btn-group {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-self: end;
}
.product-grid-row-1 .product-adv-toggle,
.product-grid-row-1 .btn-delete-product {
    white-space: nowrap;
}

/* =========================
   Row 2 (always visible)
   Description | L | W | H | Cubes
   ========================= */
.product-grid-row-2 {
    display: grid;
    align-items: center;
    column-gap: 10px;
    margin-top: 6px;

    grid-template-columns:
        minmax(520px, 1fr)    /* Description (elastic) */
        110px                 /* L */
        110px                 /* W */
        110px                 /* H */
        140px;                /* Cubes */

    min-width: 990px;
}

/* =========================
   Advanced block (toggle by JS)
   ========================= */
.product-advanced {
    margin-top: 10px;
}

.product-block .product-advanced[hidden] {
    display: none !important;
}

/* =========================
   Field wrapper (.pf)
   ========================= */
.pf {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.pf-lbl {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 12px;
}

.pf-in {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

/* Numeric caps: only for INPUTs (never for SELECTs) */
.product-block input.pf-num-3 { max-width: 84px; }
.product-block input.pf-num-4 { max-width: 96px; }
.product-block input.pf-num-5 { max-width: 112px; }

/* =====================================================================
   PRODUCTS PANEL - Advanced Panel Row Layout (ADV ONLY)
   ---------------------------------------------------------------------
   Organizes the advanced fields into 3 explicit rows without touching
   the primary products layout.
   Labels remain inline (same line as fields).
   ===================================================================== */

.product-advanced .product-adv-row {
    display: grid;
    align-items: center;
    column-gap: 10px;
    row-gap: 6px;
    margin-top: 6px;
    width: max-content;   /* row defines its own intrinsic width from template columns */
    min-width: 100%;      /* but also stretch to container when there is room */
}

/* Row 1: 7 fields */
.product-advanced .product-adv-row-1 {
    grid-template-columns:
        160px   /* Line # */
        150px   /* Qty Shipped */
        150px   /* Case Qty */
        180px   /* SKU */
        180px   /* NMFC */
        140px   /* Hazardous */
        140px;  /* Condition */
}

/* Row 2: 6 fields */
.product-advanced .product-adv-row-2 {
    grid-template-columns:
        160px   /* Unit Value */
        160px   /* Total Value */
        190px   /* Item # */
        160px   /* Size */
        160px   /* Style */
        170px;  /* Color */
}

/* Row 3: 4 fields */
.product-advanced .product-adv-row-3 {
    grid-template-columns:
        minmax(180px, 1fr)  /* Reference */
        minmax(120px, 1fr)  /* PO Ref */
        minmax(280px, 1fr)  /* Catalog Listing */
        220px;              /* Product Status */
}

/* Keep checkbox aligned with its label in the inline .pf layout */
.product-advanced .pf input.form-check-input {
    margin-top: 0;
}

/* =====================================================================
   PRODUCTS PANEL - Advanced Layout Fix (stack rows, no overlap)
   ---------------------------------------------------------------------
   Problem:
   - .product-grid-advanced was a 3-column grid.
   - We then placed three row-wrappers (.product-adv-row-1/2/3) inside it.
   - Result: the three row wrappers were laid out side-by-side across those 3 columns,
     and their internal grids collided/overlapped visually.

   Fix:
   - Make .product-grid-advanced a simple vertical stack container.
   - Let each .product-adv-row define its own grid columns.
   - Preserve inline labels (label + field on same line).
   ===================================================================== */

/* Stack the three advanced rows vertically instead of side-by-side */
.product-grid-advanced {
    display: block !important;
}



#appConfirmModal .modal-header {
    background-color: var(--secondary);
    border-bottom: 1px solid rgba(255,255,255,.15);
}

#appConfirmModal .modal-title {
    color: var(--white);
    font-weight: 600;
}

#appConfirmModal .modal-body {
    color: #212529;
}

/* ======================================================
   Tools Panel — References Tab
   ====================================================== */

/* Two-column [label | input | label | input] grid, consistent with
   shipment-details-row. Labels are direct grid children with .lbl
   (right-aligned). Collapses to one column when the panel is narrow. */
.tools-ref-fields {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
    row-gap: 6px;
    padding: 4px 0;
}

.tools-ref-fields > .lbl {
    justify-self: end;
    text-align: right;
    white-space: nowrap;
    padding-right: 4px;
}

.tools-ref-fields > .form-control {
    width: 100%;
    min-width: 0;
}

/* Collapse to single [label | input] column when panel is narrow */
@container tools-panel (max-width: 340px) {
    .tools-ref-fields {
        grid-template-columns: max-content minmax(0, 1fr);
    }
}

/* ======================================================
   Load Units Panel
   ====================================================== */
.loadunit-editor {
    margin-bottom: 0.6rem;
}

.loadunit-grid-row-1 {
    display: grid;
    align-items: center;
    column-gap: 10px;
    grid-template-columns:
        minmax(240px,1fr)
        90px
        80px
        80px
        80px
        100px
        120px;
    min-width:700px;
}
/* ======================================================
   Reference Numbers / Dates Grid
   (shared by References tab and future Dates tab)
   ====================================================== */

/* Toolbar row: type selector + add button */
.refdata-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.refdata-toolbar select {
    flex: 1 1 auto;
    min-width: 120px;  /* never collapse too small */
    max-width: none;   /* grow with the panel — no artificial cap */
}

/* One row per reference / date entry.
   Label column: at least 120px, grows up to 220px so longer type names
   (e.g. "Purchase Order Number") show fully when the panel has room.
   Value column: takes all remaining space. */
.refnum-row,
.refdate-row {
    display: grid;
    align-items: center;
    gap: 6px;
    grid-template-columns: minmax(120px, 220px) 1fr 28px;
    margin-bottom: 4px;
}

/* Type label — fixed-width, right-aligned, muted */
.refnum-type-label,
.refdate-type-label {
    font-size: 0.8rem;
    color: var(--bs-secondary-color, #6c757d);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 4px;
}

/* Delete (×) button */
.btn-delete-refnum,
.btn-delete-refdate {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    color: var(--bs-danger, #dc3545);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.btn-delete-refnum:hover,
.btn-delete-refdate:hover {
    background: rgba(220, 53, 69, 0.08);
    border-color: var(--bs-danger, #dc3545);
}

/* Locked (imported) value inputs */
.refnum-value.is-locked,
.refdate-value.is-locked {
    background-color: var(--bs-secondary-bg, #e9ecef);
    cursor: not-allowed;
}

/* ======================================================
   Rating Tab
   ====================================================== */

/* Unlock toggle row */
.rating-unlock-row {
    padding: 4px 0 6px 0;
    border-bottom: 1px solid rgba(0,0,0,.1);
    margin-bottom: 6px;
}

/* Two-column grid: [carrier-col | client-col]
   A solid vertical centre line is painted via CSS background — no DOM divider
   elements needed. Full-width row spans use .rating-row-divider.
   Padding ensures field content doesn’t touch the centre line. */
.rating-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    row-gap: 4px;
    column-gap: 0;
    position: relative;
}

/* Solid vertical centre line drawn as a pseudo-element so it spans
   continuously from top to bottom of the grid without gaps. */
.rating-grid::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(0,0,0,.35);
    pointer-events: none;
}

/* Column header labels */
.rating-col-header {
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #1f4e79;
    padding-bottom: 4px;
    border-bottom: 2px solid #1f4e79;
    margin-bottom: 2px;
}

/* Horizontal divider spanning both columns */
.rating-row-divider {
    grid-column: 1 / -1;
    border-top: 1px solid rgba(0,0,0,.25);
    margin: 4px 0;
}

/* Invoice row highlight — matches additional-stops-lane blue tint */
.rating-invoice-row {
    background: rgba(0, 123, 255, 0.06);
}

/* ----------------------------------------------------------
   Rating field sizing tokens
   All rate fields use the same standard width.
   ---------------------------------------------------------- */
:root {
    --rf-std: 7rem;   /* Base Rate, Discount, Net Rate, FSC %, FSC $, Other, etc. */
}

/* Single field group: [label right-aligned | fixed-width input]
   Right-column groups get extra left padding to clear the centre line. */
.rating-field-group {
    display: grid;
    grid-template-columns: 1fr var(--rf-std);  /* label takes remaining space, input is fixed */
    align-items: center;
    column-gap: 6px;
    row-gap: 3px;
    padding: 1px 4px;
    min-width: 0;
}

/* Right-column .rating-field-group: nudge away from the centre line */
.rating-grid > .rating-field-group:nth-child(even) {
    padding-left: 8px;
}

/* Empty spacer cell (carrier side for client-only rows) */
.rating-field-group.rating-empty {
    min-height: 1px;
}

/* Labels inside the rating grid — right-aligned within their track */
.rating-lbl {
    font-size: 0.78rem;
    white-space: nowrap;
    text-align: right;
    padding-right: 4px;
    color: #444;
    justify-self: end;   /* right-align inside 1fr label track */
}

/* Inputs inside the rating grid and post-invoice section — compact height */
.rating-grid .form-control,
.rating-post-invoice .form-control {
    font-size: 0.82rem;
    padding: 2px 5px;
    height: auto;
    width: 100%;
    min-width: 0;
}

/* Read-only locked fields in rating areas */
.rating-grid .is-locked,
.rating-post-invoice .is-locked {
    background-color: #f0f0f0 !important;
    color: #555 !important;
    cursor: not-allowed;
}

/* Post-invoice section: two equal columns matching the rating-grid above.
   No centre line. Inputs in column 2 visually align with Client column above. */
.rating-post-invoice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    row-gap: 4px;
    column-gap: 0;
    margin-top: 4px;
}

/* Right-column groups in post-invoice get the same left padding as in the grid */
.rating-post-invoice > .rating-field-group:nth-child(even),
.rating-post-invoice > .rating-field-group:only-child {
    padding-left: 8px;
}

/* Over Road Rate: full-width row — label flows left, input right-aligned
   to match the fixed --rf-std width of the fields in the client column above. */
.rating-overroad-row {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    padding: 1px 4px 1px 4px;
}
.rating-overroad-row .rating-lbl {
    flex: 1 1 auto;   /* label expands to fill available space */
    text-align: right;
    padding-right: 6px;
}
.rating-overroad-row .form-control {
    flex: 0 0 var(--rf-std);
    width: var(--rf-std);
}

/* =========================================================
   Panel Summary Fields (Products + Load Units card headers)
   Sit inline after the panel title, before the Add button.
   ========================================================= */
.panel-summary-fields {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;       /* graceful fallback on narrow cards */
    flex: 1 1 auto;        /* take remaining space between title and button */
}
.panel-summary-item {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.panel-summary-lbl {
    font-size: 0.78rem;
    color: #555;
    font-weight: 500;
    margin: 0;
}
.panel-summary-field {
    width: 6rem;           /* compact fixed width — enough for numeric values */
    min-width: 4rem;
    font-size: 0.8rem;
    padding: 2px 6px;
    height: auto;
}

/* The hold-date inline wrapper (last 2 grid cells of row-6pair).
   Always visible — JS enables/disables the date input via the disabled attribute. */
.hold-date-inline {
    display: contents; /* participates in parent grid without adding a box */
}
/* Spacing: pull the Date label away from the checkbox */
.hold-date-inline > .lbl {
    padding-left: 8px;
}
/* Make the date input fill its fixed track */
.hold-date-inline input[type="date"] {
    width: 9rem;
}

/* ============================================================
   Transportation Status Tab
   ============================================================ */

/* Entry toolbar — same pattern as refdata-toolbar */
.transstatus-toolbar {
    display: grid;
    grid-template-columns: max-content minmax(0,1fr) max-content minmax(0,1fr);
    gap: 4px 8px;
    align-items: center;
    margin-bottom: 0.5rem;
}
.transstatus-toolbar .lbl {
    justify-self: end;
    text-align: right;
    font-size: 0.82rem;
    white-space: nowrap;
}

/* Scrollable wrapper — horizontal + vertical scroll */
#transstatus-editor-container {
    max-height: 260px;
    overflow-y: auto;
    overflow-x: auto;
}

/*
  Single flat grid — header spans and all row cells are direct children
  of .transstatus-grid-inner via display:contents on header/row divs.
  All cells in the same column share the same column width — perfect alignment guaranteed.

  Columns:  Trans.  Status Date  Status         Reason         Description     City            St      Del
*/
.transstatus-grid-inner {
    display: grid;
    grid-template-columns: 48px 155px minmax(160px,auto) minmax(160px,auto) minmax(200px,auto) minmax(80px,auto) minmax(40px,auto) 32px;
    column-gap: 10px;
    align-items: baseline;   /* baseline keeps header text visually aligned with first row */
    font-size: 0.82rem;
    width: max-content;      /* shrink-wraps content; parent overflow-x:auto provides scrollbar */
}

/* Header and rows become transparent wrappers —
   their child spans flow directly into the parent grid columns */
.transstatus-grid-header,
.transstatus-row {
    display: contents;
}

/* ALL cells (header + data) share these base styles so padding is identical */
.transstatus-grid-header > span,
.transstatus-row > span {
    white-space: nowrap;
    text-align: left;
    padding: 3px 6px 3px 0;  /* consistent padding — no left indent, small right gap */
}

/* Header cell overrides */
.transstatus-grid-header > span {
    font-weight: 600;
    color: #555;
    padding-bottom: 5px;
    border-bottom: 2px solid #dee2e6;
    align-self: end;         /* pins header row to bottom so border lines up cleanly */
}

/* Data row dividers */
.transstatus-row > span {
    border-bottom: 1px solid #f0f0f0;
}

/* No divider on last row */
.transstatus-row:last-child > span {
    border-bottom: none;
}


/* Column-specific overrides */
.ts-trans {
    text-align: center;
    padding-right: 0;
}
.ts-del {
    text-align: center;
    padding-right: 0;
}
.btn-delete-transstatus {
    padding: 0 4px;
    font-size: 0.75rem;
    line-height: 1.4;
}

/* Shared rule for all panel delete buttons.
   align-self:center prevents flex containers from stretching the button.
   justify-self:end right-aligns the button when it is a direct grid child
   (Products row). No-op in flex contexts. */
.btn-delete-product,
.btn-delete-loadunit,
.btn-delete-acc,
.btn-delete-svc,
.btn-delete-adj,
.btn-delete-cadj {
    align-self: center;
    justify-self: end;
}

/* Load Units: delete button is wrapped in .pf-btn which is the grid child.
   Right-align the wrapper so the button sits at the right edge of the row. */
.loadunit-grid-row-1 .pf-btn {
    justify-self: end;
    display: flex;
    align-items: center;
}

/* Transmitted status icons — filled/hollow circle pair, same size for visual consistency */
.ts-icon-transmitted {
    color: #198754;    /* Bootstrap success green — filled circle ● */
    font-size: 0.85rem;
}
.ts-icon-pending {
    color: #adb5bd;    /* Bootstrap gray-400 — hollow circle ○, muted/not alarming */
    font-size: 0.85rem;
}

/* =========================================================================
   Record Status tab grid
   Same display:contents pattern as Trans. Status grid.
   Columns: Status  |  Created  |  Deactivated  |  Deactivate (action)
   ========================================================================= */
#recordstatus-editor-container {
    overflow-x: auto;
}

.recordstatus-grid-inner {
    display: grid;
    grid-template-columns: minmax(140px,auto) 110px 110px 32px;
    column-gap: 10px;
    align-items: baseline;
    font-size: 0.82rem;
    width: max-content;
}

.recordstatus-grid-header,
.recordstatus-row {
    display: contents;
}

.recordstatus-grid-header > span,
.recordstatus-row > span {
    white-space: nowrap;
    text-align: left;
    padding: 3px 6px 3px 0;
}

.recordstatus-grid-header > span {
    font-weight: 600;
    color: #555;
    padding-bottom: 5px;
    border-bottom: 2px solid #dee2e6;
    align-self: end;
}

.recordstatus-row > span {
    border-bottom: 1px solid #f0f0f0;
}

.recordstatus-row:last-child > span {
    border-bottom: none;
}

/* Deactivated rows — muted to signal they are no longer active */
.recordstatus-row.is-deactivated > span {
    color: #adb5bd;
    font-style: italic;
}

/* ==========================================================================
   Pop-out panel chrome
   Used by _PopoutLayout.cshtml — shared by all panel pop-out windows.
   ========================================================================== */

/* Prevent the main layout body scroll style from bleeding in */
body.popout-panel-window {
    margin: 0;
    padding: 0;
    background: #f8f9fa;
}

/* Fixed title bar at the top of every pop-out window */
.popout-titlebar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    background: #212529;
    color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 100;
    font-size: 0.85rem;
    min-height: 2.25rem;
}

.popout-titlebar-label {
    font-weight: 600;
    white-space: nowrap;
}

.popout-titlebar-hint {
    color: #adb5bd;
}

.popout-titlebar-btn,
.popout-close-btn {
    color: #f8f9fa;
    border-color: #6c757d;
    font-size: 0.78rem;
    padding: 0.15rem 0.5rem;
    line-height: 1.4;
}
.popout-close-btn {
    margin-left: auto;
}
.popout-titlebar-btn:hover,
.popout-close-btn:hover {
    background: #6c757d;
    color: #fff;
}

/* Scrollable body area below the title bar */
.popout-panel-body {
    overflow-y: auto;
    padding: 0.75rem;
}

/* ==========================================================================
   Pop-out launch bar (appears at top of panels that support pop-out)
   ========================================================================== */

.panel-popout-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 3px 8px;
    margin-bottom: 6px;
    background: rgba(0, 123, 255, 0.06);
    border: 1px solid rgba(0, 123, 255, 0.15);
    border-radius: 4px;
}

.panel-popout-btn {
    font-size: 0.78rem;
    padding: 0.15rem 0.55rem;
    color: #1f4e79;
    border-color: rgba(0, 123, 255, 0.3);
    background: transparent;
}

.panel-popout-btn:hover {
    color: #fff;
    border-color: #1f4e79;
    background: #1f4e79;
}

/* ==========================================================================
   New main-column panels: Accessorials, Service Providers, Other Financials,
   Client Adjustments, Carrier Adjustments
   ========================================================================== */

/* ==========================================================================
   Panel row pattern — shared by Accessorials, Service Providers, Adjustments
   (replaces old grid-inner / header-row approach)
   ========================================================================== */

/* Each record = a flex row; labels sit directly next to their fields */
.panel-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 5px 4px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.82rem;
}
.panel-row:last-child { border-bottom: none; }

/* label + field pair */
.panel-field {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.panel-lbl {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    white-space: nowrap;
    flex-shrink: 0;
}

/* money inputs — compact fixed width */
.panel-money {
    width: 80px;
    font-size: 0.8rem;
    padding: 2px 4px;
    height: 26px;
}

/* comment field + action buttons — always wrap as a unit, never split */
.panel-comment-field {
    flex: 1 1 200px;
    min-width: 0;          /* allows input to shrink */
    white-space: nowrap;   /* buttons stay on same line as input */
}
.panel-comment-input {
    font-size: 0.8rem;
    padding: 2px 6px;
    height: 26px;
    width: auto;
    flex: 1 1 auto;
    min-width: 60px;       /* can shrink but not disappear */
}

/* truncated comment preview */
.panel-comment-text {
    font-size: 0.8rem;
    color: #444;
    font-style: italic;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* service name input — locked, sized to content */
.panel-svc-name-input {
    min-width: 140px;
    max-width: 240px;
    font-size: 0.82rem;
    font-weight: 600;
}

/* Forces a new flex line within a panel-row — use as an empty span */
.panel-row-break {
    width: 100%;
    height: 0;
    margin: 0;
    padding: 0;
}

/* Pro/load number display — sized to hold a full DM load number (up to 10 digits) */
.panel-adj-pro {
    width: 90px;
    font-family: monospace;
    font-size: 0.82rem;
}

/* Locked type/reason display in panel rows */
.panel-type-display  { width: 160px; font-size: 0.80rem; }
.panel-status-field  { width: 130px; font-size: 0.80rem; }
.panel-carrier-display { min-width: 140px; font-size: 0.80rem; }

/* ---- Toolbars (shared compact pattern) ---- */
.acc-toolbar,
.svc-toolbar,
.adj-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0.4rem 0;
}
.acc-toolbar select { max-width: 220px; }
.svc-toolbar select { max-width: 280px; flex: 1 1 auto; }

/* ---- Other Financials card ---- */
#of-panel-body > .card-body { overflow-x: auto; }

/* Money section: 3 label+input pairs per row */
.of-money-section {
    display: grid;
    grid-template-columns: max-content 72px max-content 72px max-content 72px;
    gap: 4px 10px;
    align-items: center;
    margin-bottom: 8px;
}
.of-money-section > .lbl {
    justify-self: end;
    text-align: right;
    font-size: 0.80rem;
    white-space: nowrap;
    color: #6c757d;
    font-weight: 600;
}
.of-money-section .form-control {
    font-size: 0.80rem;
    padding: 2px 4px;
    height: 26px;
}

/* Misc section (dates, dropdowns, ComChk ref): 2 per row, inputs wider */
.of-misc-section {
    display: grid;
    grid-template-columns: max-content minmax(100px,180px) max-content minmax(120px,1fr);
    gap: 4px 10px;
    align-items: center;
    margin-bottom: 8px;
}
.of-misc-section > .lbl {
    justify-self: end;
    text-align: right;
    font-size: 0.80rem;
    white-space: nowrap;
    color: #6c757d;
    font-weight: 600;
}
.of-misc-section .form-control,
.of-misc-section .form-select {
    font-size: 0.80rem;
    padding: 2px 6px;
    height: 26px;
}

/* Compact 3-pair row for short fields (ComChk Ref, Dispute Status, Dispute Type) */
.of-short-section {
    display: grid;
    grid-template-columns: max-content minmax(80px,120px) max-content minmax(90px,130px) max-content minmax(100px,1fr);
    gap: 4px 10px;
    align-items: center;
    margin-bottom: 8px;
}
.of-short-section > .lbl {
    justify-self: end;
    text-align: right;
    font-size: 0.80rem;
    white-space: nowrap;
    color: #6c757d;
    font-weight: 600;
}
.of-short-section .form-control,
.of-short-section .form-select {
    font-size: 0.80rem;
    padding: 2px 6px;
    height: 26px;
}

/* Full-width reason fields: label right-aligned, input fills remainder */
.of-full-section {
    display: grid;
    grid-template-columns: max-content minmax(0,1fr);
    gap: 4px 10px;
    align-items: center;
}
.of-full-section > .lbl {
    justify-self: end;
    text-align: right;
    font-size: 0.80rem;
    white-space: nowrap;
    color: #6c757d;
    font-weight: 600;
}
.of-full-section .form-control {
    font-size: 0.80rem;
    padding: 2px 6px;
    height: 26px;
}

/* Tab button badge when panel is undocked */
.panel-tab-undocked {
    font-style: italic;
    color: #1f4e79 !important;
}
.panel-tab-undocked::after {
    content: ' \29C7';
    font-style: normal;
    font-size: 0.7em;
    vertical-align: super;
}

/* Placeholder shown inside a tab pane when that tab is undocked */
.panel-undocked-placeholder {
    font-size: 0.85rem;
    color: #6c757d;
    user-select: none;
}

/* ══════════════════════════════════════════════════════════════════════════════
   SYSTEM BAR — §16
   Dark top bar, present on every page.
══════════════════════════════════════════════════════════════════════════════ */
.sm-system-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    background: #1a2744;
    height: 38px;
    padding: 0 10px;
    position: sticky;
    top: 0;
    z-index: 1050;
    flex-shrink: 0;
}
.sm-sidebar-toggle {
    color: rgba(255,255,255,.7);
    font-size: 14px;
    padding: 5px 8px;
    border-radius: 4px;
    text-decoration: none;
    margin-right: 4px;
    line-height: 1;
}
.sm-sidebar-toggle:hover { color: #fff; background: rgba(255,255,255,.12); }

/* S129 (Ken): "Return to Request Log" -- moved here from the AddEdit page bar
   (sm-page-bar), where it sat lost among New/Clone/Save/List/Actions/Report/
   Cancel (Ken's own words: "gets kind of lost in the mix of buttons"). Ken's
   clarified target for "next to the panel open/close button" is this system
   bar's sidebar toggle (#sidebarToggle) specifically -- the one truly global,
   always-on-top toolbar, not the AddEdit tools-pane handle or the search-
   results collapse chevron (both considered and ruled out).
   Deliberately NOT reusing the old btn/btn-outline-secondary classes here --
   those were styled for the WHITE page bar; unstyled on this DARK bar
   (#1a2744) they would reproduce the exact same-color-different-background
   illegibility bug already fixed twice elsewhere in this file (Request Log
   filter labels, S112; Checklist task labels, S127). Kept a visible text
   label (not icon-only like the .sm-icon-btn cluster in .sm-sys-right) --
   the whole complaint was that a labeled action was easy to miss, so hiding
   it as a bare glyph next to Help/Notifications would just relocate that
   problem. Hidden by default (inline style on the element itself, unchanged
   from before the move) -- shown only by AddEdit.cshtml's own script via
   SM_ReturnNav.consumeContextFor('AddEdit'); on every other page this button
   exists in the DOM (this markup is now in the shared _Layout) but stays
   hidden forever, since no other page's script ever un-hides it -- the same
   harmless-dead-markup pattern already established for the shared search
   bar living in every page's DOM. */
.sm-return-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: rgba(255,255,255,.85);
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    margin-right: 6px;
    white-space: nowrap;
}
.sm-return-btn:hover { color: #fff; background: rgba(255,255,255,.18); }

.sm-app-name {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    letter-spacing: .04em;
    padding: 0 10px 0 4px;
    border-right: 1px solid rgba(255,255,255,.18);
    margin-right: 6px;
    white-space: nowrap;
}
.sm-nav-links {
    display: flex;
    gap: 1px;
    flex: 1;
}
.sm-nav-link {
    color: rgba(255,255,255,.72);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    text-decoration: none;
    white-space: nowrap;
}
.sm-nav-link:hover,
.sm-nav-link.active { color: #fff; background: rgba(255,255,255,.14); }
.sm-sys-right {
    display: flex;
    align-items: center;
    gap: 1px;
    margin-left: auto;
}
.sm-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: rgba(255,255,255,.72);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    padding: 0;
    flex-shrink: 0;
}
.sm-icon-btn:hover { color: #fff; background: rgba(255,255,255,.14); }
.sm-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,.75);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    margin-left: 4px;
}
.sm-user-btn:hover { color: #fff; background: rgba(255,255,255,.12); }
.sm-user-name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════════════════
   PAGE BAR SLOT — §16
   Sticky below system bar. Each page fills via @section PageBar.
══════════════════════════════════════════════════════════════════════════════ */
#sm-page-bar-slot {
    position: sticky;
    top: 38px;
    z-index: 1040;
    flex-shrink: 0;
    border-left: 1px solid #dee2e6;
    border-right: 1px solid #dee2e6;
}
.sm-page-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    background: #f4f6f8;
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
    padding: 5px 14px;
}
.sm-page-bar .sm-bar-sep {
    width: 1px;
    height: 20px;
    background: #dee2e6;
    flex-shrink: 0;
    margin: 0 3px;
}
.sm-page-bar .sm-dm-badge {
    font-size: 12px;
    padding: 2px 9px;
    border-radius: 10px;
    background: #cfe2ff;
    color: #084298;
    white-space: nowrap;
    font-weight: 500;
}
/* All page bar buttons: outline-primary style (blue outline → solid on hover) */
.sm-page-bar .btn {
    font-size: 13px;
    padding: 3px 10px;
}
.sm-page-bar .btn-outline-primary {
    color: #0d6efd;
    border-color: #0d6efd;
    background: transparent;
}
.sm-page-bar .btn-outline-primary:hover {
    color: #fff;
    background: #0d6efd;
    border-color: #0d6efd;
}
/* Disabled/unavailable: light gray outline, no hover effect */
.sm-page-bar .btn-outline-secondary:disabled,
.sm-page-bar .btn-outline-secondary.disabled,
.sm-page-bar .dropdown-item.disabled {
    color: #adb5bd;
    border-color: #dee2e6;
    background: transparent;
    pointer-events: none;
}
/* Cancel: no visible border, muted text */
.sm-page-bar .sm-btn-cancel {
    background: transparent;
    border: 1px solid #dc3545;
    color: #dc3545;
    font-size: 13px;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1.5;
}
.sm-page-bar .sm-btn-cancel:hover {
    background: #dc3545;
    color: #fff;
    text-decoration: none;
}

/* ══════════════════════════════════════════════════════════════════════════════
   SEARCH BAR — §18
   Third bar, global. Hidden by default. Pages opt in via ShipmentSearch.init().
   Results panel hidden until a search fires; collapsible, resizable.
══════════════════════════════════════════════════════════════════════════════ */
.sm-search-bar {
    background: #dce8f5;                  /* mid-blue: between dark nav (#1a2744) and light stops tint */
    border: 1px solid rgba(26, 39, 68, 0.25);
    border-radius: 0.375rem;              /* matches Bootstrap card rounded corners */
    margin: 6px 0;                        /* sits inset within the content area */
    padding: 7px 14px;
    position: relative;                   /* scrolls with page by default */
    z-index: 1030;
    flex-shrink: 0;
}
/* Sticky only when overlay mode is active (JS adds this class) */
.sm-search-bar.sm-search-sticky {
    position: sticky;
    top: 76px;
}
/* Mode buttons — three search mode selectors */
.sm-search-modes {
    display: flex;
    gap: 0;
    border: 1px solid #0d6efd;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}
.sm-search-mode-btn {
    padding: 3px 11px;
    font-size: 12px;
    background: transparent;
    color: #0d6efd;
    border: none;
    border-right: 1px solid #0d6efd;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.5;
}
.sm-search-mode-btn:last-child { border-right: none; }
.sm-search-mode-btn.active {
    background: #0d6efd;
    color: #fff;
}
.sm-search-mode-btn:not(.active):hover {
    background: rgba(13,110,253,.08);
}
.sm-search-fields-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
/* Mode field panels — use custom class not d-flex so JS display:none can override */
.sm-search-mode-fields {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

/* Search controls — consistent sizing */
.sm-search-ctrl { font-size: 13px !important; }
.sm-search-ctrl.form-select { min-width: 180px; }
/* Result-limit tier (S127) only ever holds "100"/"300"/"500" -- the shared
   180px floor above is sized for the mode/status/field dropdowns, not this
   one; override it back down so the control doesn't render far wider than
   its content needs. min-width: 0 (S128 first pass) left no room next to the
   caret arrow and looked cramped -- a small floor gives the 3-digit value
   breathing room beside the arrow without going back toward the old 180px. */
#sm-result-limit.sm-search-ctrl.form-select { min-width: 72px; width: auto; }
.sm-search-ctrl.sm-date-input { width: 140px; flex-shrink: 0; }
.sm-search-ctrl[id="sm-detail-value"],
.sm-search-ctrl[id="sm-ref-value"] { min-width: 200px; max-width: 280px; }
.sm-search-label {
    font-size: 12px;
    color: #6c757d;
    white-space: nowrap;
    flex-shrink: 0;
}
/* S128 (Ken): the "Max results:" label and its dropdown must wrap together
   as one unit within the outer .sm-search-fields-row's flex-wrap, never
   split across two lines. display:inline-flex + flex-wrap:nowrap makes this
   span itself act as a single, non-splittable flex item in that outer row --
   the pair moves to the next line together or not at all. Shared markup
   (built once in shipment-search.js, rendered into _Layout.cshtml's
   #sm-search-fields), so this covers both List and AddEdit. */
.sm-search-result-limit-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}
.sm-search-bar .sm-bar-sep {
    width: 1px;
    height: 20px;
    background: #ccc;
    flex-shrink: 0;
    margin: 0 2px;
}
.sm-search-results {
    margin-top: 6px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    position: relative;
}
.sm-search-results-header {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    background: #f1f3f5;
    border-bottom: 1px solid #dee2e6;
    border-radius: 6px 6px 0 0;
    gap: 8px;
}
.sm-search-results-count {
    font-size: 12px;
    color: #495057;
    flex: 1;
}
.sm-search-results-controls { display: flex; gap: 2px; }
.sm-search-results .sm-icon-btn {
    width: 26px;
    height: 26px;
    color: #6c757d;
    font-size: 12px;
}
.sm-search-results .sm-icon-btn:hover { color: #212529; background: #dee2e6; }
.sm-search-results-body {
    max-height: 280px;
    overflow-y: auto;
    min-height: 60px;
}
.sm-search-table thead th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6c757d;
    padding: 6px 8px;
    position: sticky;
    top: 0;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
}
.sm-search-table tbody td {
    font-size: 12px;
    padding: 6px 8px;
    vertical-align: middle;
    cursor: pointer;
}
.sm-search-table tbody tr:hover { background: #f8f9fa; }
/* S124: AG Grid renderer for the inline search results (search-results-grid.js).
   Compact to match the table it replaced; width is 100%, height is set by the
   module from the results body's max-height so the drag handle still works. */
.sm-search-grid {
    --ag-font-size: 12px;
    --ag-header-font-size: 11px;
    --ag-grid-size: 4px;
    --ag-row-hover-color: #f8f9fa;
    --ag-selected-row-background-color: #dbe7ff;
    min-height: 80px;
}
.sm-search-grid .ag-header-cell-text {
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
    color: #6c757d;
}
.sm-search-grid .ag-row { cursor: pointer; }
/* S124: manual-rate banner on the Rating panel (Shipment.RatesManuallyEdited). */
.rating-manual-banner {
    font-size: 12px;
    color: #664d03;
    background: #fff3cd;
    border: 1px solid #ffe69c;
    border-radius: 4px;
    padding: 6px 10px;
    margin: 4px 0 8px 0;
}
/* S125: O/R Calculator block under Calculate Rates (Spot Quote only). */
.or-calc {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px 8px 8px 8px;
    background: #f8f9fa;
}
.or-calc-title {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
}
.or-calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    column-gap: 8px;
    align-items: start;
}
.or-calc .form-control {
    height: 28px;
    padding: 2px 6px;
    font-size: 13px;
}
.sm-search-limit-msg {
    font-size: 12px;
    color: #856404;
    background: #fff3cd;
    border-top: 1px solid #ffecb5;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sm-search-limit-msg a { color: #0d6efd; font-weight: 600; text-decoration: underline; }
.sm-search-limit-msg a:hover { color: #0a58ca; }
.sm-search-resize-handle {
    height: 5px;
    background: #e9ecef;
    cursor: ns-resize;
    border-radius: 0 0 6px 6px;
}
.sm-search-resize-handle:hover { background: #ced4da; }
.sm-search-results.is-overlay {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 900;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    margin-top: 0;
}

/* ══════════════════════════════════════════════════════════════════════════════
   APPCOMMENTS MODAL — §17
══════════════════════════════════════════════════════════════════════════════ */
#appCommentModal .modal-title {
    color: #212529;
}
#appCommentModal .form-label {
    color: #212529;
}
/* View-all comments dialog (read-only) -- same light header as appCommentModal, so
   the title needs the same explicit dark color to render visibly. */
#appAllCommentsModal .modal-title {
    color: #212529;
}

/* ══════════════════════════════════════════════════════════════════════════════
   USER ADD/EDIT MODAL (S115 Phase 6 / S119 D1-D6) — §user-admin-dialog
   ----------------------------------------------------------------------------
   Same root cause as appCommentModal above: this modal's content stays the
   Bootstrap-default plain white, but every heading (h1-h6, including the
   Bootstrap .modal-title <h5>) and every .form-label inherit this app's global
   dark-page defaults (h1-h6 -> var(--white); label/.form-label -> the body's
   own var(--light), #b8bed6 -- both meant for the app's usual dark background).
   White-on-white made the title invisible; #b8bed6-on-white made every label
   barely readable. Fixed the same way appCommentModal already was.
══════════════════════════════════════════════════════════════════════════════ */
#adminUserModal .modal-title {
    color: #212529;
}
#adminUserModal .form-label,
#adminUserModal .form-check-label {
    color: #212529;
}
/* ══════════════════════════════════════════════════════════════════════════════
   FORBO PENDING IMPORT MODAL (S127 / S130 fix)
   ----------------------------------------------------------------------------
   Same root cause as appCommentModal and adminUserModal above: plain white
   Bootstrap modal, but the .modal-title <h5> inherits the app's global h1-h6
   var(--white) and the selected-count <span> inherits body's var(--light)
   (#b8bed6). Found in the S130 screenshot pass -- the title "Import Forbo
   Pending Shipments" was computing rgb(255,255,255) on white, i.e. invisible,
   and "N selected" was near-illegible. Ken S130: readable black, same as the
   other light-header dialogs.
══════════════════════════════════════════════════════════════════════════════ */
#forboImportModal .modal-title,
#forboImportModal #forbo-selected-count {
    color: #212529;
}
.sm-comment-history-item {
    padding: 8px 10px;
    border-bottom: 1px solid #e9ecef;
    font-size: 12px;
}
.sm-comment-history-item:last-child { border-bottom: none; }
.sm-comment-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 3px;
    color: #6c757d;
    font-size: 11px;
    flex-wrap: wrap;
}
.sm-comment-type-badge {
    padding: 1px 6px;
    border-radius: 8px;
    background: #e9ecef;
    color: #495057;
    font-size: 10px;
    white-space: nowrap;
}
.sm-comment-text {
    background: #fffde7;
    color: #212529;
    padding: 4px 8px;
    border-radius: 3px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.sm-comment-unsaved {
    background: #f0f9ff;
    border-left: 3px solid #0d6efd;
}
.sm-comment-unsaved-badge {
    padding: 1px 6px;
    border-radius: 8px;
    background: #cfe2ff;
    color: #084298;
    font-size: 10px;
    white-space: nowrap;
    font-style: italic;
}

/* ==========================================================================
   Validation Summary — inline form-level errors after a failed save
   ========================================================================== */

/*
 * .sm-validation-summary is placed directly inside #shipment-form, above the
 * main content. It renders as hidden when ModelState is valid (Razor emits
 * class="validation-summary-valid") and visible when errors are present
 * (class="validation-summary-errors").
 *
 * We scope all rules to #shipment-form to avoid interference with any
 * other validation elements that might appear elsewhere on the page.
 */

/* Hidden state: Razor adds .validation-summary-valid when ModelState is clean. */
#shipment-form .sm-validation-summary.validation-summary-valid {
    display: none;
}

/* Error state: Razor adds .validation-summary-errors when ModelState has errors. */
#shipment-form .sm-validation-summary.validation-summary-errors {
    display: block;
    margin: 0.75rem 1rem 0;          /* sits just above the shipment details panel */
    padding: 0.75rem 1rem;
    background-color: #f8d7da;       /* Bootstrap danger tint — consistent with other error UI */
    border: 1px solid #f5c2c7;
    border-left: 4px solid #dc3545;  /* strong left accent draws the eye */
    border-radius: 4px;
    color: #842029;
    font-size: 0.875rem;
}

/* The <ul> Razor generates inside the summary when multiple errors exist. */
#shipment-form .sm-validation-summary.validation-summary-errors ul {
    margin: 0;
    padding: 0 0 0 1.25rem;
    list-style: disc;
}

/* Single error (no <ul>, just text node) and list items share the same spacing. */
#shipment-form .sm-validation-summary.validation-summary-errors li {
    margin: 2px 0;
}

/* When there is only one message Razor may omit the <ul> entirely —
   ensure the plain text is still readable without extra margin. */
#shipment-form .sm-validation-summary.validation-summary-errors:empty {
    display: none;  /* hide if somehow rendered empty */
}

/* ============================================================
   SHIPMENT LIST / GRID VIEW  (Views/Shipments/Index.cshtml)
   ============================================================ */

/* Workspace — grid + detail panel side by side */
/* ──────────────────────────────────────────────────────────────────────────
   Shipment List page layout
────────────────────────────────────────────────────────────────────────── */

#sm-list-workspace {
    display: flex;
    align-items: stretch;
    /* System bar (38px) + page bar (~44px) + search bar (~62px) = ~144px.
       The search bar is always visible on this page (ShipmentSearch visible:true). */
    height: calc(100vh - 144px);
    overflow: clip;
    padding: 0;
}

#sm-grid-area {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    /* overflow: clip removed — AG Grid manages its own internal scrollbars.
       clip was blocking the horizontal scrollbar from rendering. */
    overflow: hidden;
    padding: 8px 8px 8px 12px;
}

#sm-grid-empty-state {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #e9ecef;
    user-select: none;
}
#sm-grid-empty-state,
#sm-grid-empty-state * {
    color: #e9ecef !important;
}

#sm-grid-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#shipment-grid {
    flex: 1 1 auto;
    min-height: 0;
}

/* ── AG Grid filter icon + tooltip fixes ────────────────────────────────────

   1. Hide the popup-launcher button at the right of each floating filter cell.
   2. Remove the magnifying-glass background-image that bleeds into typed text.
      The icon is painted as a background-image on the input element itself in
      Alpine theme — target it with high specificity and !important to win. */
.ag-theme-alpine .ag-floating-filter-button {
    display: none;
}
.ag-theme-alpine .ag-floating-filter-body .ag-input-field-input {
    background-image: none !important;
    padding-left: 8px !important;
}

/* 3. Tooltip: give it a solid background so it is readable over grid content. */
.ag-theme-alpine .ag-tooltip {
    background-color: #1a2744;
    color: #ffffff;
    border: 1px solid #0d1b35;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    max-width: 400px;
    word-break: break-word;
    pointer-events: none;
    white-space: normal;
}

/* ── Detail panel shell (mirrors Add/Edit tools pane) ────────────────────── */

.sm-detail-shell {
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
}

/* Vertical title bar / toggle handle */
.sm-detail-handle {
    width: 2.75rem;
    border: 1px solid rgba(0,0,0,.125);
    border-right: none;
    border-top-left-radius: .375rem;
    border-bottom-left-radius: .375rem;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 .125rem .25rem rgba(0,0,0,.075);
    flex-shrink: 0;
}

.sm-detail-handle span {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-weight: 600;
    letter-spacing: .04em;
    font-size: .85rem;
    white-space: nowrap;
}

/* Pane — collapses when shell has sm-detail-closed */
.sm-detail-panel {
    width: 440px;                 /* default — JS overrides from sessionStorage */
    flex-shrink: 0;
    min-width: 320px;
    max-width: 70vw;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #dee2e6;
    background: #fff;
    position: relative;
    overflow: hidden;
}
/* Transition only during toggle animation -- never during drag resize */
.sm-detail-panel.sm-transitioning {
    transition: width 0.2s ease;
}

/* Collapsed state — toggled by clicking the handle */
.sm-detail-shell.sm-detail-closed .sm-detail-panel {
    width: 0 !important;
    min-width: 0;
    border: 0;
    overflow: hidden;
}

/* Drag handle on the LEFT edge of the panel (separates grid from panel) */
.sm-detail-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: col-resize;
    background: transparent;
    z-index: 10;
}
.sm-detail-resize-handle:hover,
.sm-detail-resize-handle.dragging {
    background: rgba(13,110,253,.2);
}

/* Panel header */
.sm-detail-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 16px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    flex-shrink: 0;
}
.sm-detail-panel-title {
    flex: 1 1 auto;
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    overflow: clip;
    text-overflow: ellipsis;
}
.sm-detail-panel-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.sm-detail-panel-actions .btn {
    padding: 2px 6px;
    font-size: 0.75rem;
}

/* Loading indicator strip */
.sm-detail-loading {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid #dee2e6;
    background: #fffbe6;
    flex-shrink: 0;
    font-size: 0.8rem;
}

/* Detail tab nav — compact, scrollable if panel is narrow */
.sm-detail-nav {
    flex-shrink: 0;
    flex-wrap: wrap;
    border-bottom: 1px solid #dee2e6;
}
.sm-detail-nav .nav-link {
    font-size: 0.78rem;
    padding: 5px 10px;
    white-space: nowrap;
}

/* Tab content area — scrollable */
.sm-detail-tab-content {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: clip;
    padding: 10px 12px;
}

/* Tab panes — content loaded on demand */
.sm-detail-tab-content .tab-pane {
    min-height: 60px;
}

/* Placeholder while a tab pane is unloaded */
.sm-detail-tab-content .tab-pane:empty::after {
    content: 'Loading\2026';   /* Loading… */
    display: block;
    color: #adb5bd;
    font-size: 0.82rem;
    padding: 12px 0;
}

/* ── Shipment Grid — expected date cell styling ─────────────────────────────
   Applied programmatically via igc-column.cellClasses when PickupIsExpected
   or DeliveryIsExpected = true (actual date not yet recorded, showing expected).
   Medium blue keeps dates readable on both light and dark grid row backgrounds. */
.sm-date-expected {
    color: #3a7bd5 !important;
}

/* ── Shipment Grid — virtual scroll loading indicator ───────────────────────
   Shown in the record count area while the next page is fetching. */
#sm-grid-record-count.sm-loading::after {
    content: ' \2026';   /* … */
    opacity: 0.6;
}

/* S123: visible failure state for the lazy-load retry -- mirrors
   #sm-reqlog-record-count.sm-reqlog-load-failed below. */
#sm-grid-record-count.sm-grid-load-failed {
    color: #dc3545;
    font-weight: 600;
}

/* S123: SM_GridClipboard's right-click "Copy cell value" menu (grid-clipboard.js)
   -- shared by every AG Grid Community grid in the app that attaches it. Kept
   deliberately plain/native-menu-like: a small white card with a single action,
   positioned at the click point via inline left/top (set in JS). */
.sm-grid-clipboard-menu {
    position: fixed;
    z-index: 3000;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.25rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);
    padding: 0.25rem 0;
    min-width: 160px;
}
.sm-grid-clipboard-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    color: #212529;
    cursor: pointer;
}
.sm-grid-clipboard-menu-item:hover,
.sm-grid-clipboard-menu-item:focus {
    background: #f1f3f5;
    outline: none;
}

/* ============================================================================
   System Request Log grid (Session 108) -- AG Grid Community, same control as
   the Shipment List, own lightweight page-local filter bar (not the global
   ShipmentSearch bar, which is shipment-field-specific).
   ============================================================================ */

/* Session 112: the filter bar moved from its own light-gray (#f4f6f8) panel into
   the dark card-body (--secondary, #202940) when it was consolidated into the
   header card. The #212529 (near-black) label color from that light-panel era is
   now unreadable on a dark card -- this was a regression introduced by the same
   move, caught and fixed in the same pass rather than left for Ken to report
   separately. Labels now use --white (bold, for legibility given six fields
   packed tightly), matching the header's own text color instead of contrasting
   against a background that no longer exists. */
#sm-reqlog-filter-bar .form-label {
    color: var(--white);
    font-weight: 600;
}

/* Session 111: record count + user-source legend, relocated out of the retired
   page bar into the header card's button row. Session 112 (Ken): the muted grey
   (#6c757d) was illegible against the dark card-body (--secondary, #202940) --
   changed to --white per Ken's direct report ("100 of 105,152 records" was very
   hard to see). */
.sm-reqlog-status {
    font-size: 0.8125rem;
    color: var(--white);
    white-space: nowrap;
}

.sm-reqlog-status .sm-reqlog-legend {
    display: inline-block;
}

#sm-reqlog-workspace {
    display: flex;
    align-items: stretch;
    /* Session 111 (measured live, S112): the page bar (~44px) was retired on this
       screen and replaced by the standard card header block, so the subtracted
       chrome changed. Measured against the live DOM at 834px viewport height:
       #sm-reqlog-header (title card) 107px + #sm-reqlog-filter-bar 69px = 176px of
       chrome above the workspace, all sitting below the 38px sticky system bar, so
       workspace.top = 214px. The ORIGINAL 218px ESTIMATE NEVER ACCOUNTED FOR THE
       SITE FOOTER (52px) AT ALL -- that omission was the entire cause of the grid
       being clipped and the footer being pushed off-page with a permanent vertical
       scrollbar. Correct constant = workspace.top (214) + footer height (52) = 266,
       +2px safety margin for sub-pixel rounding = 268. */
    height: calc(100vh - 268px);
    overflow: clip;
    padding: 0;
}

#sm-reqlog-grid-area {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Session 112: left/right padding removed -- the parent container-fluid px-4
       (RequestLog.cshtml) now supplies the horizontal inset that lines this
       grid up with the header card above it. The 12px side padding here used to
       be the ONLY horizontal inset (no wrapping container-fluid existed), which
       put the grid's actual edge closer to the page edge than the header card's
       24px inset -- the grid read as wider than the header. Top/bottom padding
       kept for breathing room above/below the grid. */
    padding: 8px 0;
}

#sm-reqlog-empty-state {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    user-select: none;
}

#sm-reqlog-grid-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#request-log-grid {
    flex: 1 1 auto;
    min-height: 0;
}

/* ============================================================================
   NOTIFICATIONS INBOX GRID (S118)
   ----------------------------------------------------------------------------
   The See All inbox was rebuilt from a server-rendered list (capped at 200 rows)
   onto the same AG Grid lazy-load pattern as the Shipment List and the System
   Request Log. Layout mirrors #sm-reqlog-* deliberately -- same card header +
   filter bar above, same flex column workspace, same wrapper/grid sizing -- so the
   two grid screens behave identically.

   Session 121 (measured live against the running app): the inherited 268px
   estimate was wrong for this screen -- the page scrolled ~39px and the site
   footer was clipped below the viewport, the same failure mode as the Request
   Log's own original 218px guess. Measured directly against the live DOM:
   #sm-notif-workspace top = 255.5px, site footer height = 51.9px. Correct
   constant = workspace.top (255.5) + footer height (51.9) = 307.4, rounded to
   307, +2px safety margin for sub-pixel rounding = 309. */
#sm-notif-workspace {
    display: flex;
    align-items: stretch;
    height: calc(100vh - 309px);
    overflow: clip;
    padding: 0;
}

#sm-notif-grid-area {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 8px 0;
}

#sm-notif-empty-state {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    user-select: none;
}

#sm-notif-grid-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#notifications-grid {
    flex: 1 1 auto;
    min-height: 0;
}

/* Unread emphasis on a grid row, applied via notifications-grid.js rowClassRules
   (a class RULE, not a hand-added class -- AG Grid virtualizes rows, so a manually
   styled row loses its class on re-render).

   FOUND S118: .sm-notif-unread had NO rule anywhere in site.css or Base.css, so
   every add/remove of it in the retired DOM implementation was visually inert --
   including the one S117 carefully fixed. The button/badge swap in that same fix
   WAS visible, so the fix itself was real, but the highlight never did anything.
   Given a rule for the first time here so unread genuinely reads as unread. */
.ag-theme-alpine .ag-row.sm-notif-unread {
    background-color: #fff8e1;
    font-weight: 500;
}

.ag-theme-alpine .ag-row.sm-notif-unread.ag-row-hover {
    background-color: #fff3cd;
}

/* Pop-out variant: no site footer and no sticky system bar, so the fixed-viewport
   constant above does not apply. Titlebar (~44px) + compact filter bar (~62px) +
   padding. ALSO AN ESTIMATE -- same flag as above. */
.popout-panel-window #sm-notif-workspace {
    height: calc(100vh - 120px);
}

/* ============================================================================
   USER ADMINISTRATION GRID (S119 batch D5)
   ----------------------------------------------------------------------------
   Layout mirrors #sm-reqlog-* and #sm-notif-* deliberately -- same card header +
   filter bar above, same flex column workspace, same wrapper/grid sizing.

   Session 121: this rule was recorded as written at the S119 close but was NOT
   actually present in site.css -- the workspace had no height rule at all and
   was collapsing to its natural ~1.6px content height, hiding the grid entirely.
   Measured live in TWO PASSES (the first pass's offset undercounted a ~24px gap
   between the workspace and the site footer coming from surrounding container
   spacing that only shows up once the workspace actually renders at its real
   height, not while collapsed): #sm-adminusers-workspace top = 237.0px, gap to
   footer = 23.6px, footer height = 51.9px. Correct constant = workspace.top
   (237.0) + gap (23.6) + footer height (51.9) = 312.5, rounded to 313, +2px
   safety margin for sub-pixel rounding = 315. */
#sm-adminusers-workspace {
    display: flex;
    align-items: stretch;
    height: calc(100vh - 315px);
    overflow: clip;
    padding: 8px 0;
}

#sm-adminusers-empty-state {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    user-select: none;
}

#sm-adminusers-grid-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#admin-users-grid {
    flex: 1 1 auto;
    min-height: 0;
}

#sm-reqlog-record-count.sm-loading::after {
    content: ' \2026';
    opacity: 0.6;
}

/* S123: visible failure state for the lazy-load retry -- Ken reported blank
   grid sections on scroll with no indication anything had gone wrong. A failed
   page fetch now shows here instead of failing silently while it retries. */
#sm-reqlog-record-count.sm-reqlog-load-failed {
    color: #dc3545;
    font-weight: 600;
}

/* Result column -- success/failed coloring */
.sm-reqlog-success {
    color: #198754;
}
.sm-reqlog-failed {
    color: #dc3545;
    font-weight: 600;
}

/* User column -- color-codes which account system UserGUID resolved against.
   Ken, S108: System_RequestLog.UserGUID always resolves to either the legacy
   Security_Users table or the current Auth_Users table -- binary, no third
   state. Low-overhead flag -- computed once server-side into UserSource, just
   a cellClass here, no extra client-side lookup. Once Security_Users is
   decommissioned every row will be "Auth" and this distinction becomes moot
   (see RequestLogData comment). */
.sm-reqlog-user-auth {
    color: #0d6efd;
}
.sm-reqlog-user-legacy {
    color: #b8860b;
}

/* Record GUID column -- link rendered only when the server resolved a viewable
   record (RecordLink present, see RequestLogData). Monospace matches the raw
   GUID look for the unlinked case; underline-on-hover signals it's clickable. */
.sm-reqlog-record-link {
    font-family: monospace;
    font-size: 0.85em;
    color: #0d6efd;
    text-decoration: none;
}
.sm-reqlog-record-link:hover {
    text-decoration: underline;
}

/* S133 (Ken, 2026-09-23): Request Data column + popup. The cell shows a short
   RequestJson preview; the same blue / underline-on-hover cue as the record link
   marks it clickable. The popup (#sm-reqlog-json-modal, RequestLog.cshtml) is a
   plain-white Bootstrap modal, so its title and note get the explicit dark color --
   same root cause as appCommentModal, adminUserModal and forboImportModal. The
   formatted JSON scrolls inside the modal and wraps long values. */
.sm-reqlog-json-link {
    font-family: monospace;
    font-size: 0.85em;
    color: #0d6efd;
    cursor: pointer;
}
.sm-reqlog-json-link:hover {
    text-decoration: underline;
}
#sm-reqlog-json-modal .modal-title,
#sm-reqlog-json-modal #sm-reqlog-json-note {
    color: #212529;
}
#sm-reqlog-json-body {
    max-height: 65vh;
    overflow: auto;
    margin: 0;
    padding: 12px;
    background: #f8f9fa;
    color: #212529;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Legend dots in the page bar (mirrors the two classes above) */
.sm-reqlog-legend-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 3px;
    vertical-align: middle;
}
.sm-reqlog-legend-auth {
    background-color: #0d6efd;
}
.sm-reqlog-legend-legacy {
    background-color: #b8860b;
}

/* ── Detail panel toolbar (read-only header + save slot) ────────────────────
   Sits between the panel header and the tab nav.                             */
.sm-detail-panel-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    min-height: 34px;
    background: var(--bs-body-bg);
}
.sm-detail-panel-toolbar .sm-toolbar-spacer {
    flex: 1 1 auto;
}
.sm-detail-panel-toolbar .btn-save-panel {
    /* hidden until isDirty = true */
    display: none;
}
.sm-detail-panel-toolbar .btn-save-panel.dirty {
    display: inline-flex;
}

/* ============================================================
   SHIPMENT GRID DETAIL PANEL — TAB CONTENT
   All dt-* classes are scoped to the detail panel tabs.
   Read-only display only for now; edit-capable tabs will
   add controls inside .dt-tab-toolbar when wired up.
   ============================================================ */

/* Tab toolbar — empty placeholder, buttons added per tab later */
.dt-tab-toolbar {
    min-height: 0;
    margin-bottom: 4px;
}
.dt-tab-toolbar:empty {
    display: none;
}

/* ── Entry forms (References, Statuses, Tracking tabs) ─────────────── */
.dt-entry-form {
    padding: 6px 0;
}
/* Single-line entry (references, record status) */
.dt-entry-row {
    display: flex;
    gap: 4px;
    align-items: center;
}
.dt-entry-row .form-select,
.dt-entry-row .form-control {
    font-size: 0.78rem;
}
.dt-entry-row .form-select { flex: 0 0 auto; min-width: 140px; max-width: 180px; }
.dt-entry-row .form-control { flex: 1 1 auto; min-width: 80px; }
/* Multi-line entry (transportation status) */
.dt-entry-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 8px;
    align-items: center;
    margin-bottom: 6px;
}
.dt-entry-grid .form-select,
.dt-entry-grid .form-control {
    font-size: 0.78rem;
}
.dt-entry-lbl {
    font-size: 0.75rem;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    text-align: right;
}
.dt-entry-req::after {
    content: ' *';
    color: #dc3545;
}
.dt-entry-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}
.dt-entry-save,
.dt-entry-cancel {
    font-size: 0.75rem;
    padding: 2px 10px;
}
.dt-entry-error {
    font-size: 0.78rem;
    color: #dc3545;
    padding: 4px 0 0;
}

/* Empty state */
.dt-empty {
    padding: 12px 8px;
    color: var(--bs-secondary-color, #6c757d);
    font-size: .85rem;
    font-style: italic;
}

/* ── Label/value field grid (Details, References fixed section, Tracking summary) ── */
.dt-field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 8px;
    padding: 4px 6px;
}
.dt-section-header {
    grid-column: 1 / -1;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #000;
    padding: 6px 0 2px;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    margin-bottom: 2px;
}
.dt-field {
    display: flex;
    align-items: baseline;
    gap: 4px;
    padding: 1px 0;
    overflow: hidden;
}
.dt-lbl {
    font-size: .75rem;
    color: #000;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 80px;
}
.dt-lbl::after {
    content: ':';
}
.dt-val {
    font-size: .8rem;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Generic list: header + rows ─────────────────────────────── */
.dt-list-header,
.dt-list-row {
    display: grid;
    gap: 0 6px;
    padding: 2px 6px;
    font-size: .8rem;
    color: #333;
    align-items: baseline;
}
.dt-list-header {
    font-size: .7rem;
    font-weight: 600;
    color: #000;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    padding-bottom: 3px;
    margin-bottom: 1px;
}
.dt-list-row:nth-child(even) {
    background: var(--bs-tertiary-bg, #f8f9fa);
}
.dt-list-footer {
    padding: 4px 6px;
    font-size: .8rem;
    color: #333;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    margin-top: 2px;
}
.dt-row-inactive {
    opacity: .55;
}

/* Load Units: 6 columns */
.dt-loadunit-header,
.dt-loadunit-row {
    grid-template-columns: 1fr 40px 48px 48px 48px 56px;
}

/* Accessorials: 4 columns */
.dt-acc-header,
.dt-acc-row {
    grid-template-columns: 1fr 72px 80px 80px;
}

/* References: 2 columns */
.dt-refs-header,
.dt-refs-row {
    grid-template-columns: 140px 1fr;
}

/* Statuses: 3 columns */
.dt-status-header,
.dt-status-row {
    grid-template-columns: 1fr 96px 64px;
}

/* Status tab full layout (with deactivation date and action button) */
.dt-status-header-full,
.dt-status-row-full {
    display: grid;
    grid-template-columns: 1fr 80px 80px 56px 28px;
    gap: 4px;
    align-items: center;
    padding: 3px 6px;
    font-size: 0.78rem;
}
.dt-status-header-full {
    font-weight: 600;
    color: #6c757d;
    border-bottom: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    background: #fff;
}
.dt-status-row-full:hover {
    background: #f8f9fa;
}
.dt-deactivate-btn {
    font-size: 0.65rem;
    padding: 0 4px;
    line-height: 1.4;
}

/* Tracking: scrollable grid — mirrors AddEdit tracking panel, no delete column */
.dt-tracking-scroll-container {
    max-height: 260px;
    overflow-y: auto;
    overflow-x: auto;
}
.dt-tracking-grid-inner {
    display: grid;
    grid-template-columns: 48px 132px minmax(120px,auto) minmax(120px,auto) minmax(160px,auto) minmax(72px,auto) minmax(32px,auto);
    column-gap: 10px;
    align-items: baseline;
    font-size: 0.8rem;
    width: max-content;
}
.dt-tracking-grid-header,
.dt-tracking-grid-row {
    display: contents;
}
.dt-tracking-grid-header > span,
.dt-tracking-grid-row > span {
    white-space: nowrap;
    text-align: left;
    padding: 3px 6px 3px 0;
}
.dt-tracking-grid-header > span {
    font-weight: 600;
    color: #000;
    padding-bottom: 5px;
    border-bottom: 2px solid #dee2e6;
    align-self: end;
}
.dt-tracking-grid-row > span {
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}
.dt-tracking-grid-row:last-child > span {
    border-bottom: none;
}

/* Documents: 5 columns */
.dt-docs-header,
.dt-docs-row {
    grid-template-columns: 1fr 96px 120px 1fr 88px;
}
.dt-docs-desc {
    white-space: normal;
    line-height: 1.2;
}
.dt-docs-row {
    cursor: pointer;
}
.dt-docs-row:hover {
    background: rgba(var(--bs-primary-rgb, 13,110,253), .06);
}

/* Documents list scroll region. The View/Upload toolbar sits ABOVE this wrapper
   and stays fixed; only the list scrolls, so the actions are always reachable
   without scrolling back up. Mirrors the Tracking tab bounded scroll container. */
.dt-docs-scroll {
    max-height: 320px;
    overflow-y: auto;
    overflow-x: clip;
}
.dt-docs-scroll .dt-docs-header {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}
.dt-row-selected {
    background: rgba(var(--bs-primary-rgb, 13,110,253), .12) !important;
}

/* ── Status flag badges ───────────────────────────────────────── */
.dt-flag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 4px 6px;
}
.dt-flag {
    font-size: .75rem;
    padding: 1px 6px;
    border-radius: 10px;
    white-space: nowrap;
}
.dt-flag-on {
    background: #d1e7dd;
    color: #0a3622;
}
.dt-flag-off {
    background: var(--bs-tertiary-bg, #f8f9fa);
    color: var(--bs-secondary-color, #6c757d);
}
.dt-active-badge {
    font-size: .7rem;
    color: #0a3622;
}
.dt-inactive-badge {
    font-size: .7rem;
    color: var(--bs-secondary-color, #6c757d);
}

/* ── Products ─────────────────────────────────────────────────── */
.dt-product-block {
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    padding: 4px 6px 6px;
}
.dt-product-block:last-of-type {
    border-bottom: none;
}
.dt-product-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    margin-bottom: 2px;
}

/* ── Grid detail panel: Comments tab ── */
.dt-comment-block {
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    padding: 6px;
    font-size: 0.8rem;
}
.dt-comment-block:last-of-type {
    border-bottom: none;
}
.dt-comment-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 2px;
}
.dt-comment-meta {
    font-size: 0.75rem;
    margin-bottom: 2px;
}
.dt-comment-body {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.4;
}
.dt-pf {
    display: flex;
    align-items: baseline;
    gap: 3px;
}
.dt-pf-lbl {
    font-size: .75rem;
    color: #000;
    white-space: nowrap;
}
.dt-pf-lbl::after {
    content: ':';
}
.dt-pf-val {
    font-size: .8rem;
    color: #333;
}
.dt-pf-desc {
    flex: 1 1 100%;
}
.dt-product-adv {
    background: var(--bs-tertiary-bg, #f8f9fa);
    border-radius: 4px;
    padding: 4px 6px;
    margin-top: 3px;
}
.dt-product-adv-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    margin-bottom: 2px;
}
.dt-adv-toggle {
    font-size: .75rem;
    color: var(--bs-secondary-color, #6c757d);
    text-decoration: none;
    padding: 0;
    border: none;
    background: none;
}
.dt-adv-toggle:hover {
    color: var(--bs-body-color);
}
.dt-product-footer {
    padding: 4px 6px;
    font-size: .8rem;
    color: #333;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    margin-top: 2px;
}

/* ── Charges ──────────────────────────────────────────────────── */
.dt-charges-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 0 6px;
}
.dt-charges-col-header {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #000;
    padding: 4px 0 3px;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    margin-bottom: 2px;
}
.dt-charge-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 1px 4px;
    font-size: .8rem;
    gap: 4px;
}
.dt-charge-row:nth-child(4n+3),
.dt-charge-row:nth-child(4n+4) {
    background: var(--bs-tertiary-bg, #f8f9fa);
}
.dt-charge-lbl {
    font-size: .75rem;
    color: #000;
    white-space: nowrap;
}
.dt-charge-val {
    font-variant-numeric: tabular-nums;
    color: #333;
    white-space: nowrap;
}
.dt-charge-empty {
    visibility: hidden;
}
.dt-charge-invoice .dt-charge-lbl,
.dt-charge-invoice .dt-charge-val {
    font-weight: 600;
}
.dt-charges-divider {
    border-bottom: 2px solid var(--bs-border-color, #dee2e6);
    margin: 3px 0;
}
.dt-charges-post {
    padding: 4px 6px;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    display: flex;
    flex-wrap: wrap;
    gap: 2px 16px;
    margin-top: 4px;
}
.dt-charges-post .dt-charge-row {
    gap: 6px;
}

/* ── Claims ───────────────────────────────────────────────────── */
.dt-claim-block {
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    padding: 4px 6px 6px;
}
.dt-claim-block:last-of-type {
    border-bottom: none;
}
.dt-claim-row-1,
.dt-claim-row-2 {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    margin-bottom: 2px;
}

/* === Notification Management page ================================== */
/* Small symmetric inset so tab content is not flush against the card edges
   on either side. */
.nm-card .tab-content {
    padding-left: .5rem;
    padding-right: .5rem;
}
/* Neutralize Bootstrap row negative gutters so the inset above is not
   cancelled and columns sit inside the padded region. */
.nm-card .tab-content .row {
    margin-left: 0;
    margin-right: 0;
}
/* Inline new-group field sits next to the header; give it a sensible width
   while still allowing it to shrink on narrow viewports. */
.nm-card .sm-new-group .form-control {
    min-width: 12rem;
}
/* Group rows are click-to-select (load members); show it's interactive. */
.nm-card .sm-group-row {
    cursor: pointer;
}
/* Delivery-method select: wide enough that the option text is not hidden
   behind the dropdown arrow. */
.nm-card .sm-method-select {
    min-width: 8rem;
}

/* ============================================================
   CLAIMS TAB (AddEdit tools pane + pop-out)
   Reuses the dt-* grid language. One stacked block per claim:
   read-only header, read-only line items, editable processing
   fields, a Comments button, and a documents sub-list.
   ============================================================ */
.claim-block {
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 12px;
    background: #fff;
}
.claim-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    padding-bottom: 4px;
    margin-bottom: 6px;
}
.claim-pro {
    font-weight: 600;
    font-size: .85rem;
    color: #000;
}
.claim-status-badge {
    font-size: .72rem;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 10px;
    background: rgba(var(--bs-primary-rgb, 13,110,253), .12);
    color: var(--bs-primary, #0d6efd);
    white-space: nowrap;
}
.claim-section-lbl {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #000;
    padding: 6px 0 2px;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    margin: 6px 0 3px;
}
.claim-readonly-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 8px;
    padding: 2px 2px 4px;
}
/* Line items: Qty / Item / Damage / Value */
.claim-li-header,
.claim-li-row {
    grid-template-columns: 48px 1fr 1fr 80px;
}
.claim-li-row:nth-child(even) {
    background: var(--bs-tertiary-bg, #f8f9fa);
}
/* Editable processing fields: label / input pairs */
.claim-edit-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 8px;
    align-items: center;
    padding: 2px 2px 4px;
}
.claim-edit-grid .form-control {
    font-size: .78rem;
}
.claim-actions {
    display: flex;
    gap: 6px;
    padding: 4px 0 2px;
}
/* Documents sub-list: Name / Category / Last Changed / action */
.claim-docs-header,
.claim-docs-row {
    grid-template-columns: 1fr 96px 110px 32px;
}
.claim-docs-row {
    cursor: pointer;
}
.claim-docs-row:hover {
    background: rgba(var(--bs-primary-rgb, 13,110,253), .06);
}
.claim-doc-deactivate-btn,
.dt-doc-deactivate-btn {
    font-size: .65rem;
    padding: 0 5px;
    line-height: 1.4;
}
/* Documents tab last cell now holds the date + deactivate (X); widen it. */
.dt-docs-header,
.dt-docs-row {
    grid-template-columns: 1fr 96px 120px 1fr 120px;
}
/* ==========================================================================
   S100 -- Logon validation summary (Views/Account/Logon.cshtml)
   Mirrors the #shipment-form .sm-validation-summary pattern: hidden when Razor
   emits .validation-summary-valid, visible when .validation-summary-errors is
   present (server ModelState errors or client-side unobtrusive validation).
   ========================================================================== */
.sm-logon-validation-summary.validation-summary-valid {
    display: none;
}

.sm-logon-validation-summary.validation-summary-errors {
    display: block;
    margin: 0 0 1rem;
    padding: 0.6rem 0.85rem;
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
    border-left: 4px solid #dc3545;
    border-radius: 4px;
    color: #842029;
    font-size: 0.875rem;
}

.sm-logon-validation-summary.validation-summary-errors ul {
    margin: 0;
    padding: 0 0 0 1.15rem;
    list-style: disc;
}

.sm-logon-validation-summary.validation-summary-errors li {
    margin: 2px 0;
}

.sm-logon-validation-summary.validation-summary-errors:empty {
    display: none;
}

/* Documents tab last cell (continued from above). */
.dt-docs-lastcell {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* ============================================================
   CHECKLIST TAB (Session 126)
   Shared by the AddEdit tools-pane tab (_ChecklistPanel /
   _ChecklistList, checklist-panel.js) and the List grid-detail tab
   (_Tab_Checklist, checklist-grid.js). Completed tasks sort last (see
   both partials' OrderBy(t => t.Completed)) and are struck through so
   a mostly-complete checklist reads at a glance (S127: no longer
   color-dimmed -- see the standing convention note at the top of this
   file -- strikethrough alone is the completed signal now).
   ============================================================ */

.checklist-add-toolbar {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: nowrap;
}
.checklist-add-toolbar input[type="text"] {
    /* S127 (Ken): was flex:1 1 auto with no cap, so the input grew to fill
       all available space and crowded the Add Task button into wrapping.
       Capped and shrunk at that time -- but the real fix for the wrapping
       was giving the button its own flex:0 0 auto + white-space:nowrap
       below, which makes the button wrap-proof regardless of how much
       space the input takes. S128 (Ken, both Checklist tab panels): with
       the button now protected, the max-width cap was only holding the
       field back from filling a wider panel -- removed so flex:1 1 140px
       can grow to fill the available space; still shrinks toward the
       140px basis (never below the 80px floor) on a narrow panel. */
    flex: 1 1 140px;
    min-width: 80px;
}
.checklist-add-toolbar #btn-add-task {
    /* Sized to its own text, never the flex-grow target, never wraps. */
    flex: 0 0 auto;
    white-space: nowrap;
}

.checklist-empty {
    padding: 8px 0;
}

.checklist-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 2px;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}
.checklist-row:last-child {
    border-bottom: none;
}

.checklist-completed-checkbox {
    flex: 0 0 auto;
    cursor: pointer;
}

.checklist-task-label {
    flex: 1 1 auto;
    margin: 0;
    cursor: pointer;
    word-break: break-word;
    /* S127 (Ken): explicit dark color + font-size, not left to ambient
       inheritance. The app's own <body> default is light gray-blue on dark
       (--light, #b8bed6, see Base.css) -- a plain <label> with no color of
       its own falls through to that default unless a closer ancestor resets
       it (e.g. a Bootstrap .card does). AddEdit's tools pane happens to have
       that reset (its wrapper carries Bootstrap's .card); the List-view grid
       detail panel does not, which is why the SAME markup read black in one
       place and gray in the other. Likewise font-size depended on Base.css's
       global label token, which pop-out windows never load (_PopoutLayout.cshtml
       includes only site.css) -- the pop-out's task text rendered at the
       browser/Bootstrap default size while everything around it used an
       explicit small size. Setting both explicitly here makes this label
       render identically everywhere it appears, regardless of container.
       Every other dt-prefixed or panel text class in this file already
       follows this same explicit-color convention (.dt-lbl, .dt-val,
       .panel-comment-text, etc.) for the same reason.
       S129 (Ken): this comment previously read "dt-star-slash-panel" -- a
       literal star immediately followed by a slash inside CSS comment prose
       closes the comment early (comments don't nest), which silently
       swallowed the very next declaration. Confirmed live: the browser's
       parsed stylesheet for this rule was missing the color property
       entirely (present in the file's raw text, absent from
       document.styleSheets), while font-size -- the declaration written
       right after color -- parsed fine, exactly the signature of one bad
       declaration being discarded during CSS error recovery. This is why
       AddEdit read correctly (its Bootstrap card wrapper resets color on
       its own, unrelated to this rule) while List -- which has no such
       wrapper -- fell through to html/body's --light default the whole
       time, even after this rule was supposedly fixed at S127. File-wide
       grep confirmed this was the only stray comment-closer in the whole
       file (327 comment-openers vs 328 comment-closers before this fix;
       balanced after). LESSON: never write a literal star-slash inside a
       CSS comment's prose, even as shorthand for "or" -- write the word
       "or" instead, or put a space between the star and the slash. */
    color: #212529;
    font-size: 0.85rem;
}

.checklist-row.is-completed .checklist-task-label {
    /* Ken, S127: any light-gray/muted text on new UI has to be readable black --
       this was originally --bs-secondary-color (#6c757d) to "dim" completed rows,
       but that reads as illegible light gray rather than dim. The strikethrough
       alone is sufficient to mark a row completed; text stays full-strength. */
    text-decoration: line-through;
}

/* ======================================================
   Invoiced lock (S130) -- SM_InvoicedLock, invoiced-lock.js
   ------------------------------------------------------
   Once Shipments.Invoiced is true the main-form cards (Shipment Details,
   Stops, Products, Load Units, Accessorials, Service Providers) carry
   .sm-invoiced-lock. Text inputs there are made readOnly + .is-locked by the
   JS (the shared style above); selects, checkboxes and radios cannot be
   readOnly and must NOT be disabled (a disabled control drops out of the
   form POST, and the save pipeline needs the cascade GUIDs), so their
   pointer events are removed here instead. Buttons are disabled by the JS
   as well; removing their pointer events too means an editor init that
   re-enables one after the lock ran still leaves it inert. Every selector
   below keys on .is-locked or data-inv-locked, which the JS never puts on
   collapse toggles or on the exempt Hold Payment checkbox + date, so those
   stay clickable inside a locked card.
   ====================================================== */
.sm-invoiced-lock select.is-locked,
.sm-invoiced-lock input[type="checkbox"].is-locked,
.sm-invoiced-lock input[type="radio"].is-locked,
.sm-invoiced-lock .btn-check.is-locked + .btn,
.sm-invoiced-lock .btn[data-inv-locked="1"] {
    pointer-events: none;
    cursor: not-allowed;
}
.sm-invoiced-lock .btn-check.is-locked + .btn,
.sm-invoiced-lock .btn[data-inv-locked="1"] {
    opacity: .55;
}
.sm-invoiced-lock select.is-locked {
    background-image: none;   /* hide the caret: it cannot be opened */
}
.sm-invoiced-badge {
    background-color: #b02a37;
    color: #fff;
    font-weight: 600;
    font-size: 0.7rem;
    vertical-align: middle;
    cursor: help;
}

