/* ===== HVAC CRM — Base Styles ===== */
:root {
    --primary: #1e40af;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--gray-800);
    background: var(--gray-100);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Auth Layout ===== */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
}

.auth-container { width: 100%; max-width: 400px; padding: 20px; }

.auth-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo h1 { color: var(--primary); font-size: 24px; }
.auth-subtitle { color: var(--gray-500); margin-bottom: 16px; text-align: center; }
.auth-card h2 { text-align: center; margin-bottom: 20px; color: var(--gray-800); }

/* ===== App Layout ===== */
.app-body { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-logo { font-size: 18px; font-weight: 700; }
.sidebar-close { display: none; background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--gray-300);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    font-size: 14px;
}

.nav-item:hover { background: var(--gray-700); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; }

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* Icon placeholders — will be replaced with SVG icons later */
[data-icon="dashboard"]::before { content: "\25A0"; }
[data-icon="people"]::before { content: "\25CB"; }
[data-icon="calendar"]::before { content: "\25A1"; }
[data-icon="field"]::before { content: "\2692"; }
[data-icon="inspect"]::before { content: "\2611"; }
[data-icon="dispatch"]::before { content: "\25B6"; }
[data-icon="estimate"]::before { content: "\25C6"; }
[data-icon="invoice"]::before { content: "\25C7"; }
[data-icon="agreement"]::before { content: "\25C8"; }
[data-icon="pricebook"]::before { content: "\25CE"; }
[data-icon="report"]::before { content: "\25A3"; }
[data-icon="marketing"]::before { content: "\25C9"; }
[data-icon="review"]::before { content: "\2605"; }
[data-icon="chat"]::before { content: "\25EF"; }
[data-icon="settings"]::before { content: "\2699"; }
[data-icon="tracking"]::before { content: "\1F4CD"; }
[data-icon="logout"]::before { content: "\2192"; }

.sidebar-footer { border-top: 1px solid var(--gray-700); padding: 8px 0; }
.sidebar-overlay { display: none; }

.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== Topbar ===== */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-menu-btn { display: none; }
.topbar-title { font-size: 16px; font-weight: 600; flex: 1; }
.topbar-user { color: var(--gray-600); font-size: 13px; }

/* ===== Main Content ===== */
.main-content { padding: 24px; flex: 1; }

/* ===== Cards ===== */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.stat-label { color: var(--gray-500); font-size: 13px; margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--gray-900); }

/* ===== Dashboard ===== */
.dashboard-welcome { margin-bottom: 24px; }
.dashboard-welcome h2 { font-size: 20px; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; color: var(--gray-700); font-size: 13px; }

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    color: var(--gray-800);
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--gray-600);
    cursor: pointer;
}

.link-small { font-size: 13px; }
.link-back { display: block; text-align: center; margin-top: 12px; font-size: 13px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; }

/* ===== Alerts ===== */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 500;
}

.alert-error { background: var(--danger-light); color: var(--danger); }
.alert-success { background: var(--success-light); color: var(--success); }
.alert-warning { background: var(--warning-light); color: var(--warning); }

/* ===== Utilities ===== */
.text-muted { color: var(--gray-500); }

/* ===== Error Page ===== */
.error-page { text-align: center; padding: 60px 20px; }
.error-page h1 { font-size: 72px; color: var(--gray-300); }
.error-page p { color: var(--gray-500); margin: 8px 0 24px; }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th { font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover { background: var(--gray-50); }

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
    .sidebar-overlay.active { display: block; }

    .main-wrapper { margin-left: 0; }

    .topbar-menu-btn {
        display: flex;
        flex-direction: column;
        gap: 4px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 4px;
    }
    .topbar-menu-btn span {
        display: block;
        width: 20px;
        height: 2px;
        background: var(--gray-600);
    }

    .dashboard-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
}

.page-header h2 { font-size: 20px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-header-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}

.badge-lead { background: var(--warning-light); color: var(--warning); }
.badge-active { background: var(--success-light); color: var(--success); }
.badge-inactive { background: var(--gray-200); color: var(--gray-600); }
.badge-archived { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--primary-light); color: var(--primary); }

/* ===== Tags ===== */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

.tag-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 0 0 4px;
    opacity: 0.6;
    color: inherit;
}
.tag-remove:hover { opacity: 1; }

/* ===== Search Bar ===== */
.search-bar { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.search-bar-fields { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
}
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.search-select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    min-width: 140px;
}
.search-select:focus { outline: none; border-color: var(--primary); }

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.pagination-info { font-size: 13px; color: var(--gray-500); }

/* ===== Form Grid ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ===== Btn Outline ===== */
.btn-outline {
    background: #fff;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}
.btn-outline:hover { background: var(--gray-50); text-decoration: none; }

/* ===== Btn Link ===== */
.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 13px;
    padding: 0;
}
.btn-link:hover { text-decoration: underline; }
.btn-link-danger { color: var(--danger); }

/* ===== Clickable Rows ===== */
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--primary-light) !important; }

/* ===== Detail Grid (Customer Show) ===== */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
}

.detail-list { display: flex; flex-direction: column; gap: 12px; }

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.detail-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    min-width: 100px;
    flex-shrink: 0;
}

/* ===== Tabs ===== */
.tabs { margin-top: 0; }

.tab-nav {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 16px;
    gap: 0;
}

.tab-link {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-500);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.tab-link:hover { color: var(--gray-700); text-decoration: none; }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ===== Notes ===== */
.note-form { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--gray-200); }
.notes-list { display: flex; flex-direction: column; gap: 12px; }

.note-card {
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 12px;
}
.note-pinned { border-color: var(--warning); background: var(--warning-light); }

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 13px;
}
.note-author { font-weight: 600; color: var(--gray-700); }
.note-date { color: var(--gray-400); font-size: 12px; }
.note-body { font-size: 14px; line-height: 1.5; color: var(--gray-800); }
.note-actions { margin-top: 8px; display: flex; gap: 12px; }
.pin-icon { font-size: 14px; margin-right: 4px; }

/* ===== Properties ===== */
.property-card {
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    margin-bottom: 12px;
    overflow: hidden;
}

.property-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.property-body { padding: 12px; }

.property-details { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.detail-chip {
    display: inline-block;
    padding: 2px 8px;
    background: var(--gray-100);
    border-radius: 4px;
    font-size: 12px;
    color: var(--gray-600);
}

/* ===== Timeline ===== */
.timeline { position: relative; padding-left: 28px; }

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--gray-200);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-icon {
    position: absolute;
    left: -28px;
    top: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gray-400);
    border: 2px solid #fff;
}

.timeline-icon-note { background: var(--primary); }
.timeline-icon-status_change { background: var(--warning); }
.timeline-icon-call { background: var(--success); }
.timeline-icon-email { background: #8b5cf6; }
.timeline-icon-visit { background: #ec4899; }
.timeline-icon-job { background: var(--primary); }
.timeline-icon-invoice { background: var(--success); }
.timeline-icon-other { background: var(--gray-400); }

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.timeline-title { font-weight: 600; font-size: 14px; }
.timeline-date { font-size: 12px; color: var(--gray-400); white-space: nowrap; }
.timeline-desc { font-size: 13px; color: var(--gray-600); margin-top: 4px; }
.timeline-author { font-size: 12px; color: var(--gray-400); margin-top: 2px; display: inline-block; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--gray-500); }

/* ===== Portal Layout ===== */
.portal-body {
    background: var(--gray-100);
    min-height: 100vh;
}

.portal-header {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.portal-logo { font-size: 18px; font-weight: 700; color: var(--primary); }
.portal-nav { display: flex; gap: 4px; }

.portal-nav-link {
    padding: 6px 12px;
    font-size: 14px;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: 6px;
}
.portal-nav-link:hover { background: var(--gray-100); color: var(--gray-800); text-decoration: none; }

.portal-content { max-width: 800px; margin: 0 auto; padding: 24px; }

.portal-login-card {
    max-width: 400px;
    margin: 60px auto;
    background: #fff;
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}
.portal-login-card h2 { text-align: center; margin-bottom: 8px; }

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
    .sidebar-overlay.active { display: block; }

    .main-wrapper { margin-left: 0; }

    .topbar-menu-btn {
        display: flex;
        flex-direction: column;
        gap: 4px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 4px;
    }
    .topbar-menu-btn span {
        display: block;
        width: 20px;
        height: 2px;
        background: var(--gray-600);
    }

    .dashboard-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid-3 { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
    .search-bar-fields { flex-direction: column; }
    .portal-nav { gap: 0; }
    .portal-nav-link { padding: 6px 8px; font-size: 13px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .main-content { padding: 16px; }
    .tab-link { padding: 8px 10px; font-size: 13px; }
}

/* ===== Calendar Controls ===== */
.calendar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-title {
    font-weight: 600;
    font-size: 15px;
    margin-left: 8px;
}

.calendar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.view-toggle { display: flex; gap: 0; }
.view-toggle .btn { border-radius: 0; }
.view-toggle .btn:first-child { border-radius: 6px 0 0 6px; }
.view-toggle .btn:last-child { border-radius: 0 6px 6px 0; }

/* ===== Month Calendar ===== */
.cal-month-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--gray-200);
}

.cal-dow {
    padding: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
}

.cal-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.cal-day {
    min-height: 100px;
    border-right: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
    padding: 4px;
    cursor: pointer;
}

.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: var(--gray-50); }
.cal-day-today { background: var(--primary-light) !important; }
.cal-day-other { opacity: 0.4; }

.cal-day-num {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 4px;
}

.cal-event {
    display: block;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 11px;
    color: #fff;
    margin-bottom: 2px;
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.cal-event:hover { opacity: 0.85; text-decoration: none; }

.cal-event-time {
    font-weight: 600;
    margin-right: 2px;
}

.cal-more {
    font-size: 11px;
    color: var(--gray-500);
    padding: 0 4px;
}

/* ===== Day View ===== */
.cal-day-view { border-top: 1px solid var(--gray-200); }

.cal-hour-row {
    display: flex;
    border-bottom: 1px solid var(--gray-100);
    min-height: 56px;
}

.cal-hour-label {
    width: 80px;
    flex-shrink: 0;
    padding: 8px;
    font-size: 12px;
    color: var(--gray-500);
    text-align: right;
    border-right: 1px solid var(--gray-200);
}

.cal-hour-content {
    flex: 1;
    padding: 4px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cal-event-block {
    display: block;
    padding: 6px 10px;
    background: var(--gray-50);
    border-radius: 4px;
    text-decoration: none;
    color: var(--gray-800);
}
.cal-event-block:hover { background: var(--gray-100); text-decoration: none; }

.cal-event-block-title { font-weight: 600; font-size: 13px; }
.cal-event-block-meta { font-size: 12px; color: var(--gray-500); }

/* ===== Week View ===== */
.cal-week { overflow-x: auto; }

.cal-week-header {
    display: grid;
    grid-template-columns: 70px repeat(7, 1fr);
    border-bottom: 1px solid var(--gray-200);
}

.cal-week-day-header {
    padding: 8px;
    text-align: center;
    border-left: 1px solid var(--gray-200);
}
.cal-week-day-header.cal-day-today { background: var(--primary-light); }

.cal-week-dow {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
}

.cal-week-date {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
}

.cal-week-body { max-height: 600px; overflow-y: auto; }

.cal-week-row {
    display: grid;
    grid-template-columns: 70px repeat(7, 1fr);
    border-bottom: 1px solid var(--gray-100);
    min-height: 48px;
}

.cal-week-time-col {
    padding: 6px 8px;
    font-size: 11px;
    color: var(--gray-400);
    text-align: right;
    border-right: 1px solid var(--gray-200);
}

.cal-week-cell {
    border-left: 1px solid var(--gray-200);
    padding: 2px;
    min-height: 48px;
}

.cal-week-event {
    display: block;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 11px;
    color: #fff;
    text-decoration: none;
    margin-bottom: 2px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.cal-week-event:hover { opacity: 0.85; text-decoration: none; }

/* ===== Calendar Legend ===== */
.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    padding: 8px 0;
}

.cal-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--gray-600);
}

.cal-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* ===== Dispatch Board ===== */
.dispatch-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.dispatch-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.dispatch-bar-success { background: var(--success); }
.dispatch-bar-warning { background: var(--warning); }
.dispatch-bar-danger { background: var(--danger); }

/* ===== Calendar Responsive ===== */
@media (max-width: 768px) {
    .calendar-controls { flex-wrap: wrap; }
    .calendar-actions { flex-wrap: wrap; width: 100%; }
    .cal-day { min-height: 60px; }
    .cal-event-time { display: none; }
    .cal-week-header, .cal-week-row { grid-template-columns: 50px repeat(7, 1fr); }
    .cal-hour-label { width: 50px; font-size: 11px; }
    .card-header { flex-direction: column; gap: 8px; align-items: flex-start; }
}

/* ===== Field Operations (Tech Mobile) ===== */
.field-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}
.field-stat {
    flex: 1;
    background: white;
    border-radius: var(--radius);
    padding: 12px 16px;
    text-align: center;
    box-shadow: var(--shadow);
}
.field-stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}
.field-stat-label {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-clock-banner {
    background: var(--warning-light);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}
.field-clock-elapsed {
    font-weight: 700;
    color: var(--warning);
}

.field-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.field-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--gray-400);
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Job Cards */
.field-job-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    overflow: hidden;
}
.field-job-link {
    display: block;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
}
.field-job-link:hover { background: var(--gray-50); }
.field-job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.field-job-time {
    font-weight: 700;
    font-size: 15px;
    margin-right: 8px;
}
.field-job-type {
    font-size: 12px;
    color: var(--gray-500);
}
.field-job-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}
.field-job-customer {
    font-size: 14px;
    color: var(--gray-600);
}
.field-job-address {
    font-size: 13px;
    color: var(--gray-400);
    margin-top: 2px;
}

.field-job-actions {
    display: flex;
    border-top: 1px solid var(--gray-200);
}
.field-action-btn {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-right: 1px solid var(--gray-200);
    transition: background 0.15s;
}
.field-action-btn:last-child { border-right: none; }
.field-action-call { color: var(--success); }
.field-action-call:hover { background: var(--success-light); }
.field-action-text { color: var(--primary); }
.field-action-text:hover { background: var(--primary-light); }
.field-action-nav { color: var(--warning); }
.field-action-nav:hover { background: var(--warning-light); }

/* Upcoming */
.field-upcoming-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
}
.field-upcoming-date {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-500);
    min-width: 70px;
}
.field-upcoming-info { flex: 1; }
.field-upcoming-title {
    display: block;
    font-weight: 600;
    font-size: 14px;
}
.field-upcoming-customer {
    font-size: 12px;
    color: var(--gray-500);
}

/* Field Job Detail */
.field-job-detail { max-width: 640px; }

.field-detail-header {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.field-back-link {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
}
.field-detail-meta {
    margin-top: 8px;
    font-size: 13px;
    color: var(--gray-500);
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.field-quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.field-quick-actions .field-action-btn {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-right: none;
}

.field-status-clock {
    background: white;
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.field-status-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.field-status-btn {
    color: white !important;
    border: none;
    font-weight: 600;
    padding: 10px 20px;
    font-size: 14px;
    flex: 1;
    min-width: 120px;
}
.field-status-btn:hover { opacity: 0.9; }

.field-clock-section { margin-top: 8px; }
.field-clock-active {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    color: var(--warning);
}
.field-clock-form { margin-top: 8px; }
.field-total-time {
    margin-top: 8px;
    font-size: 13px;
    color: var(--gray-500);
    text-align: right;
}

.form-control-sm {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
}
.form-control-sm:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

/* Field Tabs */
.field-tabs {
    display: flex;
    gap: 4px;
    background: white;
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}
.field-tabs .tab-link {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-600);
}
.field-tabs .tab-link.active {
    background: var(--primary);
    color: white;
}
.tab-count {
    font-size: 11px;
    opacity: 0.7;
}

/* Field Info Card */
.field-info-card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}
.field-info-section {
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}
.field-info-section:last-child { border-bottom: none; }
.field-info-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.field-info-value {
    margin-top: 4px;
    font-size: 14px;
}
.field-info-value a { color: var(--primary); text-decoration: none; }

/* Status History */
.field-history-item {
    display: flex;
    gap: 10px;
    padding: 6px 0;
    font-size: 13px;
}
.field-history-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}
.field-history-time { color: var(--gray-400); font-size: 12px; }
.field-history-by { color: var(--gray-400); font-size: 12px; }
.field-history-note { color: var(--gray-600); font-size: 12px; margin-top: 2px; }

/* Field Notes */
.field-note-form {
    background: white;
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
}
.field-textarea {
    width: 100%;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}
.field-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}
.field-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--gray-600);
    cursor: pointer;
}
.field-note-item {
    background: white;
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-top: 8px;
    box-shadow: var(--shadow);
}
.field-note-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 4px;
}
.field-note-date { color: var(--gray-400); font-size: 12px; }
.field-note-content { font-size: 14px; line-height: 1.5; }
.btn-link-danger {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

/* Photo Grid */
.field-photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
}
.field-photo-item {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.field-photo-item img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}
.field-photo-meta {
    padding: 8px 10px;
    font-size: 12px;
}
.field-photo-caption {
    display: block;
    margin-top: 2px;
    color: var(--gray-600);
}
.field-photo-info {
    display: block;
    color: var(--gray-400);
    font-size: 11px;
}
.field-photo-item form { padding: 0 10px 8px; }

/* Upload Form */
.field-upload-form {
    background: white;
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
}
.field-upload-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.field-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--gray-100);
    border: 2px dashed var(--gray-300);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    white-space: nowrap;
}
.field-upload-btn:hover { border-color: var(--primary); color: var(--primary); }
.field-upload-name {
    font-size: 13px;
    color: var(--gray-500);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Document Items */
.field-doc-item {
    background: white;
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-top: 8px;
    box-shadow: var(--shadow);
}
.field-doc-link {
    display: flex;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}
.field-doc-link:hover { color: var(--primary); }
.field-doc-icon { font-size: 24px; }
.field-doc-name { font-weight: 600; font-size: 14px; }
.field-doc-meta { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.field-doc-desc { font-size: 13px; color: var(--gray-600); margin-top: 4px; }

/* Time Entries */
.field-time-total {
    background: white;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    font-size: 14px;
    text-align: center;
    color: var(--gray-600);
}
.field-time-item {
    background: white;
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 6px;
    box-shadow: var(--shadow);
}
.field-time-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 4px;
}
.field-time-range { font-size: 14px; }
.field-time-duration { font-weight: 700; color: var(--primary); margin-left: 8px; }
.field-time-break { color: var(--gray-400); font-size: 12px; }
.field-time-notes { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

/* ===== Inspection Forms ===== */
.insp-section {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.insp-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}
.insp-form-field {
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}
.insp-form-field:last-child { border-bottom: none; }
.insp-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
}
.insp-input {
    width: 100%;
}
.insp-pass-fail {
    display: flex;
    gap: 6px;
}
.insp-pf-option {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
    border: 2px solid var(--gray-200);
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}
.insp-pf-option input { display: none; }
.insp-pf-pass.active { border-color: var(--success); background: var(--success-light); color: var(--success); }
.insp-pf-fail.active { border-color: var(--danger); background: var(--danger-light); color: var(--danger); }
.insp-pf-option.active:not(.insp-pf-pass):not(.insp-pf-fail) { border-color: var(--gray-400); background: var(--gray-100); }
.insp-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Template builder */
.insp-field-row {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--gray-100);
}
.insp-field-row:last-child { border-bottom: none; }
.insp-field-label { flex: 2; padding: 6px 10px; border: 1px solid var(--gray-300); border-radius: 4px; font-size: 13px; }
.insp-field-type { flex: 1; padding: 6px 10px; border: 1px solid var(--gray-300); border-radius: 4px; font-size: 13px; background: #fff; }

/* Template picker */
.field-template-pick {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 14px 16px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    transition: border-color 0.15s;
}
.field-template-pick:hover { border-color: var(--primary); }

/* ===== AI Advisor Chat ===== */
.advisor-chat {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 400px;
}
.advisor-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.advisor-msg {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 85%;
}
.advisor-msg strong {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}
.advisor-msg-user {
    background: var(--primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.advisor-msg-user strong { opacity: 0.7; }
.advisor-msg-ai {
    background: var(--gray-100);
    color: var(--gray-800);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.advisor-msg-ai strong { color: var(--primary); }
.advisor-input-form {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--gray-200);
}

/* Field Mobile Responsive */
@media (max-width: 480px) {
    .field-photo-grid { grid-template-columns: 1fr; }
    .field-status-btn { min-width: unset; }
    .insp-field-row { flex-wrap: wrap; }
    .insp-field-label, .insp-field-type { flex: unset; width: 100%; }
}

/* ===== Communication Log ===== */
.comm-timeline { display: flex; flex-direction: column; gap: 12px; }
.comm-entry { display: flex; gap: 12px; padding: 12px; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); }
.comm-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.comm-icon-sms { background: var(--success-light); color: var(--success); }
.comm-icon-email { background: var(--primary-light); color: var(--primary); }
.comm-icon-call { background: var(--warning-light); color: var(--warning); }
.comm-icon-system { background: var(--gray-100); color: var(--gray-500); }
.comm-body { flex: 1; min-width: 0; }
.comm-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.comm-date { font-size: 12px; color: var(--gray-400); }
.comm-subject { font-weight: 600; margin-bottom: 4px; }
.comm-text { font-size: 13px; color: var(--gray-600); }
.comm-direction { font-size: 12px; font-weight: 600; }
.comm-outbound { color: var(--primary); }
.comm-inbound { color: var(--success); }

/* ===== Modal ===== */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-content { background: #fff; border-radius: var(--radius); width: 100%; box-shadow: var(--shadow-lg); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--gray-500); }
.modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }

/* ===== Notification Bell ===== */
.topbar-bell { position: relative; cursor: pointer; padding: 4px 8px; background: none; border: none; font-size: 18px; color: var(--gray-600); }
.topbar-bell:hover { color: var(--gray-800); }
.topbar-bell-badge { position: absolute; top: -2px; right: 0; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 4px; border-radius: 8px; min-width: 16px; text-align: center; line-height: 14px; }
.notification-dropdown { position: absolute; top: 40px; right: 0; width: 360px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 200; max-height: 400px; overflow-y: auto; border: 1px solid var(--gray-200); }
.notification-dropdown-header { padding: 10px 16px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.notification-item { padding: 10px 16px; border-bottom: 1px solid var(--gray-100); cursor: pointer; transition: background 0.15s; }
.notification-item:hover { background: var(--gray-50); }
.notification-item.unread { background: var(--primary-light); }
.notification-item .notif-title { font-weight: 600; font-size: 13px; }
.notification-item .notif-body { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.notification-item .notif-time { font-size: 11px; color: var(--gray-400); margin-top: 4px; }

/* ===== Reviews ===== */
.review-stars { font-size: 16px; letter-spacing: 1px; }
.review-stars-positive { color: #16a34a; }
.review-stars-neutral { color: #d97706; }
.review-stars-negative { color: #dc2626; }
.stat-stars { font-size: 20px; color: #f59e0b; margin-top: 4px; }
.stat-detail { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ===== Marketing ===== */
.badge-blue { background: var(--primary); color: #fff; }
.badge-green { background: var(--success); color: #fff; }
.badge-purple { background: #8b5cf6; color: #fff; }

/* ===== Reporting ===== */
.stat-sub { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.report-nav-card { transition: border-color 0.15s, box-shadow 0.15s; border: 2px solid transparent; }
.report-nav-card:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); color: inherit; }
[data-icon="comm"]::before { content: "\2709"; }

/* ===== Fleet Tracking ===== */
.tracking-status-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.stat-mini {
    font-size: 13px;
    color: var(--gray-600);
}

.stat-mini .stat-value {
    font-weight: 700;
    font-size: 18px;
    margin-right: 4px;
}

.text-success { color: var(--success); }
.text-gray { color: var(--gray-400); }

.tracking-map-container {
    display: flex;
    gap: 16px;
    height: calc(100vh - 220px);
    min-height: 400px;
}

.tracking-map {
    flex: 1;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--gray-200);
    box-shadow: var(--shadow);
}

.tracking-panel {
    width: 280px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-y: auto;
    padding: 12px;
}

.tracking-panel h3 {
    font-size: 14px;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.tech-card {
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    border-left: 3px solid var(--gray-300);
    transition: background 0.15s;
}

.tech-card:hover {
    background: var(--gray-50);
}

.tech-card.online {
    border-left-color: var(--success);
}

.tech-card.stale {
    border-left-color: var(--warning);
}

.tech-card.offline {
    border-left-color: var(--gray-300);
}

.tech-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.tech-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-300);
    flex-shrink: 0;
}

.tech-card.online .tech-status-dot {
    background: var(--success);
    box-shadow: 0 0 6px rgba(22, 163, 74, 0.4);
}

.tech-card.stale .tech-status-dot {
    background: var(--warning);
}

.tech-card-details {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
    padding-left: 16px;
}

.tech-card-job {
    font-size: 12px;
    margin-top: 4px;
    padding-left: 16px;
}

.tech-card-job a {
    color: var(--primary);
    font-weight: 500;
}

/* Customer tracking page */
.tracking-customer-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.tracking-tech-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tracking-tech-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.tracking-eta {
    text-align: right;
}

.tracking-customer-map {
    width: 100%;
    height: 400px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--gray-200);
}

@media (max-width: 768px) {
    .tracking-map-container {
        flex-direction: column;
        height: auto;
    }

    .tracking-map {
        min-height: 350px;
    }

    .tracking-panel {
        width: 100%;
        max-height: 300px;
    }

    .tracking-status-bar {
        gap: 10px;
    }

    .tracking-customer-map {
        height: 300px;
    }

    .tracking-customer-info {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .tracking-eta {
        text-align: center;
    }
}

/* ===== Photo Lightbox ===== */
body.photo-lightbox-open { overflow: hidden; }

.photo-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: none;
    flex-direction: column;
    color: #fff;
}
.photo-lightbox-overlay.open { display: flex; }

.photo-lightbox-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(180deg, rgba(0,0,0,0.6), transparent);
    flex-shrink: 0;
}
.photo-lightbox-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}
.photo-lightbox-counter {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.photo-lightbox-caption {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.photo-lightbox-category {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.15);
    white-space: nowrap;
}
.photo-lightbox-actions { display: flex; gap: 4px; flex-shrink: 0; }
.photo-lightbox-btn {
    width: 36px;
    height: 36px;
    border-radius: 18px;
    border: 0;
    background: transparent;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.15s;
}
.photo-lightbox-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.photo-lightbox-close { font-size: 24px; }

.photo-lightbox-stage {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: zoom-out;
}
.photo-lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    cursor: default;
}
.photo-lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 24px;
    border: 0;
    background: rgba(0,0,0,0.4);
    color: #fff;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.photo-lightbox-arrow:hover { background: rgba(0,0,0,0.7); }
.photo-lightbox-prev { left: 12px; }
.photo-lightbox-next { right: 12px; }

@media (max-width: 600px) {
    .photo-lightbox-arrow { width: 40px; height: 40px; font-size: 18px; }
    .photo-lightbox-caption { font-size: 13px; }
}
