/* Desert Theme Colors */
:root {
    --desert-bg: #F8F1DE;
    --desert-accent: #C97B4B;
    --desert-accent-dark: #8B5E3C;
    --desert-sand: #EED6C4;
    --desert-text: #222;
    --desert-table-border: #EED6C4;
    --desert-card-bg: #fffaf3;
    --radius-lg: 2rem;
    --radius-md: 1rem;
    --radius-sm: 0.5rem;
    --shadow-lg: 0 8px 32px rgba(201,123,75,0.12);
    --shadow-md: 0 4px 16px rgba(201,123,75,0.10);
    --shadow-sm: 0 2px 8px rgba(201,123,75,0.08);
}

body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--desert-bg) !important;
    color: var(--desert-text);
    line-height: 1.6;
}

/* iOS Safe Area Insets - Fix left offset on iOS devices */
@supports (-webkit-touch-callout: none) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    main {
        padding-left: calc(20px + env(safe-area-inset-left));
        padding-right: calc(20px + env(safe-area-inset-right));
    }
    
    .header-container {
        padding-left: calc(20px + env(safe-area-inset-left));
        padding-right: calc(20px + env(safe-area-inset-right));
    }
    
    .content-section {
        padding-left: calc(20px + env(safe-area-inset-left));
        padding-right: calc(20px + env(safe-area-inset-right));
    }
}

header {
    background: linear-gradient(90deg, var(--desert-sand) 0%, var(--desert-bg) 100%);
    color: var(--desert-text);
    padding: 0.3rem 0;
    box-shadow: 0 2px 8px rgba(201,123,75,0.08);
    position: relative;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

header h1 a {
    color: var(--desert-accent-dark);
    text-decoration: none;
    font-weight: bold;
    letter-spacing: 2px;
}

nav {
    position: relative;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: center;
}

nav ul li {
    display: inline;
    margin: 0 15px;
}

nav ul li a {
    color: var(--desert-accent-dark);
    font-weight: 500;
    border-radius: 6px;
    padding: 4px 12px;
    transition: background 0.2s, color 0.2s;
    text-decoration: none !important;
}

nav ul li a:hover, nav ul li a:focus {
    background: var(--desert-accent);
    color: #fff;
    text-decoration: none !important;
}

main {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background-color: var(--desert-card-bg);
    box-shadow: 0 0 10px rgba(201,123,75,0.07);
    border-radius: 10px;
}

footer {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    color: var(--desert-accent-dark);
    background: none;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-field {
    margin-bottom: 1rem; /* Consistent spacing for form elements */
}

.form-control-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-control, .form-control-lg {
    display: block;
    width: 100%;
    padding: 0.5rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-sizing: border-box; /* Ensure padding doesn't increase size */
}

.form-control-lg {
    padding: 0.75rem 1rem;
    font-size: 1.25rem;
}

textarea.form-control {
    min-height: 100px;
}

.form-control:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.is-invalid {
    border-color: #dc3545;
}

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 80%;
    color: #dc3545;
}

.is-invalid ~ .invalid-feedback,
.is-invalid .invalid-feedback {
    display: block;
}

.form-check {
    position: relative;
    display: block;
    padding-left: 1.25rem;
}

.form-check-input {
    position: absolute;
    margin-top: 0.3rem;
    margin-left: -1.25rem;
}

.form-check-label {
    margin-bottom: 0;
}

/* Buttons - Global consistent height */
.btn, button.btn, a.btn, .btn-primary, .btn-secondary, .btn-danger, .btn-info, .btn-success, .btn-warning,
.btn-outline-primary, .btn-outline-secondary, .btn-outline-danger, .btn-outline-info, .btn-outline-success, .btn-outline-warning {
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    gap: 8px !important; /* Force space between icons and text */
    border-radius: var(--radius-lg) !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    padding: 0.7rem 1.5rem;
    box-shadow: var(--shadow-sm);
    min-width: 44px;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    line-height: 1.5 !important;
    vertical-align: middle;
    text-align: center;
    text-decoration: none !important;
    outline: none !important;
    border: none;
    box-sizing: border-box !important;
    transition: box-shadow 0.18s cubic-bezier(.4,0,.2,1),
                background 0.18s cubic-bezier(.4,0,.2,1),
                color 0.18s cubic-bezier(.4,0,.2,1),
                transform 0.13s cubic-bezier(.4,0,.2,1);
    /* iOS fix: ensure proper baseline alignment */
    -webkit-box-align: center;
}

/* Clear any legacy icon margins that might interfere */
.btn i, button.btn i, a.btn i {
    margin: 0 !important;
    /* iOS fix: ensure icons center properly */
    line-height: 1 !important;
    vertical-align: middle !important;
}

.btn-primary {
    background-color: #ffd6b3;
    border-color: #ffd6b3;
    color: #8B5E3C;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #ffc299;
    border-color: #ffc299;
    color: #8B5E3C;
}

.btn-secondary {
    background-color: #e0e7ef;
    border-color: #e0e7ef;
    color: #6c757d;
}

.btn-secondary:hover, .btn-secondary:focus {
    background-color: #cfd8dc;
    border-color: #cfd8dc;
    color: #6c757d;
}

.btn-danger {
    background-color: #ffd6d6;
    border-color: #ffd6d6;
    color: #a94442;
}

.btn-danger:hover, .btn-danger:focus {
    background-color: #ffb3b3;
    border-color: #ffb3b3;
    color: #a94442;
}

.btn-info {
    background-color: #d6eaff;
    border-color: #d6eaff;
    color: #31708f;
}

.btn-info:hover, .btn-info:focus {
    background-color: #b3daff;
    border-color: #b3daff;
    color: #31708f;
}

.btn-warning {
    background-color: #fff7cc;
    border-color: #fff7cc;
    color: #856404;
}

.btn-warning:hover, .btn-warning:focus {
    background-color: #ffe699;
    border-color: #ffe699;
    color: #856404;
}

.btn-success {
    background-color: #b6e2b6;
    border-color: #b6e2b6;
    color: #226622;
}

.btn-success:hover, .btn-success:focus {
    background-color: #a2d9a2;
    border-color: #a2d9a2;
    color: #226622;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.2rem;
    height: auto !important;
    min-height: 32px !important;
    max-height: none !important;
}

/* Overrides a.btn line-height (1.5 !important): keeps wrapped labels compact and visually centered */
.btn.btn-sm {
    line-height: 1.2 !important;
}

.btn:hover, .btn:focus, .btn:active,
button:hover, button:focus, button:active,
.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.btn-secondary:hover, .btn-secondary:focus, .btn-secondary:active,
.btn-danger:hover, .btn-danger:focus, .btn-danger:active,
.btn-info:hover, .btn-info:focus, .btn-info:active,
.btn-warning:hover, .btn-warning:focus, .btn-warning:active {
    text-decoration: none !important;
}

.btn:hover, .btn:focus, button:hover, button:focus {
    transform: scale(1.045);
    box-shadow: 0 4px 18px rgba(201,123,75,0.13);
    z-index: 2;
}

/* Alerts / Flash Messages */
.flashes {
    margin-bottom: 1rem;
    animation: fadeInFlash 0.7s cubic-bezier(.4,0,.2,1);
}
@keyframes fadeInFlash {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    animation: fadeInFlash 0.7s cubic-bezier(.4,0,.2,1);
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.alert-info {
    background: #fffbe6;
    color: var(--desert-accent-dark);
    border-color: var(--desert-accent);
}

/* Tables */
table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    border: 1.5px solid var(--desert-table-border);
    overflow: hidden;
}

table th,
table td {
    padding: 0.75rem;
    vertical-align: top;
    border-color: var(--desert-table-border) !important;
}

table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid var(--desert-table-border);
    background: var(--desert-sand);
    color: var(--desert-accent-dark);
    font-weight: 600;
    border-radius: 0 !important;
}

table tbody tr:nth-of-type(odd) {
    background: #f9f6ef;
}

.table-hover tbody tr:hover {
    color: #212529;
    background-color: rgba(0, 0, 0, 0.075);
}

/* Dashboard Specific */
.dashboard-summary .grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.summary-card {
    border: 1.5px solid var(--desert-table-border);
    padding: 20px;
    text-align: center;
    border-radius: 10px;
    background-color: var(--desert-card-bg);
    box-shadow: 0 2px 8px rgba(201,123,75,0.06);
    transition: box-shadow 0.18s cubic-bezier(.4,0,.2,1),
                transform 0.18s cubic-bezier(.4,0,.2,1);
}
.summary-value {
    font-size: 2em;
    font-weight: bold;
    margin: 10px 0;
}
.dashboard-charts {
    margin-top: 40px;
    text-align: center;
}

/* Badges (used for status) */
.badge {
    display: inline-block;
    padding: 0.3em 0.6em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}
.status-pending {
    background-color: #ffc107; /* Yellow */
    color: #212529;
}
.status-in.progress, .status-in-progress {
    background-color: #17a2b8; /* Blue */
}
.status-completed {
    background-color: #28a745; /* Green */
}
.status-unpaid {
    background-color: #dc3545; /* Red */
}
.status-paid {
    background-color: #28a745; /* Green */
}

/* Utility */
.mb-3 {
    margin-bottom: 1rem !important;
}
.text-muted {
    color: #6c757d !important;
}

/* Content Section */
.content-section {
    background: #ffffff;
    padding: 20px;
    border: 1px solid #dddddd;
    border-radius: 3px;
    margin-bottom: 20px;
    transition: box-shadow 0.18s cubic-bezier(.4,0,.2,1),
                transform 0.18s cubic-bezier(.4,0,.2,1);
}
.summary-card:hover {
    box-shadow: 0 8px 32px rgba(201,123,75,0.16);
    transform: translateY(-2px) scale(1.01);
}

/* Subtle hover for large content sections to avoid layout shift */
.content-section:hover {
    box-shadow: 0 6px 24px rgba(201,123,75,0.12);
    transform: translateY(-1px);
}

/* Responsive adjustments (basic example) */
@media (max-width: 768px) {
    nav ul li {
        display: block;
        margin: 0;
        padding: 0;
        border-bottom: 1px solid var(--desert-sand);
    }
    
    nav ul li:last-child {
        border-bottom: none;
    }
    
    nav ul li a {
        display: block;
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        font-weight: 500;
        color: var(--desert-accent-dark);
        text-decoration: none;
        transition: all 0.2s ease;
    }
    
    nav ul li a:hover {
        background: var(--desert-accent);
        color: white;
        transform: translateX(5px);
    }
    main {
        padding: 10px;
    }
}

/* Accent utility class for headings or highlights */
.desert-accent {
    color: var(--desert-accent-dark) !important;
}

/* Optional: Add a subtle sand texture or pattern to the background for extra desert feel */
/* body {
    background-image: url('/static/img/sand-texture.png');
    background-size: cover;
    background-blend-mode: lighten;
} */

/* End Desert Theme */

main, .content-section, .summary-card, .modal-content, .table, table, .form-control, .btn, .badge, .service-bubble, .team-bubble {
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-md);
}

.form-control, .form-control-lg {
    border-radius: var(--radius-md) !important;
    font-size: 1.1rem;
    min-height: 44px;
}

input[type="date"], input[type="number"], select, textarea {
    border-radius: var(--radius-md) !important;
}

.modal-content {
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg);
}

.table, table {
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    border: 1.5px solid var(--desert-table-border);
    overflow: hidden;
}

.table-responsive, .table {
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}

@media (max-width: 900px) {
    main, .content-section {
        padding: 10px;
        border-radius: var(--radius-md);
    }
    .summary-card {
        padding: 12px;
        border-radius: var(--radius-md);
    }
    .modal-content {
        width: 98vw !important;
        max-width: 98vw !important;
        min-width: 0 !important;
        border-radius: var(--radius-md) !important;
    }
}

@media (max-width: 600px) {
    .header-container {
        padding: 0 15px;
    }
    
    header {
        padding: 0.2rem 0;
    }
    
    header h1 img {
        height: 100px !important;
    }
    
    main, .content-section {
        padding: 2vw;
        border-radius: var(--radius-sm);
    }
    .summary-card {
        padding: 8px;
        border-radius: var(--radius-sm);
    }
    .modal-content {
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 0 !important;
        border-radius: var(--radius-sm) !important;
        margin: 0 !important;
        padding: 2vw !important;
    }
    .table, table {
        font-size: 0.95em;
        border-radius: var(--radius-sm) !important;
    }
    .btn, .btn-primary, .btn-secondary, .btn-danger, .btn-info, .btn-success, .btn-warning,
    .btn-outline-primary, .btn-outline-secondary, .btn-outline-danger, .btn-outline-info, .btn-outline-success, .btn-outline-warning,
    button.btn, a.btn {
        font-size: 1em;
        padding: 0.5rem 1rem;
        border-radius: var(--radius-sm) !important;
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
        line-height: 1.5 !important;
        box-sizing: border-box !important;
    }
    /* Do not lock .btn-sm to 44px — wrapped labels need natural height + tighter leading */
    .btn.btn-sm,
    a.btn.btn-sm,
    button.btn.btn-sm {
        height: auto !important;
        min-height: 32px !important;
        max-height: none !important;
        line-height: 1.2 !important;
    }
    .form-control, .form-control-lg {
        font-size: 1em;
        min-height: 38px;
        border-radius: var(--radius-sm) !important;
    }
}

/* Utility classes */
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.rounded-sm { border-radius: var(--radius-sm) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }

/* Hide scrollbars but allow scrolling */
.table-responsive::-webkit-scrollbar { display: none; }
.table-responsive { -ms-overflow-style: none; scrollbar-width: none; }

/* Hamburger nav for mobile */
@media (max-width: 700px) {
    .header-container {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0;
    }
    
    nav {
        width: auto;
        display: flex;
        justify-content: flex-end;
    }
    
    header h1 img {
        height: 100px !important;
    }
    
    nav ul {
        display: none;
        flex-direction: column;
        background: var(--desert-card-bg);
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 400px;
        z-index: 1000;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-md);
        padding: 1rem 0;
        border: 1px solid var(--desert-sand);
    }
    
    nav ul.show {
        display: flex !important;
        animation: slideIn 0.3s ease-out;
    }
    
    @keyframes slideIn {
        from {
            opacity: 0;
            transform: translate(-50%, -50%) scale(0.9);
        }
        to {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1);
        }
    }
    
    nav ul li {
        display: block;
        margin: 0;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid var(--desert-sand);
    }
    
    nav ul li:last-child {
        border-bottom: none;
    }
    
    nav ul li a {
        display: block;
        padding: 0.5rem 1rem;
        font-size: 1.1rem;
        font-weight: 500;
    }
    
    .hamburger {
        display: block !important;
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid var(--desert-sand);
        color: var(--desert-accent);
        cursor: pointer;
        padding: 0.75rem;
        border-radius: var(--radius-md);
        transition: all 0.3s ease;
        position: relative !important;
        z-index: 9999 !important;
        width: 48px;
        height: 48px;
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        box-shadow: 0 2px 12px rgba(201, 123, 75, 0.15);
    }
    
    /* Hide hamburger menu when modal is open */
    body.modal-open .hamburger,
    body:has(.modal.show) .hamburger {
        display: none !important;
        z-index: 1 !important;
        pointer-events: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
    
    .hamburger:hover {
        background: rgba(255, 255, 255, 1);
        transform: translateY(-2px);
        box-shadow: 0 4px 20px rgba(201, 123, 75, 0.25);
    }
}

/* Hamburger button - hidden by default, shown on mobile */
.hamburger { 
    display: none; 
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--desert-sand);
    color: var(--desert-accent);
    cursor: pointer;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    z-index: 9999;
    width: 48px;
    height: 48px;
    position: relative;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 12px rgba(201, 123, 75, 0.15);
}

/* Hide hamburger menu when modal is open */
body.modal-open .hamburger {
    display: none !important;
    z-index: 1 !important;
    pointer-events: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

.hamburger:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(201, 123, 75, 0.25);
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--desert-accent);
    margin: 5px auto;
    transition: all 0.3s ease;
    border-radius: 1px;
}

.hamburger:hover .hamburger-line {
    background: var(--desert-accent-dark);
}

/* Micro-animations */
.summary-card, .content-section, .modal-content, .service-item, .team-bubble {
    transition: box-shadow 0.18s cubic-bezier(.4,0,.2,1),
                transform 0.18s cubic-bezier(.4,0,.2,1);
}
.summary-card:hover, .service-item:hover, .team-bubble:hover {
    box-shadow: 0 8px 32px rgba(201,123,75,0.16);
    transform: translateY(-2px) scale(1.01);
}

/* Keep the toned-down effect for content sections here as well */
.content-section:hover {
    box-shadow: 0 6px 24px rgba(201,123,75,0.12);
    transform: translateY(-1px);
}

/* Modal open/close animation */
.modal {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(.4,0,.2,1);
}
.modal[style*="display: block"], .modal.show {
    opacity: 1;
    pointer-events: auto;
    animation: modalIn 0.32s cubic-bezier(.4,0,.2,1);
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(40px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Table row hover animation */
table tbody tr {
    transition: background 0.18s cubic-bezier(.4,0,.2,1), box-shadow 0.18s cubic-bezier(.4,0,.2,1);
}
table tbody tr:hover {
    background: #fffbe6 !important;
    box-shadow: 0 2px 8px rgba(201,123,75,0.08);
}

/* Jobs Overview specific styling for thinner rows */
.jobs-overview-table tbody tr {
    padding: 0.3rem 0;
    line-height: 1.2;
}

.jobs-overview-table tbody td {
    padding: 0.4rem 0.75rem;
    vertical-align: middle;
}

.jobs-overview-table tbody tr.breakdown-row {
    padding: 0.2rem 0;
    background-color: #f8f9fa;
}

.jobs-overview-table tbody tr.breakdown-row td {
    padding: 0.3rem 0.75rem;
    border-top: none;
}

/* Alternating week styling for jobs overview */
.jobs-overview-table tbody tr.week-odd {
    background-color: #e1f5fe;
}

.jobs-overview-table tbody tr.week-even {
    background-color: #f8f9fa;
}

.jobs-overview-table tbody tr.week-odd:hover {
    background-color: #b3e5fc !important;
}

.jobs-overview-table tbody tr.week-even:hover {
    background-color: #e9ecef !important;
}

.jobs-overview-table tbody tr.breakdown-row.week-odd {
    background-color: #f0f8ff;
}

.jobs-overview-table tbody tr.breakdown-row.week-even {
    background-color: #ffffff;
}

/* Responsive tables */
@media (max-width: 700px) {
  table, thead, tbody, th, td, tr {
    display: block;
  }
  thead {
    display: none;
  }
  tr {
    margin-bottom: 1.5rem;
    background: var(--desert-card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0.5rem;
  }
  td {
    display: block;
    width: 100%;
    padding-left: 0;
    min-height: 44px;
    border: none;
    border-bottom: 1px solid var(--desert-table-border);
    position: relative;
  }
  td:before {
    content: attr(data-label);
    display: block;
    font-weight: bold;
    color: #8B5E3C;
    margin-bottom: 0.2em;
    font-size: 1em;
    text-transform: capitalize;
  }
  table {
    box-shadow: none;
    border-radius: 0;
    width: 100%;
    overflow-x: auto;
  }
}

/* Zebra striping for tables */
tbody tr:nth-child(odd) {
    background: #f7f3ea;
}

/* Cards mobile-friendly */
@media (max-width: 700px) {
  .summary-card, .content-section, .modal-content, .service-item, .team-bubble {
    width: 100% !important;
    margin: 1rem 0 !important;
    padding: 1.2rem 1rem !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-md) !important;
  }
}

@media (max-width: 700px) {
  .service-item {
    flex-direction: column !important;
    align-items: flex-start !important;
    width: 100% !important;
    padding: 1rem !important;
    margin-bottom: 1rem !important;
    overflow-x: auto;
  }
  .service-item .service-name,
  .service-item .service-details,
  .service-item .service-price {
    width: 100% !important;
    text-align: left !important;
    justify-content: flex-start !important;
    margin: 0 !important;
    padding: 0 !important;
    word-break: break-word;
  }
  .service-item .service-price {
    margin-top: 0.5em !important;
    text-align: right !important;
  }
}

/* Field Service Styles */
.field-service-status {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.status-badge {
    margin-top: 4px;
}

.status-badge .badge {
    margin-right: 4px;
    font-size: 11px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.photo-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.photo-thumbnail {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}

.photo-status-badges {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 2px;
}

.photo-status-badges .badge {
    font-size: 10px;
    padding: 2px 4px;
}

.photo-actions {
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.photo-item:hover .photo-actions {
    opacity: 1;
}

.photo-actions .btn {
    flex: 1;
    padding: 2px 4px;
    font-size: 12px;
    border-radius: 4px;
}

.field-report-summary {
    background: #e9ecef;
    border-left: 4px solid #28a745;
    padding: 8px 12px;
    margin: 8px 0;
}

.report-preview {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

.comment-item {
    background: #f8f9fa;
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

.comment-item small {
    font-weight: 600;
    color: #495057;
}

/* Action button styling for field report */
.action-icon.report-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
}

.action-icon.report-btn:hover {
    background: linear-gradient(45deg, #218838, #1ea080);
    transform: translateY(-1px);
}

/* Field Service Statistics */
.field-service-stats .stat-card {
    background: #f8f9fa;
    transition: all 0.2s ease;
}

.field-service-stats .stat-card:hover {
    background: #e9ecef;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-number {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 2px;
}

.stat-label {
    color: #6c757d;
    font-size: 0.8rem;
}

/* Simple completed job styling */
.simple-completed {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 4px 0;
}

.completed-text {
    color: #28a745;
    font-weight: 600;
    font-size: 14px;
}

.simple-undo-btn {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s ease;
}

.simple-undo-btn:hover {
    background: #5a6268;
}

/* Hide action buttons for completed jobs */
.job-row.completed .job-actions {
    display: none;
}

/* ============================================
   ROUTE ASSISTANT - Inline Bar & Panel
   ============================================ */

/* ---- Inline Insight Bar (primary UI) ---- */
.ri-bar {
    background: var(--desert-card-bg);
    border: 1px solid var(--desert-table-border);
    border-radius: 14px;
    margin-bottom: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(201, 123, 75, 0.08);
    animation: riSlideIn 0.3s ease-out;
}

@keyframes riSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ri-bar-content {
    padding: 0;
}

.ri-bar-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 13px;
    color: #888;
}

.ri-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--desert-sand);
    border-top-color: var(--desert-accent);
    border-radius: 50%;
    animation: riSpin 0.7s linear infinite;
}

@keyframes riSpin { to { transform: rotate(360deg); } }

/* Team rows */
.ri-team-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.ri-team-row.single {
    padding: 10px 16px;
}

.ri-team-row + .ri-team-row {
    border-top: 1px solid var(--desert-table-border);
}

.ri-team-row.has-savings {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.03) 0%, rgba(22, 163, 74, 0.01) 100%);
}

.ri-left, .ri-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ri-team-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--desert-text);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.ri-team-label i {
    color: var(--desert-accent);
    font-size: 12px;
}

.ri-pill {
    font-size: 10px;
    font-weight: 600;
    background: var(--desert-sand);
    color: var(--desert-accent-dark);
    padding: 2px 8px;
    border-radius: 10px;
}

.ri-metrics {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #888;
}

.ri-metrics i {
    font-size: 11px;
    margin-right: 3px;
    color: #aaa;
}

.ri-summary-text {
    font-size: 12px;
    color: #999;
}

/* Savings highlight */
.ri-saving-highlight {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.ri-saving-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}

.ri-saving-badge i {
    font-size: 11px;
}

.ri-saving-sub {
    font-size: 10px;
    color: #16a34a;
    font-weight: 500;
}

/* Good route badge */
.ri-good-badge {
    font-size: 12px;
    font-weight: 600;
    color: #22c55e;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.ri-good-badge i {
    font-size: 13px;
}

/* Details button */
.ri-details-btn {
    padding: 6px 14px;
    background: var(--desert-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    font-family: inherit;
}

.ri-details-btn:hover {
    background: var(--desert-accent-dark);
    transform: translateY(-1px);
}

.ri-details-btn.subtle {
    background: transparent;
    color: var(--desert-accent);
    border: 1px solid var(--desert-sand);
}

.ri-details-btn.subtle:hover {
    background: var(--desert-sand);
    color: var(--desert-accent-dark);
}

/* Inline suggestion preview */
.ri-suggestion-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 10px;
    background: rgba(245, 158, 11, 0.04);
    border-top: 1px solid rgba(245, 158, 11, 0.1);
    font-size: 12px;
}

.ri-suggestion-icon {
    color: #f59e0b;
    font-size: 14px;
    flex-shrink: 0;
}

.ri-suggestion-text {
    flex: 1;
    color: var(--desert-text);
    line-height: 1.4;
}

.ri-suggestion-text strong {
    font-weight: 600;
}

.ri-suggestion-time {
    color: #16a34a;
    font-weight: 600;
    margin-left: 6px;
}

.ri-more-link {
    color: var(--desert-accent);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.ri-more-link:hover {
    text-decoration: underline;
}

/* Inline issue rows */
.ri-issue-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 6px;
    font-size: 11px;
    border-top: 1px solid var(--desert-table-border);
}

.ri-issue-row.warning {
    color: #92400e;
    background: rgba(245, 158, 11, 0.04);
}

.ri-issue-row.warning i { color: #f59e0b; }

.ri-issue-row.info {
    color: #1e40af;
    background: rgba(59, 130, 246, 0.03);
}

.ri-issue-row.info i { color: #3b82f6; }

/* Demo note */
.ri-demo-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 11px;
    color: #92400e;
    background: rgba(245, 158, 11, 0.04);
    border-top: 1px solid rgba(245, 158, 11, 0.1);
}

.ri-demo-note i { color: #f59e0b; }
.ri-demo-note span { flex: 1; }

/* Panel */
.route-assistant-panel {
    position: fixed;
    top: 0;
    right: -440px;
    width: 420px;
    height: 100vh;
    z-index: 1060;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.route-assistant-panel.open {
    right: 0;
    pointer-events: auto;
}

.ra-panel-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--desert-card-bg);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
    border-left: 1px solid var(--desert-sand);
    overflow: hidden;
}

/* Header */
.ra-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--desert-accent) 0%, var(--desert-accent-dark) 100%);
    color: #fff;
    flex-shrink: 0;
}

.ra-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ra-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    backdrop-filter: blur(8px);
}

.ra-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.ra-subtitle {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.85;
    font-weight: 400;
}

.ra-close-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
}

.ra-close-btn:hover {
    background: rgba(255,255,255,0.3);
}

.ra-stale-notice {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px 20px;
    margin: 0;
    display: none;
}

.ra-stale-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #856404;
    font-size: 13px;
}

.ra-stale-content i {
    font-size: 16px;
}

.ra-stale-content strong {
    font-weight: 600;
}

.ra-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ra-refresh-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.ra-refresh-btn:hover {
    background: rgba(255,255,255,0.3);
}

.ra-refresh-btn.refreshing i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Tabs */
.ra-tabs {
    display: flex;
    padding: 0;
    background: var(--desert-bg);
    border-bottom: 1px solid var(--desert-sand);
    flex-shrink: 0;
}

.ra-tab {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--desert-accent-dark);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    font-family: inherit;
}

.ra-tab:hover {
    background: rgba(201, 123, 75, 0.08);
}

.ra-tab.active {
    color: var(--desert-accent);
    background: var(--desert-card-bg);
}

.ra-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 12px;
    right: 12px;
    height: 2px;
    background: var(--desert-accent);
    border-radius: 2px 2px 0 0;
}

.ra-tab i {
    font-size: 13px;
}

.ra-tab-badge {
    background: #e74c3c;
    color: #fff;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* Content Area */
.ra-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--desert-sand) transparent;
}

.ra-content::-webkit-scrollbar {
    width: 6px;
}

.ra-content::-webkit-scrollbar-thumb {
    background: var(--desert-sand);
    border-radius: 3px;
}

.ra-tab-content {
    padding: 16px;
}

/* Loading State */
.ra-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
    color: var(--desert-accent-dark);
}

.ra-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--desert-sand);
    border-top-color: var(--desert-accent);
    border-radius: 50%;
    animation: raSpin 0.8s linear infinite;
}

@keyframes raSpin {
    to { transform: rotate(360deg); }
}

.ra-loading p {
    font-size: 13px;
    margin: 0;
    color: #888;
}

/* Empty State */
.ra-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.ra-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: var(--desert-sand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--desert-accent-dark);
    margin-bottom: 16px;
}

.ra-empty h4 {
    margin: 0 0 8px;
    font-size: 16px;
    color: var(--desert-text);
}

.ra-empty p {
    margin: 0 0 20px;
    font-size: 13px;
    color: #888;
    line-height: 1.5;
    max-width: 280px;
}

.ra-empty-tip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(201, 123, 75, 0.08);
    border-radius: 10px;
    font-size: 12px;
    color: var(--desert-accent-dark);
}

.ra-empty-tip i {
    color: var(--desert-accent);
    flex-shrink: 0;
}

/* Team Section */
.ra-team-section {
    margin-bottom: 20px;
}

.ra-team-section:last-child {
    margin-bottom: 0;
}

.ra-team-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.ra-team-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--desert-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ra-team-header h4 i {
    color: var(--desert-accent);
    font-size: 13px;
}

.ra-job-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--desert-accent-dark);
    background: var(--desert-sand);
    padding: 3px 10px;
    border-radius: 12px;
}

/* Metrics Grid */
.ra-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.ra-metric-card {
    background: #fff;
    border: 1px solid var(--desert-table-border);
    border-radius: 14px;
    padding: 14px;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
}

.ra-metric-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(201, 123, 75, 0.1);
}

.ra-metric-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 14px;
}

.ra-metric-icon.travel { background: #e8f4fd; color: #2196F3; }
.ra-metric-icon.distance { background: #e8f5e9; color: #4CAF50; }
.ra-metric-icon.time { background: #fff3e0; color: #FF9800; }
.ra-metric-icon.total { background: #fce4ec; color: #E91E63; }

.ra-metric-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--desert-text);
    line-height: 1.2;
}

.ra-metric-unit {
    font-size: 12px;
    font-weight: 500;
    color: #888;
    margin-left: 2px;
}

.ra-metric-label {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
    font-weight: 500;
}

/* Savings Banner */
.ra-savings-banner {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #bbf7d0;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

.ra-savings-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #16a34a;
}

.ra-savings-header i {
    font-size: 16px;
}

.ra-savings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.ra-saving-item {
    text-align: center;
    padding: 8px 4px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
}

.ra-saving-value {
    font-size: 18px;
    font-weight: 800;
    color: #16a34a;
}

.ra-saving-label {
    font-size: 10px;
    color: #666;
    font-weight: 500;
    margin-top: 2px;
}

.ra-view-suggestions-btn {
    width: 100%;
    padding: 10px;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
}

.ra-view-suggestions-btn:hover {
    background: #15803d;
    transform: translateY(-1px);
}

/* All Good Banner */
.ra-allgood-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1px solid #bbf7d0;
    border-radius: 14px;
    margin-bottom: 16px;
}

.ra-allgood-banner > i {
    font-size: 20px;
    color: #22c55e;
    margin-top: 2px;
    flex-shrink: 0;
}

.ra-allgood-banner strong {
    font-size: 13px;
    color: #16a34a;
    display: block;
    margin-bottom: 2px;
}

.ra-allgood-banner p {
    margin: 0;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

/* Section Title */
.ra-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--desert-accent-dark);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ra-section-title i {
    font-size: 12px;
    color: var(--desert-accent);
}

/* Route Timeline */
.ra-route-timeline {
    position: relative;
    padding-left: 4px;
}

.ra-timeline-stop {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 4px 0;
}

.ra-stop-marker {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.ra-stop-marker.booked { background: var(--desert-accent); }
.ra-stop-marker.pending { background: #f59e0b; }
.ra-stop-marker.completed { background: #22c55e; }

.ra-stop-details {
    flex: 1;
    min-width: 0;
    padding-bottom: 4px;
}

.ra-stop-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--desert-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ra-stop-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
}

.ra-stop-service {
    font-size: 11px;
    color: #888;
}

.ra-stop-suburb {
    font-size: 11px;
    color: var(--desert-accent);
    display: flex;
    align-items: center;
    gap: 3px;
}

.ra-stop-suburb i {
    font-size: 9px;
}

.ra-stop-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 3px;
    font-size: 11px;
    color: #999;
}

.ra-stop-info i {
    font-size: 10px;
    margin-right: 2px;
}

/* Travel between stops */
.ra-timeline-travel {
    display: flex;
    align-items: center;
    padding: 2px 0 2px 13px;
    gap: 8px;
}

.ra-travel-line {
    width: 2px;
    height: 20px;
    background: var(--desert-sand);
    border-radius: 2px;
}

.ra-travel-info {
    font-size: 11px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(201, 123, 75, 0.06);
    padding: 3px 10px;
    border-radius: 8px;
}

.ra-travel-info i {
    font-size: 10px;
    color: var(--desert-accent);
}

/* Issues Section */
.ra-issues-section {
    margin-top: 16px;
}

.ra-issue-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    margin-bottom: 8px;
}

.ra-issue-card.warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.ra-issue-card.info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.ra-issue-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.ra-issue-card.warning .ra-issue-icon {
    background: #fef3c7;
    color: #d97706;
}

.ra-issue-card.info .ra-issue-icon {
    background: #dbeafe;
    color: #2563eb;
}

.ra-issue-message {
    font-size: 12px;
    font-weight: 600;
    color: var(--desert-text);
    line-height: 1.4;
}

.ra-issue-detail {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
    line-height: 1.4;
}

/* Unassigned Notice */
.ra-unassigned-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: #92400e;
    margin-top: 12px;
}

.ra-unassigned-notice i {
    color: #f59e0b;
    flex-shrink: 0;
}

/* Suggestion Tab — Reorder Card */
.ra-reorder-card {
    background: #fff;
    border: 1px solid var(--desert-table-border);
    border-radius: 16px;
    overflow: hidden;
}

.ra-reorder-section {
    padding: 14px 16px;
}

.ra-reorder-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ra-reorder-label.current { color: #64748b; }
.ra-reorder-label.current::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
}

.ra-reorder-label.suggested { color: #16a34a; }
.ra-reorder-label.suggested::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
}

.ra-reorder-sequence {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ra-seq-stop {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background 0.15s;
}

.ra-seq-stop:hover {
    background: rgba(201, 123, 75, 0.04);
}

.ra-seq-stop.moved {
    background: rgba(22, 163, 74, 0.06);
    border-left: 3px solid #22c55e;
    padding-left: 5px;
}

.ra-seq-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--desert-sand);
    color: var(--desert-accent-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.ra-seq-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--desert-text);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ra-seq-suburb {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
}

.ra-seq-moved-badge {
    font-size: 9px;
    font-weight: 700;
    color: #16a34a;
    background: #dcfce7;
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
}

.ra-seq-arrow {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 0 0 18px;
    font-size: 10px;
    color: #ccc;
}

.ra-seq-arrow span {
    font-size: 10px;
    color: #aaa;
    font-weight: 500;
}

.ra-reorder-totals {
    display: flex;
    gap: 14px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--desert-table-border);
    font-size: 12px;
    color: #888;
}

.ra-reorder-totals.suggested {
    color: #16a34a;
    font-weight: 600;
    border-top-color: #dcfce7;
}

.ra-reorder-totals i {
    font-size: 11px;
    margin-right: 3px;
}

/* Savings divider */
.ra-reorder-divider {
    padding: 10px 16px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-top: 1px solid #bbf7d0;
    border-bottom: 1px solid #bbf7d0;
    text-align: center;
}

.ra-reorder-savings {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    color: #16a34a;
}

.ra-reorder-savings i {
    font-size: 14px;
}

.ra-reorder-savings strong {
    font-size: 15px;
}

.ra-reorder-savings span {
    font-size: 11px;
    opacity: 0.8;
}

/* Suggestion note */
.ra-suggestion-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 11px;
    color: #999;
}

.ra-suggestion-note i {
    color: var(--desert-accent);
    font-size: 12px;
}

/* Apply button */
.ra-action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.ra-action-buttons .ra-apply-btn {
    flex: 1;
    margin-top: 0;
}

.ra-action-buttons .ra-dismiss-btn {
    flex: 1;
}

.ra-dismiss-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.ra-dismiss-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* Modern Route Modal Styling - Matches Main App UI/UX */
.route-modal-content {
    padding: 0;
}

.route-metrics-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--desert-table-border);
}

.route-metric-item {
    text-align: center;
    padding: 16px;
    background: var(--desert-card-bg);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.route-metric-item:hover {
    border-color: var(--desert-accent);
    box-shadow: var(--shadow-sm);
}

.route-metric-optimized {
    background: linear-gradient(135deg, #f0f9f4 0%, #e8f5ed 100%);
    border-color: #28a745;
}

.route-metric-savings {
    background: linear-gradient(135deg, #fff8e6 0%, #fff3cd 100%);
    border-color: #ffc107;
}

.route-metric-label {
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.route-metric-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--desert-text);
    line-height: 1.2;
    margin-bottom: 4px;
}

.route-metric-value.route-metric-success {
    color: #28a745;
}

.route-metric-value.route-metric-warning {
    color: #ffc107;
}

.route-metric-unit {
    font-size: 20px;
    font-weight: 500;
    opacity: 0.7;
}

.route-metric-sub {
    font-size: 11px;
    color: #6c757d;
    margin-top: 4px;
}

.route-info-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #e7f3ff;
    border-left: 4px solid #2196F3;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    color: #1976d2;
    font-size: 14px;
}

.route-info-banner i {
    font-size: 16px;
}

.route-section {
    margin-bottom: 32px;
}

.route-section:last-child {
    margin-bottom: 0;
}

.route-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--desert-text);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--desert-table-border);
}

.route-section-header > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.route-section-header i {
    color: var(--desert-accent);
    font-size: 16px;
}

.route-reverse-btn {
    background: transparent;
    border: 1px solid var(--desert-table-border);
    border-radius: var(--radius-sm);
    color: #6c757d;
    cursor: pointer;
    padding: 6px 10px;
    font-size: 13px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.route-reverse-btn:hover {
    background: var(--desert-card-bg);
    border-color: var(--desert-accent);
    color: var(--desert-accent);
}

.route-reverse-btn.active {
    background: var(--desert-accent);
    border-color: var(--desert-accent);
    color: white;
}

.route-reverse-btn.active i {
    color: white !important;
}

.route-reverse-btn.active:hover {
    background: var(--desert-accent-dark);
    border-color: var(--desert-accent-dark);
    color: white;
}

.route-reverse-btn.active:hover i {
    color: white !important;
}

/* Reverse button for Route Assistant panel */
.ra-reverse-btn-panel {
    background: transparent;
    border: 1px solid var(--desert-table-border);
    border-radius: var(--radius-sm);
    color: #6c757d;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
}

.ra-reverse-btn-panel:hover {
    background: var(--desert-card-bg);
    border-color: var(--desert-accent);
    color: var(--desert-accent);
}

.ra-reverse-btn-panel.active {
    background: var(--desert-accent);
    border-color: var(--desert-accent);
    color: white;
}

.ra-reverse-btn-panel.active i {
    color: white !important;
}

.ra-reverse-btn-panel.active:hover {
    background: var(--desert-accent-dark);
    border-color: var(--desert-accent-dark);
    color: white;
}

.ra-reverse-btn-panel.active:hover i {
    color: white !important;
}

.route-timeline-modern {
    background: var(--desert-card-bg);
    border-radius: var(--radius-sm);
    padding: 16px;
    border: 1px solid var(--desert-table-border);
}

.route-stop-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--desert-table-border);
}

.route-stop-item:last-child {
    border-bottom: none;
}

.route-stop-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    background: var(--desert-accent);
    color: white;
}

.route-stop-number.completed {
    background: #28a745;
}

.route-stop-number.booked {
    background: #2196F3;
}

.route-stop-number.pending {
    background: #6c757d;
}

.route-stop-content {
    flex: 1;
    min-width: 0;
}

.route-stop-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--desert-text);
    margin-bottom: 6px;
}

.route-stop-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 6px;
}

.route-stop-service {
    font-size: 13px;
    color: #6c757d;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
}

.route-stop-address {
    font-size: 13px;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 4px;
}

.route-stop-address i {
    font-size: 11px;
    color: var(--desert-accent);
}

.route-stop-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--desert-accent);
    margin-top: 4px;
}

.route-travel-leg {
    margin: 8px 0 8px 44px;
    position: relative;
}

.route-travel-line {
    position: absolute;
    left: -20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--desert-table-border);
}

.route-travel-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6c757d;
    padding-left: 8px;
}

.route-travel-info i {
    color: var(--desert-accent);
    font-size: 11px;
}

.route-travel-sep {
    opacity: 0.5;
}

.route-empty {
    text-align: center;
    color: #999;
    padding: 24px;
    font-size: 14px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .route-metrics-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .route-metric-value {
        font-size: 28px;
    }
    
    #routeQuickModal .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .route-stop-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

/* Ensure modal close button matches settings page style (quarter-turn on hover) */
#routeQuickModal .modal-header {
    padding: 20px 24px 16px 24px !important;
    border-bottom: 1px solid #e9ecef;
}

#routeQuickModal .modal-header .close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: 300;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
    position: absolute;
    top: 20px;
    right: 24px;
}

#routeQuickModal .modal-header .close:hover {
    background-color: #f8f9fa;
    color: #212529;
    transform: rotate(90deg);
}

#routeQuickModal .modal-body {
    padding: 24px !important;
    background: var(--desert-bg);
}

#routeQuickModal .modal-content {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--desert-table-border);
}

#routeQuickModal .modal-footer {
    border-top: 1px solid var(--desert-table-border);
    background: #fafafa;
}

#routeQuickModal .modal-footer .btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 10px 20px;
}

#routeQuickModal .modal-footer .btn-primary {
    background: linear-gradient(135deg, var(--desert-accent) 0%, var(--desert-accent-dark) 100%);
    border: none;
}

#routeQuickModal .modal-footer .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

#routeQuickModal .modal-title {
    color: var(--desert-text);
    font-weight: 600;
}

#routeQuickModal .modal-title i {
    color: var(--desert-accent);
    margin-right: 8px;
}

.ra-apply-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 12px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--desert-accent) 0%, var(--desert-accent-dark) 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.ra-apply-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(201, 123, 75, 0.35);
}

/* No Suggestions State */
.ra-no-suggestions {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 24px;
    text-align: center;
}

.ra-no-suggestions-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: #f0fdf4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #22c55e;
    margin-bottom: 14px;
}

.ra-no-suggestions h4 {
    margin: 0 0 6px;
    font-size: 15px;
    color: var(--desert-text);
}

.ra-no-suggestions p {
    margin: 0;
    font-size: 12px;
    color: #888;
    max-width: 260px;
    line-height: 1.5;
}

/* Demo Banner */
.ra-demo-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fffbeb;
    border-top: 1px solid #fde68a;
    font-size: 11px;
    color: #92400e;
    flex-shrink: 0;
}

.ra-demo-banner i {
    color: #f59e0b;
    flex-shrink: 0;
}

.ra-add-key-btn, .ri-add-key-btn {
    margin-left: auto;
    padding: 4px 12px;
    background: #f59e0b;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.ra-add-key-btn:hover, .ri-add-key-btn:hover {
    background: #d97706;
    transform: translateY(-1px);
}

/* API Key Modal */
.ra-api-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.ra-api-modal.show {
    opacity: 1;
}

.ra-api-modal-content {
    background: var(--desert-card-bg);
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    transition: transform 0.2s;
}

.ra-api-modal.show .ra-api-modal-content {
    transform: scale(1);
}

.ra-api-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--desert-table-border);
}

.ra-api-modal-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--desert-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ra-api-modal-header h4 i {
    color: var(--desert-accent);
}

.ra-api-close {
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.ra-api-close:hover {
    color: var(--desert-text);
}

.ra-api-modal-body {
    padding: 20px;
}

.ra-api-info {
    font-size: 13px;
    color: #666;
    margin-bottom: 16px;
    line-height: 1.5;
}

.ra-api-steps {
    margin: 0 0 20px 0;
    padding-left: 20px;
    font-size: 13px;
    color: var(--desert-text);
    line-height: 1.8;
}

.ra-api-steps li {
    margin-bottom: 6px;
}

.ra-api-steps a {
    color: var(--desert-accent);
    text-decoration: none;
    font-weight: 600;
}

.ra-api-steps a:hover {
    text-decoration: underline;
}

.ra-api-form {
    margin-top: 20px;
}

.ra-api-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--desert-text);
    margin-bottom: 6px;
}

.ra-api-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--desert-table-border);
    border-radius: 10px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    background: #fff;
    color: var(--desert-text);
    box-sizing: border-box;
}

.ra-api-input:focus {
    outline: none;
    border-color: var(--desert-accent);
    box-shadow: 0 0 0 3px rgba(201, 123, 75, 0.1);
}

.ra-api-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    justify-content: flex-end;
}

.ra-api-cancel, .ra-api-save {
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.ra-api-cancel {
    background: var(--desert-sand);
    color: var(--desert-accent-dark);
}

.ra-api-cancel:hover {
    background: #e0c9b0;
}

.ra-api-save {
    background: var(--desert-accent);
    color: #fff;
}

.ra-api-save:hover {
    background: var(--desert-accent-dark);
    transform: translateY(-1px);
}

.ra-api-note {
    margin-top: 16px;
    font-size: 11px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ra-api-note i {
    color: var(--desert-accent);
    font-size: 12px;
}

/* Toast Notifications */
.ra-toast-container {
    position: fixed;
    bottom: 90px;
    right: 24px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
}

.ra-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border-left: 3px solid var(--desert-accent);
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ra-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.ra-toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.ra-toast-message {
    flex: 1;
    font-size: 13px;
    color: var(--desert-text);
    line-height: 1.4;
}

.ra-toast-close {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 2px;
    font-size: 12px;
    transition: color 0.2s;
}

.ra-toast-close:hover {
    color: #999;
}

/* Helper */
.ra-muted {
    font-size: 12px;
    color: #999;
    text-align: center;
    padding: 16px;
}

/* ============================================
   ROUTE ASSISTANT - Responsive / Mobile
   ============================================ */

@media (max-width: 768px) {
    .ri-team-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .ri-left, .ri-right {
        flex-wrap: wrap;
        gap: 8px;
    }

    .route-assistant-panel {
        width: 100%;
        right: -100%;
    }

    .ra-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        justify-content: center;
    }
    
    .ra-toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
    }
    
    .ri-suggestion-preview {
        flex-wrap: wrap;
    }
}

/* Adjust main content when panel is open (desktop only) */
@media (min-width: 769px) {
    body.ra-panel-open main {
        margin-right: 420px;
        transition: margin-right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

