.driver-settlements-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.driver-settlement-tabs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.driver-settlement-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid rgba(0, 128, 123, .22);
    border-radius: 8px;
    background: #fff;
    color: #005f5b;
    font-weight: 800;
    cursor: pointer;
}

.driver-settlement-tab.active {
    background: rgb(0, 128, 123);
    color: #fff;
    border-color: rgb(0, 128, 123);
}

.driver-settlement-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.driver-settlement-summary.dispatcher {
    grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.driver-pay-controls-card,
.driver-history-controls {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid rgba(0, 128, 123, .16);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .05);
}

.driver-settlement-summary div {
    padding: 12px 14px;
    border: 1px solid rgba(0, 128, 123, .16);
    border-radius: 8px;
    background: #fff;
}

.driver-settlement-summary strong,
.driver-settlement-summary span {
    display: block;
}

.driver-settlement-summary strong {
    color: #111827;
    font-size: 22px;
    line-height: 1.1;
}

.driver-settlement-summary span {
    margin-top: 3px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.driver-settlement-grid,
.driver-history-shell {
    display: grid;
    grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
}

.driver-history-shell {
    grid-template-columns: minmax(288px, 375px) minmax(0, 1fr);
}

.driver-pay-sidebar,
.driver-history-list,
.driver-pay-main,
.driver-history-detail,
.driver-directory-table-wrap {
    min-height: 0;
    border: 1px solid rgba(0, 128, 123, .16);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .05);
}

.driver-pay-sidebar,
.driver-history-list {
    max-height: calc(100vh - 238px);
    overflow: auto;
    padding: 10px;
}

.driver-pay-main,
.driver-history-detail {
    overflow: hidden;
    padding: 12px;
}

.driver-section-title {
    margin: 0 0 8px;
    color: #004d4a;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.driver-pay-card,
.driver-history-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    gap: 3px 6px;
    margin-bottom: 5px;
    padding: 7px 9px;
    border: 1px solid #d6e7e5;
    border-radius: 8px;
    background: #f9fffe;
    color: #111827;
    text-align: left;
    cursor: pointer;
}

.driver-pay-card.selected,
.driver-history-card.selected {
    border-color: rgb(0, 128, 123);
    box-shadow: inset 4px 0 0 rgb(0, 128, 123);
}

.driver-pay-card strong,
.driver-pay-card small,
.driver-history-card strong,
.driver-history-card small {
    display: block;
}

.driver-pay-card strong,
.driver-history-card strong {
    font-size: 13px;
}

.driver-pay-card small,
.driver-history-card small {
    color: #6b7280;
    font-size: 11px;
    font-weight: 800;
}

.driver-pay-card-metrics {
    text-align: right;
    white-space: nowrap;
}

.driver-pay-card-bottom {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    min-width: 0;
    margin-top: -2px;
}

.driver-load-days-line {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.driver-load-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 54px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: #e8f6f4;
    color: #004d4a;
    font-size: 12px;
    font-weight: 900;
}

.driver-load-pill b {
    color: inherit;
    font-size: 12px;
}

.driver-load-pill span {
    color: inherit;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
}

.driver-days-field {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #6b7280;
    font-size: 10px;
    font-weight: 900;
}

.driver-days-field input,
.driver-pay-controls input,
.driver-pay-controls select,
.driver-extra-grid input,
.driver-history-search input,
.driver-directory-head select,
.driver-modal-body input,
.driver-modal-body select,
.driver-modal-body textarea,
.driver-email-form input,
.driver-email-form select,
.driver-email-form textarea {
    width: 100%;
    border: 1px solid #cfe1df;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font: inherit;
    font-weight: 700;
    outline: none;
}

.driver-days-field input {
    width: 42px;
    height: 24px;
    padding: 0 4px;
    text-align: center;
}

.driver-pay-card-money-row {
    display: inline-flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 8px;
    white-space: nowrap;
}

.driver-pay-controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(110px, 1fr)) auto;
    gap: 10px;
    align-items: end;
}

.driver-pay-controls label,
.driver-modal-body label,
.driver-email-form label {
    display: grid;
    gap: 5px;
    color: #52606d;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.driver-pay-controls input,
.driver-pay-controls select,
.driver-directory-head select {
    height: 36px;
    padding: 0 10px;
}

.dispatcher-toolbar-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 10px;
}

.dispatcher-settlement-controls {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(108px, 124px) minmax(88px, 106px) minmax(126px, 150px) minmax(160px, 1fr) auto auto;
    gap: 8px;
    align-items: end;
    margin-bottom: 0;
    padding: 8px;
    border: 1px solid rgba(0, 128, 123, .16);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .05);
}

.dispatcher-view-tabs {
    flex: 0 0 auto;
    display: inline-flex;
    gap: 8px;
    margin: 0;
    padding: 4px;
    border: 1px solid rgba(0, 128, 123, .16);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .05);
}

.dispatcher-view-tab {
    height: 34px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: rgb(0, 96, 92);
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.dispatcher-view-tab.active {
    background: rgb(0, 128, 123);
    border-color: rgb(0, 128, 123);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 128, 123, .22);
}

.dispatcher-bulk-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    flex-wrap: nowrap;
    padding-top: 0;
}

.dispatcher-bulk-actions .portal-row-action,
.dispatcher-bulk-actions .portal-primary-btn,
.dispatcher-settlement-controls > .portal-row-action {
    white-space: nowrap;
}

.dispatcher-settlement-controls label {
    display: grid;
    gap: 5px;
    color: #52606d;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.dispatcher-settlement-controls select {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #cfe1df;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font: inherit;
    font-weight: 800;
    outline: none;
}

.dispatcher-search {
    margin-bottom: 0;
}

.dispatcher-summary-actions {
    justify-content: flex-start;
}

.dispatcher-settlement-note {
    margin-bottom: 10px;
    padding: 9px 11px;
    border: 1px solid #d6e7e5;
    border-radius: 8px;
    background: #f5fbfa;
    color: #52606d;
    font-size: 12px;
    font-weight: 800;
}

.dispatcher-settlement-table-wrap {
    max-height: calc(100vh - 360px);
    overflow: auto;
    border: 1px solid #d6e7e5;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .05);
}

.dispatcher-settlement-table {
    width: 100%;
    min-width: 1320px;
    border-collapse: separate;
    border-spacing: 0;
}

.dispatcher-summary-table {
    min-width: 1180px;
}

.dispatcher-settlement-table th,
.dispatcher-settlement-table td {
    padding: 8px 9px;
    border-bottom: 1px solid #edf3f2;
    color: #1f2937;
    font-size: 12px;
    text-align: left;
    vertical-align: middle;
}

.dispatcher-settlement-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgb(0, 128, 123);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.dispatcher-settlement-table tbody tr:nth-child(even) {
    background: #fbfefd;
}

.dispatcher-settlement-table tbody tr.dispatcher-week-total-row {
    background: #e7f4f2;
    font-weight: 900;
}

.dispatcher-settlement-table tbody tr.dispatcher-week-total-row td {
    border-top: 2px solid rgba(0, 128, 123, .32);
    border-bottom-color: rgba(0, 128, 123, .22);
}

.dispatcher-settlement-table tfoot td {
    background: #e7f4f2;
    border-top: 2px solid rgb(0, 128, 123);
    font-weight: 900;
}

.dispatcher-settlement-table tfoot tr.dispatcher-truck-total-row td {
    background: #f5fbfa;
    border-top: 1px solid rgba(0, 128, 123, .18);
}

.dispatcher-settlement-table strong,
.dispatcher-settlement-table small {
    display: block;
}

.dispatcher-settlement-table small {
    margin-top: 2px;
    color: #6b7280;
    font-size: 10px;
    font-weight: 800;
}

.dispatcher-select-col {
    width: 38px;
    text-align: center !important;
}

.dispatcher-row-check {
    width: 14px;
    height: 14px;
    accent-color: rgb(0, 128, 123);
    cursor: pointer;
}

.driver-print-frame {
    position: fixed;
    right: 0;
    bottom: 0;
    width: 0;
    height: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.dispatcher-rate-modal {
    width: min(430px, 94vw);
    overflow: hidden;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(15, 23, 42, .24);
}

.dispatcher-rate-form {
    display: grid;
    gap: 10px;
    padding: 18px;
}

.dispatcher-rate-form label {
    display: grid;
    gap: 6px;
    color: #52606d;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.dispatcher-rate-form input {
    width: 100%;
    height: 40px;
    padding: 0 10px;
    border: 1px solid #cfe1df;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font: inherit;
    font-size: 16px;
    font-weight: 900;
    outline: none;
}

.dispatcher-rate-form p {
    margin: 0;
    color: #6b7280;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
}

.driver-pay-control-actions,
.driver-settle-actions,
.driver-history-actions,
.driver-modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.driver-load-table-wrap {
    max-height: calc(100vh - 430px);
    overflow: auto;
    border: 1px solid #e4efee;
    border-radius: 8px;
}

.driver-load-table-wrap.history {
    max-height: calc(100vh - 365px);
}

.driver-load-table,
.driver-directory-table {
    width: 100%;
    min-width: 880px;
    border-collapse: separate;
    border-spacing: 0;
}

.driver-load-table th,
.driver-load-table td,
.driver-directory-table th,
.driver-directory-table td {
    padding: 8px 9px;
    border-bottom: 1px solid #eef2f2;
    color: #1f2937;
    font-size: 12px;
    text-align: left;
    vertical-align: middle;
}

.driver-load-table th,
.driver-directory-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f2fbfa;
    color: #004d4a;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.driver-load-table td strong,
.driver-load-table td small,
.driver-directory-table td strong,
.driver-directory-table td small {
    display: block;
}

.driver-load-table td small,
.driver-directory-table td small {
    color: #6b7280;
    font-weight: 800;
}

.driver-load-securement {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border: 1px solid #b9dfdc;
    border-radius: 999px;
    background: #eefafa;
    color: #006560;
    font-size: 10px;
    font-weight: 900;
    white-space: nowrap;
}

.driver-load-table tr.selected {
    background: #f1fbfa;
}

.driver-extra-grid {
    display: grid;
    grid-template-columns: 82px minmax(140px, 1fr);
    gap: 6px;
}

.driver-extra-grid input {
    height: 30px;
    padding: 0 8px;
    font-size: 12px;
}

.driver-settle-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    margin: 0 0 12px;
    padding: 12px;
    border: 1px solid #d6e7e5;
    border-radius: 8px;
    background: #f9fffe;
}

.driver-settle-totals {
    display: grid;
    grid-template-columns: repeat(7, minmax(70px, 1fr));
    gap: 8px;
}

.driver-settle-totals div {
    padding: 8px 9px;
    border-radius: 8px;
    background: #fff;
}

.driver-settle-totals span {
    display: block;
    color: #6b7280;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.driver-settle-totals strong {
    display: block;
    color: #111827;
    font-size: 14px;
}

.driver-settle-totals .primary {
    border: 1px solid rgba(0, 128, 123, .22);
    background: #dff5f3;
}

.driver-settle-totals .primary span,
.driver-settle-totals .primary strong {
    color: #004d4a;
}

.driver-settle-actions {
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 10px;
    padding: 12px;
    border: 1px solid #d6e7e5;
    border-radius: 8px;
    background: #f9fffe;
}

.driver-settle-actions > div {
    min-width: 170px;
    text-align: right;
}

.driver-settle-actions strong,
.driver-settle-actions small {
    display: block;
}

.driver-settle-actions small {
    color: #6b7280;
    font-size: 11px;
    font-weight: 800;
}

.driver-selected-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.2fr) repeat(4, minmax(120px, 1fr));
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid #d6e7e5;
    border-radius: 8px;
    background: #f9fffe;
}

.driver-selected-row > div {
    min-width: 0;
}

.driver-selected-row span {
    display: block;
    color: #6b7280;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.driver-selected-row strong {
    display: block;
    overflow: hidden;
    color: #111827;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.driver-settlement-empty,
.portal-loading {
    padding: 28px;
    color: #6b7280;
    text-align: center;
    font-weight: 800;
}

.driver-history-search {
    position: relative;
    margin-bottom: 10px;
}

.driver-history-search i {
    position: absolute;
    left: 11px;
    top: 50%;
    color: #6b7280;
    transform: translateY(-50%);
}

.driver-history-search input {
    height: 38px;
    padding: 0 10px 0 32px;
}

.driver-history-controls {
    display: grid;
    grid-template-columns: minmax(200px, 1.3fr) minmax(140px, .9fr) repeat(4, minmax(105px, 1fr));
    gap: 10px;
    align-items: end;
}

.driver-history-controls label {
    display: grid;
    gap: 5px;
    color: #52606d;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.driver-history-controls select {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #cfe1df;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font: inherit;
    font-weight: 700;
}

.driver-history-controls > div {
    padding: 8px 10px;
    border-radius: 8px;
    background: #f9fffe;
}

.driver-history-controls > div.primary {
    background: rgb(0, 128, 123);
}

.driver-history-controls span {
    display: block;
    color: #6b7280;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.driver-history-controls strong {
    display: block;
    color: #111827;
    font-size: 15px;
}

.driver-history-controls .primary span,
.driver-history-controls .primary strong {
    color: #fff;
}

.driver-history-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5eeee;
}

.driver-history-detail-head h2 {
    margin: 2px 0 4px;
    color: #111827;
    font-size: 20px;
}

.driver-history-detail-head p {
    margin: 0;
    color: #6b7280;
    font-size: 12px;
    font-weight: 800;
}

.driver-history-card {
    align-items: start;
}

.driver-history-card-side {
    display: grid;
    justify-items: end;
    gap: 3px;
    min-width: 158px;
}

.driver-history-card-side > strong {
    font-size: 15px;
}

.driver-history-status-row {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    white-space: nowrap;
}

.driver-history-status-row small {
    display: inline;
    margin-left: 3px;
}

.driver-paid-chip,
.driver-email-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
}

.driver-paid-chip {
    background: #d1fae5;
    color: #047857;
}

.driver-email-chip {
    background: #f3f4f6;
    color: #9ca3af;
}

.driver-email-chip.emailed {
    background: #e0f2fe;
    color: #0369a1;
}

.driver-directory-head {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 140px auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.driver-directory-table-wrap {
    max-height: calc(100vh - 278px);
    overflow: auto;
}

.driver-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e9f7f5;
    color: #00615d;
    font-size: 11px;
    font-weight: 900;
}

.driver-status-pill.ex {
    background: #f3f4f6;
    color: #6b7280;
}

.driver-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(17, 24, 39, .48);
}

.driver-modal,
.driver-email-modal,
.driver-confirm-modal {
    width: min(980px, 96vw);
    max-height: 92vh;
    overflow: hidden;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(15, 23, 42, .24);
}

.driver-email-modal {
    width: min(1100px, 96vw);
}

.driver-confirm-modal {
    width: min(480px, 94vw);
}

.driver-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid #e5eeee;
}

.driver-modal-head h2 {
    margin: 2px 0 0;
    color: #111827;
    font-size: 20px;
}

.driver-modal-body,
.driver-email-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    max-height: calc(92vh - 150px);
    overflow: auto;
    padding: 18px;
}

.driver-email-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.driver-modal-body label.span-2,
.driver-email-form .span-2,
.driver-email-form label.span-2 {
    grid-column: span 2;
}

.driver-modal-body input,
.driver-modal-body select,
.driver-modal-body textarea,
.driver-email-form input,
.driver-email-form select,
.driver-email-form textarea {
    min-height: 38px;
    padding: 8px 10px;
    text-transform: none;
}

.driver-modal-body textarea,
.driver-email-form textarea {
    resize: vertical;
}

.driver-modal-actions {
    padding: 14px 18px;
    border-top: 1px solid #e5eeee;
}

.driver-confirm-modal p {
    margin: 0;
    padding: 18px;
    color: #374151;
    font-weight: 700;
}

.driver-email-preview {
    min-height: 220px;
    padding: 12px;
    border: 1px solid #d6e7e5;
    border-radius: 10px;
    background: #f9fffe;
    overflow: auto;
}

.driver-email-preview > strong {
    display: block;
    margin-bottom: 8px;
    color: #004d4a;
    font-size: 12px;
    text-transform: uppercase;
}

@media (max-width: 1000px) {
    .driver-settlement-grid,
    .driver-history-shell {
        grid-template-columns: 1fr;
    }

    .driver-pay-sidebar,
    .driver-history-list {
        max-height: none;
    }

    .dispatcher-toolbar-row {
        flex-direction: column;
    }

    .driver-pay-controls,
    .driver-settle-panel,
    .driver-directory-head,
    .driver-selected-row,
    .driver-history-controls,
    .dispatcher-settlement-controls {
        grid-template-columns: 1fr;
    }

    .dispatcher-view-tabs {
        display: flex;
        width: 100%;
    }

    .dispatcher-view-tab {
        flex: 1;
    }

    .driver-settle-totals,
    .driver-settlement-summary.dispatcher {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .driver-modal-body,
    .driver-email-form {
        grid-template-columns: 1fr;
    }

    .driver-modal-body label.span-2,
    .driver-email-form .span-2,
    .driver-email-form label.span-2 {
        grid-column: auto;
    }
}
