/* ==============================
   MSR SERVICE MANAGER - PREMIUM DARK THEME
   ============================== */

:root {
    --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --bg-primary: #0D0D0F;
    --bg-secondary: #131316;
    --bg-card: #16161A;
    --bg-card-hover: #1E1E24;
    --bg-input: #111114;
    --border: #2A2A32;
    --border-focus: rgba(220, 38, 38, 0.6);
    --text-primary: #FAFAFA;
    --text-secondary: #A1A1AA;
    --text-muted: #71717A;
    --accent: #DC2626;
    --accent-hover: #EF4444;
    --accent-glow: rgba(220, 38, 38, 0.25);
    --primary-color: #DC2626;
    --primary-hover: #B91C1C;
    --gold: #A1A1AA;
    --gold-bg: rgba(255, 255, 255, 0.08);
    --success: #10B981;
    --success-bg: rgba(16, 185, 129, 0.14);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.14);
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, 0.14);
    --info: #E4E4E7;
    --info-bg: rgba(255, 255, 255, 0.08);
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

h1, h2, h3, h4, .page-title, .brand-text, .stat-card-value, .login-header h1 {
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
}


/* ====== SCROLLBAR ====== */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.28);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

@media (max-width: 768px) {
    * {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    *::-webkit-scrollbar {
        width: 0 !important;
        height: 0 !important;
        display: none !important;
    }
}

/* ====== SIDEBAR ====== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
    transition: all var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sidebar-close-btn,
.sidebar-backdrop {
    display: none;
}

.sidebar-header .logo-icon {
    font-size: 18px;
    color: var(--accent);
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-header {
    padding: 0;
    justify-content: center;
}

.sidebar.collapsed .sidebar-header span {
    display: none;
}

.sidebar.collapsed .sidebar-header .logo-icon {
    font-size: 20px;
}

.sidebar.collapsed .nav-category-header {
    padding: 0;
    height: 1px;
    margin: 8px 12px;
    border-top: 1px solid var(--border);
    overflow: hidden;
}

.sidebar.collapsed .nav-category-header span,
.sidebar.collapsed .nav-category-header i {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px 0;
    width: 46px;
    margin: 0 auto;
}

.sidebar.collapsed .nav-item span {
    display: none;
}

.sidebar.collapsed .nav-item i {
    width: auto;
    font-size: 17px;
}

.sidebar.collapsed .sub-nav-item {
    padding-left: 0 !important;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

/* Category Navigation Styling */
.nav-category {
    margin-bottom: 4px;
}

.nav-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 4px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    transition: color var(--transition);
}

.nav-category-header:hover {
    color: var(--text-secondary);
}

.nav-category-header i.arrow-icon {
    font-size: 10px;
    transition: transform var(--transition);
}

.nav-category.collapsed .nav-category-header i.arrow-icon {
    transform: rotate(-90deg);
}

.nav-category.collapsed .nav-category-items {
    display: none;
}

.nav-category-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.nav-item.active {
    color: var(--accent-hover);
    background: var(--accent-glow);
    font-weight: 600;
}

.sidebar.collapsed .nav-category-header span,
.sidebar.collapsed .nav-category-header i {
    display: none;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border);
}


.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition);
}

.sidebar-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

/* ====== MAIN ====== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    transition: margin-left var(--transition);
}

.sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-collapsed);
}

/* ====== TOPBAR ====== */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(13, 13, 15, 0.9);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 15px;
    cursor: pointer;
    transition: all var(--transition);
}

.hamburger:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: var(--bg-card-hover);
    transform: translateY(-1px);
}


.page-title {
    font-size: 20px;
    font-weight: 700;
    white-space: nowrap;
}

.topbar-center {
    flex: 1;
    max-width: 480px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-quick-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.quick-action-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--accent-hover);
    transform: translateY(-1px);
}

/* Pagination Control Bar */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

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

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination-btn {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-wrapper>i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 13px;
}

.search-wrapper input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all var(--transition);
}

.search-wrapper input:focus {
    border-color: var(--border-focus);
    background: rgba(255, 255, 255, 0.08);
}

.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 360px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 380px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    z-index: 1000;
    backdrop-filter: blur(16px);
}

.search-results.active {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.selected {
    background: rgba(99, 102, 241, 0.12);
}

.search-result-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.search-result-icon.customer {
    background: rgba(255, 255, 255, 0.08);
    color: #E4E4E7;
}

.search-result-icon.job {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.search-result-icon.invoice {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.search-result-icon.service {
    background: rgba(220, 38, 38, 0.16);
    color: #f87171;
}

.search-result-icon.part {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-sub {
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-type {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 7px;
    border-radius: 5px;
    flex-shrink: 0;
}

.badge-customer {
    background: rgba(255, 255, 255, 0.08);
    color: #E4E4E7;
    border: 1px solid #2A2A32;
}

.badge-job {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-invoice {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-service {
    background: rgba(220, 38, 38, 0.16);
    color: #f87171;
    border: 1px solid rgba(220, 38, 38, 0.3);
}

.badge-part {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.28);
}

.search-result-empty {
    padding: 16px 18px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.tab-count-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    opacity: 0.85;
    margin-left: 4px;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
}

.sub-nav-item {
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.sub-nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.sub-nav-item.active {
    background: rgba(99, 102, 241, 0.15) !important;
    border-left: 2px solid var(--accent) !important;
    color: var(--text-primary) !important;
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-date {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ====== PAGE CONTENT ====== */
.page-content {
    padding: 24px 28px;
}

.page {
    animation: fadeIn 0.3s ease;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== TIMELINE ========== */
.timeline {
    position: relative;
    padding: 20px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-left: 50px;
    margin-bottom: 30px;
}

.timeline-marker {
    position: absolute;
    left: 10px;
    top: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 3px solid var(--primary-color);
    z-index: 1;
}

.timeline-content {
    background: var(--bg-card);
    padding: 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.timeline-date {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
}

.timeline-title {
    font-weight: 700;
    margin-bottom: 5px;
    display: block;
}

.timeline-desc {
    font-size: 14px;
    color: var(--text-color);
}

.timeline-meta {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

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

@media (min-width: 769px) {
    #statsGrid.stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1440px) {
    #statsGrid.stats-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.28);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(220, 38, 38, 0.5);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}


.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.stat-card-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-card-icon {
    font-size: 20px;
    opacity: 0.4;
}

.stat-card-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
}

/* ========== LOGIN OVERLAY ========== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.login-overlay.active {
    display: flex;
}

.login-card {
    background: rgba(15, 15, 25, 0.95);
    padding: 40px;
    border-radius: 16px;
    border: 2px solid rgba(99, 102, 241, 0.3);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(99, 102, 241, 0.1);
    backdrop-filter: blur(12px);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    margin: 10px 0 5px;
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
}

.login-header p {
    color: #c0c0d0;
    font-size: 14px;
    font-weight: 500;
}

/* ====== CARDS (Solid, High-Contrast & Fast) ====== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: border-color var(--transition);
}

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

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

.chart-container {
    position: relative;
    height: 250px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* ====== ALERT BANNERS ====== */
.alert-banners {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-banner.warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-banner.danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-banner.info {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid rgba(56, 189, 248, 0.25);
}

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

/* ====== PAGE ACTIONS ====== */
.page-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}

.search-box>i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}

.search-box input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all var(--transition);
}

.search-box input:focus {
    border-color: var(--border-focus);
}

.action-btns {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.status-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.filter-btn.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

/* ====== BUTTONS ====== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #DC2626, #B91C1C);
    color: #FAFAFA;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 3px 14px rgba(220, 38, 38, 0.32);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-ghost {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.25);
}

.form-control {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    outline: none;
    color-scheme: dark;
}

.form-control:focus {
    border-color: var(--border-focus);
}

body.theme-light .btn-secondary {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
}

body.theme-light .form-control {
    background: #ffffff;
    color: #0f172a;
    border-color: #cbd5e1;
    color-scheme: light;
}

.btn-export {
    background: transparent;
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-export:hover {
    background: var(--success-bg);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-danger-sm {
    padding: 5px 10px;
    font-size: 12px;
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger-sm:hover {
    background: var(--danger-bg);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-icon:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.btn-icon.danger:hover {
    color: var(--danger);
    border-color: var(--danger);
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table th {
    padding: 10px 12px;
}

.data-table td.td-actions,
.data-table th:last-child {
    min-width: 110px;
    width: 110px;
    max-width: 130px;
    white-space: nowrap;
    text-align: right;
}

.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.td-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

/* Linear-style Primary Row Button */
.btn-row-primary {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}
.btn-row-primary.wa {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.25);
}
.btn-row-primary.wa:hover {
    background: #10b981;
    color: #ffffff;
}
.btn-row-primary.approve {
    background: rgba(239, 68, 68, 0.14);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}
.btn-row-primary.approve:hover {
    background: #dc2626;
    color: #ffffff;
}

/* Linear-style 3-Dots More Button */
.btn-row-more {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s ease;
}
.btn-row-more:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Universal Floating Row Popover Menu */
.floating-row-menu {
    position: fixed;
    z-index: 99999;
    background: #15192c !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.06) !important;
    display: flex;
    flex-direction: column;
    min-width: 185px;
    animation: fadeInMenu 0.12s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes fadeInMenu {
    from { opacity: 0; transform: scale(0.96) translateY(-4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.row-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: #f1f5f9;
    font-size: 12.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.12s ease;
    width: 100%;
}
.row-menu-item:hover {
    background: rgba(99, 102, 241, 0.15);
    color: #ffffff;
}
.row-menu-item i {
    width: 16px;
    font-size: 13px;
    color: #94a3b8;
    text-align: center;
}
.row-menu-item:hover i {
    color: #EF4444;
}
.row-menu-item.danger {
    color: #f87171;
}
.row-menu-item.danger i {
    color: #f87171;
}
.row-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}
.row-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 0;
}

/* Light Theme overrides for row actions & menu */
body.theme-light .btn-row-more {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #64748b;
}
body.theme-light .btn-row-more:hover {
    background: #e2e8f0;
    color: #0f172a;
}
body.theme-light .floating-row-menu {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12) !important;
}
body.theme-light .row-menu-item {
    color: #334155;
}
body.theme-light .row-menu-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}
body.theme-light .row-menu-item i {
    color: #64748b;
}
body.theme-light .row-menu-item:hover i {
    color: #881337;
}
body.theme-light .row-menu-item.danger {
    color: #dc2626;
}
body.theme-light .row-menu-item.danger:hover {
    background: #fee2e2;
    color: #b91c1c;
}
body.theme-light .row-menu-divider {
    background: #e2e8f0;
}

.td-actions .btn-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 6px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    font-size: 14px;
    margin: 0;
}

/* Styled Action Buttons for High Visibility */
.btn-icon.btn-action-pdf {
    background: rgba(239, 68, 68, 0.25);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.5);
}
.btn-icon.btn-action-pdf:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

.btn-icon.btn-action-print {
    background: rgba(255, 255, 255, 0.08);
    color: #E4E4E7;
    border: 1px solid #2A2A32;
}
.btn-icon.btn-action-print:hover {
    background: #E4E4E7;
    color: #0D0D0F;
    border-color: #E4E4E7;
}

.btn-icon.btn-action-excel {
    background: rgba(16, 185, 129, 0.25);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.5);
}
.btn-icon.btn-action-excel:hover {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
}

.btn-icon.btn-action-wa {
    background: rgba(37, 211, 102, 0.18);
    color: #86efac;
    border: 1px solid rgba(37, 211, 102, 0.4);
}
.btn-icon.btn-action-wa:hover {
    background: #25d366;
    color: #ffffff;
    border-color: #25d366;
}

.btn-icon.btn-action-edit {
    background: rgba(220, 38, 38, 0.16);
    color: #f87171;
    border: 1px solid rgba(220, 38, 38, 0.38);
}
.btn-icon.btn-action-edit:hover {
    background: #DC2626;
    color: #FAFAFA;
    border-color: #DC2626;
}

/* ====== BADGES (Linear-Style Minimal) ====== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2.5px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    border: 1px solid transparent;
}

.badge-pending {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-assigned {
    background: var(--info-bg);
    color: var(--info);
}

.badge-in-progress {
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
}

.badge-completed {
    background: var(--success-bg);
    color: var(--success);
}

.badge-cancelled {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-active {
    background: var(--success-bg);
    color: var(--success);
}

.badge-inactive {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-expired {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-renewed {
    background: var(--info-bg);
    color: var(--info);
}

.badge-paid {
    background: var(--success-bg);
    color: var(--success);
}

.badge-unpaid {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-partial {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-regular {
    background: var(--info-bg);
    color: var(--info);
}

.badge-amc {
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
}

.badge-corporate {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

.stock-low {
    color: var(--danger);
    font-weight: 600;
}

.stock-ok {
    color: var(--success);
}

.clickable {
    cursor: pointer;
    color: var(--accent) !important;
}

.clickable:hover {
    text-decoration: underline;
}

/* ====== EMPTY STATE ====== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 14px;
}

/* ====== MODAL ====== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
    animation: modalIn 0.25s ease;
}

.modal.modal-wide {
    max-width: 980px;
    width: min(980px, 96vw);
    max-height: 90vh;
}

/* Side-by-Side Invoice Studio (Book-like Layout) */
.modal.modal-invoice {
    max-width: 1540px;
    width: min(1540px, 98vw);
    height: 94vh;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
}

.modal.modal-invoice .modal-body {
    padding: 0 !important;
    overflow: hidden !important;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.modal.modal-invoice .modal-footer {
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    z-index: 10;
}

.invoice-split-layout {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Left Pane: Interactive Editor */
.invoice-split-editor {
    flex: 1 1 50%;
    max-width: 52%;
    padding: 24px;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: var(--bg-card);
}

/* Right Pane: Live Document Preview */
.invoice-split-preview-pane {
    flex: 1 1 50%;
    max-width: 50%;
    display: flex;
    flex-direction: column;
    background: #090d16;
    overflow: hidden;
    border-left: 1px solid var(--border);
}

[data-theme="light"] .invoice-split-preview-pane {
    background: #cbd5e1;
}

.preview-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    flex-shrink: 0;
}

[data-theme="light"] .preview-header-bar {
    background: #f1f5f9;
    border-bottom: 1px solid #cbd5e1;
    color: #0f172a;
}

.preview-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.preview-live-pulse {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 10.5px;
    font-weight: 700;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 6px #22c55e;
    animation: livePulseAnim 1.6s infinite ease-in-out;
}

@keyframes livePulseAnim {
    0% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.25); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.7; }
}

.preview-copy-badge {
    background: rgba(185, 28, 28, 0.15);
    color: #ef4444;
    border: 1px solid rgba(185, 28, 28, 0.35);
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 5px;
    letter-spacing: 0.5px;
}

.preview-sheet-scroller {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Paper Sheet Styling */
.live-invoice-paper {
    background: #ffffff;
    color: #0f172a;
    width: 100%;
    max-width: 640px;
    min-height: 840px;
    padding: 24px 26px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
    border-radius: 4px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 9pt;
    line-height: 1.35;
    transform-origin: top center;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.live-invoice-paper.zoom-fit {
    transform: scale(0.92);
}

.live-invoice-paper.zoom-compact {
    transform: scale(0.82);
}

/* Draft Banner on Live Paper */
.live-paper-draft-banner {
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px dashed #b91c1c;
    padding: 3px 6px;
    text-align: center;
    font-size: 7.5pt;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 8px;
    border-radius: 3px;
}

/* Media query for smaller displays */
@media (max-width: 1100px) {
    .modal.modal-invoice {
        width: 98vw !important;
        max-width: 98vw !important;
        height: 94vh;
        max-height: 94vh;
    }
    .modal.modal-invoice .modal-header {
        padding: 12px 16px;
    }
    .modal.modal-invoice .modal-footer {
        padding: 10px 14px;
    }
    .invoice-split-layout {
        flex-direction: column;
        flex: 1;
        min-height: 0;
        width: 100%;
    }
    .invoice-split-editor {
        max-width: 100%;
        width: 100%;
        height: 100%;
        flex: 1 1 auto;
        border-right: none;
        border-bottom: none;
        padding: 14px;
        overflow-y: auto;
    }
    .invoice-split-preview-pane {
        max-width: 100%;
        width: 100%;
        height: 100%;
        flex: 1 1 auto;
        min-height: 0;
        border-left: none;
    }
    .preview-header-bar {
        padding: 8px 12px;
        gap: 6px;
        flex-wrap: wrap;
    }
    .preview-sheet-scroller {
        padding: 10px;
        justify-content: center;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .live-invoice-paper {
        width: 600px;
        min-width: 600px;
        max-width: 600px;
        zoom: 0.56;
        flex-shrink: 0;
    }
}

@media (max-width: 400px) {
    .live-invoice-paper {
        zoom: 0.50;
    }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

.modal-header h2 {
    font-size: 17px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ====== FORM ====== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #d0d0e8;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    outline: none;
    transition: all var(--transition);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--border-focus);
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group select {
    cursor: pointer;
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 70px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* ====== CUSTOMER DETAIL ====== */
.detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.detail-avatar {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: white;
}

.detail-info h2 {
    font-size: 22px;
    font-weight: 700;
}

.detail-info p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.detail-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.detail-tab {
    padding: 10px 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
}

.detail-tab:hover {
    color: var(--text-primary);
}

.detail-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.detail-section {
    animation: fadeIn 0.3s ease;
}

/* ====== TODAY'S JOBS LIST ====== */
.today-job-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.today-job-item:last-child {
    border-bottom: none;
}

.today-job-time {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 80px;
}

.today-job-info {
    flex: 1;
}

.today-job-info strong {
    font-size: 14px;
}

.today-job-info p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ====== PRINT OVERLAY ====== */
.print-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.print-content {
    background: white;
    color: #111;
    width: 100%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: var(--radius);
    padding: 40px;
    font-family: 'Inter', sans-serif;
}

.print-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}

.invoice-print h1 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
    color: #111;
}

.invoice-print .inv-meta {
    font-size: 13px;
    color: #666;
    margin-bottom: 24px;
}

.invoice-print .inv-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.invoice-print .inv-table th {
    text-align: left;
    padding: 8px 12px;
    background: #f3f4f6;
    font-size: 12px;
    text-transform: uppercase;
    border-bottom: 2px solid #e5e7eb;
}

.invoice-print .inv-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

.invoice-print .inv-totals {
    margin-top: 20px;
    text-align: right;
}

.invoice-print .inv-totals div {
    padding: 4px 0;
    font-size: 14px;
}

.invoice-print .inv-totals .grand-total {
    font-size: 20px;
    font-weight: 800;
    color: #111;
    border-top: 2px solid #111;
    padding-top: 8px;
    margin-top: 8px;
}

.invoice-print .inv-footer {
    margin-top: 30px;
    text-align: center;
    font-size: 12px;
    color: #999;
}

/* ====== TOAST ====== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 700;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    font-size: 13px;
    font-weight: 500;
    animation: toastIn 0.3s ease;
    min-width: 280px;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.info {
    border-left: 3px solid var(--info);
}

.toast i {
    font-size: 16px;
}

.toast.success i {
    color: var(--success);
}

.toast.error i {
    color: var(--danger);
}

.toast.info i {
    color: var(--info);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform var(--transition);
        z-index: 1050;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 12px 0 32px rgba(0, 0, 0, 0.45);
    }

    .sidebar-close-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border-radius: 8px;
        border: 1px solid var(--border);
        background: rgba(255, 255, 255, 0.08);
        color: var(--text-primary);
        font-size: 16px;
        cursor: pointer;
        flex-shrink: 0;
    }

    .sidebar-close-btn:active {
        transform: scale(0.95);
    }

    .sidebar-backdrop.active {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(2px);
        z-index: 1040;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        min-width: 0 !important;
    }

    .topbar {
        padding: 0 12px;
        gap: 8px;
        height: 56px;
        justify-content: space-between;
        max-width: 100vw;
        overflow: hidden;
    }

    .topbar-left {
        gap: 10px;
        min-width: 0;
        flex: 1;
    }

    .page-title {
        font-size: 17px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar-right {
        gap: 6px;
        flex-shrink: 0;
    }

    .topbar-date,
    .density-toggle-btn {
        display: none !important;
    }

    .hamburger {
        display: flex;
        flex-shrink: 0;
    }

    .topbar-center {
        display: none;
    }

    .page-content {
        padding: 12px 12px 86px 12px;
        max-width: 100%;
        min-width: 0;
    }

    .card {
        max-width: 100%;
        min-width: 0;
    }

    .card-header {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .card-header h3 {
        font-size: 14px;
    }

    .card-body {
        padding: 12px 14px;
        min-width: 0;
    }

    .page-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }

    .action-btns {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 8px;
        width: 100%;
    }

    .action-btns .btn {
        flex: 1 1 auto;
        justify-content: center;
        padding: 8px 10px;
        font-size: 12.5px;
        min-height: 38px;
    }

    .stats-grid,
    #accountsStatsGrid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
        margin-bottom: 16px !important;
    }

    .stat-card {
        padding: 13px 12px !important;
        min-width: 0 !important;
    }

    .stat-card-header {
        margin-bottom: 6px;
        gap: 6px;
    }

    .stat-card-label {
        font-size: 11.5px;
        line-height: 1.25;
    }

    .stat-card-icon {
        font-size: 15px;
    }

    .stat-card-value,
    .stat-card .stat-value {
        font-size: 20px !important;
        letter-spacing: -0.5px;
        word-break: break-word;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Mobile Touch Target & Form Enhancements */
    button, input, select, textarea, .nav-item {
        min-height: 44px;
    }

    .modal-content {
        width: 95% !important;
        max-width: 95vw !important;
        margin: 10px auto !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        padding: 16px !important;
    }

    .table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ====== LOGIN OVERLAY STYLES ====== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 20, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-overlay.active {
    display: flex;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px 28px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-header {
    text-align: center;
}

.login-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin-top: 12px;
    color: var(--text-primary);
}

.login-header p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

@media print {
    body * {
        visibility: hidden;
    }

    .print-overlay,
    .print-overlay * {
        visibility: visible;
    }

    .print-overlay {
        position: static;
        background: white;
    }

    .print-actions {
        display: none;
    }

    .print-content {
        max-height: none;
        box-shadow: none;
        border-radius: 0;
    }
}

/* ====== MOBILE FLOATING ACTION BUTTON (FAB) ====== */
.mobile-fab {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #dc2626);
    color: white;
    border: none;
    font-size: 22px;
    box-shadow: 0 8px 24px var(--accent-glow);
    z-index: 999;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.mobile-fab:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 30px rgba(239, 68, 68, 0.4);
}

@media (max-width: 768px) {
    .mobile-fab {
        display: flex;
    }
}

/* ====== SEARCH GROUP FALLBACK ====== */
.search-group {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}
.search-group > i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
}
.search-group input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all var(--transition);
}
.search-group input:focus {
    border-color: var(--border-focus);
}

/* ====== RADAR CARDS DARK HARMONY ====== */
.radar-card-danger {
    border-left: 4px solid #ef4444 !important;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.07) 0%, rgba(15, 23, 42, 0.4) 100%) !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
}
.radar-card-info {
    border-left: 4px solid #0ea5e9 !important;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.07) 0%, rgba(15, 23, 42, 0.4) 100%) !important;
    border-color: rgba(14, 165, 233, 0.2) !important;
}

/* ====== TABLE PAGINATION ====== */
.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 13px;
    color: var(--text-secondary);
    flex-wrap: wrap;
    gap: 10px;
}
.pagination-info {
    font-weight: 500;
}
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-indicator {
    font-weight: 600;
    color: var(--text-primary);
    padding: 4px 10px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 12px;
}

/* ====== EMPLOYEE GUIDE & HELP MODAL ====== */
.help-modal {
    max-width: 840px !important;
    width: 95% !important;
}
.help-nav-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    overflow-x: auto;
}
.help-tab {
    padding: 8px 16px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.help-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.help-tab.active {
    color: var(--accent);
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.3);
}
.help-body {
    padding: 24px !important;
    max-height: 65vh;
    overflow-y: auto;
}
.help-tab-pane {
    display: none;
}
.help-tab-pane.active {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}
.help-intro-card {
    padding: 16px;
    border-radius: var(--radius-sm);
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    margin-bottom: 20px;
}
.help-intro-card h4 {
    margin: 0 0 6px 0;
    color: var(--text-primary);
    font-size: 15px;
}
.help-intro-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}
.sop-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.sop-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: transform var(--transition), border-color var(--transition);
}
.sop-step:hover {
    border-color: var(--accent);
    transform: translateX(4px);
}
.sop-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sop-step-content h5 {
    margin: 0 0 4px 0;
    font-size: 14px;
    color: var(--text-primary);
}
.sop-step-content p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.module-card {
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.module-card-icon {
    font-size: 24px;
    margin-bottom: 10px;
}
.module-card h6 {
    margin: 0 0 6px 0;
    font-size: 14px;
    color: var(--text-primary);
}
.module-card p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.accounting-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.acc-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
}
.acc-badge {
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    font-weight: 700;
    font-size: 11px;
    flex-shrink: 0;
}
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.faq-item {
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.faq-item h6 {
    margin: 0 0 6px 0;
    font-size: 13px;
    color: var(--text-primary);
}
.faq-item p {
    margin: 0;
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.quick-action-btn.help-btn {
    background: rgba(255, 255, 255, 0.05);
    color: #E4E4E7;
    border-color: #2A2A32;
}
.quick-action-btn.help-btn:hover {
    background: #DC2626;
    color: #FAFAFA;
    border-color: #DC2626;
}

.btn-dispatch-gold {
    background: linear-gradient(135deg, #D4A373, #B8834E);
    color: #0D0D0F !important;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 2px 10px rgba(212, 163, 115, 0.28);
}
.btn-dispatch-gold:hover {
    background: linear-gradient(135deg, #E2B688, #C48F59);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(212, 163, 115, 0.4);
}

/* ============================================================
   THEME TOGGLE BUTTON
   ============================================================ */
.theme-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: #facc15; /* warm yellow sun in dark mode */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all var(--transition);
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.theme-toggle-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--accent);
    transform: rotate(20deg) scale(1.08);
}

.theme-toggle-btn.is-light {
    color: #881337; /* Royal Maroon in light mode */
    box-shadow: 0 2px 8px rgba(136, 19, 55, 0.16);
}

/* ============================================================
   INVOICE SERVICES & SPARE PARTS TABLE (HIGH CONTRAST)
   ============================================================ */
#invoice-services-table {
    width: 100%;
    min-width: 820px;
    border-collapse: separate;
    border-spacing: 0 6px;
    margin-bottom: 12px;
}

#invoice-services-table th {
    padding: 8px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

#invoice-services-table td {
    padding: 3px 4px;
    vertical-align: middle;
}

#invoice-services-table input,
#invoice-services-table select {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid #2A2A32;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

/* Remove number spin buttons so quantity & rates are completely visible */
#invoice-services-table input[type=number]::-webkit-inner-spin-button,
#invoice-services-table input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#invoice-services-table input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Specific styling for item type and unit dropdowns to prevent text clipping */
#invoice-services-table select.row-item-type {
    padding: 6px 4px 6px 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

#invoice-services-table input.row-qty {
    text-align: center;
    font-weight: 600;
    padding: 6px 4px;
}

#invoice-services-table select.row-unit {
    padding: 6px 4px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
}

#invoice-services-table input.row-hsn-sac {
    text-align: center;
}

#invoice-services-table input.row-rate {
    text-align: right;
    font-weight: 600;
}

#invoice-services-table input:focus,
#invoice-services-table select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

#invoice-services-table input::placeholder {
    color: var(--text-muted);
}

#invoice-services-table .row-service-price {
    background: #0D0D0F !important;
    color: #34D399 !important;
    font-weight: 800 !important;
    border-color: #2A2A32 !important;
    cursor: default;
    text-align: right;
}

#invoice-services-table select option {
    background: #16161A;
    color: #FAFAFA;
}

.invoice-add-item-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
}

.invoice-add-item-bar select,
.invoice-add-item-bar input {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid #2A2A32;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

.invoice-add-item-bar select option {
    background: #16161A;
    color: #FAFAFA;
}

/* ============================================================
   ROYAL MAROON & WARM IVORY LIGHT THEME (Matches Customer Website)
   ============================================================ */
body.theme-light,
html.theme-light body {
    --bg-primary: #fdfbf7;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #fdf2f4;
    --bg-input: #ffffff;
    --border: #e7e5e4;
    --border-focus: #881337;
    --text-primary: #1c1917;
    --text-secondary: #44403c;
    --text-muted: #78716c;
    --accent: #881337;
    --accent-hover: #6b0f2b;
    --accent-glow: rgba(136, 19, 55, 0.22);
    --primary-color: #881337;
    --primary-hover: #6b0f2b;
    --gold: #b45309;
    --gold-bg: rgba(180, 83, 9, 0.12);
    --success: #16a34a;
    --success-bg: rgba(22, 163, 74, 0.12);
    --warning: #b45309;
    --warning-bg: rgba(180, 83, 9, 0.12);
    --danger: #9f1239;
    --danger-bg: rgba(159, 18, 57, 0.12);
    --info: #881337;
    --info-bg: rgba(136, 19, 55, 0.1);
    --shadow: 0 4px 20px rgba(28, 25, 23, 0.06);
    --bg-dark: #f5f0e8;
    --text-light: #1c1917;
}

body.theme-light {
    background: var(--bg-primary);
    color: var(--text-primary);
}

body.theme-light .sidebar {
    background: #ffffff;
    border-right-color: #e7e5e4;
    box-shadow: 2px 0 16px rgba(28, 25, 23, 0.04);
}

body.theme-light .nav-category-header {
    color: #78716c;
}

body.theme-light .nav-category-header:hover {
    color: #1c1917;
}

body.theme-light .nav-item {
    color: #44403c;
}

body.theme-light .nav-item:hover {
    background: #f5f0e8;
    color: #881337;
}

body.theme-light .nav-item.active {
    background: #fdf2f4;
    color: #881337;
    font-weight: 700;
}

body.theme-light .topbar {
    background: rgba(253, 251, 247, 0.94);
    border-bottom-color: #e7e5e4;
    box-shadow: 0 1px 8px rgba(28, 25, 23, 0.04);
}

body.theme-light .page-title {
    color: #1c1917;
}

body.theme-light .card,
body.theme-light .stat-card {
    background: #ffffff;
    border: 1px solid #e7e5e4;
    box-shadow: 0 2px 10px rgba(28, 25, 23, 0.04);
}

body.theme-light .stat-card:hover {
    border-color: #881337;
    box-shadow: 0 6px 20px rgba(136, 19, 55, 0.12);
}

body.theme-light .stat-card-label {
    color: #44403c;
}

body.theme-light .stat-card-value {
    color: #1c1917;
}

body.theme-light .data-table th {
    background: #f5f0e8;
    color: #44403c;
    border-bottom: 1px solid #e7e5e4;
}

body.theme-light .data-table td {
    color: #1c1917;
    border-bottom: 1px solid #f5f0e8;
}

body.theme-light .data-table tbody tr:hover td {
    background: #fdf2f4;
}

body.theme-light .search-wrapper input,
body.theme-light .search-box input {
    background: #ffffff;
    border-color: #d6d3d1;
    color: #1c1917;
}

body.theme-light .search-wrapper input:focus,
body.theme-light .search-box input:focus {
    border-color: #881337;
    box-shadow: 0 0 0 3px rgba(136, 19, 55, 0.14);
}

body.theme-light .quick-action-btn {
    background: #f5f0e8;
    border-color: #e7e5e4;
    color: #44403c;
}

body.theme-light .quick-action-btn:hover {
    background: #fdf2f4;
    border-color: #881337;
    color: #881337;
}

body.theme-light .quick-action-btn.help-btn {
    background: #fdf2f4;
    border-color: rgba(136, 19, 55, 0.25);
    color: #881337;
}

body.theme-light .quick-action-btn.help-btn:hover {
    background: #881337;
    border-color: #881337;
    color: #ffffff;
}

body.theme-light .btn-primary {
    background: linear-gradient(135deg, #881337, #6b0f2b);
    color: #ffffff;
    border-color: #881337;
    box-shadow: 0 2px 10px rgba(136, 19, 55, 0.22);
}

body.theme-light .btn-primary:hover {
    background: linear-gradient(135deg, #6b0f2b, #500724);
    border-color: #6b0f2b;
}

body.theme-light .detail-tab {
    background: #f5f0e8;
    color: #44403c;
    border: 1px solid #e7e5e4;
}

body.theme-light .detail-tab:hover {
    background: #fdf2f4;
    color: #881337;
}

body.theme-light .detail-tab.active {
    background: #881337;
    color: #ffffff;
    border-color: #881337;
}

body.theme-light .modal {
    background: #ffffff;
    border: 1px solid #e7e5e4;
    box-shadow: 0 24px 60px rgba(28, 25, 23, 0.16);
    color: #1c1917;
}

body.theme-light .modal-header {
    border-bottom: 1px solid #e7e5e4;
}

body.theme-light .modal-header h2 {
    color: #1c1917 !important;
}

body.theme-light .modal-footer {
    border-top: 1px solid #e7e5e4;
}

body.theme-light .form-group label {
    color: #44403c !important;
}

body.theme-light .form-group input,
body.theme-light .form-group select,
body.theme-light .form-group textarea {
    background: #ffffff !important;
    border: 1.5px solid #d6d3d1 !important;
    color: #1c1917 !important;
}

body.theme-light .form-group input:focus,
body.theme-light .form-group select:focus,
body.theme-light .form-group textarea:focus {
    border-color: #881337 !important;
    box-shadow: 0 0 0 3px rgba(136, 19, 55, 0.14) !important;
}

body.theme-light .form-group input::placeholder,
body.theme-light .form-group textarea::placeholder {
    color: #78716c !important;
}

/* Light mode overrides for Edit Invoice table */
body.theme-light #invoice-services-table th {
    color: #44403c !important;
    border-bottom-color: #e7e5e4 !important;
}

body.theme-light #invoice-services-table input,
body.theme-light #invoice-services-table select {
    background: #ffffff !important;
    color: #1c1917 !important;
    border: 1.5px solid #d6d3d1 !important;
    box-shadow: 0 1px 2px rgba(28, 25, 23, 0.05) !important;
    font-weight: 600;
}

body.theme-light #invoice-services-table input:focus,
body.theme-light #invoice-services-table select:focus {
    border-color: #881337 !important;
    box-shadow: 0 0 0 2px rgba(136, 19, 55, 0.18) !important;
}

body.theme-light #invoice-services-table .row-service-price {
    background: #fdf2f4 !important;
    color: #881337 !important;
    border-color: rgba(136, 19, 55, 0.3) !important;
    font-weight: 800 !important;
}

body.theme-light #invoice-services-table select option {
    background: #ffffff;
    color: #1c1917;
}

body.theme-light .invoice-add-item-bar {
    background: #f5f0e8;
    border-color: #e7e5e4;
}

body.theme-light .invoice-add-item-bar select,
body.theme-light .invoice-add-item-bar input {
    background: #ffffff !important;
    color: #1c1917 !important;
    border: 1px solid #d6d3d1 !important;
}

body.theme-light .invoice-add-item-bar select option {
    background: #ffffff;
    color: #1c1917;
}

body.theme-light .search-results {
    background: #ffffff;
    border: 1px solid #d6d3d1;
    box-shadow: 0 16px 40px rgba(28, 25, 23, 0.12);
}

body.theme-light .search-result-item {
    border-bottom: 1px solid #f5f0e8;
}

body.theme-light .search-result-item:hover,
body.theme-light .search-result-item.selected {
    background: #fdf2f4;
}

body.theme-light .search-result-title {
    color: #1c1917;
}

body.theme-light .search-result-sub {
    color: #78716c;
}

body.theme-light .tab-count-badge {
    background: rgba(136, 19, 55, 0.08);
    color: #881337;
}

body.theme-light .sub-nav-item.active {
    background: #fdf2f4 !important;
    border-left: 2px solid #881337 !important;
    color: #881337 !important;
}

/* ====== JOB MODAL CUSTOMER SELECTOR ====== */
.customer-select-container {
    position: relative;
}

.job-customer-search-box {
    position: relative;
}

.job-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.job-search-input-wrapper .job-search-icon {
    position: absolute;
    left: 14px;
    font-size: 13px;
    color: var(--text-muted);
    pointer-events: none;
}

.job-customer-input {
    width: 100%;
    padding: 10px 38px 10px 38px !important;
    font-size: 13.5px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: all var(--transition);
}

.job-customer-input:focus {
    border-color: var(--border-focus);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px var(--accent-glow);
    outline: none;
}

.job-clear-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 13px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}

.job-clear-btn:hover {
    color: var(--danger);
}

.job-customer-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-height: 290px;
    overflow-y: auto;
    z-index: 1050;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
}

.job-customer-dropdown-header {
    padding: 7px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
}

.job-customer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.job-customer-item:last-child {
    border-bottom: none;
}

.job-customer-item:hover,
.job-customer-item.selected {
    background: rgba(99, 102, 241, 0.14);
}

.job-customer-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.job-customer-info {
    flex: 1;
    min-width: 0;
}

.job-customer-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.job-customer-title .cust-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-customer-title .cust-id-tag {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.25);
    padding: 1px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.job-customer-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.job-customer-meta .cust-phone i,
.job-customer-meta .cust-loc i {
    font-size: 10px;
    margin-right: 3px;
    opacity: 0.7;
}

.job-customer-empty {
    padding: 18px 14px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.job-customer-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    background: rgba(99, 102, 241, 0.08);
    border: 1.5px solid rgba(99, 102, 241, 0.35);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.job-customer-card-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--accent-glow);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.job-customer-card-info {
    flex: 1;
    min-width: 0;
}

.job-customer-card-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-customer-card-sub {
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Light Theme Overrides for Job Customer Combobox */
body.theme-light .job-customer-input {
    background: #ffffff !important;
    border: 1.5px solid #d6d3d1 !important;
    color: #1c1917 !important;
}

body.theme-light .job-customer-input:focus {
    border-color: #881337 !important;
    box-shadow: 0 0 0 3px rgba(136, 19, 55, 0.14) !important;
}

body.theme-light .job-customer-dropdown {
    background: #ffffff;
    border: 1px solid #d6d3d1;
    box-shadow: 0 16px 40px rgba(28, 25, 23, 0.12);
}

body.theme-light .job-customer-dropdown-header {
    background: #f5f0e8;
    border-bottom: 1px solid #e7e5e4;
    color: #78716c;
}

body.theme-light .job-customer-item {
    border-bottom: 1px solid #f5f0e8;
}

body.theme-light .job-customer-item:hover,
body.theme-light .job-customer-item.selected {
    background: #fdf2f4;
}

body.theme-light .job-customer-avatar {
    background: #fdf2f4;
    color: #881337;
}

body.theme-light .job-customer-title .cust-name {
    color: #1c1917;
}

body.theme-light .job-customer-title .cust-id-tag {
    background: #fdf2f4;
    border-color: rgba(136, 19, 55, 0.3);
    color: #881337;
}

body.theme-light .job-customer-meta {
    color: #78716c;
}

body.theme-light .job-customer-card {
    background: #fdf2f4;
    border: 1.5px solid rgba(136, 19, 55, 0.3);
}

body.theme-light .job-customer-card-avatar {
    background: #f5f0e8;
    color: #881337;
}

body.theme-light .job-customer-card-name {
    color: #1c1917;
}

body.theme-light .job-customer-card-sub {
    color: #44403c;
}

/* ========================================================
   MINIMALIST UPGRADES: DENSITY, STATUS SWITCHER, SHORTCUTS
   ======================================================== */

/* Table Density Toggle Button */
.density-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
}

.density-toggle-btn:hover {
    color: var(--accent-hover);
    border-color: var(--accent);
    background: var(--bg-card-hover);
    transform: translateY(-1px);
}

/* Compact Table Density Mode */
body.compact-density .data-table th,
body.compact-density .data-table td {
    padding: 6px 10px !important;
    font-size: 12px !important;
}

body.compact-density .badge {
    padding: 2px 6px !important;
    font-size: 10.5px !important;
}

body.compact-density .btn-icon {
    width: 26px !important;
    height: 26px !important;
    font-size: 11px !important;
}

body.compact-density .td-actions {
    gap: 4px !important;
}

/* Inline Job Status Switcher */
.job-status-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.status-badge-btn {
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
    font-weight: 600;
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
    outline: none;
    user-select: none;
}

.status-badge-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.status-chevron {
    font-size: 8.5px;
    opacity: 0.75;
    transition: transform 0.2s;
}

.status-badge-btn.active .status-chevron {
    transform: rotate(180deg);
}

.job-status-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    z-index: 1000;
    min-width: 175px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: fadeInStatusMenu 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.job-status-menu-header {
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    padding: 4px 8px 2px 8px;
}

.job-status-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    transition: all 0.15s;
}

.job-status-menu-item:hover {
    background: var(--bg-card-hover);
    color: var(--accent-hover);
}

.job-status-menu-item.current {
    font-weight: 600;
    background: var(--accent-glow);
    color: var(--accent-hover);
}

.job-status-menu-item i {
    font-size: 11px;
    width: 14px;
    text-align: center;
}

/* Keyboard Shortcut Hints */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-kbd-shortcut {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    pointer-events: none;
    font-family: monospace;
}

body.theme-light .search-kbd-shortcut {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-muted);
    border-color: #cbd5e1;
}

.kbd-hint {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 0 4px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.18);
    color: inherit;
    margin-left: 5px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-family: monospace;
    line-height: 1.4;
}

body.theme-light .kbd-hint {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.15);
}

/* Collapsible Dashboard Radar Cards */
.radar-collapsible-body {
    transition: all 0.25s ease;
}

.radar-collapsible-body.collapsed {
    display: none !important;
}

.radar-chevron.rotated {
    transform: rotate(-90deg);
}

/* Light Theme Overrides for Minimalism Components */
body.theme-light .job-status-menu {
    background: #ffffff;
    border: 1px solid #e7e5e4;
    box-shadow: 0 12px 32px rgba(28, 25, 23, 0.12);
}

body.theme-light .job-status-menu-header {
    color: #78716c;
}

body.theme-light .job-status-menu-item {
    color: #1c1917;
}

body.theme-light .job-status-menu-item:hover {
    background: #fdf2f4;
    color: #881337;
}

body.theme-light .job-status-menu-item.current {
    background: #fdf2f4;
    color: #881337;
}

body.theme-light .density-toggle-btn {
    background: #ffffff;
    border-color: #e7e5e4;
    color: #44403c;
}

body.theme-light .density-toggle-btn:hover {
    color: #881337;
    border-color: #881337;
    background: #fdf2f4;
}

body.theme-light .hamburger {
    background: #ffffff;
    border-color: #e7e5e4;
    color: #44403c;
}

body.theme-light .hamburger:hover {
    color: #881337;
    border-color: #881337;
    background: #fdf2f4;
}

/* ============================================================
   PHASE 1: ACCOUNTS & FINANCIAL CONTROL CENTER STYLES
   ============================================================ */
.accounts-tabs .detail-tab {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.accounts-tabs .detail-tab:hover {
    background: rgba(16, 185, 129, 0.08);
    color: var(--text-primary);
}

.accounts-tabs .detail-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.daybook-reconciliation-flow > div {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media (max-width: 768px) {
    .daybook-reconciliation-flow {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* ============================================================
   MSR HVAC AI COPILOT & INVENTORY ADVISOR STYLES
   ============================================================ */
.ai-prompt-chip {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ai-prompt-chip:hover {
    background: rgba(220, 38, 38, 0.14);
    border-color: #DC2626;
    color: #FAFAFA;
    transform: translateY(-1px);
}

.ai-msg {
    display: flex;
    gap: 10px;
    max-width: 90%;
    animation: fadeInMsg 0.25s ease-out;
}
@keyframes fadeInMsg {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.ai-msg-bot {
    align-self: flex-start;
}
.ai-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.ai-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #DC2626, #991B1B);
    color: #FAFAFA;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.ai-msg-user .ai-msg-avatar {
    background: #DC2626;
}
.ai-msg-bubble {
    background: #16161A !important;
    border: 1px solid #2A2A32 !important;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 13.5px;
    line-height: 1.5;
    color: #FAFAFA !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}
.ai-msg-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 12.5px;
    background: #111114 !important;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #2A2A32 !important;
}
.ai-msg-bubble th {
    background: #1E1E24 !important;
    color: #FAFAFA !important;
    padding: 7px 10px;
    text-align: left;
    font-weight: 700;
    border-bottom: 1px solid #2A2A32 !important;
}
.ai-msg-bubble td {
    padding: 7px 10px;
    color: #E4E4E7 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}
.ai-msg-user .ai-msg-bubble {
    background: #DC2626 !important;
    color: #FAFAFA !important;
    border-color: #B91C1C !important;
}
.ai-msg-bubble h3, .ai-msg-bubble h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #F87171 !important;
}
.ai-msg-user .ai-msg-bubble h3, .ai-msg-user .ai-msg-bubble h4 {
    color: #FAFAFA !important;
}
.ai-msg-bubble ul, .ai-msg-bubble ol {
    margin: 6px 0;
    padding-left: 18px;
}
.ai-msg-bubble li {
    margin-bottom: 4px;
}

/* Floating AI Copilot Widget */
#aiCopilotFab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    background: linear-gradient(135deg, #DC2626, #B91C1C);
    color: #FAFAFA;
    border-radius: 28px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.35);
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1.5px solid rgba(255, 255, 255, 0.16);
}
/* Prevent FAB from EVER overlapping the Send button or Drawer */
body:has(#page-ai-jobs:not(.hidden)) #aiCopilotFab,
body:has(.ai-drawer:not(.hidden)) #aiCopilotFab {
    display: none !important;
}
#aiCopilotFab:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 26px rgba(220, 38, 38, 0.5);
}
.ai-fab-icon {
    font-size: 18px;
}
.ai-fab-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.ai-fab-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 rgba(16, 185, 129, 0.7);
    animation: fabPulse 2s infinite;
}
@keyframes fabPulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* AI Copilot Drawer - Solid, High-Contrast & Opaque */
.ai-drawer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 410px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 80px);
    background: #0D0D0F !important; /* 100% Solid Matte Carbon Canvas */
    border: 1.5px solid rgba(220, 38, 38, 0.45) !important;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.78), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom right;
}
.ai-drawer.hidden {
    display: none !important;
}
.ai-drawer-header {
    padding: 12px 16px;
    background: #16161A !important; /* Solid Header */
    border-bottom: 1px solid #2A2A32 !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ai-drawer-chips {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: #131316 !important; /* Solid Chips Bar */
    border-bottom: 1px solid #2A2A32 !important;
    overflow-x: auto;
    white-space: nowrap;
}
.ai-drawer-chip {
    background: #1E1E24 !important;
    border: 1px solid #2A2A32 !important;
    color: #E4E4E7 !important;
    padding: 4px 11px;
    border-radius: 14px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.ai-drawer-chip:hover {
    background: rgba(220, 38, 38, 0.22) !important;
    border-color: #DC2626 !important;
    color: #FAFAFA !important;
}
.ai-drawer-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #0D0D0F !important; /* Solid Messages Canvas */
}
.ai-drawer-footer {
    padding: 12px 14px;
    background: #16161A !important; /* Solid Footer Bar */
    border-top: 1px solid #2A2A32 !important;
}

/* Chat & Note Input Fields - Crisp, 100% Readable High-Contrast */
#aiChatInput, #aiDrawerInput, #aiRawNoteInput {
    background: #16161A !important;
    border: 1.5px solid #3F3F46 !important;
    color: #FAFAFA !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    letter-spacing: 0.2px !important;
    caret-color: #EF4444 !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35) !important;
}
#aiChatInput:focus, #aiDrawerInput:focus, #aiRawNoteInput:focus {
    background: #1E1E24 !important;
    border-color: #DC2626 !important;
    color: #FAFAFA !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25), inset 0 1px 2px rgba(0, 0, 0, 0.2) !important;
    outline: none !important;
}
#aiChatInput::placeholder, #aiDrawerInput::placeholder, #aiRawNoteInput::placeholder {
    color: #71717A !important;
    opacity: 0.9 !important;
    font-weight: 500 !important;
}

/* Light Theme Adaptations for AI Copilot */
body.theme-light .ai-drawer {
    background: #fdfbf7 !important;
    border: 1.5px solid #e7e5e4 !important;
    box-shadow: 0 20px 50px rgba(28, 25, 23, 0.18) !important;
}
body.theme-light .ai-drawer-header,
body.theme-light .ai-drawer-footer {
    background: #f5f0e8 !important;
    border-color: #e7e5e4 !important;
}
body.theme-light .ai-drawer-chips {
    background: #fdfbf7 !important;
    border-color: #e7e5e4 !important;
}
body.theme-light .ai-drawer-chip {
    background: #ffffff !important;
    color: #44403c !important;
    border-color: #e7e5e4 !important;
}
body.theme-light .ai-drawer-chip:hover {
    background: #fdf2f4 !important;
    color: #881337 !important;
    border-color: #881337 !important;
}
body.theme-light .ai-drawer-messages {
    background: #fdfbf7 !important;
}
body.theme-light .ai-msg-bubble {
    background: #ffffff !important;
    color: #1c1917 !important;
    border: 1px solid #e7e5e4 !important;
    box-shadow: 0 2px 8px rgba(28, 25, 23, 0.06) !important;
}
body.theme-light .ai-msg-user .ai-msg-bubble {
    background: #881337 !important;
    color: #ffffff !important;
    border-color: #881337 !important;
}
body.theme-light .ai-msg-bubble table {
    background: #ffffff !important;
    border-color: #e7e5e4 !important;
}
body.theme-light .ai-msg-bubble th {
    background: #f5f0e8 !important;
    color: #881337 !important;
    border-color: #e7e5e4 !important;
}
body.theme-light .ai-msg-bubble td {
    color: #1c1917 !important;
    border-color: #e7e5e4 !important;
}
body.theme-light #aiChatInput,
body.theme-light #aiDrawerInput,
body.theme-light #aiRawNoteInput {
    background: #ffffff !important;
    border-color: #d6d3d1 !important;
    color: #1c1917 !important;
    box-shadow: inset 0 1px 2px rgba(28, 25, 23, 0.05) !important;
}
body.theme-light #aiChatInput::placeholder,
body.theme-light #aiDrawerInput::placeholder,
body.theme-light #aiRawNoteInput::placeholder {
    color: #78716c !important;
}
body.theme-light #aiCopilotFab {
    background: linear-gradient(135deg, #881337, #6b0f2b);
    box-shadow: 0 6px 20px rgba(136, 19, 55, 0.32);
}

@media (max-width: 768px) {
    #aiCopilotFab {
        bottom: 72px;
        right: 12px;
        width: 42px;
        height: 42px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
        z-index: 94;
        opacity: 0.92;
    }
    #aiCopilotFab .ai-fab-pulse {
        display: none;
    }
    .ai-fab-label {
        display: none;
    }
    .ai-drawer {
        bottom: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        height: 82vh;
        border-radius: 20px 20px 0 0;
    }
}

/* ============================================================
   MOBILE-FIRST BILLING, QUOTES & BOTTOM NAV
   ============================================================ */
.mobile-bottom-nav {
    display: none;
}

.invoice-mobile-tabs {
    display: none;
}

@media (max-width: 1100px) {
    .invoice-mobile-tabs {
        display: flex;
        flex-direction: row;
        flex-shrink: 0;
        width: 100%;
        gap: 8px;
        padding: 8px 12px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border);
        z-index: 20;
    }
    .invoice-mobile-tab-btn {
        flex: 1;
        min-height: 40px;
        padding: 8px 10px;
        border-radius: 8px;
        border: 1px solid var(--border);
        background: var(--bg-card);
        color: var(--text-secondary);
        font-weight: 700;
        font-size: 13px;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        white-space: nowrap;
    }
    .invoice-mobile-tab-btn.active {
        background: var(--primary-color);
        color: #ffffff;
        border-color: var(--primary-color);
    }
    .invoice-split-editor.mobile-pane-hidden,
    .invoice-split-preview-pane.mobile-pane-hidden {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: 12px 12px 86px 12px !important;
    }
    .mobile-fab {
        display: none !important;
    }
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 95;
        background: rgba(13, 13, 15, 0.97);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-top: 1px solid var(--border);
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        padding: 6px 4px;
        height: 64px;
    }
    body.theme-light .mobile-bottom-nav {
        background: rgba(253, 251, 247, 0.97);
        border-top-color: #e7e5e4;
    }
    body.theme-light .mobile-nav-btn.mobile-nav-create {
        background: linear-gradient(135deg, #881337, #6b0f2b);
        box-shadow: 0 3px 12px rgba(136, 19, 55, 0.28);
    }
    .mobile-bottom-nav.junior-nav {
        grid-template-columns: repeat(3, 1fr);
    }
    .mobile-nav-btn {
        background: none;
        border: none;
        color: var(--text-secondary);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        font-size: 10.5px;
        font-weight: 600;
        cursor: pointer;
        min-height: 44px;
        padding: 4px 2px;
    }
    .mobile-nav-btn i {
        font-size: 16px;
    }
    .mobile-nav-btn.active {
        color: var(--primary-color);
        font-weight: 700;
    }
    .mobile-nav-btn.mobile-nav-create {
        color: #FAFAFA;
        background: linear-gradient(135deg, #DC2626, #B91C1C);
        border-radius: 12px;
        margin: 2px 4px;
        box-shadow: 0 3px 12px rgba(220, 38, 38, 0.35);
    }

    /* Stack 8-column line-item tables into touch-friendly cards on mobile */
    #invoice-services-table,
    #quote-items-table {
        min-width: 100% !important;
        width: 100% !important;
        display: block;
    }
    #invoice-services-table thead,
    #quote-items-table thead {
        display: none;
    }
    #invoice-services-table tbody,
    #quote-items-table tbody {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    #invoice-services-table tbody tr,
    #quote-items-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        background: var(--bg-dark);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 10px;
        position: relative;
    }
    #invoice-services-table tbody tr td,
    #quote-items-table tbody tr td {
        display: block;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
    }
    /* Description spans full width */
    #invoice-services-table tbody tr td:nth-child(2),
    #quote-items-table tbody tr td:nth-child(2) {
        grid-column: 1 / -1;
    }
    /* Micro-labels for touch-friendly line-item cards */
    #invoice-services-table tbody tr td:nth-child(3)::before,
    #quote-items-table tbody tr td:nth-child(3)::before { content: "HSN/SAC"; display: block; font-size: 10px; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }
    #invoice-services-table tbody tr td:nth-child(4)::before,
    #quote-items-table tbody tr td:nth-child(4)::before { content: "Qty"; display: block; font-size: 10px; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }
    #invoice-services-table tbody tr td:nth-child(5)::before,
    #quote-items-table tbody tr td:nth-child(5)::before { content: "Unit"; display: block; font-size: 10px; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }
    #invoice-services-table tbody tr td:nth-child(6)::before,
    #quote-items-table tbody tr td:nth-child(6)::before { content: "Rate (₹)"; display: block; font-size: 10px; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }
    #invoice-services-table tbody tr td:nth-child(7)::before,
    #quote-items-table tbody tr td:nth-child(7)::before { content: "Total (₹)"; display: block; font-size: 10px; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }

    /* Delete button sits cleanly at bottom right */
    #invoice-services-table tbody tr td:last-child,
    #quote-items-table tbody tr td:last-child {
        grid-column: 1 / -1;
        text-align: right !important;
    }

    .topbar-quick-actions .quick-action-btn:not(.help-btn) {
        display: none !important;
    }
    .topbar-quick-actions .quick-action-btn.help-btn {
        width: 36px;
        height: 36px;
        min-height: 36px;
        padding: 0;
        justify-content: center;
    }
    .topbar-quick-actions .quick-action-btn.help-btn .help-btn-label {
        display: none;
    }
    .theme-toggle-btn {
        width: 36px;
        height: 36px;
        min-height: 36px !important;
        padding: 0;
    }
    .detail-tabs {
        display: flex;
        flex-wrap: wrap !important;
        gap: 6px;
        padding-bottom: 0;
        border-bottom: none;
        overflow: visible !important;
    }
    .detail-tabs .detail-tab {
        padding: 6px 10px;
        font-size: 12px;
        border-radius: 999px;
        border: 1px solid var(--border);
        background: var(--bg-card);
        min-height: 34px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .detail-tabs .detail-tab.active {
        background: var(--primary-color);
        color: #ffffff;
        border-color: var(--primary-color);
    }

    /* Compact Essential-Only Mobile Tables + Minimizable Wrapper */
    .table-wrapper {
        width: 100%;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .table-wrapper.table-minimized {
        display: none !important;
    }
    .table-wrapper > .data-table {
        width: 100%;
    }
    .table-wrapper > .data-table th {
        padding: 7px 4px !important;
        font-size: 9.5px !important;
        letter-spacing: 0.2px;
        white-space: normal !important;
        line-height: 1.15;
    }
    .table-wrapper > .data-table td {
        padding: 8px 4px !important;
        font-size: 11.5px !important;
        max-width: 102px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .table-wrapper > .data-table td .badge,
    .table-wrapper > .data-table td .status-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    .table-wrapper > .data-table td.td-actions,
    .table-wrapper > .data-table th:last-child {
        width: 66px !important;
        min-width: 64px !important;
        max-width: 72px !important;
        padding-left: 2px !important;
        padding-right: 4px !important;
        overflow: visible !important;
    }
    .td-actions {
        gap: 4px !important;
    }
    .btn-row-primary,
    .btn-row-more {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
        padding: 0 !important;
        justify-content: center !important;
        font-size: 12px !important;
    }
    .btn-row-primary span {
        display: none !important;
    }

    /* Show only essential columns on mobile per table */
    #dashboardBookingsTable :is(th, td):not(:nth-child(2)):not(:nth-child(3)):not(:nth-child(8)),
    #followupsTable :is(th, td):not(:nth-child(1)):not(:nth-child(2)):not(:nth-child(3)),
    #collectionsTable :is(th, td):not(:nth-child(2)):not(:nth-child(3)):not(:nth-child(6)),
    #invoicesTable :is(th, td):not(:nth-child(4)):not(:nth-child(8)):not(:nth-child(9)):not(:nth-child(11)),
    #quotesTable :is(th, td):not(:nth-child(2)):not(:nth-child(5)):not(:nth-child(6)):not(:nth-child(7)),
    #onlineBookingsTable :is(th, td):not(:nth-child(2)):not(:nth-child(3)):not(:nth-child(8)):not(:nth-child(9)),
    #jobsTable :is(th, td):not(:nth-child(2)):not(:nth-child(4)):not(:nth-child(7)):not(:nth-child(8)),
    #customersTable :is(th, td):not(:nth-child(2)):not(:nth-child(3)):not(:nth-child(8)),
    #receivablesTable :is(th, td):not(:nth-child(3)):not(:nth-child(6)):not(:nth-child(7)),
    #gstRegisterTable :is(th, td):not(:nth-child(1)):not(:nth-child(4)):not(:nth-child(7)),
    #expensesTable :is(th, td):not(:nth-child(1)):not(:nth-child(3)):not(:nth-child(8)):not(:nth-child(9)),
    #partsTable :is(th, td):not(:nth-child(2)):not(:nth-child(5)):not(:nth-child(6)):not(:nth-child(8)),
    #amcTable :is(th, td):not(:nth-child(2)):not(:nth-child(7)):not(:nth-child(8)):not(:nth-child(9)),
    #warrantyTable :is(th, td):not(:nth-child(2)):not(:nth-child(4)):not(:nth-child(5)):not(:nth-child(6)),
    #dbInflowsTable :is(th, td):not(:nth-child(1)):not(:nth-child(2)):not(:nth-child(4)),
    #dbOutflowsTable :is(th, td):not(:nth-child(2)):not(:nth-child(3)):not(:nth-child(5)) {
        display: none;
    }

    #radarOnlineBookingsCard .card-body {
        padding: 8px 10px 12px 10px !important;
    }

    #dashboardBookingsTable {
        table-layout: fixed !important;
        width: 100% !important;
    }

    #dashboardBookingsTable :is(th, td) {
        padding-left: 3px !important;
        padding-right: 3px !important;
    }

    #dashboardBookingsTable :is(th, td):nth-child(2) {
        width: 35% !important;
        max-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    #dashboardBookingsTable :is(th, td):nth-child(3) {
        width: 33% !important;
        max-width: 0 !important;
        font-size: 11px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    #dashboardBookingsTable th:last-child,
    #dashboardBookingsTable td:last-child {
        width: 32% !important;
        min-width: 0 !important;
        max-width: none !important;
        overflow: visible !important;
        text-align: right !important;
        padding-left: 2px !important;
        padding-right: 2px !important;
    }

    #onlineBookingsTable th:last-child,
    #onlineBookingsTable td:last-child {
        width: 88px !important;
        min-width: 86px !important;
        max-width: none !important;
        overflow: visible !important;
        text-align: right !important;
        padding-left: 3px !important;
        padding-right: 3px !important;
    }

    #onlineBookingsTable td:nth-child(3) {
        white-space: nowrap;
        max-width: none;
    }

    .btn-dispatch-gold {
        padding: 5px 7px !important;
        font-size: 10.5px !important;
        gap: 3px !important;
        white-space: nowrap !important;
        border-radius: 6px !important;
        max-width: 100%;
        justify-content: center;
    }

    .btn-dispatch-gold i {
        font-size: 10px;
    }

    /* Clean Accounts & Finance Mobile Layout */
    #page-accounts .page-header {
        margin-bottom: 12px !important;
        gap: 10px !important;
    }
    #page-accounts .page-subtitle {
        display: none;
    }
    #page-accounts .header-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px !important;
        width: 100%;
    }
    #page-accounts .header-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 8px 10px;
        font-size: 12px;
        min-height: 38px;
    }
    #page-accounts .accounts-tabs {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        padding-bottom: 0 !important;
        border-bottom: none !important;
        margin-bottom: 14px !important;
        overflow: visible !important;
    }
    #page-accounts .accounts-tabs .detail-tab {
        flex: 1 1 calc(33% - 6px);
        justify-content: center;
        text-align: center;
        padding: 7px 8px;
        font-size: 11.5px;
        border-radius: 999px;
        border: 1px solid var(--border);
        background: var(--bg-card);
        min-height: 34px;
    }
    #page-accounts .accounts-tabs .detail-tab.active {
        background: var(--primary-color);
        color: #ffffff;
        border-color: var(--primary-color);
    }
    #paneAccountsDaybook .card-body,
    #paneAccountsSettlement .card-body,
    #paneAccountsExpenses .card-body,
    #paneAccountsPnl .card-body,
    #paneAccountsGst .card-body {
        padding: 12px !important;
    }
    .daybook-reconciliation-flow {
        padding: 12px !important;
        gap: 10px !important;
        margin-bottom: 14px !important;
    }
    /* Keep empty-state colspan rows visible */
    .table-wrapper > .data-table td[colspan] {
        display: table-cell !important;
        max-width: none !important;
        text-align: center !important;
    }
}

.table-minimize-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    font-size: 11.5px;
    color: var(--text-muted);
}

.table-minimize-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px !important;
    transition: all 0.15s ease;
}

.table-minimize-btn:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

body.theme-light .table-minimize-bar {
    background: #f8fafc;
}

/* ============================================================
   FAST 3-STEP INVOICE BILLING CONTROLS
   ============================================================ */
.invoice-customer-badge {
    display: none;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    padding: 7px 10px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #34d399;
    font-size: 12px;
    font-weight: 600;
}

.invoice-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.invoice-quick-chip {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.28);
    color: #fca5a5;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
    min-height: 32px !important;
}

.invoice-quick-chip:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

.invoice-quick-chip.chip-alt {
    background: var(--bg-input);
    border-color: var(--border);
    color: var(--text-secondary);
}

.invoice-quick-chip.chip-alt:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.invoice-fast-summary {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary-color);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.invoice-fast-summary .summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
    color: var(--text-secondary);
}

.invoice-fast-summary .summary-row.summary-grand {
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
}

.invoice-fast-summary .summary-row.summary-grand strong {
    color: #f87171;
    font-size: 16.5px;
}

.invoice-pill-group {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}

.invoice-pill-btn {
    flex: 1;
    min-height: 38px !important;
    padding: 7px 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    white-space: nowrap;
}

.invoice-pill-btn:hover {
    border-color: rgba(239, 68, 68, 0.45);
    color: var(--text-primary);
}

.invoice-pill-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
    font-weight: 700;
}

.invoice-fast-drawer {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}

.invoice-fast-drawer summary {
    padding: 10px 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.invoice-fast-drawer summary::-webkit-details-marker {
    display: none;
}

.invoice-fast-drawer summary::after {
    content: '▸';
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.invoice-fast-drawer[open] summary {
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.invoice-fast-drawer[open] summary::after {
    transform: rotate(90deg);
}

.invoice-drawer-body {
    padding: 12px;
}

body.theme-light .invoice-customer-badge {
    color: #047857;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

body.theme-light .invoice-quick-chip {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

body.theme-light .invoice-quick-chip.chip-alt {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}

/* ========================================================
   HOME / TODAY DASHBOARD MOBILE-FIRST UPGRADES
   ======================================================== */
.mobile-home-top {
    display: none;
}

.stat-card-clickable {
    cursor: pointer;
    user-select: none;
}

.stat-card-clickable:hover {
    transform: translateY(-2px);
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.stat-card-clickable:active {
    transform: scale(0.985);
}

@media (max-width: 768px) {
    .mobile-home-top {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 14px;
    }

    .mobile-search-wrapper {
        width: 100%;
        max-width: none;
        position: relative;
    }

    .mobile-search-wrapper input {
        width: 100%;
        min-height: 42px;
        padding: 10px 14px 10px 38px;
        border-radius: 10px;
        border: 1px solid var(--border);
        background: var(--bg-card);
        color: var(--text-primary);
        font-size: 13.5px;
    }

    .mobile-search-wrapper input:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.16);
    }

    .mobile-search-wrapper .search-icon {
        left: 13px;
    }

    #mobileSearchResults {
        width: 100%;
        max-height: 300px;
        z-index: 950;
    }

    .mobile-quick-strip {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .mobile-quick-strip .btn {
        min-height: 38px;
        padding: 7px 6px;
        font-size: 12px;
        justify-content: center;
        white-space: nowrap;
        border-radius: 9px;
    }

    #page-dashboard .card-header {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    #page-dashboard .radar-toggle-hint {
        display: none;
    }

    #radarLightningBookBody.lightning-book-body {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    #radarLightningBookBody .form-group {
        width: 100% !important;
        min-width: 0 !important;
    }

    #radarLightningBookBody .lightning-submit-btn {
        width: 100%;
        height: 42px !important;
        justify-content: center;
    }

    #radarChartsBody .chart-container {
        height: 205px;
        min-height: 205px;
    }

    #todaysJobsList .today-job-item {
        padding: 10px 12px;
        gap: 10px;
    }
}

body.theme-light .mobile-search-wrapper input {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

.invoice-catalog-opt {
    padding: 9px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.14s ease;
}

.invoice-catalog-opt:last-child {
    border-bottom: none;
}

.invoice-catalog-opt:hover {
    background: var(--bg-card-hover);
}

.catalog-opt-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}