/* Fieldera - Field Service Management App Styles */

:root {
    /* Modern Indigo/Slate Theme */
    --primary: #4f46e5;      /* Indigo 600 */
    --primary-dark: #3730a3; /* Indigo 800 */
    --primary-light: #818cf8; /* Indigo 400 */
    --secondary: #64748b;    /* Slate 500 */
    --accent: #06b6d4;       /* Cyan 500 */
    
    --success: #10b981;      /* Emerald 500 */
    --warning: #f59e0b;      /* Amber 500 */
    --danger: #ef4444;       /* Red 500 */
    --info: #3b82f6;         /* Blue 500 */

    --bg-dark: #111827;      /* Gray 900 */
    --bg-card: #ffffff;
    --bg-light: #f8fafc;     /* Slate 50 */
    --bg-page: #f1f5f9;      /* Slate 100 */
    --bg-secondary: #f3f4f6;

    --text-primary: #1e293b; /* Slate 800 */
    --text-secondary: #64748b; /* Slate 500 */
    --text-light: #ffffff;
    --text-muted: #94a3b8;   /* Slate 400 */

    --border: #e2e8f0;       /* Slate 200 */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --sidebar-width: 250px;
    --header-height: 70px;

    --radius: 8px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    background: var(--bg-page);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--bg-dark) 0%, #1e1b4b 100%);
    color: var(--text-light);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-logo {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 8px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo i {
    font-size: 2rem;
    color: var(--accent);
}

.sidebar-header small {
    display: block;
    margin-top: 5px;
    opacity: 0.8;
    font-size: 0.85rem;
}

.nav-menu {
    list-style: none;
    padding: 10px 0;
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* Important for flex scrolling */
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    border-left-color: var(--accent);
}

.nav-item i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-footer {
    padding: 12px 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-export, .btn-import {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(255,255,255,0.3);
    background: transparent;
    color: var(--text-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-export:hover, .btn-import:hover {
    background: rgba(255,255,255,0.1);
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1100;
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1.2rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px 30px;
    height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Page Styles */
.page {
    display: none;
    flex: 1;
    min-height: 0;
}

.page.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
    flex-shrink: 0;
}

.page-header h1 {
    font-size: 1.8rem;
    color: var(--text-primary);
}

.date-display {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--border);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 5px 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.blue { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.stat-icon.green { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }

.stat-info h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    flex: 1;
    align-content: start;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h2 i {
    color: var(--primary);
}

.card-body {
    padding: 20px;
    max-height: 350px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px;
    font-style: italic;
}

/* Search Bar */
.search-bar {
    position: relative;
    flex: 1;
    max-width: 400px;
}

/* Standalone search bar (not in filters-bar) */
.page > .search-bar {
    flex: none;
    margin-bottom: 15px;
}

.search-bar i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-bar input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Filters Bar */
.filters-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.filters-bar select {
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    font-size: 0.95rem;
    cursor: pointer;
    min-width: 150px;
}

.filters-bar-wrap {
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-group input[type="date"] {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--bg-card);
}

/* Jobs Summary */
.jobs-summary {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding: 8px 0;
    flex-shrink: 0;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding: 15px 0;
    flex-shrink: 0;
}

.pagination-btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-info {
    padding: 8px 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.filters-bar select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 100%;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table tbody tr:hover {
    background: var(--bg-light);
}

.data-table tbody tr.clickable-row {
    cursor: pointer;
}

.data-table tbody tr.clickable-row:hover {
    background: var(--primary-light, #e8f4fd);
}

.data-table .actions {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    white-space: nowrap;
}

.data-table .actions button {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.data-table .actions .btn-view {
    background: #e3f2fd;
    color: #1976d2;
}

.data-table .actions .btn-edit {
    background: #fff3e0;
    color: #f57c00;
}

.data-table .actions .btn-delete {
    background: #ffebee;
    color: #d32f2f;
}

.data-table .actions button:hover {
    transform: scale(1.1);
}

/* Column Filter Row */
.data-table .filter-row {
    display: table-row;
}

.data-table .filter-row th {
    display: table-cell;
    background: var(--bg-card);
    padding: 8px 10px;
    border-bottom: 2px solid var(--primary);
    top: 47px; /* Position below header row */
    text-transform: none;
    font-weight: normal;
}

.column-filter {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.filter-type-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    background: var(--bg-light);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.filter-type-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    min-width: 140px;
    display: none;
    overflow: hidden;
}

.filter-dropdown.show,
.filter-dropdown.active {
    display: block;
}

.filter-dropdown button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: background 0.2s ease;
}

.filter-dropdown button:hover {
    background: var(--bg-light);
}

.filter-dropdown button.active {
    background: var(--primary);
    color: white;
}

.column-filter input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    min-width: 0;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.column-filter input:focus {
    outline: none;
    border-color: var(--primary);
}

.column-filter input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Jobs Column Filters (for card grid) */
.jobs-column-filters {
    display: flex;
    gap: 10px;
    padding: 12px 15px;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.jobs-column-filters .column-filter {
    flex: 1;
    min-width: 120px;
    max-width: 200px;
}

.jobs-column-filters .column-filter input {
    width: 100%;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: capitalize;
}

/* Status badges - matching filter button colors */
.status-badge.scheduled { background: #dbeafe; color: #2563eb; }    /* Blue 100/600 */
.status-badge.in-progress { background: #fef3c7; color: #d97706; } /* Amber 100/600 */
.status-badge.completed { background: #d1fae5; color: #059669; }   /* Emerald 100/600 */
.status-badge.cancelled { background: #f1f5f9; color: #64748b; }   /* Slate 100/500 */
.status-badge.draft { background: #f1f5f9; color: #64748b; }       /* Slate 100/500 */
.status-badge.sent { background: #dbeafe; color: #2563eb; }        /* Blue 100/600 */
.status-badge.paid { background: #d1fae5; color: #059669; }        /* Emerald 100/600 */
.status-badge.overdue { background: #fee2e2; color: #dc2626; }     /* Red 100/600 */
.status-badge.accepted { background: #d1fae5; color: #059669; }    /* Emerald 100/600 */
.status-badge.declined { background: #fee2e2; color: #dc2626; }    /* Red 100/600 */
.status-badge.expired { background: #ffedd5; color: #ea580c; }     /* Orange 100/600 */

/* Table row status colors - matching filter button colors */
tr.status-draft { border-left: 4px solid #64748b; }
tr.status-sent { border-left: 4px solid #2563eb; }
tr.status-paid { border-left: 4px solid #059669; }
tr.status-overdue { border-left: 4px solid #dc2626; }
tr.status-accepted { border-left: 4px solid #059669; }
tr.status-declined { border-left: 4px solid #dc2626; }
tr.status-expired { border-left: 4px solid #ea580c; }

/* Jobs Grid */
.jobs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    flex: 1;
    align-content: start;
    overflow-y: auto;
    min-height: 0;
}

.job-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.job-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.job-card-header {
    padding: 15px 20px;
    background: var(--primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.job-card-header .job-number {
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(255,255,255,0.25);
    padding: 3px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.job-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
    min-width: 0;
}

.job-type-badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.job-card-body {
    padding: 20px;
}

.job-card-body p {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.job-card-body p i {
    width: 20px;
    color: var(--primary);
}

.job-card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.job-card-footer .estimate {
    font-weight: 600;
    color: var(--primary);
}

/* Calendar / Schedule */
.schedule-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

#weekDisplay {
    font-weight: 600;
    min-width: 200px;
    text-align: center;
}

/* Schedule page fills available space with proper scroll containment */
#schedule.page.active {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

#schedule .page-header {
    flex-shrink: 0;
}

#schedule .schedule-container {
    position: absolute;
    top: 80px; /* Below page header */
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    gap: 0;
    overflow-x: auto;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.schedule-time-column {
    width: 60px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    position: sticky;
    left: 0;
    z-index: 10;
}

.time-column-header {
    height: 50px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 11;
}

.time-slot {
    height: 50px;
    padding: 4px 6px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    text-align: right;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}

.time-slot.current-hour {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    font-weight: 600;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    min-width: 700px;
}

.calendar-day {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: white;
    min-height: 1250px; /* Ensure full 24-hour height + header */
}

.calendar-day:last-child {
    border-right: none;
}

.calendar-day-header {
    font-weight: 600;
    height: 50px;
    padding: 10px 5px;
    box-sizing: border-box;
    border-bottom: 2px solid var(--border);
    font-size: 0.9rem;
    text-align: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 5;
}

.calendar-day-header small {
    display: block;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    margin-top: 2px;
}

.calendar-day.today {
    background: rgba(79, 70, 229, 0.05);
}

.calendar-day.today .calendar-day-jobs {
    background:
        linear-gradient(to bottom, rgba(79, 70, 229, 0.03), rgba(79, 70, 229, 0.03)),
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 49px,
            var(--border) 49px,
            var(--border) 50px
        );
}

.calendar-day.today .calendar-day-header {
    color: var(--primary);
    background: rgba(79, 70, 229, 0.2);
    border-bottom-color: var(--primary);
}

.calendar-day-jobs {
    flex: 1;
    position: relative;
    min-height: 1200px; /* 24 hours * 50px */
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 49px,
        var(--border) 49px,
        var(--border) 50px
    );
}

/* Current time indicator line */
.current-time-indicator {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #ef4444;
    z-index: 5;
    pointer-events: none;
}

.current-time-indicator::before {
    content: attr(data-time);
    position: absolute;
    left: 6px;
    top: -8px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
    white-space: nowrap;
}

.current-time-indicator::after {
    content: '';
    position: absolute;
    left: -4px;
    top: -3px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
}

.calendar-day-jobs .no-jobs {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
    text-align: center;
    padding: 20px 5px;
}

.calendar-job {
    position: absolute;
    background: var(--primary);
    color: white;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    z-index: 1;
}

.calendar-job.timed {
    position: absolute;
}

.calendar-job.untimed {
    position: relative;
    margin: 5px 2px;
    opacity: 0.8;
}

.calendar-job .job-number {
    font-size: 0.65rem;
    opacity: 0.85;
    font-weight: 600;
}

.calendar-job .job-time {
    font-weight: 600;
    font-size: 0.7rem;
    opacity: 0.9;
}

.calendar-job .job-title {
    font-size: 0.75rem;
    line-height: 1.2;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-job .job-assigned {
    font-size: 0.65rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 3px;
}

.calendar-job .job-assigned i {
    font-size: 0.6rem;
}

.calendar-job .job-hours {
    font-size: 0.65rem;
    opacity: 0.8;
    background: rgba(255,255,255,0.2);
    padding: 1px 4px;
    border-radius: 3px;
    align-self: flex-start;
    margin-top: auto;
}

.calendar-job:hover {
    z-index: 10;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

.calendar-job.in-progress {
    background: #f57c00;
}

.calendar-job.completed {
    background: #388e3c;
}

/* Status Filter Bar */
.status-filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.status-filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.status-filter-btn:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.status-filter-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.status-filter-btn .status-label {
    font-weight: 500;
}

.status-filter-btn .status-count {
    background: rgba(0,0,0,0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-filter-btn.active .status-count {
    background: rgba(255,255,255,0.25);
}

/* Status-specific colors for filter buttons */
.status-filter-btn.draft {
    border-color: #9e9e9e;
}
.status-filter-btn.draft.active {
    background: #757575;
    border-color: #757575;
}

.status-filter-btn.sent {
    border-color: #2196f3;
}
.status-filter-btn.sent.active {
    background: #1976d2;
    border-color: #1976d2;
}

.status-filter-btn.accepted {
    border-color: #4caf50;
}
.status-filter-btn.accepted.active {
    background: #388e3c;
    border-color: #388e3c;
}

.status-filter-btn.declined {
    border-color: #f44336;
}
.status-filter-btn.declined.active {
    background: #d32f2f;
    border-color: #d32f2f;
}

.status-filter-btn.expired {
    border-color: #ff9800;
}
.status-filter-btn.expired.active {
    background: #f57c00;
    border-color: #f57c00;
}

/* Status buttons with subtitles */
.status-filter-btn.has-subtitle {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 14px;
    gap: 2px;
}

.status-filter-btn .status-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.status-filter-btn .status-subtitle {
    font-size: 0.7rem;
    opacity: 0.7;
    font-weight: 400;
    text-align: center;
    line-height: 1.2;
}

.status-filter-btn.active .status-subtitle {
    opacity: 0.85;
}

/* Job Quick Filter Buttons */
.status-filter-btn.today {
    border-color: #4caf50;
}
.status-filter-btn.today.active {
    background: #388e3c;
    border-color: #059669;
}

.status-filter-btn.in-progress {
    border-color: #d97706;
}
.status-filter-btn.in-progress.active {
    background: #d97706;
    border-color: #d97706;
}

.status-filter-btn.needs-invoice {
    border-color: #ea580c;
}
.status-filter-btn.needs-invoice.active {
    background: #ea580c;
    border-color: #ea580c;
}

.status-filter-btn.overdue {
    border-color: #dc2626;
}
.status-filter-btn.overdue.active {
    background: #dc2626;
    border-color: #dc2626;
}

/* Invoice Quick Filter Buttons */
.status-filter-btn.draft {
    border-color: #64748b;
}
.status-filter-btn.draft.active {
    background: #64748b;
    border-color: #64748b;
}

.status-filter-btn.sent {
    border-color: #2563eb;
}
.status-filter-btn.sent.active {
    background: #2563eb;
    border-color: #2563eb;
}

.status-filter-btn.paid {
    border-color: #059669;
}
.status-filter-btn.paid.active {
    background: #059669;
    border-color: #059669;
}

.status-filter-btn.this-week {
    border-color: #9333ea;
}
.status-filter-btn.this-week.active {
    background: #9333ea;
    border-color: #9333ea;
}

/* Admin-only elements */
.admin-only {
    display: none !important;
}
body.is-admin .admin-only {
    display: flex !important;
}
body.is-admin button.admin-only,
body.is-admin .btn-export.admin-only,
body.is-admin .btn-import.admin-only {
    display: block !important;
}
body.is-admin .card.admin-only {
    display: block !important;
}
body.is-admin .stat-card.admin-only {
    display: flex !important;
}

/* Employee-only elements (like "Show All Jobs" toggle) */
.employee-only {
    display: none !important;
}
body.is-employee .employee-only {
    display: flex !important;
}

/* Non-admin elements (shown for employees and contractors only) */
.non-admin-only {
    display: none !important;
}
body.is-employee .non-admin-only,
body.is-contractor .non-admin-only {
    display: flex !important;
}

/* Role-based visibility */
/* Money-related elements hidden for employees and contractors */
body.is-employee .money-field,
body.is-employee .money-column,
body.is-contractor .money-field,
body.is-contractor .money-column {
    display: none !important;
}

/* Status badge colors for roles */
.status-badge.admin {
    background: #ffebee;
    color: #c62828;
}

.status-badge.employee {
    background: #e3f2fd;
    color: #1565c0;
}

.status-badge.contractor {
    background: #fff3e0;
    color: #e65100;
}

/* Archive toggle */
.archive-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: all 0.2s;
}
.archive-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.archive-toggle input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}
.archive-toggle input[type="checkbox"]:checked + span {
    color: var(--primary);
    font-weight: 500;
}

/* Archived item styling */
.job-card.archived,
tr.archived {
    opacity: 0.6;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(0,0,0,0.03) 10px,
        rgba(0,0,0,0.03) 20px
    );
}
.job-card.archived .status-badge,
tr.archived .status-badge {
    background: #9e9e9e !important;
    color: white !important;
}
.archived-badge {
    background: #9e9e9e;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
}

/* Quote Stats */
.quote-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    background: var(--bg-card);
    padding: 15px 25px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.quote-stat .label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.quote-stat .value {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary);
}

/* Invoice Stats */
.invoice-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    background: var(--bg-card);
    padding: 20px 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.invoice-stat .label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.invoice-stat .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Map */
.map-container {
    height: 500px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.map-legend {
    display: flex;
    gap: 25px;
    margin-top: 15px;
    padding: 15px 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.legend-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.legend-marker.scheduled { background: #1976d2; }
.legend-marker.in-progress { background: #f57c00; }
.legend-marker.completed { background: #388e3c; }

/* Photos Grid */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.photo-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.photo-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.photo-card-image {
    position: relative;
}

.photo-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.photo-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
    z-index: 10;
}

.photo-card:hover .photo-delete-btn {
    opacity: 1;
}

.photo-delete-btn:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.1);
}

.photo-delete-btn i {
    font-size: 0.85rem;
}

.photo-card-info {
    padding: 15px;
}

.photo-card-info h4 {
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.photo-card-info p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.photo-card-info .task-label {
    color: var(--primary);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.photo-card-info .task-label i {
    font-size: 0.75rem;
}

.photo-type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    margin-top: 8px;
}

.photo-type-badge.before { background: #e3f2fd; color: #1976d2; }
.photo-type-badge.during { background: #fff3e0; color: #f57c00; }
.photo-type-badge.after { background: #e8f5e9; color: #388e3c; }

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content.modal-large {
    max-width: 700px;
}

.modal-content.modal-xlarge {
    max-width: 900px;
}

@media (max-width: 950px) {
    .modal-content.modal-xlarge {
        max-width: 95%;
        margin: 10px;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.3rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-light);
}

.btn-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.btn-close:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

/* Forms */
form {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Highlight reminder for fields that need attention */
.field-reminder {
    position: relative;
}

.field-reminder input,
.field-reminder select {
    border: 2px solid #ffc107 !important;
    background: #fffde7 !important;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.3) !important;
}

.field-reminder::after {
    content: "Please verify";
    position: absolute;
    top: -8px;
    right: 8px;
    background: #ffc107;
    color: #5d4037;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    z-index: 1;
}

.input-with-button {
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-with-button input {
    flex: 1;
}

.input-with-button .btn-secondary {
    white-space: nowrap;
    flex-shrink: 0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

/* Multi-Select Dropdown */
.multi-select-dropdown {
    position: relative;
}

.multi-select-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    min-height: 42px;
}

.multi-select-display:hover {
    border-color: var(--primary);
}

.multi-select-display .selected-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

.multi-select-display .selected-text.has-selection {
    color: var(--text-primary);
}

.multi-select-display .dropdown-arrow {
    font-size: 0.8em;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.multi-select-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.multi-select-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1001;
}

.multi-select-dropdown.open .multi-select-options {
    display: block;
}

.multi-select-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    gap: 10px;
}

.multi-select-option:hover {
    background: var(--bg-light);
}

.multi-select-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.multi-select-option label {
    flex: 1;
    cursor: pointer;
    font-size: 0.95rem;
}

.multi-select-option .user-role {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: capitalize;
}

.multi-select-option .user-role.admin {
    background: #ffebee;
    color: #c62828;
}

.multi-select-option .user-role.employee {
    background: #e3f2fd;
    color: #1565c0;
}

.multi-select-option .user-role.contractor {
    background: #fff3e0;
    color: #e65100;
}

/* Invoice Line Items */
.invoice-items {
    margin: 20px 0;
}

.invoice-items h3 {
    margin-bottom: 15px;
    font-size: 1rem;
}

.line-items-table {
    width: 100%;
    margin-bottom: 10px;
}

.line-items-table th,
.line-items-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.line-items-table th {
    background: var(--bg-light);
    font-size: 0.8rem;
    font-weight: 600;
}

.line-items-table input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.line-items-table input.line-amount {
    text-align: right;
    width: 100px;
}

.line-items-table .btn-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.1rem;
}

.invoice-totals {
    text-align: right;
    padding: 15px 0;
    border-top: 2px solid var(--border);
}

.total-row {
    display: flex;
    justify-content: flex-end;
    gap: 30px;
    padding: 8px 0;
}

.total-row.total {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    border-top: 1px solid var(--border);
    padding-top: 15px;
    margin-top: 10px;
}

/* Tax Input Group */
.tax-row {
    align-items: center;
}

.tax-input-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tax-input-group .currency-prefix {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.tax-input-group input {
    width: 90px;
    padding: 4px 8px;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: right;
}

.tax-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1);
}

.btn-recalc {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-recalc:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-recalc i {
    font-size: 0.8rem;
}

/* Photo Upload */
.photo-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.photo-upload-area:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.02);
}

.photo-upload-area i {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.photo-upload-area p {
    color: var(--text-secondary);
}

.photo-upload-area input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.photo-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.photo-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
}

/* Job Detail Content */
.job-detail-content {
    padding: 20px;
}

.job-detail-section {
    margin-bottom: 25px;
}

.job-detail-section h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.job-detail-row {
    display: flex;
    gap: 30px;
    margin-bottom: 10px;
}

.job-detail-row .label {
    font-weight: 600;
    min-width: 120px;
    color: var(--text-secondary);
}

.job-detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.job-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.job-photos-grid img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
    cursor: pointer;
}

/* Job Photos with Task Info */
.job-photos-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.photo-with-task {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: var(--bg-light);
    border-radius: var(--radius);
}

.photo-with-task img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
    cursor: pointer;
    flex-shrink: 0;
}

.photo-task-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.photo-task-name {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Job Sheet Styles */
.job-sheet {
    background: white;
    padding: 30px;
    border-radius: var(--radius);
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

.job-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--primary);
    margin-bottom: 25px;
}

.job-sheet-company {
    display: flex;
    align-items: center;
    gap: 15px;
}

.job-sheet-logo {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 8px;
}

.job-sheet-company-info h2 {
    color: var(--primary);
    font-size: 1.3rem;
    margin: 0;
}

.job-sheet-company-info p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 4px 0 0 0;
}

.job-sheet-title {
    text-align: right;
}

.job-sheet-title h1 {
    font-size: 1.5rem;
    color: var(--primary);
    margin: 0;
    letter-spacing: 2px;
}

.job-sheet-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 5px 0;
}

.job-sheet-status {
    display: inline-block;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
}

/* Linked Reference Styles (Quote → Job → Invoice chain) */
.job-sheet-linked-ref {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-top: 8px;
    margin-right: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.job-sheet-linked-ref:hover {
    background: #1976d2;
    color: white;
    transform: scale(1.05);
}

.job-sheet-linked-ref i {
    margin-right: 5px;
}

.job-sheet-linked-ref.invoice-ref {
    background: #e8f5e9;
    color: #2e7d32;
}

.job-sheet-linked-ref.invoice-ref:hover {
    background: #388e3c;
    color: white;
}

.linked-ref {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    margin-left: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.linked-ref:hover {
    background: #1976d2;
    color: white !important;
    transform: scale(1.05);
}

.linked-ref[style*="e8f5e9"]:hover {
    background: #388e3c !important;
}

.linked-job-link {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    margin-left: 6px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.linked-job-link:hover {
    background: #1976d2;
    color: white !important;
    transform: scale(1.05);
}

.linked-job-link[style*="e8f5e9"]:hover {
    background: #388e3c !important;
}

.linked-job-link[style*="fff3e0"]:hover {
    background: #e65100 !important;
}

.linked-job-link i {
    margin-right: 3px;
}

.linked-ref-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.linked-ref-sub {
    font-size: 0.75rem;
    color: #666;
    font-weight: normal;
}

.linked-ref-sub::before {
    content: '← ';
    color: #999;
}

.invoice-ref-chain {
    background: #f5f5f5;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.invoice-ref-chain i {
    color: #999;
    margin-right: 5px;
}

.job-sheet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.job-sheet-box {
    background: var(--bg-light);
    padding: 15px;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.job-sheet-box h4 {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.job-sheet-box h4 i {
    color: var(--primary);
}

.job-sheet-box .primary-info {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.job-sheet-box p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.job-sheet-box p i {
    width: 14px;
    color: var(--primary);
    opacity: 0.7;
}

.job-sheet-box a {
    color: var(--primary);
    text-decoration: none;
}

.job-sheet-section {
    background: var(--bg-light);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.job-sheet-section h4 {
    font-size: 0.85rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.job-sheet-title-section {
    background: var(--primary);
    text-align: center;
}

.job-sheet-title-section h3 {
    color: white;
    font-size: 1.2rem;
    margin: 0;
}

.job-sheet-instructions {
    white-space: pre-line;
    line-height: 1.6;
    color: var(--text-primary);
}

.job-sheet-instructions p {
    margin: 0 0 10px 0;
}

.job-sheet-equipment {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.equipment-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
}

.equipment-tag i {
    color: var(--primary);
    font-size: 0.75rem;
}

.job-sheet-tasks {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.job-sheet-task {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.job-sheet-task.completed {
    background: #e8f5e9;
    border-color: #a5d6a7;
}

.job-sheet-task .task-checkbox {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.job-sheet-task.completed .task-checkbox {
    color: #4caf50;
}

.job-sheet-task .task-description {
    flex: 1;
    font-size: 0.95rem;
}

.job-sheet-task.completed .task-description {
    text-decoration: line-through;
    opacity: 0.7;
}

.job-sheet-task .task-photo-badge {
    background: #fff3e0;
    color: #f57c00;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.job-sheet-task .task-completed-time {
    font-size: 0.75rem;
    color: #4caf50;
    margin-left: auto;
}

/* Incomplete Task Warning Styles */
.job-sheet-task.incomplete-warning {
    background: #ffebee;
    border-left: 4px solid #f44336;
}

.job-sheet-task.incomplete-warning .task-checkbox {
    color: #f44336;
}

.incomplete-warning-banner {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border: 2px solid #f44336;
    border-radius: var(--radius);
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #c62828;
}

.incomplete-warning-banner i {
    font-size: 1.5rem;
    color: #f44336;
}

.incomplete-warning-banner span {
    font-weight: 600;
}

/* Job Card status colors - matching filter button colors */
/* Today filter = green, so scheduled = green */
.job-card.status-scheduled .job-card-header {
    background: linear-gradient(135deg, #388e3c 0%, #4caf50 100%);
}

/* In Progress filter = blue */
.job-card.status-in-progress .job-card-header {
    background: linear-gradient(135deg, #1976d2 0%, #2196f3 100%);
}

/* Needs Invoice filter = orange, completed jobs */
.job-card.status-completed .job-card-header {
    background: linear-gradient(135deg, #f57c00 0%, #ff9800 100%);
}

.job-card.status-cancelled .job-card-header {
    background: #757575;
}

/* Job Card incomplete warning - uses overdue color (red) */
.job-card.completed-incomplete {
    border-left: 4px solid #f44336;
}

.job-card.completed-incomplete .job-card-header {
    background: linear-gradient(135deg, #d32f2f 0%, #f44336 100%);
}

.job-card .task-progress {
    font-weight: 500;
}

.job-card .task-progress.incomplete-warning {
    color: #f44336;
    font-weight: 600;
}

.job-card .task-progress.incomplete-warning i.fa-exclamation-triangle {
    margin-left: 5px;
}

.job-card .task-progress.all-complete {
    color: #4caf50;
}

.status-badge.incomplete-warning {
    background: #ffebee !important;
    color: #c62828 !important;
    border: 1px solid #f44336;
}

/* Confirm Modal Styles */
.confirm-modal-content {
    max-width: 450px;
}

.confirm-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 1px solid #eee;
    margin-top: 15px;
}

.btn-warning {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #f57c00 0%, #e65100 100%);
    transform: translateY(-1px);
}

.incomplete-confirm-warning {
    text-align: center;
    padding: 10px 0;
}

.incomplete-confirm-warning i {
    font-size: 3rem;
    color: #ff9800;
    margin-bottom: 15px;
}

.incomplete-confirm-warning p {
    margin: 8px 0;
    color: #333;
}

.incomplete-confirm-warning .warning-note {
    font-size: 0.85rem;
    color: #f57c00;
    font-style: italic;
}

/* Toast warning style */
.toast.warning {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

.job-sheet-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.job-sheet-photo {
    position: relative;
}

.job-sheet-photo img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.2s;
}

.job-sheet-photo img:hover {
    transform: scale(1.05);
}

.job-sheet-photo .photo-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    font-size: 0.75rem;
}

.job-sheet-quote,
.job-sheet-invoice {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.job-sheet-footer {
    text-align: center;
    padding-top: 20px;
    margin-top: 30px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.empty-state-small {
    color: var(--text-secondary);
    font-style: italic;
    padding: 10px 0;
}

/* Print styles */
.print-only {
    display: none;
}

.no-print {
    /* Normal display, hidden when printing */
}

@media print {
    .no-print {
        display: none !important;
    }
    .print-only {
        display: block !important;
    }
    .job-sheet {
        box-shadow: none;
        padding: 0;
    }
    .job-sheet-box {
        border-left-color: #333;
    }
}

/* Job sheet responsive */
@media (max-width: 900px) {
    .job-sheet-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .job-sheet-header {
        flex-direction: column;
        gap: 20px;
    }
    .job-sheet-title {
        text-align: left;
    }
    .job-sheet-grid {
        grid-template-columns: 1fr;
    }
    .job-sheet {
        padding: 15px;
    }
}

/* Invoice Preview */
.invoice-preview {
    padding: 40px;
    background: white;
}

.invoice-banner {
    text-align: center;
    margin-bottom: 20px;
}

.invoice-banner img {
    max-width: 100%;
    height: auto;
    max-height: 120px;
}

.invoice-preview-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

.invoice-preview-company h2 {
    color: var(--primary);
    font-size: 1.5rem;
}

.invoice-preview-company p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 2px 0;
}

.invoice-preview-details {
    text-align: right;
}

.invoice-preview-details h3 {
    font-size: 1.5rem;
    color: var(--primary);
    margin: 0 0 5px 0;
}

.invoice-preview-details p {
    margin: 2px 0;
    font-size: 0.85rem;
}

.invoice-preview-billing {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 15px;
}

.invoice-preview-billing h4 {
    margin: 0 0 5px 0;
    color: var(--primary);
    font-size: 0.9rem;
}

.invoice-preview-billing p {
    margin: 2px 0;
    font-size: 0.85rem;
}

.invoice-preview-table {
    width: 100%;
    margin-bottom: 15px;
}

.invoice-preview-table th,
.invoice-preview-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.invoice-preview-table th {
    background: var(--bg-light);
    font-size: 0.8rem;
}

.invoice-preview-totals p {
    margin: 3px 0;
}

.invoice-footer {
    margin-top: 15px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.invoice-preview-totals {
    text-align: right;
}

/* Quote Photos */
.quote-photos-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.quote-photos-upload small {
    color: var(--text-secondary);
}

.quote-photos-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.quote-photo-item {
    position: relative;
    width: 100px;
    height: 100px;
}

.quote-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.quote-photo-item .remove-photo {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.quote-photo-item .photo-note {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 0 0 var(--radius) var(--radius);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90%;
    max-height: 85%;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    border-radius: 50%;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
}

.lightbox-nav.prev { left: 20px; }
.lightbox-nav.next { right: 20px; }

.lightbox-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    text-align: center;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 15px 25px;
    border-radius: var(--radius);
    color: white;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    box-shadow: var(--shadow-lg);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }

/* Dashboard Schedule Items */
.schedule-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--bg-light);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.schedule-item:hover {
    background: var(--border);
}

.schedule-item-time {
    font-weight: 600;
    color: var(--primary);
    min-width: 70px;
}

.schedule-item-info h4 {
    font-size: 0.95rem;
    margin-bottom: 3px;
}

.schedule-item-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Activity Items */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    margin: 0 -12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: var(--radius);
}

.activity-item:hover {
    background: var(--bg-light);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.activity-icon.job { background: #e3f2fd; color: #1976d2; }
.activity-icon.invoice { background: #fff3e0; color: #f57c00; }
.activity-icon.customer { background: #e8f5e9; color: #388e3c; }
.activity-icon.photo { background: #f3e5f5; color: #9c27b0; }

.activity-content p {
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.activity-content small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Pending Invoice Item */
.pending-invoice-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--bg-light);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pending-invoice-item:hover {
    background: var(--border);
}

.pending-invoice-info h4 {
    font-size: 0.95rem;
    margin-bottom: 3px;
}

.pending-invoice-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pending-invoice-amount {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.pending-invoice-amount .status-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
}

.pending-invoice-amount .status-badge.overdue {
    background: #ffebee;
    color: #c62828;
}

/* Templates */
.page-description {
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-size: 0.95rem;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.template-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.3s ease;
}

.template-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.template-card-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.template-card-header h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.template-card-header .template-type {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.template-card-body {
    padding: 20px;
}

.template-card-body p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.template-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.template-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.template-stat i {
    color: var(--primary);
}

.template-card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.template-card-footer .price {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

.template-card-actions {
    display: flex;
    gap: 8px;
}

/* Template Tasks Section */
.template-tasks-section,
.template-equipment-section {
    margin: 25px 0;
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--radius);
}

.template-tasks-section h3,
.template-equipment-section h3 {
    font-size: 1rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.template-tasks-section h3 i,
.template-equipment-section h3 i {
    color: var(--primary);
}

.section-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.tasks-list {
    margin-bottom: 10px;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 10px;
    border: 1px solid var(--border);
}

.task-item .task-order {
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

.task-item .task-content {
    flex: 1;
}

.task-item .task-content input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.task-item .task-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.task-item .task-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.task-item .task-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.task-item .task-options select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
}

.task-item .btn-remove-task {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
}

.task-item .btn-remove-task:hover {
    color: #c82333;
}

/* Job Execution / Crew View */
.job-execution-content {
    padding: 20px;
}

.execution-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.execution-header h3 {
    margin-bottom: 5px;
}

.execution-header p {
    opacity: 0.9;
    font-size: 0.9rem;
}

.execution-progress {
    margin: 20px 0;
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--success) 100%);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: right;
}

.execution-instructions {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 20px;
}

.execution-instructions h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: #856404;
}

.execution-instructions p {
    color: #856404;
    font-size: 0.9rem;
    white-space: pre-line;
}

.execution-tasks {
    margin-bottom: 20px;
}

.execution-tasks h4 {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.execution-task {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.execution-task.completed {
    border-color: var(--success);
    background: #f8fff8;
}

.execution-task .task-checkbox {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.execution-task .task-checkbox:hover {
    border-color: var(--primary);
}

.execution-task.completed .task-checkbox {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.execution-task .task-info {
    flex: 1;
}

.execution-task .task-info h5 {
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.execution-task .task-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.execution-task .task-photo-required {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    padding: 3px 8px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 10px;
    margin-top: 8px;
}

.execution-task .task-photos {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.execution-task .task-photos img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.execution-task .btn-add-photo {
    width: 60px;
    height: 60px;
    border: 2px dashed var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    background: transparent;
}

.execution-task .btn-add-photo:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.execution-equipment {
    background: var(--bg-light);
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.execution-equipment h4 {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.execution-equipment ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.execution-equipment li {
    background: var(--bg-card);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
}

.execution-actions {
    display: flex;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.btn-complete-job {
    flex: 1;
    padding: 15px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-complete-job:hover {
    background: #218838;
}

.btn-complete-job:disabled {
    background: var(--border);
    cursor: not-allowed;
}

.btn-complete-job.incomplete-tasks {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

.btn-complete-job.incomplete-tasks:hover {
    background: linear-gradient(135deg, #f57c00 0%, #e65100 100%);
}

/* Reopen Job Button */
.btn-reopen {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-reopen:hover {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        /* Use dvh for mobile browsers, fallback to vh */
        height: 100vh;
        height: 100dvh;
        max-height: -webkit-fill-available;
        overflow: hidden;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    /* Ensure nav menu is scrollable and fits within viewport */
    .sidebar .nav-menu {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
    }

    /* Make sidebar header and footer more compact on mobile */
    .sidebar .sidebar-header {
        flex-shrink: 0;
        padding: 12px 10px;
    }

    .sidebar .sidebar-footer {
        flex-shrink: 0;
        padding: 15px;
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-nav-toggle {
        display: block;
    }

    .schedule-container {
        flex-direction: column;
    }

    .schedule-time-column {
        display: none;
    }

    .calendar-grid {
        grid-template-columns: 1fr;
    }

    .calendar-day {
        min-height: auto;
    }

    .calendar-day-jobs {
        min-height: auto;
        background: none;
    }

    .calendar-job {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: calc(100% - 4px) !important;
        margin: 5px 2px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 70px 15px 15px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .jobs-grid {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        flex-direction: column;
    }

    .search-bar {
        max-width: 100%;
    }

    .map-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 10px;
    }

    .invoice-stats {
        flex-direction: column;
        gap: 15px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 15px;
    }

    .photos-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Compact sidebar items on small screens */
    .sidebar .nav-item {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .sidebar .sidebar-logo {
        max-width: 150px;
    }

    .sidebar .sidebar-header small {
        font-size: 0.75rem;
    }

    .sidebar .btn-export,
    .sidebar .btn-import {
        padding: 8px;
        font-size: 0.8rem;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .mobile-nav-toggle,
    .modal-header button,
    .form-actions {
        display: none !important;
    }

    .main-content {
        margin: 0;
        padding: 0;
    }

    .invoice-preview {
        padding: 20px;
    }
}

/* Promos Grid */
.promos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.promo-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.promo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.promo-card img {
    width: 100%;
    height: auto;
    display: block;
}

.promo-card-info {
    padding: 12px 15px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.promo-card-info h3 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    color: #333;
    text-transform: capitalize;
}

.promo-card-info small {
    color: #666;
}

/* Promo Lightbox */
.promo-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.promo-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.promo-lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.promo-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.promo-lightbox-close:hover {
    opacity: 1;
}

/* ===== APP CONTAINER ===== */
#appContainer {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ===== LOGIN SCREEN ===== */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.login-logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 20px;
    border: 4px solid var(--primary);
}

.login-container h1 {
    color: var(--primary);
    margin: 0 0 5px 0;
    font-size: 1.5rem;
}

.login-subtitle {
    color: #666;
    margin: 0 0 30px 0;
}

.login-container .form-group {
    text-align: left;
    margin-bottom: 20px;
}

.login-container input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.login-container input:focus {
    border-color: var(--primary);
    outline: none;
}

.btn-full {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
}

.login-error {
    color: var(--danger);
    margin-top: 15px;
    font-size: 0.9rem;
    min-height: 20px;
}

.login-help {
    margin-top: 20px;
    color: #666;
    font-size: 0.9rem;
    text-align: center;
}

.modal-description {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.form-hint {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 4px;
}

#setPasswordModal {
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
}

#setPasswordModal .modal-content {
    max-width: 400px;
}

/* ===== USER INFO IN SIDEBAR ===== */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    margin-bottom: 10px;
    color: white;
}

.user-info > i {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.user-info .user-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.user-info .user-details #currentUsername {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    background: var(--accent);
    color: var(--primary-dark);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    width: fit-content;
    margin-top: 2px;
}

.user-info .btn-logout {
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.4);
    color: #ff6b6b;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.user-info .btn-logout:hover {
    background: rgba(220, 53, 69, 0.4);
    color: #fff;
}

.btn-logout {
    width: 100%;
    padding: 10px;
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.5);
    color: #ff6b6b;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    transition: all 0.2s;
    margin-top: 10px;
}

.btn-logout:hover {
    background: rgba(220, 53, 69, 0.3);
}

/* ===== MAP CONTROLS ===== */
.map-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.toggle-label span {
    white-space: nowrap;
}

/* ===== MAP LAYOUT WITH ROUTE SIDEBAR ===== */
.map-layout {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.map-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.map-main .map-container {
    flex: 1;
    height: auto;
}

.route-sidebar {
    width: 350px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.route-sidebar-header {
    padding: 15px 20px;
    background: var(--primary);
    color: white;
}

.route-sidebar-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.route-help {
    margin: 5px 0 0 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

.route-job-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.route-job-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.2s;
    cursor: pointer;
}

.route-job-item:hover {
    border-color: var(--primary);
    background: #f8f9fa;
}

.route-job-item.selected {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

.route-job-item input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.route-job-info {
    flex: 1;
}

.route-job-info h4 {
    margin: 0 0 5px 0;
    font-size: 0.95rem;
    color: #333;
}

.route-job-info p {
    margin: 0;
    font-size: 0.8rem;
    color: #666;
}

.route-job-time {
    font-weight: 600;
    color: var(--primary);
}

.route-job-countdown {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 5px;
}

.route-job-countdown.upcoming {
    background: #fff3e0;
    color: #e65100;
}

.route-job-countdown.urgent {
    background: #ffebee;
    color: #c62828;
    animation: pulse 1.5s infinite;
}

.route-job-countdown.past {
    background: #e8f5e9;
    color: #388e3c;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.route-job-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 5px;
}

.route-job-status.completed {
    background: #e8f5e9;
    color: #388e3c;
}

.route-job-status.in-progress {
    background: #fff3e0;
    color: #e65100;
}

.route-actions {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

.route-actions button {
    flex: 1;
}

.route-selected-count {
    text-align: center;
    padding: 10px;
    font-size: 0.85rem;
    color: #666;
    background: #f5f5f5;
}

/* ===== MAP MARKER STATUS LABELS ===== */
.marker-with-status {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.marker-status-label {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.marker-status-label.completed {
    background: #388e3c;
    color: white;
}

.marker-status-label.in-progress {
    background: #f57c00;
    color: white;
}

.marker-countdown {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    color: #333;
}

/* Cluster marker for multiple jobs at same location */
.cluster-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cluster-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.cluster-circle:hover {
    transform: scale(1.1);
}

.cluster-count {
    color: white;
    font-weight: 700;
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.cluster-popup-job:last-child {
    border-bottom: none !important;
}

.cluster-popup-job:hover {
    background: #f5f5f5;
}

/* ===== ADMIN PAGE ===== */

/* Admin Tabs */
.admin-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 6px;
    border-radius: var(--radius-lg);
    margin-bottom: 15px;
    overflow-x: auto;
    flex-shrink: 0;
}

.admin-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.admin-tab:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.admin-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.admin-tab i {
    font-size: 1rem;
}

.admin-tab-content {
    display: none;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.admin-tab-content.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.2s ease;
}

.admin-tab-content > .card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.admin-tab-content > .card > .card-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    max-height: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.admin-grid .card {
    margin-bottom: 0;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 15px 0;
}

.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.checkbox-grid label:hover {
    background: rgba(79, 70, 229, 0.1);
}

/* Permissions Grid for Role Management */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 15px 0;
}

.permission-category {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 15px;
}

.permission-category h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.permission-category label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.permission-category label:hover {
    color: var(--text-primary);
}

.permission-category input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.checkbox-grid input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ===== CUSTOM FIELDS ===== */

/* Entity tabs for switching between customers/jobs */
.entity-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    width: fit-content;
}

.entity-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: calc(var(--radius) - 2px);
    transition: all 0.2s ease;
}

.entity-tab:hover {
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
}

.entity-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.entity-tab i {
    font-size: 0.85rem;
}

/* Custom fields table */
#customFieldsTable code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Custom field modal form */
#customFieldForm .form-group small {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 4px;
}

#customFieldForm .checkbox-row {
    display: flex;
    gap: 24px;
    margin: 15px 0;
}

#customFieldForm .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

#customFieldForm .checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Custom fields section in entity forms */
.custom-fields-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.custom-fields-header {
    margin-bottom: 15px;
}

.custom-fields-header h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-fields-header h4 i {
    color: var(--primary);
}

.custom-fields-section:empty {
    display: none;
}

/* Custom field header cells in tables */
.custom-field-header {
    background: var(--bg-secondary);
}

/* Text success/muted helpers */
.text-success {
    color: var(--success);
}

.text-muted {
    color: var(--text-muted);
}

.form-description {
    color: #666;
    margin-bottom: 10px;
}

/* ===== WHITE LABELING / BRANDING ===== */
.branding-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

@media (max-width: 1200px) {
    .branding-grid {
        grid-template-columns: 1fr;
    }
}

.branding-section {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.branding-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.branding-section h3 i {
    color: var(--primary);
}

/* Logo Upload */
.logo-upload-area {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.logo-preview {
    width: 120px;
    height: 120px;
    background: #fff;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 0.85rem;
}

.logo-placeholder i {
    font-size: 2rem;
}

.logo-upload-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.logo-upload-controls small {
    color: #64748b;
    font-size: 0.8rem;
}

/* Color Pickers */
.color-pickers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.color-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-input-group input[type="color"] {
    width: 50px;
    height: 40px;
    padding: 2px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
}

.color-input-group input[type="text"] {
    width: 100px;
    font-family: monospace;
    text-transform: uppercase;
}

/* Color Preview */
.color-preview {
    margin-top: 16px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.preview-header {
    padding: 12px 16px;
    background: var(--primary);
    color: #fff;
    font-weight: 500;
}

.preview-button {
    padding: 8px 16px;
    margin: 12px;
    background: var(--primary);
    color: #fff;
    border-radius: 6px;
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===== START JOB / JOB EXECUTION ENHANCEMENTS ===== */
.start-job-section {
    text-align: center;
    padding: 20px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: 10px;
}

.btn-start-job {
    background: linear-gradient(135deg, #43a047, #2e7d32);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3);
}

.btn-start-job:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
}

.btn-start-job i {
    font-size: 1.1rem;
}

.start-job-hint {
    margin-top: 10px;
    color: #2e7d32;
    font-size: 0.9rem;
}

.started-time {
    color: var(--primary);
    font-size: 0.9rem;
    margin-top: 5px;
}

.task-completed-time {
    display: block;
    color: #388e3c;
    font-size: 0.8rem;
    margin-top: 2px;
}

.template-selector-group {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 1024px) {
    .map-layout {
        flex-direction: column;
        height: auto;
    }

    .route-sidebar {
        width: 100%;
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .login-container {
        padding: 30px 25px;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== ENHANCED MOBILE FIXES ===== */

/* Ensure mobile nav toggle is always visible and clickable */
@media (max-width: 1024px) {
    .mobile-nav-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: fixed !important;
        top: 10px !important;
        left: 10px !important;
        z-index: 1100 !important;
        width: 48px;
        height: 48px;
        padding: 0;
        font-size: 1.4rem;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        /* Improve touch responsiveness */
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
    }

    .mobile-nav-toggle:active {
        transform: scale(0.95);
        background: var(--primary-dark);
    }

    /* Add top padding so content doesn't overlap hamburger menu */
    .main-content {
        padding-top: 70px;
    }
}

/* Jobs Page - Mobile Filters */
@media (max-width: 768px) {
    /* Collapse quick filter bar into horizontal scroll */
    #jobStatsBar.status-filter-bar {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 10px;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    #jobStatsBar.status-filter-bar::-webkit-scrollbar {
        display: none;
    }

    #jobStatsBar .status-filter-btn {
        flex-shrink: 0;
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    #jobStatsBar .status-filter-btn .status-label {
        white-space: nowrap;
    }

    /* Jobs filters - collapsible style */
    #jobs .filters-bar.filters-bar-wrap {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 10px;
        background: var(--bg-card);
        border-radius: var(--radius);
        margin-bottom: 15px;
    }

    #jobs .filters-bar .search-bar {
        grid-column: 1 / -1;
        max-width: 100%;
    }

    #jobs .filters-bar select {
        min-width: unset;
        width: 100%;
        padding: 10px;
        font-size: 0.85rem;
    }

    #jobs .filters-bar .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    #jobs .filters-bar .filter-group label {
        font-size: 0.75rem;
    }

    #jobs .filters-bar .filter-group input[type="date"] {
        width: 100%;
        padding: 8px;
    }

    #jobs .filters-bar .btn-secondary.btn-sm {
        grid-column: 1 / -1;
        justify-content: center;
    }

    #jobs .filters-bar .archive-toggle {
        font-size: 0.8rem;
        padding: 8px;
    }

    /* Job cards - full width */
    .jobs-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .job-card {
        margin: 0;
    }

    .job-card-header {
        padding: 12px 15px;
    }

    .job-card-header h3 {
        font-size: 0.95rem;
    }

    .job-card-body {
        padding: 15px;
    }

    .job-card-footer {
        padding: 12px 15px;
    }
}

/* Schedule Page - Mobile Calendar */
@media (max-width: 1024px) {
    #schedule .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    #schedule .page-header h1 {
        text-align: center;
    }

    .schedule-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    #weekDisplay {
        width: 100%;
        text-align: center;
        order: -1;
        font-size: 1rem;
        min-width: unset;
    }

    #scheduleUserFilter {
        width: 100%;
        margin-left: 0 !important;
    }

    /* Calendar redesign for mobile - stacked days */
    .schedule-container {
        display: block;
        height: calc(100vh - 200px);
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }

    .schedule-time-column {
        display: none;
    }

    .calendar-grid {
        display: flex;
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        min-height: unset;
    }

    .calendar-day {
        border: 1px solid var(--border);
        border-radius: var(--radius);
        overflow: hidden;
    }

    .calendar-day-header {
        background: var(--bg-light);
        padding: 12px;
        height: auto;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid var(--border);
    }

    .calendar-day-header small {
        display: inline;
        margin-left: 8px;
        margin-top: 0;
    }

    .calendar-day.today .calendar-day-header {
        background: var(--primary);
        color: white;
    }

    .calendar-day.today .calendar-day-header small {
        color: rgba(255, 255, 255, 0.8);
    }

    .calendar-day-jobs {
        min-height: 50px;
        padding: 10px;
        background: white;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .calendar-day-jobs .no-jobs {
        padding: 15px;
        margin: 0;
    }

    .calendar-job {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        width: 100% !important;
        height: auto !important;
        min-height: unset;
        padding: 10px 12px;
        margin: 0;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .calendar-job .job-time {
        font-size: 0.85rem;
        font-weight: 600;
        min-width: 50px;
    }

    .calendar-job .job-number {
        font-size: 0.7rem;
        padding: 2px 6px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
    }

    .calendar-job .job-title {
        flex: 1;
        min-width: 120px;
        white-space: normal;
        font-size: 0.85rem;
    }

    .calendar-job .job-assigned {
        width: 100%;
        margin-top: 4px;
        font-size: 0.75rem;
    }

    .calendar-job .job-hours {
        margin-top: 0;
        margin-left: auto;
    }
}

/* Job Map Page - Mobile Layout */
@media (max-width: 1024px) {
    #map .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .map-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .map-controls select {
        width: 100%;
        grid-column: 1 / -1;
    }

    .map-controls .toggle-label {
        justify-content: center;
        padding: 8px 12px;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
    }

    /* Map layout stacked */
    .map-layout {
        flex-direction: column;
        height: auto;
        gap: 15px;
    }

    .map-main {
        width: 100%;
    }

    /* CRITICAL: Ensure map has proper height on mobile */
    .map-main .map-container,
    #mapContainer {
        height: 350px !important;
        min-height: 350px;
        width: 100%;
    }

    .map-legend {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
        padding: 12px;
    }

    .legend-item {
        font-size: 0.8rem;
    }

    /* Route sidebar - horizontal scroll list on mobile */
    .route-sidebar {
        width: 100%;
        max-height: none;
        border-radius: var(--radius);
    }

    .route-sidebar-header {
        padding: 12px 15px;
    }

    .route-sidebar-header h3 {
        font-size: 1rem;
    }

    .route-help {
        font-size: 0.8rem;
    }

    .route-job-list {
        max-height: 250px;
        overflow-y: auto;
    }

    .route-job-item {
        padding: 10px;
    }

    .route-job-info h4 {
        font-size: 0.9rem;
    }

    .route-job-info p {
        font-size: 0.75rem;
    }

    .route-actions {
        padding: 12px;
    }

    .route-actions button {
        padding: 10px;
        font-size: 0.85rem;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    /* Jobs page - single column filters */
    #jobs .filters-bar.filters-bar-wrap {
        grid-template-columns: 1fr;
    }

    #jobStatsBar .status-filter-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    #jobStatsBar .status-filter-btn .status-count {
        font-size: 0.7rem;
        padding: 1px 6px;
    }

    /* Schedule - more compact */
    .calendar-job {
        padding: 8px 10px;
    }

    .calendar-job .job-time {
        font-size: 0.8rem;
    }

    .calendar-job .job-title {
        font-size: 0.8rem;
    }

    /* Map - taller for better visibility */
    .map-main .map-container,
    #mapContainer {
        height: 300px !important;
        min-height: 300px;
    }

    .route-job-list {
        max-height: 200px;
    }

    /* Hide some labels on very small screens */
    .map-controls .toggle-label span {
        font-size: 0.8rem;
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: 20px;
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.loading-subtext {
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Loading states for buttons */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Skeleton loading for cards */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Initial app loading screen */
.app-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.app-loading .loading-logo {
    width: 120px;
    height: 120px;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.app-loading .loading-spinner {
    border-color: rgba(255,255,255,0.2);
    border-top-color: white;
}

.app-loading .loading-text {
    color: white;
    font-size: 1.2rem;
}

.app-loading .loading-subtext {
    color: rgba(255,255,255,0.7);
}

/* ============================================
   REPORTS & ANALYTICS STYLES
   ============================================ */

/* Reports Page Header */
#reports .page-header {
    flex-wrap: wrap;
    gap: 15px;
}

.report-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.date-range-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.date-range-picker label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.date-range-picker input[type="date"] {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: white;
}

.date-range-picker .btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Report Tabs */
.report-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 25px;
    background: white;
    padding: 8px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}

.report-tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-tab:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.report-tab.active {
    background: var(--primary);
    color: white;
}

.report-tab i {
    font-size: 1rem;
}

/* Report Content Sections */
.report-content {
    display: none;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.report-content.active {
    display: block;
}

/* Report Summary Cards */
.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.report-summary-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.report-summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
}

.report-summary-card.blue::before { background: var(--info); }
.report-summary-card.green::before { background: var(--success); }
.report-summary-card.orange::before { background: var(--warning); }
.report-summary-card.purple::before { background: #9b59b6; }
.report-summary-card.red::before { background: var(--danger); }

.summary-icon {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.report-summary-card.blue .summary-icon { background: #e3f2fd; color: var(--info); }
.report-summary-card.green .summary-icon { background: #e8f5e9; color: var(--success); }
.report-summary-card.orange .summary-icon { background: #fff3e0; color: #f57c00; }
.report-summary-card.purple .summary-icon { background: #f3e5f5; color: #9b59b6; }
.report-summary-card.red .summary-icon { background: #ffebee; color: var(--danger); }

.summary-content {
    display: flex;
    flex-direction: column;
}

.summary-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.summary-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 3px;
}

.summary-change {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.summary-change.positive { color: var(--success); }
.summary-change.negative { color: var(--danger); }

/* Chart Cards */
.report-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.chart-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.chart-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-actions {
    display: flex;
    gap: 8px;
}

.chart-actions .btn-icon {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.chart-actions .btn-icon:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.chart-container {
    position: relative;
    height: 300px;
}

.chart-container.chart-small {
    height: 250px;
}

/* Report Tables */
.report-table-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 25px;
}

.report-table-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.report-table-card .table-container {
    max-height: 400px;
    overflow-y: auto;
}

.report-table-card .data-table th {
    position: sticky;
    top: 0;
    background: var(--bg-light);
    z-index: 1;
}

/* Export Bar */
.report-export-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: var(--radius-lg);
    padding: 15px 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
}

.report-export-bar h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.export-buttons {
    display: flex;
    gap: 10px;
}

/* Status Pills in Tables */
.status-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-pill.paid { background: #e8f5e9; color: #2e7d32; }
.status-pill.sent { background: #e3f2fd; color: #1565c0; }
.status-pill.draft { background: #f5f5f5; color: #616161; }
.status-pill.overdue { background: #ffebee; color: #c62828; }
.status-pill.completed { background: #e8f5e9; color: #2e7d32; }
.status-pill.scheduled { background: #e3f2fd; color: #1565c0; }
.status-pill.in-progress { background: #fff3e0; color: #ef6c00; }
.status-pill.cancelled { background: #f5f5f5; color: #616161; }

/* Print Styles for PDF Export */
@media print {
    .sidebar, .report-tabs, .report-export-bar, .chart-actions, .export-buttons {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .report-content {
        display: block !important;
    }

    .report-summary-card, .chart-card, .report-table-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd;
    }

    .chart-container {
        height: 250px !important;
    }
}

/* Mobile Responsive for Reports */
@media (max-width: 768px) {
    .report-tabs {
        flex-wrap: wrap;
    }

    .report-tab {
        flex: 1 1 auto;
        min-width: 80px;
        justify-content: center;
        padding: 10px 15px;
        font-size: 0.85rem;
    }

    .report-tab span {
        display: none;
    }

    .report-tab i {
        font-size: 1.2rem;
    }

    .date-range-picker {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .date-range-picker input[type="date"] {
        width: 100%;
    }

    .report-charts-grid {
        grid-template-columns: 1fr;
    }

    .report-summary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .report-export-bar {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .summary-value {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .report-summary-grid {
        grid-template-columns: 1fr;
    }

    .report-summary-card {
        padding: 15px;
    }

    .summary-icon {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
}

/* ============================================
   CUSTOM REPORT BUILDER STYLES
   ============================================ */

.custom-report-builder {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    flex-wrap: wrap;
    gap: 15px;
}

.builder-title h3 {
    font-size: 1.3rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.builder-title p {
    font-size: 0.9rem;
    opacity: 0.9;
    margin: 0;
}

.builder-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.builder-actions .btn-secondary {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.3);
    color: white;
}

.builder-actions .btn-secondary:hover {
    background: rgba(255,255,255,0.3);
}

/* Builder Steps */
.builder-steps {
    padding: 20px;
}

.builder-step {
    background: var(--bg-light);
    border-radius: var(--radius);
    margin-bottom: 15px;
    overflow: hidden;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: white;
    border-bottom: 1px solid var(--border);
}

.step-number {
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.step-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    margin: 0;
}

.step-actions {
    display: flex;
    gap: 10px;
}

.step-content {
    padding: 20px;
}

/* Data Source Selection */
.data-source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.data-source-option {
    cursor: pointer;
}

.data-source-option input {
    display: none;
}

.data-source-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 15px;
    text-align: center;
    transition: all 0.2s ease;
}

.data-source-card i {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 8px;
    display: block;
}

.data-source-card span {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.data-source-card small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.data-source-option input:checked + .data-source-card {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.data-source-card:hover {
    border-color: var(--primary-light);
}

/* Columns Selection */
.columns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.column-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.column-option:hover {
    border-color: var(--primary-light);
    background: rgba(79, 70, 229, 0.02);
}

.column-option input {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

.column-option label {
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    flex: 1;
}

.column-option .column-type {
    font-size: 0.7rem;
    padding: 2px 6px;
    background: var(--bg-light);
    border-radius: 10px;
    color: var(--text-secondary);
}

.column-option.selected {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

/* Filters */
.filters-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex-wrap: wrap;
}

.filter-row select,
.filter-row input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: white;
}

.filter-row .filter-field {
    min-width: 150px;
}

.filter-row .filter-operator {
    min-width: 120px;
}

.filter-row .filter-value {
    flex: 1;
    min-width: 120px;
}

.filter-row .filter-and {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.filter-row .btn-remove-filter {
    width: 32px;
    height: 32px;
    border: none;
    background: #ffebee;
    color: var(--danger);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.filter-row .btn-remove-filter:hover {
    background: var(--danger);
    color: white;
}

/* Sort & Group */
.sort-group-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.sort-options,
.group-options,
.limit-options {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
}

.sort-options label,
.group-options label,
.limit-options label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
}

.sort-options select,
.group-options select,
.limit-options select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: white;
}

/* Generate Button */
.builder-generate {
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--bg-light);
}

.builder-generate .btn-lg {
    padding: 14px 40px;
    font-size: 1.1rem;
}

/* Results Section */
.custom-report-results {
    border-top: 3px solid var(--primary);
    background: white;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 15px;
}

.results-info h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.results-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.results-actions {
    display: flex;
    gap: 10px;
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    padding: 20px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border);
}

.summary-stat {
    background: white;
    padding: 15px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.summary-stat .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.summary-stat .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 3px;
}

.results-table-container {
    max-height: 500px;
    overflow: auto;
    padding: 20px;
}

.results-table-container .data-table {
    width: 100%;
}

.results-table-container .data-table th {
    position: sticky;
    top: 0;
    background: var(--bg-light);
    z-index: 1;
}

/* Grouped Results */
.grouped-section {
    margin-bottom: 25px;
}

.grouped-section .group-header {
    background: var(--primary);
    color: white;
    padding: 10px 15px;
    border-radius: var(--radius) var(--radius) 0 0;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grouped-section .group-header .group-count {
    background: rgba(255,255,255,0.2);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
}

.grouped-section .data-table {
    border-radius: 0 0 var(--radius) var(--radius);
    overflow: hidden;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .builder-header {
        flex-direction: column;
        text-align: center;
    }

    .builder-actions {
        justify-content: center;
    }

    .data-source-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .columns-grid {
        grid-template-columns: 1fr;
    }

    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-row select,
    .filter-row input {
        width: 100%;
    }

    .sort-group-row {
        flex-direction: column;
    }

    .sort-options,
    .group-options,
    .limit-options {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Button variants */
.btn-link {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 5px 10px;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* ============================================
   TIME TRACKING STYLES
   ============================================ */

.clock-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
}

.clock-status {
    display: flex;
    align-items: center;
    gap: 20px;
}

.clock-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.clock-card.clocked-in .clock-icon {
    background: #e8f5e9;
    color: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.clock-info {
    display: flex;
    flex-direction: column;
}

.clock-label {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.clock-time {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    font-family: 'Courier New', monospace;
}

.clock-actions {
    display: flex;
    gap: 15px;
}

.btn-clock-in, .btn-clock-out {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-clock-in {
    background: var(--success);
    color: white;
    border: none;
}

.btn-clock-in:hover {
    background: #388e3c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.btn-clock-out {
    background: var(--danger);
    color: white;
    border: none;
}

.btn-clock-out:hover {
    background: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.clock-job-select {
    flex-basis: 100%;
    margin-top: 10px;
}

.clock-job-select label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.clock-job-select select {
    width: 100%;
    max-width: 400px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.time-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.summary-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}

.summary-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
}

.summary-content {
    display: flex;
    flex-direction: column;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.time-filters {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-filters input[type="date"] {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.time-filters span {
    color: var(--text-secondary);
}

/* ============================================
   RECURRING JOBS STYLES
   ============================================ */

.days-checkbox-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.days-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.days-checkbox-group label:hover {
    background: var(--border);
}

.days-checkbox-group input:checked + span,
.days-checkbox-group label:has(input:checked) {
    background: var(--primary);
    color: white;
}

.recurring-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.recurring-status.active {
    background: #e8f5e9;
    color: var(--success);
}

.recurring-status.paused {
    background: #fff3e0;
    color: #f57c00;
}

.recurring-status.inactive {
    background: #f5f5f5;
    color: var(--text-secondary);
}

.frequency-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Toggle switch for recurring jobs */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Mobile responsiveness for time tracking */
@media (max-width: 768px) {
    .clock-card {
        flex-direction: column;
        text-align: center;
    }

    .clock-status {
        flex-direction: column;
    }

    .clock-actions {
        width: 100%;
        justify-content: center;
    }

    .btn-clock-in, .btn-clock-out {
        flex: 1;
    }

    .time-summary-grid {
        grid-template-columns: 1fr;
    }

    .time-filters {
        flex-wrap: wrap;
    }
}

/* ============================================
   PAYMENT MODAL STYLES
   ============================================ */

.payment-info {
    text-align: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.payment-info h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.payment-info p {
    color: var(--text-secondary);
    margin: 5px 0;
}

.payment-amount {
    font-size: 1.3rem;
    margin-top: 15px !important;
}

.payment-amount strong {
    color: var(--primary);
    font-size: 1.5rem;
}

.payment-not-configured {
    text-align: center;
    padding: 20px;
}

.payment-not-configured h4 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.payment-not-configured ol {
    color: var(--text-secondary);
    padding-left: 25px;
}

.payment-not-configured li {
    margin: 8px 0;
}

.payment-message {
    padding: 12px;
    border-radius: var(--radius);
    margin-top: 15px;
    font-size: 0.9rem;
}

.payment-message.error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.payment-message.success {
    background: #ecfdf5;
    color: var(--success);
    border: 1px solid #a7f3d0;
}

#paymentElement {
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-light);
}

.btn-pay {
    background: linear-gradient(135deg, #635bff 0%, #5851ea 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-pay:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 91, 255, 0.3);
}

.btn-pay:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   CREW TRACKER STYLES
   ============================================ */

.crew-tracker-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    margin-top: 20px;
}

.crew-map-container {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.crew-list-sidebar {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.crew-list-sidebar h3 {
    margin: 0 0 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
    color: #1f2937;
}

.crew-status-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 450px;
    overflow-y: auto;
}

.crew-status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

.crew-status-item:hover {
    background: #f3f4f6;
    transform: translateX(3px);
}

.crew-status-item.active {
    border-left-color: #22c55e;
}

.crew-status-item.idle {
    border-left-color: #f59e0b;
}

.crew-status-item.offline {
    border-left-color: #ef4444;
}

.crew-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.crew-info {
    flex: 1;
    min-width: 0;
}

.crew-name {
    font-weight: 600;
    color: #1f2937;
}

.crew-job {
    font-size: 0.85rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crew-time {
    font-size: 0.75rem;
    color: #9ca3af;
}

.crew-status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.crew-status-badge.active {
    background: #dcfce7;
    color: #166534;
}

.crew-status-badge.idle {
    background: #fef3c7;
    color: #92400e;
}

.crew-status-badge.offline {
    background: #fee2e2;
    color: #991b1b;
}

.crew-map-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Location tracking button */
.tracking-active {
    background: #22c55e !important;
    color: white !important;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
}

/* Responsive */
@media (max-width: 900px) {
    .crew-tracker-layout {
        grid-template-columns: 1fr;
    }

    .crew-list-sidebar {
        order: -1;
    }

    .crew-status-list {
        max-height: 200px;
    }
}

/* ============================================
   MAP SIDEBAR WITH TABS
   ============================================ */

.map-sidebar {
    width: 320px;
    min-width: 320px;
    height: 100%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.sidebar-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.sidebar-tab:hover {
    background: #e9ecef;
    color: #333;
}

.sidebar-tab.active {
    background: white;
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    margin-bottom: -1px;
}

.sidebar-tab i {
    font-size: 0.85rem;
}

.sidebar-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.sidebar-panel.active {
    display: flex;
}

.panel-header {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
}

.panel-header .panel-help {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
}

/* Crew Panel Styles */
.crew-panel-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: #f0f0f0;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #e0e0e0;
    color: #333;
}

.btn-icon:active {
    transform: scale(0.95);
}

.auto-refresh-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    background: #dcfce7;
    color: #16a34a;
    border-radius: 12px;
    font-weight: 500;
}

.auto-refresh-badge.paused {
    background: #fef3c7;
    color: #d97706;
}

.crew-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.crew-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.crew-list-item:hover {
    background: #e9ecef;
    transform: translateX(2px);
}

.crew-list-item:last-child {
    margin-bottom: 0;
}

.crew-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.crew-avatar.active {
    background: #22c55e;
}

.crew-avatar.idle {
    background: #f59e0b;
}

.crew-avatar.offline {
    background: #6b7280;
}

.crew-details {
    flex: 1;
    min-width: 0;
}

.crew-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crew-job-info {
    font-size: 0.8rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crew-status-indicator {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.crew-status-indicator.active {
    background: #dcfce7;
    color: #16a34a;
}

.crew-status-indicator.idle {
    background: #fef3c7;
    color: #d97706;
}

.crew-status-indicator.offline {
    background: #f3f4f6;
    color: #6b7280;
}

.crew-summary {
    padding: 10px 15px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
}

/* Crew marker legend items */
.legend-marker.crew-active {
    background: #22c55e;
    border-radius: 50%;
}

.legend-marker.crew-idle {
    background: #f59e0b;
    border-radius: 50%;
}

/* Responsive */
@media (max-width: 1024px) {
    .map-sidebar {
        width: 280px;
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .map-layout {
        flex-direction: column;
    }

    .map-sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
        max-height: 300px;
        order: 2;
    }

    .sidebar-tab {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .crew-list-item {
        padding: 8px 10px;
    }

    .crew-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
}
