body { font-family: system-ui, sans-serif; margin: 0; padding: 0; background: #f4f4f4; }
.nav {
    background: #0b1a16; color: white; padding: 12px 18px;
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    border-bottom: 3px solid #e6392e;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo-img {
    height: 42px; width: auto; max-width: 160px; object-fit: contain;
    display: block; flex-shrink: 0;
}
.logo-img.logo-lease {
    height: 64px; max-width: 460px; background: #fff;
    border-radius: 8px; padding: 4px 8px;
}
.login-logo {
    display: block; width: min(100%, 420px); height: auto; margin: 0 auto 14px;
}
.brand-text { min-width: 0; }
.brand-name {
    font-size: 1.15rem; font-weight: 800; letter-spacing: 0.5px; line-height: 1.15;
    white-space: nowrap;
}
.brand-name span { color: #e6392e; }
.brand-tag {
    font-size: 0.72rem; color: #a8d5c2; letter-spacing: 0.4px;
    text-transform: uppercase; margin-top: 2px;
}
.brand-tag:empty { display: none; }
.logo { font-size: 1.8rem; font-weight: bold; }
.logo span { color: #e6392e; }
.nav-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.admin-link { color: #a8d5c2; text-decoration: none; font-size: 0.9rem; }
.admin-link:hover { color: white; }
.sync-badge {
    font-size: 0.72rem; font-weight: 600; padding: 4px 10px; border-radius: 999px;
    white-space: nowrap; border: 1px solid rgba(255,255,255,0.2); cursor: pointer;
}
.sync-local { background: #3d3d3d; color: #ddd; }
.sync-connecting { background: #664d03; color: #fff3cd; }
.sync-online { background: #0f5132; color: #d1e7dd; }
.sync-offline { background: #41464b; color: #e2e3e5; }
.sync-error { background: #842029; color: #f8d7da; }

/* QuickBooks Online */
.qbo-status { margin: 10px 0 6px; }
.qbo-connected .status-badge { background: #2ca01c; color: #fff; }
.qbo-disconnected .status-badge { background: #6c757d; color: #fff; }
#qboSendSelectedBtn, #qboSendDumpSelectedBtn {
    background: #2ca01c; color: #fff; border-color: #248a18;
}
#qboSendSelectedBtn:hover, #qboSendDumpSelectedBtn:hover, #qboSendHotoilSelectedBtn:hover {
    background: #248a18;
}
#qboSendHotoilSelectedBtn {
    background: #2ca01c; color: #fff; border-color: #248a18;
}
.oi-connected .status-badge { background: #0d6efd; color: #fff; }
#oiSendSelectedBtn, #oiSendDumpSelectedBtn, #oiSendHotoilSelectedBtn {
    background: #0d6efd; color: #fff; border-color: #0a58ca;
}
#oiSendSelectedBtn:hover, #oiSendDumpSelectedBtn:hover, #oiSendHotoilSelectedBtn:hover {
    background: #0a58ca;
}
.switch-driver-btn {
    background: transparent; border: 1px solid #a8d5c2; color: #a8d5c2;
    font-size: 0.8rem; padding: 6px 10px; margin: 0; border-radius: 6px;
}
.switch-driver-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.driver-login {
    min-height: calc(100vh - 70px); display: flex; align-items: center; justify-content: center;
    padding: 24px; background: #f4f4f4;
}
.driver-login-card {
    background: #fff; border-radius: 12px; padding: 28px 24px; width: 100%; max-width: 420px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08); border-top: 4px solid #e6392e;
}
.driver-login-logo { display: block; width: min(100%, 380px); height: auto; margin: 0 auto 16px; }
.driver-login-card h2 { text-align: center; margin: 0 0 8px; color: #1a3c34; }
.driver-login-card .submit-btn { margin-top: 16px; }
#driverName[readonly] { background: #f0f0f0; cursor: not-allowed; }
.cloud-status-banner {
    padding: 12px 14px; border-radius: 8px; margin-bottom: 14px;
    font-size: 0.92rem; line-height: 1.45;
}
.cloud-status-banner.warn {
    background: #fff3cd; border-left: 4px solid #b45309; color: #664d03;
}
.cloud-status-banner.ok {
    background: #d1e7dd; border-left: 4px solid #0f5132; color: #0f5132;
}
.gps-panel {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin: 6px 0 10px; padding: 8px 10px; background: #eef6ff;
    border: 1px solid #b6d4fe; border-radius: 6px; font-size: 0.9rem;
}
.gps-coords { font-family: ui-monospace, monospace; color: #084298; word-break: break-all; flex: 1; min-width: 120px; }
.maps-btn { background: #198754; margin: 0; white-space: nowrap; font-size: 0.85rem; padding: 8px 12px; }
.maps-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.option-section-place { border-left-color: #0d6efd; }
.option-section-place .h3-sub { color: #0d6efd; }
.option-add-place { flex-wrap: wrap; }
.option-add-place input[type="text"] { flex: 1; min-width: 140px; }
.place-option-row { align-items: flex-start !important; }
.place-main { flex: 1; min-width: 0; }
.place-gps-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.place-gps-row input { flex: 1; min-width: 160px; margin: 0; }

@media (max-width: 600px) {
    .nav { flex-wrap: wrap; }
    .logo-img { height: 34px; max-width: 120px; }
    .logo-img.logo-lease { height: 48px; max-width: 100%; }
    .brand-name { font-size: 0.95rem; }
    .brand-tag { font-size: 0.65rem; }
}
.container { padding: 20px; max-width: 900px; margin: 0 auto; }
.buttons button { margin: 5px; padding: 10px 15px; }
.main-tabs {
    display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px;
    padding-bottom: 10px; border-bottom: 2px solid #dfe7e4;
}
.main-tabs button.tab-active {
    background: #1a3c34; box-shadow: 0 0 0 2px rgba(26,60,52,0.25);
}
.sub-tabs {
    display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px;
    padding: 10px 12px; background: #eef5f2; border-radius: 8px;
    border-left: 4px solid #e6392e;
}
.sub-tabs button {
    background: #fff; color: #1a3c34; border: 1px solid #c5d8d0;
}
.sub-tabs button.sub-active {
    background: #b45309; color: #fff; border-color: #b45309;
}
.sub-tabs button:hover { opacity: 0.92; }
.page { display: none; }
.page.active { display: block; }
button { padding: 10px 15px; margin: 5px; background: #0d6efd; color: white; border: none; border-radius: 6px; cursor: pointer; }
button:hover { opacity: 0.9; }
.gps-btn { background: #198754; }
.submit-btn { margin-top: 20px; background: #198754; width: 100%; padding: 15px; font-size: 1.1rem; }
.logout-btn { background: #6c757d; }
.danger-btn { background: #dc3545; }

label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 0.9rem; }
input, select, textarea {
    width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px;
    font-size: 1rem; box-sizing: border-box;
}
.field-row { display: flex; gap: 8px; }
.field-row input { flex: 1; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.signature-pad {
    border: 2px dashed #ccc; border-radius: 6px; background: white;
    width: 100%; max-width: 600px; cursor: crosshair;
}
.photo-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.photo-preview img { width: 100px; height: 100px; object-fit: cover; border-radius: 6px; border: 1px solid #ccc; }

.ticket-list { list-style: none; padding: 0; }
.ticket-list li {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    background: white; padding: 12px 15px; margin-bottom: 8px; border-radius: 6px; border-left: 4px solid #1a3c34;
}
.ticket-list li .ticket-info { flex: 1; }
.ticket-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.ticket-list .print-btn { background: #1a3c34; white-space: nowrap; font-size: 0.85rem; padding: 8px 12px; margin: 0; }
.ticket-list .complete-btn { background: #198754; white-space: nowrap; font-size: 0.85rem; padding: 8px 12px; margin: 0; }
.status-badge {
    display: inline-block; font-size: 0.75rem; font-weight: bold;
    padding: 2px 8px; border-radius: 4px; margin-right: 6px;
}
.status-badge.completed { background: #d1e7dd; color: #0f5132; }
.status-badge.in_progress { background: #fff3cd; color: #664d03; }
.status-badge.status-assigned { background: #fff3cd; color: #664d03; }
.status-badge.status-accepted { background: #cfe2ff; color: #084298; }
.status-badge.status-en_route { background: #e0cffc; color: #3d1a73; }
.status-badge.status-on_site { background: #cff4fc; color: #055160; }
.status-badge.status-in_progress { background: #ffe5b4; color: #7a4b00; }
.status-badge.status-completed { background: #d1e7dd; color: #0f5132; }
.status-badge.status-cancelled { background: #e9ecef; color: #495057; }

.option-section-dispatch { border-left-color: #0d6efd; }
.load-working-banner {
    background: #e7f1ff; border-left: 4px solid #0d6efd; color: #084298;
    padding: 10px 12px; border-radius: 0 8px 8px 0; margin: 0 0 14px; font-size: 0.95rem;
}
.load-card {
    background: #fff; border: 1px solid #e3e8ee; border-radius: 10px;
    padding: 12px 14px; margin: 0 0 10px;
}
.load-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.load-line {
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
    color: #0d6efd; background: #eef5ff; padding: 2px 8px; border-radius: 999px;
}
.load-card-body { font-size: 0.95rem; line-height: 1.45; }
.load-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.load-card-actions button { margin: 0; }
.dispatch-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.dispatch-filters button {
    margin: 0; padding: 6px 10px; font-size: 0.85rem; background: #eef1f4; color: #1a3c34;
}
.dispatch-filters button.sub-active { background: #1a3c34; color: #fff; }

.dispatch-map-wrap { margin: 14px 0 4px; }
.dispatch-map-head {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
    gap: 8px; margin-bottom: 6px;
}
.dispatch-map-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dispatch-map-actions button { margin: 0; padding: 6px 10px; font-size: 0.85rem; }
.dispatch-map {
    height: 320px; border-radius: 10px; border: 1px solid #d5dde6; background: #e7eef2;
}
.dispatch-pin-wrap { background: transparent; border: none; }
.dispatch-pin {
    display: flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    color: #fff; font-weight: 700; font-size: 12px; line-height: 1;
    border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.dispatch-bulk {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px;
}
.dispatch-bulk select { width: auto; min-width: 200px; margin: 0; }
.dispatch-bulk .checkbox-label { margin: 0; }
.load-card-focus { outline: 2px solid #e07a2f; }
.load-check { width: auto; margin: 0; }
@media (max-width: 640px) {
    .dispatch-map { height: 240px; }
}

.checkbox-label {
    display: flex; align-items: center; gap: 8px;
    margin-top: 8px; font-weight: normal; font-size: 0.95rem; cursor: pointer;
}
.checkbox-label input { width: auto; margin: 0; }

.modal {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 100;
    align-items: center; justify-content: center; padding: 20px;
}
.modal-content {
    background: white; border-radius: 8px; padding: 24px;
    width: 100%; max-width: 420px;
    max-height: 90vh; overflow-y: auto;
}
.modal-content-wide { max-width: 560px; }
.modal-content-edit { max-width: 640px; }
.modal-content h3 { margin-top: 0; }
.complete-label { font-weight: 600; margin-bottom: 12px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.modal-actions .submit-btn { flex: 1; margin: 0; width: auto; min-width: 140px; }
.modal-actions .logout-btn { margin: 0; }
.complete-section {
    margin: 14px 0; padding: 12px 14px; border-radius: 8px;
    border: 1px solid #e5e5e5; background: #fafafa;
}
.complete-section h4 { margin: 0 0 8px; font-size: 0.95rem; color: #1a3c34; }
.complete-section-notes { background: #fff8f0; border-color: #f0d9b5; }
.complete-section-photos { background: #eef5ff; border-color: #b6d0f7; }
.complete-section .req { color: #dc3545; }
#completeNotes, #edit_notes, #edit_completionNotes { resize: vertical; min-height: 72px; }
#completePhotoUpload, #editPhotoUpload { margin-top: 4px; }
.edit-btn { background: #6f42c1; white-space: nowrap; font-size: 0.85rem; padding: 8px 12px; margin: 0; }
.edit-id { font-weight: 600; color: #b45309; font-size: 0.95rem; }
.photo-thumb {
    position: relative; width: 100px; height: 100px;
}
.photo-thumb img {
    width: 100px; height: 100px; object-fit: cover; border-radius: 6px; border: 1px solid #ccc;
}
.photo-remove {
    position: absolute; top: 2px; right: 2px; margin: 0; padding: 0;
    width: 24px; height: 24px; border-radius: 50%; background: #dc3545;
    color: #fff; font-size: 16px; line-height: 22px; text-align: center;
}
.existing-photos { margin-top: 8px; }
.ticket-list .edit-btn { font-size: 0.85rem; }
.ticket-list .empty, .empty { color: #888; font-style: italic; display: block; }

.document-list { margin-top: 15px; }
.document-item {
    display: flex; justify-content: space-between; align-items: center;
    background: white; padding: 12px 15px; margin-bottom: 8px; border-radius: 6px;
    gap: 10px; flex-wrap: wrap;
}
.fleet-doc-section { margin-bottom: 14px; }
.fleet-doc-section h3 { margin-bottom: 8px; }
.fleet-mine-badge {
    display: inline-block; font-size: 0.72rem; font-weight: 700;
    padding: 2px 8px; border-radius: 4px; margin-left: 6px;
    background: #d1e7dd; color: #0f5132; vertical-align: middle;
}
.hint { color: #888; font-size: 0.85rem; }

.login-screen {
    max-width: 420px; margin: 40px auto; background: white;
    padding: 30px; border-radius: 8px; text-align: left;
}
.login-screen h2 { text-align: center; }
.login-screen label { margin-top: 8px; }
.login-screen input { margin-bottom: 10px; }
.login-screen button { width: 100%; margin-top: 8px; }
.login-screen .hint { text-align: center; margin-top: 12px; }

.admin-actions { margin-bottom: 20px; }
.ticket-table { overflow-x: auto; }
.ticket-table table { width: 100%; border-collapse: collapse; background: white; border-radius: 6px; overflow: hidden; }
.ticket-table th, .ticket-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; font-size: 0.9rem; }
.ticket-table th { background: #1a3c34; color: white; }
.ticket-table tr:hover { background: #f9f9f9; }
.ticket-table .print-btn { background: #1a3c34; font-size: 0.8rem; padding: 6px 10px; white-space: nowrap; }

.upload-area { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 15px 0; }
.upload-area input[type="file"] { flex: 1; min-width: 200px; }

.option-section {
    background: white; border-radius: 8px; padding: 15px 20px;
    margin-bottom: 20px; border-left: 4px solid #1a3c34;
}
.field-options-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin: 0 0 16px;
}
.field-options-toolbar button { margin: 0; }
#flatbedFieldOptionsManager { min-height: 240px; }
#adminFlatbedFields.page.active { display: block; }
.option-section-collapsible { padding: 0; overflow: hidden; }
.option-section-toggle {
    display: flex; align-items: center; gap: 10px; width: 100%;
    background: transparent; color: inherit; border: none; border-radius: 0;
    text-align: left; padding: 14px 18px; margin: 0; cursor: pointer;
}
.option-section-toggle:hover { opacity: 1; background: #f3f7f5; }
.option-section-toggle h3 {
    margin: 0; flex: 1; min-width: 0; pointer-events: none;
}
.option-section-count {
    background: #eef2f0; color: #1a3c34; border-radius: 999px;
    font-size: 0.8rem; font-weight: 700; padding: 2px 9px;
    min-width: 1.6em; text-align: center; flex-shrink: 0;
}
.option-section-chevron {
    width: 0.5em; height: 0.5em; flex-shrink: 0;
    border-right: 2px solid #1a3c34; border-bottom: 2px solid #1a3c34;
    transform: rotate(45deg); transition: transform 0.15s ease;
    margin: 0 4px 0 2px;
}
.option-section-collapsible.is-collapsed .option-section-chevron,
.field-nested-collapse.is-collapsed .option-section-chevron {
    transform: rotate(-45deg); margin-bottom: 2px;
}
.option-section-body { padding: 0 18px 16px; }
.option-section-collapsible.is-collapsed .option-section-body,
.field-nested-collapse.is-collapsed .field-nested-body { display: none; }
.field-nested-toggle {
    display: flex; align-items: center; gap: 8px; width: 100%;
    background: transparent; color: inherit; border: none; border-radius: 0;
    text-align: left; padding: 0; margin: 0 0 8px; cursor: pointer;
}
.field-nested-toggle:hover { opacity: 1; }
.field-nested-toggle .account-haul-rates-label { margin: 0; flex: 1; }
.field-nested-hint {
    font-size: 0.75rem; font-weight: 600; color: #0d6efd; white-space: nowrap;
}
.field-nested-collapse.is-collapsed { padding-bottom: 2px; }
.option-section-accounts { border-left-color: #b45309; }
.option-section-haul { border-left-color: #0d6efd; }
.option-section-haul .h3-sub { color: #0d6efd; }
.option-add-haul .rate-add-bbl { background: #eef5ff; border-color: #b6d0f7; }
.option-section-haul .account-rate-inline button { background: #0d6efd; }
.option-section h3 { margin: 0 0 12px; font-size: 1rem; color: #1a3c34; }
.option-section h3 .h3-sub {
    font-weight: 600; font-size: 0.85rem; color: #b45309; margin-left: 6px;
}
.option-add { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.option-add input { flex: 1; min-width: 140px; }
.option-add-account .rate-add-wrap {
    display: flex; align-items: center; gap: 4px;
    background: #fff8f0; border: 1px solid #f0d9b5; border-radius: 6px;
    padding: 4px 8px;
}
.option-add-account .rate-add-wrap input {
    width: 90px; min-width: 90px; flex: none; margin: 0;
    border: 1px solid #ddd; border-radius: 4px; padding: 8px;
}
.account-option-row {
    flex-wrap: wrap; align-items: center !important;
}
.account-option-with-hauls {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 12px 0 !important;
}
.account-option-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.account-haul-rates {
    background: #f4f8ff;
    border: 1px solid #c9ddf7;
    border-radius: 8px;
    padding: 10px 12px;
}
.account-haul-rates-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #0d6efd;
    margin-bottom: 8px;
}
details.account-haul-rates > summary.account-haul-rates-label {
    cursor: pointer;
    list-style: none;
}
details.account-haul-rates > summary.account-haul-rates-label::-webkit-details-marker {
    display: none;
}
.account-haul-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #e3eefc;
}
.account-haul-row:last-of-type { border-bottom: none; }
.account-haul-name {
    min-width: 120px;
    font-size: 0.9rem;
}
.save-haul-rates-btn {
    margin-top: 10px;
    background: #0d6efd;
    font-size: 0.85rem;
    padding: 8px 12px;
}
.account-rate-inline {
    display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.account-rate-inline input {
    width: 90px; margin: 0; padding: 6px 8px; font-size: 0.9rem;
}
.account-rate-inline button {
    font-size: 0.8rem; padding: 6px 10px; margin: 0; background: #b45309;
}
.fsc-inline input {
    width: 72px;
}
.option-add-account { flex-wrap: wrap; }
.option-list { list-style: none; padding: 0; margin: 0; }
.option-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid #eee; gap: 10px;
}
.option-list li:last-child { border-bottom: none; }
.option-name { flex: 1; word-break: break-word; min-width: 120px; }
.option-actions { display: flex; gap: 6px; flex-shrink: 0; }
.option-actions button { font-size: 0.8rem; padding: 6px 10px; margin: 0; }

/* Billing */
.billing-preview {
    margin-top: 16px; padding: 12px 14px; background: #e8f5f0;
    border-left: 4px solid #1a3c34; border-radius: 0 6px 6px 0;
    font-size: 0.95rem;
}
.billing-preview strong { display: block; color: #1a3c34; margin-bottom: 4px; }
.ticket-bill { margin-top: 6px; font-size: 0.9rem; color: #1a3c34; }
.ticket-bill.muted { color: #888; font-size: 0.85rem; }
.invoice-btn { background: #b45309; white-space: nowrap; font-size: 0.85rem; padding: 8px 12px; margin: 0; }
.invoice-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ticket-list .invoice-btn { font-size: 0.85rem; }
.create-invoice-btn {
    background: #b45309 !important; font-weight: 700;
    font-size: 1.05rem !important; padding: 14px 18px !important;
}
.create-invoice-panel {
    background: white; border-radius: 10px; padding: 20px 22px;
    border: 2px solid #b45309; margin-bottom: 8px;
}
.account-select-row {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.account-select-row select { flex: 1; min-width: 220px; }
.account-select-row button { white-space: nowrap; margin: 0; background: #1a3c34; }
.create-invoice-panel h2 { margin-top: 0; color: #1a3c34; }
.create-invoice-actions {
    display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; align-items: center;
}
.create-invoice-actions .submit-btn { width: auto; margin: 0; flex: 1; min-width: 200px; }
.invoice-filters {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px;
    margin: 12px 0 8px; align-items: end;
}
@media (max-width: 720px) {
    .invoice-filters { grid-template-columns: 1fr; }
}
.invoice-filters input[type="date"] { min-width: 160px; }
.invoice-ticket-row.invoiced { border-color: #b6d4fe; background: #f8fbff; }
.status-badge.invoiced { background: #cfe2ff; color: #084298; }
.invoice-ticket-picker {
    background: #f8f9fa; border: 1px solid #ddd; border-radius: 8px;
    padding: 8px; max-height: 360px; overflow-y: auto; margin-top: 4px;
}
.invoice-ticket-row {
    display: flex; gap: 12px; align-items: flex-start;
    background: white; border: 1px solid #e5e5e5; border-radius: 8px;
    padding: 12px; margin-bottom: 8px; cursor: pointer;
}
.invoice-ticket-row:last-child { margin-bottom: 0; }
.invoice-ticket-row input[type="checkbox"] { width: auto; margin-top: 4px; flex-shrink: 0; }
.inv-ticket-body { flex: 1; min-width: 0; }
.inv-ticket-title { font-size: 0.95rem; margin-bottom: 4px; }
.inv-ticket-meta { font-size: 0.85rem; color: #555; }
.inv-end-row { margin-top: 8px; max-width: 280px; }
.invoice-preview {
    margin-top: 14px; padding: 12px 14px; background: #fff8f0;
    border-left: 4px solid #b45309; border-radius: 0 6px 6px 0;
    font-size: 0.95rem;
}
.invoice-preview strong { color: #9a3412; }

.rates-manager { margin-top: 12px; }
.rates-table {
    width: 100%; border-collapse: collapse; background: white;
    border-radius: 8px; overflow: hidden;
}
.rates-table th, .rates-table td {
    padding: 12px 14px; text-align: left; border-bottom: 1px solid #eee;
}
.rates-table th { background: #1a3c34; color: white; }
.rate-input-row { display: flex; align-items: center; gap: 6px; max-width: 200px; }
.rate-input-row input { width: 100px; margin: 0; }
.rate-prefix, .rate-suffix { color: #666; font-size: 0.9rem; }

.bill-type-row {
    display: flex; flex-wrap: wrap; gap: 16px 24px;
    margin: 4px 0 8px; padding: 10px 12px;
    background: #fff; border: 1px solid #ddd; border-radius: 8px;
}
.bill-type-row .checkbox-label { margin: 0; font-weight: 600; }

.misc-charges { margin: 8px 0 16px; }
.misc-charges h4 { margin: 0 0 8px; font-size: 1rem; color: #1a3c34; }
.misc-row { margin-bottom: 8px; align-items: end; }
.misc-row .misc-amt { max-width: 140px; }
.misc-row .danger-btn { padding: 8px 12px; }

.ancillary-charges { margin: 12px 0 18px; padding: 12px; background: #f7faf8; border: 1px solid #d5e0da; border-radius: 8px; }
.ancillary-charges h4 { margin: 0 0 4px; font-size: 1rem; color: #1a3c34; }
.ancillary-row {
    display: grid;
    grid-template-columns: minmax(140px, 1.6fr) minmax(110px, 0.9fr) minmax(80px, 0.6fr) minmax(100px, 0.7fr) minmax(80px, 0.55fr) auto;
    gap: 8px;
    align-items: end;
    margin-bottom: 10px;
}
.ancillary-row-driver {
    grid-template-columns: minmax(180px, 1.8fr) minmax(100px, 0.7fr) auto auto;
}
.ancillary-unit-chip {
    font-size: 0.85rem; font-weight: 700; color: #1a3c34;
    padding: 10px 0 8px; white-space: nowrap;
}
.option-section-ancillary { border-left-color: #0f766e; }
.ancillary-row label { font-size: 0.75rem; color: #4a6359; margin-bottom: 2px; display: block; }
.ancillary-rate-wrap { display: flex; align-items: center; gap: 4px; }
.ancillary-rate-suffix { font-size: 0.8rem; color: #555; white-space: nowrap; }
.ancillary-amt { font-weight: 700; padding: 8px 0; color: #1a3c34; }
.ancillary-remove { margin: 0 0 2px; padding: 8px 12px; }
@media (max-width: 720px) {
    .ancillary-row { grid-template-columns: 1fr 1fr; }
    .ancillary-amt-wrap { grid-column: 1; }
    .ancillary-remove { grid-column: 2; justify-self: end; }
}

.account-invoice-list { margin-top: 12px; }
.account-invoice-card {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    background: white; padding: 14px 16px; margin-bottom: 10px;
    border-radius: 8px; border-left: 4px solid #b45309;
}
.aic-meta { font-size: 0.85rem; color: #555; margin-top: 4px; }
.action-cell { white-space: nowrap; }
.action-cell button { margin: 2px; padding: 6px 10px; font-size: 0.8rem; }
.driver-actions { white-space: normal; display: flex; flex-wrap: wrap; gap: 4px; max-width: 280px; }
.driver-actions button { margin: 0; }

.payroll-kpis {
    display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 10px;
    margin: 8px 0 16px;
}
.payroll-kpi {
    background: #fff; border: 1px solid #e3e8ee; border-radius: 10px;
    padding: 12px 14px; border-left: 4px solid #1a3c34;
}
.payroll-kpi-label { font-size: 0.75rem; color: #5a7268; text-transform: uppercase; letter-spacing: 0.4px; }
.payroll-kpi-value { font-size: 1.25rem; font-weight: 800; color: #0b1a16; margin-top: 4px; }
.payroll-total-row td { background: #eef4f1; font-weight: 700; }
.payroll-warn { color: #9a3412; }
@media (max-width: 900px) {
    .payroll-kpis { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
    .field-grid { grid-template-columns: 1fr; }
    .field-row { flex-direction: column; }
    .account-invoice-card { flex-direction: column; align-items: stretch; }
}