/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
    --navy:         #1a2744;
    --navy-dark:    #141d36;
    --navy-hover:   #223362;
    --white:        #ffffff;
    --gray-50:      #f9fafb;
    --gray-100:     #f3f4f6;
    --gray-200:     #e5e7eb;
    --gray-300:     #d1d5db;
    --gray-400:     #9ca3af;
    --gray-500:     #6b7280;
    --gray-700:     #374151;
    --gray-900:     #111827;
    --green-100:    #d1fae5;
    --green-600:    #059669;
    --green-700:    #047857;
    --red-100:      #fee2e2;
    --red-600:      #dc2626;
    --red-700:      #b91c1c;
    --yellow-100:   #fef9c3;
    --yellow-700:   #a16207;
    --blue-100:     #dbeafe;
    --blue-600:     #2563eb;
    --blue-700:     #1d4ed8;
    --orange-100:   #ffedd5;
    --orange-700:   #c2410c;
    --radius:       8px;
    --shadow:       0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --transition:   0.15s ease;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--blue-700); }

code { font-family: "SFMono-Regular", Consolas, monospace; font-size: .875em; background: var(--gray-100); padding: 0 .3em; border-radius: 3px; }

/* ============================================================
   Layout
   ============================================================ */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ============================================================
   Header & Nav
   ============================================================ */
.site-header {
    background: var(--navy);
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: .75rem;
    padding-bottom: .75rem;
}

.header-brand {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.header-title {
    color: var(--white);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.header-sub {
    color: rgba(255,255,255,.55);
    font-size: .8rem;
    font-weight: 400;
}

.site-nav {
    display: flex;
    gap: .25rem;
    align-items: center;
}

.nav-link {
    color: rgba(255,255,255,.8);
    padding: .45rem .85rem;
    border-radius: 5px;
    font-size: .9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
    background: var(--navy-hover);
    color: var(--white);
    text-decoration: none;
}

.nav-link.active {
    color: var(--white);
    background: rgba(255,255,255,.12);
    border-bottom: 2px solid rgba(255,255,255,.6);
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.card-heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-note {
    color: var(--gray-500);
    font-size: .875rem;
    margin-bottom: .75rem;
}

/* ============================================================
   Flash Messages
   ============================================================ */
.flash-container {
    margin-bottom: 1rem;
}

.flash {
    padding: .8rem 1.2rem;
    border-radius: var(--radius);
    margin-bottom: .5rem;
    font-weight: 500;
    font-size: .95rem;
}

.flash-success {
    background: var(--green-100);
    color: var(--green-700);
    border-left: 4px solid var(--green-600);
}

.flash-error {
    background: var(--red-100);
    color: var(--red-700);
    border-left: 4px solid var(--red-600);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    padding: .5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), opacity var(--transition), box-shadow var(--transition);
    white-space: nowrap;
    line-height: 1;
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--navy);
    color: var(--white);
}
.btn-primary:hover:not(:disabled) {
    background: var(--navy-hover);
    text-decoration: none;
    color: var(--white);
}

.btn-success {
    background: var(--green-600);
    color: var(--white);
}
.btn-success:hover:not(:disabled) {
    background: var(--green-700);
    text-decoration: none;
    color: var(--white);
}

.btn-danger {
    background: var(--red-600);
    color: var(--white);
}
.btn-danger:hover:not(:disabled) {
    background: var(--red-700);
    text-decoration: none;
    color: var(--white);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
    text-decoration: none;
    color: var(--gray-900);
}

.btn-sm {
    padding: .3rem .65rem;
    font-size: .8rem;
    border-radius: 5px;
}

/* ============================================================
   Forms
   ============================================================ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.form-group-wide {
    grid-column: span 2;
}

.form-group-action {
    justify-content: flex-end;
    align-items: flex-end;
    flex-direction: row;
    gap: .5rem;
}

.form-label {
    font-size: .825rem;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.form-input {
    padding: .45rem .7rem;
    border: 1.5px solid var(--gray-300);
    border-radius: 5px;
    font-size: .9rem;
    background: var(--white);
    color: var(--gray-900);
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
}

.form-input:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(26,39,68,.12);
}

.form-input-sm {
    padding: .3rem .5rem;
    font-size: .85rem;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: .75rem;
}

.save-feedback {
    font-size: .875rem;
    font-weight: 600;
    transition: color .2s;
}

.save-feedback.ok   { color: var(--green-600); }
.save-feedback.err  { color: var(--red-600); }

/* Upload form */
.upload-form { }
.upload-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.upload-row .form-input { flex: 1; min-width: 220px; }

/* ============================================================
   Tables
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.table-actions {
    display: flex;
    gap: .5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.data-table th {
    background: var(--gray-100);
    color: var(--gray-700);
    font-weight: 700;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .6rem .9rem;
    text-align: left;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.data-table td {
    padding: .65rem .9rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: top;
}

.data-table tbody tr:hover td {
    background: var(--gray-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tfoot td {
    border-top: 2px solid var(--gray-300);
    background: var(--gray-50);
}

.num-col { text-align: right; }
.nowrap  { white-space: nowrap; }

.load-link {
    font-weight: 700;
    color: var(--navy);
}
.load-link:hover { color: var(--blue-600); }

/* Route cell */
.route-cell {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    min-width: 160px;
}
.route-from { font-weight: 600; font-size: .85rem; color: var(--gray-900); }
.route-arrow { color: var(--gray-400); font-size: .75rem; }
.route-to   { font-size: .85rem; color: var(--gray-700); }
.route-city { font-size: .78rem; color: var(--gray-500); }

/* Carrier cell in table */
.carrier-cell {
    display: flex;
    flex-direction: column;
    gap: .1rem;
}
.carrier-name { font-weight: 700; font-size: .82rem; color: var(--navy); }
.carrier-cost { font-size: .8rem; color: var(--gray-600, #4b5563); }
.empty-cell   { color: var(--gray-400); }

.action-cell {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
}

.email-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .82rem;
    color: var(--gray-500);
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-block;
    padding: .25rem .65rem;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.badge-pending {
    background: var(--gray-100);
    color: var(--gray-500);
    border: 1px solid var(--gray-300);
}

.badge-pushed {
    background: var(--green-100);
    color: var(--green-700);
    border: 1px solid var(--green-600);
}

.badge-error {
    background: var(--red-100);
    color: var(--red-700);
    border: 1px solid var(--red-600);
}

/* Carrier type badges in settings */
.type-badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 4px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: capitalize;
}
.type-pickup    { background: var(--blue-100);   color: var(--blue-700); }
.type-crossdock { background: var(--orange-100); color: var(--orange-700); }
.type-linehaul  { background: var(--yellow-100); color: var(--yellow-700); }
.type-delivery  { background: var(--green-100);  color: var(--green-700); }

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}

/* ============================================================
   Detail Page
   ============================================================ */
.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.detail-load-number {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--navy);
}

.detail-meta {
    color: var(--gray-500);
    margin-top: .25rem;
    font-size: .9rem;
}

.detail-header-right {
    text-align: right;
    flex-shrink: 0;
}

.detail-billed {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--navy);
}

.detail-billed-label {
    font-size: .75rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* Detail grid: shipper | arrow | consignee | freight */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.detail-arrow-col {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 1.5rem;
}

.big-arrow {
    font-size: 2rem;
    color: var(--gray-300);
}

.section-label {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--gray-400);
    margin-bottom: .35rem;
}

.detail-name {
    font-weight: 700;
    color: var(--gray-900);
}

.detail-addr {
    font-size: .875rem;
    color: var(--gray-500);
}

.freight-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .4rem .75rem;
}

.freight-label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    margin-right: .35rem;
}

.freight-val {
    font-weight: 700;
    color: var(--gray-900);
}

/* ============================================================
   Assignment Form
   ============================================================ */
.assignment-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

.assignment-section {
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
}

.assignment-section-title {
    font-size: .8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--navy);
    margin-bottom: .75rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--navy);
}

.carrier-fixed-display {
    font-weight: 700;
    color: var(--gray-700);
    padding: .45rem .7rem;
    background: var(--gray-100);
    border-radius: 5px;
    border: 1.5px solid var(--gray-200);
    font-size: .9rem;
}

.suggested-rate {
    font-size: .78rem;
    color: var(--gray-400);
    margin-top: .2rem;
    font-style: italic;
}

/* ============================================================
   Push Section
   ============================================================ */
.push-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.push-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.push-status-area {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    color: var(--gray-500);
}

.push-timestamp {
    font-size: .8rem;
    color: var(--gray-400);
}

.push-response-section {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.push-response {
    background: var(--gray-900);
    color: #a8ff78;
    padding: .75rem 1rem;
    border-radius: 5px;
    font-size: .78rem;
    font-family: "SFMono-Regular", Consolas, monospace;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

.push-response.hidden { display: none; }

/* ============================================================
   Settings Inline Form
   ============================================================ */
.inline-form {
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.inline-form.hidden { display: none; }

.inline-form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .75rem;
    margin-bottom: .75rem;
}

/* ============================================================
   Manifest Styles
   ============================================================ */
.manifest-doc {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 1.5rem 2rem 2rem;
    max-width: 1100px;
    margin: 0 auto;
}

.manifest-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    border-bottom: 3px solid var(--navy);
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
    gap: 1rem;
}

.manifest-company {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--navy);
    letter-spacing: -.01em;
}

.manifest-type-label {
    font-size: .95rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-top: .2rem;
}

.manifest-meta-table { font-size: .875rem; }
.manifest-meta-table td { padding: .15rem .4rem; }
.meta-key { font-weight: 700; color: var(--gray-500); white-space: nowrap; text-align: right; padding-right: .5rem; }
.meta-val { color: var(--gray-900); }

.manifest-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
    margin-bottom: 1.5rem;
}

.manifest-table th {
    background: var(--navy);
    color: var(--white);
    padding: .5rem .7rem;
    text-align: left;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}

.manifest-table td {
    padding: .5rem .7rem;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: top;
}

.manifest-table tbody tr:nth-child(even) td { background: var(--gray-50); }
.manifest-table tfoot td {
    background: var(--gray-100);
    border-top: 2px solid var(--gray-300);
}

.manifest-empty {
    color: var(--gray-500);
    text-align: center;
    padding: 2rem;
    font-style: italic;
}

.manifest-footer {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.sig-block {}

.sig-line {
    border-bottom: 1.5px solid var(--gray-700);
    height: 2.5rem;
    margin-bottom: .3rem;
}

.sig-label {
    font-size: .78rem;
    color: var(--gray-500);
    text-align: center;
}

.filter-form {}

.filter-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-row .form-group {
    min-width: 180px;
}

.manifest-links {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .assignment-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: .5rem;
    }
    .site-nav { flex-wrap: wrap; }

    .assignment-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
    .detail-arrow-col { display: none; }

    .inline-form-grid {
        grid-template-columns: 1fr 1fr;
    }

    .manifest-footer {
        grid-template-columns: 1fr;
    }

    .upload-row {
        flex-direction: column;
    }

    .filter-row {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .inline-form-grid { grid-template-columns: 1fr; }
    .form-group-wide { grid-column: span 1; }
}

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
    .no-print,
    .site-header,
    .site-nav,
    .flash-container,
    .upload-form,
    .table-actions,
    .manifest-links,
    .btn {
        display: none !important;
    }

    body {
        background: white;
        color: black;
        font-size: 11pt;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .manifest-doc {
        box-shadow: none;
        padding: 0;
        max-width: 100%;
    }

    .manifest-table {
        font-size: 9pt;
    }

    .manifest-table th {
        background: #1a2744 !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .manifest-table tbody tr:nth-child(even) td {
        background: #f9f9f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .manifest-footer {
        margin-top: 1.5rem;
    }

    .sig-line {
        border-bottom: 1px solid black;
    }

    .manifest-header {
        border-bottom: 2px solid black;
    }

    a { color: black; text-decoration: none; }
    .card { box-shadow: none; }

    /* ── Stop page-break rules ── */

    /* Keep the whole stop together when it fits on one page */
    .stop-block {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Never break immediately after the stop header — always pull
       at least the thead + first data row onto the same page */
    .stop-header {
        break-after: avoid;
        page-break-after: avoid;
    }

    /* Keep thead attached to the first data rows */
    .stop-block .manifest-table thead tr {
        break-after: avoid;
        page-break-after: avoid;
    }

    /* First two data rows must stay with the header/thead */
    .stop-block .manifest-table tbody tr:first-child,
    .stop-block .manifest-table tbody tr:nth-child(2) {
        break-before: avoid;
        page-break-before: avoid;
    }

    /* Totals row must stay with the last data row above it */
    .stop-block .manifest-table tfoot tr {
        break-before: avoid;
        page-break-before: avoid;
    }

    /* Summary + signature block: keep together and with each other */
    .manifest-summary {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .manifest-footer {
        break-inside: avoid;
        page-break-inside: avoid;
        break-before: avoid;
        page-break-before: avoid;
    }
}

/* ── Master Load Status Badges ── */
.badge-ml-draft       { background:#f3f4f6; color:#374151; }
.badge-ml-booked      { background:#dbeafe; color:#1d4ed8; }
.badge-ml-dispatched  { background:#e0e7ff; color:#4338ca; }
.badge-ml-in-transit  { background:#fef3c7; color:#92400e; }
.badge-ml-delivered   { background:#d1fae5; color:#065f46; }
.badge-ml-complete    { background:#374151; color:#f9fafb; }
.badge-ml-cancelled   { background:#fee2e2; color:#991b1b; }

/* ── Shipment Status Badges ── */
.badge-ss-booked             { background:#f3f4f6; color:#374151; }
.badge-ss-pickup_scheduled   { background:#dbeafe; color:#1d4ed8; }
.badge-ss-in_transit_to_xd   { background:#ffedd5; color:#c2410c; }
.badge-ss-at_cross_dock      { background:#fef9c3; color:#a16207; }
.badge-ss-on_master_load     { background:#e0e7ff; color:#4338ca; }
.badge-ss-on_the_road        { background:#f3e8ff; color:#7e22ce; }
.badge-ss-with_final_mile    { background:#ccfbf1; color:#0f766e; }
.badge-ss-delivered          { background:#d1fae5; color:#065f46; }
.badge-ss-osd                { background:#fee2e2; color:#991b1b; font-weight:700; }
.badge-retracted             { background:#fed7aa; color:#c2410c; }
.badge-ml-at-final-mile      { background:#ccfbf1; color:#0f766e; }

/* ── Pickup Run Status Badges ── */
.badge-pr-scheduled   { background:#f3f4f6; color:#374151; }
.badge-pr-in_progress { background:#dbeafe; color:#1d4ed8; }
.badge-pr-completed   { background:#d1fae5; color:#065f46; }

/* ── Shipment Status Pipeline ── */
.pipeline-section { margin-bottom: 1.5rem; }
.pipeline-section-label {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--gray-400);
    margin-bottom: .4rem;
    padding-left: .1rem;
}
.pipeline-widget {
    display: flex;
    align-items: stretch;
    gap: 0;
    overflow-x: auto;
    margin-bottom: 0;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    background: #fff;
    box-shadow: var(--shadow);
}
.pipeline-stage-card {
    flex: 1;
    min-width: 90px;
    padding: .6rem .5rem;
    text-align: center;
    cursor: pointer;
    border-right: 1px solid var(--gray-200);
    transition: filter var(--transition);
    text-decoration: none;
}
.pipeline-stage-card:last-child { border-right: none; }
.pipeline-stage-card:hover { filter: brightness(.93); }
.pipeline-stage-card.active { outline: 3px solid var(--navy); outline-offset: -3px; }
.pipeline-stage-card .ps-label {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    display: block;
    margin-bottom: .2rem;
}
.pipeline-stage-card .ps-count {
    font-size: 1.3rem;
    font-weight: 800;
    display: block;
}
.ps-booked           { background:#f3f4f6; color:#374151; }
.ps-pickup_scheduled { background:#dbeafe; color:#1d4ed8; }
.ps-in_transit_to_xd { background:#ffedd5; color:#c2410c; }
.ps-at_cross_dock    { background:#fef9c3; color:#a16207; }
.ps-on_master_load   { background:#e0e7ff; color:#4338ca; }
.ps-on_the_road      { background:#f3e8ff; color:#7e22ce; }
.ps-with_final_mile  { background:#ccfbf1; color:#0f766e; }
.ps-delivered        { background:#d1fae5; color:#065f46; }

/* ── Master Load Status Pipeline tiles ── */
.ps-ml-planning      { background:#f3f4f6; color:#374151; }
.ps-ml-booked        { background:#dbeafe; color:#1d4ed8; }
.ps-ml-dispatched    { background:#e0e7ff; color:#4338ca; }
.ps-ml-in-transit    { background:#f3e8ff; color:#7e22ce; }
.ps-ml-at-final-mile { background:#ccfbf1; color:#0f766e; }
.ps-ml-delivered     { background:#d1fae5; color:#065f46; }
.ps-ml-cancelled     { background:#f9fafb; color:#9ca3af; flex: 0 0 80px; min-width:80px; }
.ps-ml-cancelled .ps-count { font-size:1rem; }
.pipeline-stage-card { background: none; border: none; font: inherit; }

/* ── Collapsible Section ── */
.collapsible-section { margin-top: 2rem; }
.collapsible-toggle {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    user-select: none;
    color: var(--gray-500);
    font-size: .85rem;
    font-weight: 600;
    padding: .6rem .25rem;
    border-top: 1px solid var(--gray-200);
    border-bottom: 1px solid transparent;
    transition: color var(--transition);
}
.collapsible-toggle:hover { color: var(--gray-700); }
.collapsible-body { display: block; }
.collapsible-body.hidden { display: none; }

/* ── Modal ── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-backdrop.hidden { display: none; }
.modal-box {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    max-height: 90vh;
    overflow-y: auto;
}

/* ── Drag-over highlight ── */
.stop-drop-zone.drag-over {
    border-color: var(--blue) !important;
    background: #eff6ff !important;
}
.draggable-shipment:active { opacity: .7; }

/* ── Danger button ── */
.btn-danger {
    background: #ef4444;
    color: #fff;
    border: none;
}
.btn-danger:hover { background: #dc2626; }
