body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --- Liquid Glass / Glassmorphism Styles --- */
.liquid-glass {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.12) !important;
}

[data-theme="dracula"] .liquid-glass,
[data-bs-theme="dark"] .liquid-glass {
    background: rgba(40, 42, 54, 0.75) !important;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37) !important;
}

.liquid-glass-subtle {
    background: rgba(255, 255, 255, 0.45) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
}

[data-theme="dracula"] .liquid-glass-subtle,
[data-bs-theme="dark"] .liquid-glass-subtle {
    background: rgba(30, 31, 41, 0.6) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Liquid glass gradient page background */
body.liquid-glass-bg {
    min-height: 100vh;
    background: radial-gradient(circle at 10% 20%, rgba(13, 110, 253, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(111, 66, 193, 0.08) 0%, transparent 40%),
                #f8f9fa;
}

[data-theme="dracula"] body.liquid-glass-bg,
[data-bs-theme="dark"] body.liquid-glass-bg {
    background: radial-gradient(circle at 10% 20%, rgba(189, 147, 249, 0.08) 0%, transparent 45%),
                radial-gradient(circle at 90% 80%, rgba(98, 114, 164, 0.1) 0%, transparent 45%),
                #21222c;
}

.cursor-pointer {
    cursor: pointer;
    transition: transform 0.2s;
}

.cursor-pointer:hover {
    transform: translateY(-5px);
}

.view-content {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#chatWindow {
    scroll-behavior: smooth;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

/* --- AI Assistant Floating Widget & Mobile Responsive Layout --- */

.chat-floating-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1040;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: linear-gradient(135deg, #0d6efd, #0b5ed7);
    color: white;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.chat-floating-launcher:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 25px rgba(13, 110, 253, 0.45) !important;
}

@media (max-width: 991.98px) {
    .chat-floating-launcher {
        display: none !important; /* Hide completely on mobile & tablets so it never overlaps with the mobile New Job (+) FAB button */
    }
}

.chat-floating-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 420px;
    height: 520px;
    max-height: calc(100vh - 110px); /* Leave ample clearance below navbar so it never falls off screen */
    z-index: 1055;
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22) !important;
    display: flex;
    flex-direction: column;
    transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), height 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s ease;
}

.chat-floating-widget.expanded {
    width: min(680px, calc(100vw - 40px));
    height: 680px;
    max-height: calc(100vh - 90px);
}

.chat-card {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden;
    border-radius: 14px;
    border: none;
}

.chat-floating-widget .card-footer {
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    z-index: 10;
    background-color: #ffffff;
    border-top: 1px solid #dee2e6;
}

@media (max-width: 767.98px) {
    .chat-floating-widget {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100% !important;
        max-width: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0;
        border: none;
        z-index: 1060;
    }
}

.chat-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: #eef2ff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-msg {
    align-self: flex-end;
    background-color: #0d6efd;
    color: white;
    max-width: 80%;
    margin-left: auto;
}

.assistant-msg {
    align-self: flex-start;
    background-color: white;
    color: #333;
    max-width: 80%;
}

.list-group-item {
    border: none;
    padding: 15px 1.25rem;
    border-bottom: 1px solid #eee;
}

.list-group-item:last-child {
    border-bottom: none;
}

.transition-transform {
    transition: transform 0.2s ease;
}

.collapsed .transition-transform {
    transform: rotate(-90deg);
}

/* --- FullCalendar Premium Custom Styling --- */
#jobsCalendar {
    font-family: inherit;
    font-size: 0.9rem;
}

.fc {
    --fc-border-color: #eef1f6 !important;
    --fc-button-bg-color: #0d6efd !important;
    --fc-button-border-color: #0d6efd !important;
    --fc-button-hover-bg-color: #0b5ed7 !important;
    --fc-button-hover-border-color: #0a58ca !important;
    --fc-button-active-bg-color: #0a58ca !important;
    --fc-button-active-border-color: #0a53be !important;
    --fc-today-bg-color: rgba(13, 110, 253, 0.04) !important;
}

.fc .fc-toolbar {
    margin-bottom: 1.5rem !important;
    gap: 10px;
    flex-wrap: wrap;
}

.fc .fc-toolbar-title {
    font-size: 1.35rem !important;
    font-weight: 700 !important;
    color: #2b303a;
    letter-spacing: -0.02em;
}

.fc .fc-col-header-cell {
    background-color: #f8f9fa;
    padding: 10px 0 !important;
    font-weight: 600 !important;
    color: #495057;
    border-bottom: 2px solid #dee2e6 !important;
}

.fc-event {
    border-radius: 6px !important;
    padding: 3px 6px !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04) !important;
    border: none !important;
    cursor: pointer;
    transition: all 0.2s ease-in-out !important;
}

.fc-event:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08) !important;
    filter: brightness(0.95);
}

.fc-daygrid-event-dot {
    display: none !important;
}

.fc-daygrid-day-number {
    font-weight: 600;
    color: #495057;
    text-decoration: none !important;
    padding: 8px !important;
}

.fc-daygrid-day.fc-day-today {
    background-color: rgba(13, 110, 253, 0.05) !important;
}

/* Site visits aesthetics */
#visitList .list-group-item {
    border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
    transition: background-color 0.2s;
}

#visitList .list-group-item:hover {
    background-color: rgba(13, 110, 253, 0.02);
}

#visitList .list-group-item:last-child {
    border-bottom: none;
}

/* --- Global Loading Overlay --- */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

#loadingOverlay.d-none {
    display: none !important;
}

.spinner-container {
    text-align: center;
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* --- Chat Loading Animation --- */
.chat-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    font-style: italic;
    color: #666;
}

.chat-loading .spinner-grow {
    width: 0.8rem;
    height: 0.8rem;
}

/* --- Financial Reporting & Customer Profile Custom Styles --- */
.bg-light-primary {
    background-color: rgba(13, 110, 253, 0.05) !important;
}

.bg-light-success {
    background-color: rgba(25, 135, 84, 0.05) !important;
}

.bg-light-danger {
    background-color: rgba(220, 53, 69, 0.05) !important;
}

.bg-light-warning {
    background-color: rgba(255, 193, 7, 0.05) !important;
}

.progress {
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    transition: width 0.6s ease;
}

.table th {
    font-weight: 600;
    color: #495057;
    background-color: #f8f9fa;
}

/* Hover effects for tables linked to view functions */
.table-hover tbody tr.cursor-pointer:hover {
    background-color: rgba(13, 110, 253, 0.03) !important;
}

/* Responsive table styling details */
.font-monospace {
    font-family: var(--bs-font-monospace);
    font-size: 0.9em;
}

/* --- Chat Visualization Enhancements --- */
.chat-thumbnail {
    max-width: 100px;
    max-height: 100px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    border: 1px solid #dee2e6;
    margin-top: 8px;
    display: block;
}

.chat-thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.chat-image-expanded {
    max-width: 100%;
    max-height: 400px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease-in-out;
    margin-top: 8px;
    display: block;
}

.truncated-link {
    display: inline-block;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    color: #0d6efd;
    text-decoration: none;
    font-weight: 500;
}

.truncated-link:hover {
    text-decoration: underline;
}

.chat-metadata-item {
    background-color: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border-left: 3px solid #0d6efd;
    margin-top: 4px;
    font-size: 0.85rem;
}

/* --- Ad-Hoc Report Builder & Tabulator Customizations --- */

.report-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.report-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1) !important;
}

#reportGrid {
    font-size: 0.875rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    background-color: #ffffff;
}

/* High-Contrast Prominent Column Headers */
.tabulator .tabulator-header {
    background: #1e293b !important; /* Deep dark slate for maximum visibility */
    color: #ffffff !important;
    border-bottom: 2px solid #0f172a !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em;
}

.tabulator .tabulator-header .tabulator-col {
    background: #1e293b !important;
    border-right: 1px solid #334155 !important;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content {
    padding: 8px 10px !important;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-title {
    color: #ffffff !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    white-space: normal !important; /* Allow wrapping so headers are never prematurely cut off */
    line-height: 1.25;
}

.tabulator .tabulator-header .tabulator-col .tabulator-arrow {
    border-bottom-color: #cbd5e1 !important;
    border-top-color: #cbd5e1 !important;
}

/* Column Header Search Filters */
.tabulator-header-filter {
    margin-top: 6px !important;
}

.tabulator-header-filter input {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    font-size: 0.78rem !important;
    padding: 4px 6px !important;
    width: 100% !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.tabulator-header-filter input:focus {
    border-color: #3b82f6 !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25) !important;
}

.tabulator-header-filter input::placeholder {
    color: #94a3b8 !important;
    font-size: 0.75rem !important;
}

/* Multi-Level Row Grouping */
.tabulator-row.tabulator-group {
    background: #e2e8f0 !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    border-bottom: 1px solid #cbd5e1 !important;
    border-top: 1px solid #cbd5e1 !important;
    border-left: 4px solid #0d6efd !important;
    padding: 6px 12px !important;
}

.tabulator-row.tabulator-group.tabulator-group-level-1 {
    background: #f1f5f9 !important;
    padding-left: 28px !important;
    border-left: 4px solid #64748b !important;
}

.tabulator-row.tabulator-group.tabulator-group-level-2 {
    background: #f8fafc !important;
    padding-left: 44px !important;
    border-left: 4px solid #94a3b8 !important;
}

.tabulator-row.tabulator-group:hover {
    background: #cbd5e1 !important;
}

.tabulator .tabulator-footer {
    background-color: #f8fafc !important;
    border-top: 2px solid #e2e8f0 !important;
    font-weight: 600;
}

/* Bottom Calculation & Subtotal Row */
.tabulator-calcs-bottom {
    background-color: #f1f5f9 !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    border-top: 2px solid #94a3b8 !important;
    border-bottom: 2px solid #94a3b8 !important;
}

/* Collapsible Report Sidebar Transition */
#reportSidebarCol {
    transition: all 0.2s ease-in-out;
}

#reportMainCol {
    transition: all 0.2s ease-in-out;
}

/* --- High-End Dark Mode Customizations --- */

[data-bs-theme="dark"] {
    --bs-body-bg: #0b0f19;
    --bs-body-color: #f1f5f9;
    --bs-tertiary-bg: #111827;
    --bs-secondary-bg: #1e293b;
    --bs-border-color: #334155;
    --bs-card-bg: #1e293b;
}

[data-bs-theme="dark"] body {
    background-color: #0b0f19 !important;
    color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .bg-light {
    background-color: #111827 !important;
}

[data-bs-theme="dark"] .bg-white {
    background-color: #1e293b !important;
}

[data-bs-theme="dark"] .text-dark {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .card {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .card-header {
    background-color: #172033 !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .card-footer {
    background-color: #172033 !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .modal-content {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #111827 !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    border-color: #3b82f6 !important;
    background-color: #111827 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: #64748b !important;
}

[data-bs-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: #f8fafc;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .table th {
    background-color: #172033 !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

[data-bs-theme="dark"] .list-group-item {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

/* Floating Chat Dark Mode */
[data-bs-theme="dark"] .chat-floating-widget {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] #chatWindow {
    background-color: #111827 !important;
}

[data-bs-theme="dark"] .assistant-msg {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
}

[data-bs-theme="dark"] .chat-metadata-item {
    background-color: #172033 !important;
    color: #cbd5e1 !important;
    border-color: #3b82f6 !important;
}

/* Tabulator Dark Mode */
[data-bs-theme="dark"] #reportGrid {
    background-color: #111827 !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .tabulator {
    background-color: #111827 !important;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .tabulator-row {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border-bottom: 1px solid #334155 !important;
}

[data-bs-theme="dark"] .tabulator-row:hover {
    background-color: #27354f !important;
}

[data-bs-theme="dark"] .tabulator-row.tabulator-group {
    background: #172033 !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .tabulator-row.tabulator-group.tabulator-group-level-1 {
    background: #1a253a !important;
}

[data-bs-theme="dark"] .tabulator-row.tabulator-group.tabulator-group-level-2 {
    background: #1e2c45 !important;
}

[data-bs-theme="dark"] .tabulator-calcs-bottom {
    background-color: #172033 !important;
    color: #f8fafc !important;
    border-color: #475569 !important;
}

[data-bs-theme="dark"] .tabulator .tabulator-footer {
    background-color: #172033 !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

/* FullCalendar Dark Mode */
[data-bs-theme="dark"] #calendarContainer {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .fc {
    --fc-border-color: #334155 !important;
    --fc-today-bg-color: rgba(59, 130, 246, 0.1) !important;
}

[data-bs-theme="dark"] .fc .fc-toolbar-title {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .fc .fc-col-header-cell {
    background-color: #172033 !important;
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .fc-daygrid-day-number {
    color: #cbd5e1 !important;
}

/* --- Liquid Glass Modals & Dialogs --- */
.modal-content {
    background: rgba(255, 255, 255, 0.88) !important;
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, 0.45) !important;
    border-radius: 28px !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2) !important;
    overflow: hidden;
}

[data-theme="dracula"] .modal-content,
[data-bs-theme="dark"] .modal-content {
    background: rgba(40, 42, 54, 0.88) !important;
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 28px !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6) !important;
}

.modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 1.25rem 1.75rem !important;
}

.modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 1.25rem 1.75rem !important;
}

/* --- Ensure Bootstrap Tabs & Tab Content Work Seamlessly With DaisyUI --- */
.tab-content {
    display: block !important;
}

.tab-content > .tab-pane {
    display: none !important;
}

.tab-content > .tab-pane.active,
.tab-content > .tab-pane.show.active {
    display: block !important;
}

/* --- Ensure Bootstrap Modals Work Seamlessly With DaisyUI --- */
.modal {
    visibility: visible !important;
    pointer-events: auto !important;
}

.modal:not(.show) {
    display: none !important;
    opacity: 0 !important;
}

.modal.show {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.modal.fade .modal-dialog {
    transition: transform 0.25s ease-out;
    transform: translate(0, -20px);
}

.modal.show .modal-dialog {
    transform: none !important;
}

/* --- Material Pill Buttons & Button Group Alignment --- */
/* Standalone buttons get modern pill curvature */
.btn:not(.btn-group > .btn):not(.btn-circle):not(.btn-square) {
    border-radius: 9999px;
}

/* Button groups form a single cohesive pill unit without mismatched inner radii */
.btn-group,
.btn-group-sm,
.btn-group-lg {
    display: inline-flex !important;
    border-radius: 9999px !important;
    overflow: hidden !important;
    border: 1px solid rgba(13, 110, 253, 0.4) !important;
}

.btn-group > .btn {
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
}

.btn-group > .btn + .btn,
.btn-group > .btn-group + .btn,
.btn-group > .btn + .btn-group {
    border-left: 1px solid rgba(13, 110, 253, 0.4) !important;
}

.btn-group > .btn:first-child {
    border-top-left-radius: 9999px !important;
    border-bottom-left-radius: 9999px !important;
}

.btn-group > .btn:last-child {
    border-top-right-radius: 9999px !important;
    border-bottom-right-radius: 9999px !important;
}

/* Fix flex gap button spacing */
.gap-1 > .btn, .gap-2 > .btn, .gap-3 > .btn,
.d-flex.gap-1 > .btn, .d-flex.gap-2 > .btn, .d-flex.gap-3 > .btn {
    flex-shrink: 0;
}

/* --- Circular Action Bubble Buttons & Icon Placement (Edit, Delete, Dropdowns) --- */
.btn-circle,
.btn.rounded-circle:not(#mobileJobFab):not(.d-md-none):not(.d-none),
button.rounded-circle:not(#mobileJobFab):not(.d-md-none):not(.d-none) {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 0 !important;
    border-radius: 9999px !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
    aspect-ratio: 1 / 1 !important;
    vertical-align: middle !important;
}

.btn-circle.btn-xs,
.btn.btn-xs.rounded-circle,
.btn.btn-xs.btn-circle {
    width: 1.85rem !important;
    height: 1.85rem !important;
    min-height: 1.85rem !important;
    max-width: 1.85rem !important;
    max-height: 1.85rem !important;
    font-size: 0.75rem !important;
}

.btn-circle.btn-sm,
.btn.btn-sm.rounded-circle,
.btn.btn-sm.btn-circle {
    width: 2.15rem !important;
    height: 2.15rem !important;
    min-height: 2.15rem !important;
    max-width: 2.15rem !important;
    max-height: 2.15rem !important;
    font-size: 0.85rem !important;
}

.btn-circle i,
.btn.rounded-circle:not(#mobileJobFab) i,
button.rounded-circle:not(#mobileJobFab) i {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    text-align: center !important;
}

/* Mobile Floating Action Button (FAB): Strictly mobile only, hidden on desktop (>=768px) */
#mobileJobFab {
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 768px) {
    #mobileJobFab,
    button#mobileJobFab,
    .d-md-none {
        display: none !important;
    }
}

/* --- Universal Perfect Centering for All Badge Pills (Status, Dates, Types) --- */
.badge,
.badge.rounded-pill,
.rounded-pill.badge,
span.badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    vertical-align: middle !important;
    border-radius: 9999px !important;
    line-height: 1 !important;
    height: auto !important;
    padding: 0.26rem 0.75rem !important;
    box-sizing: border-box !important;
    font-variant-numeric: tabular-nums;
}

/* Small and extra small badge pills (item type, expense type, card dates, crew tags) */
.badge.text-xs,
.badge.badge-sm,
.badge.badge-xs,
.table .badge,
#jobLineItems .badge,
#jobExpenses .badge,
#jobCrewPayList .badge {
    font-size: 0.72rem !important;
    min-height: 1.35rem !important;
    padding: 0.2rem 0.65rem !important;
    line-height: 1 !important;
}

/* --- Login / Auth Screen Viewport Centering & Compact Width --- */
#authView {
    min-height: 100vh !important;
    min-height: 100dvh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1rem !important;
    margin: 0 auto !important;
}

#authView.d-none {
    display: none !important;
}

#authView .card {
    width: 100% !important;
    max-width: 360px !important;
    margin: auto !important;
}

/* Liquid Glass Cards in App View */
.card,
.view-content .card {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    border-radius: 20px !important;
    overflow: hidden !important; /* Critical: clips all internal child elements to the container's rounded radius */
}

[data-theme="dracula"] .card,
[data-bs-theme="dark"] .card,
[data-theme="dracula"] .view-content .card,
[data-bs-theme="dark"] .view-content .card {
    background: rgba(40, 42, 54, 0.75) !important;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 20px !important;
    overflow: hidden !important;
}

/* Eliminate opaque square headers and bodies from bleeding outside rounded cards */
.view-content .card-header,
.view-content .card .card-header,
.card-header.bg-white,
.card-header.bg-light {
    background: transparent !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

[data-theme="dracula"] .view-content .card-header,
[data-bs-theme="dark"] .view-content .card-header,
[data-theme="dracula"] .card-header.bg-white,
[data-bs-theme="dark"] .card-header.bg-white,
[data-theme="dracula"] .card-header.bg-light,
[data-bs-theme="dark"] .card-header.bg-light {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.view-content .card-body.bg-white,
.view-content .card-body.bg-light,
.view-content .card > .bg-white,
.view-content .card > .bg-light {
    background-color: transparent !important;
}

/* Site visits container & items alignment */
#visitList {
    background: transparent !important;
}

#visitList .list-group-item {
    background: transparent !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

[data-theme="dracula"] #visitList .list-group-item,
[data-bs-theme="dark"] #visitList .list-group-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

#visitList .border-start.border-primary {
    background: rgba(13, 110, 253, 0.08) !important;
    border-radius: 12px !important;
}

[data-theme="dracula"] #visitList .border-start.border-primary,
[data-bs-theme="dark"] #visitList .border-start.border-primary {
    background: rgba(189, 147, 249, 0.12) !important;
    color: #f8fafc !important;
    border-color: #bd93f9 !important;
}

/* Reports Grid & Tabulator seamless alignment */
#reportGrid {
    border-radius: 14px !important;
    overflow: hidden !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    background: transparent !important;
}

[data-theme="dracula"] #reportGrid,
[data-bs-theme="dark"] #reportGrid {
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    background: #1e1f29 !important;
}

.tabulator {
    border-radius: 14px !important;
    overflow: hidden !important;
    background: transparent !important;
}

[data-theme="dracula"] .tabulator,
[data-bs-theme="dark"] .tabulator {
    background: #1e1f29 !important;
}

/* Boolean Logic container in Report Builder */
#builder-filters-pane .p-2.border.rounded.bg-white {
    background: rgba(255, 255, 255, 0.6) !important;
    border-radius: 16px !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="dracula"] #builder-filters-pane .p-2.border.rounded.bg-white,
[data-bs-theme="dark"] #builder-filters-pane .p-2.border.rounded.bg-white {
    background: rgba(30, 31, 41, 0.65) !important;
    border-radius: 16px !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* ==========================================================================
   Section 508 / WCAG 2.1 AA Color Contrast Compliance Tokens
   ========================================================================== */

/* 1. High-contrast Badges: Ensure dark readable text on yellow and cyan badges (11.2:1+ ratio) */
.badge.bg-warning,
.badge-warning,
[data-bs-theme="dark"] .badge.bg-warning,
[data-theme="dracula"] .badge.bg-warning,
[data-bs-theme="dark"] .badge.bg-warning.text-dark,
[data-theme="dracula"] .badge.bg-warning.text-dark {
    background-color: #f59e0b !important;
    color: #111827 !important;
    font-weight: 700 !important;
}

.badge.bg-info,
.badge-info,
[data-bs-theme="dark"] .badge.bg-info,
[data-theme="dracula"] .badge.bg-info,
[data-bs-theme="dark"] .badge.bg-info.text-dark,
[data-theme="dracula"] .badge.bg-info.text-dark {
    background-color: #06b6d4 !important;
    color: #0f172a !important;
    font-weight: 700 !important;
}

/* 2. Accessible Profit & Success text (9.8:1 ratio against dark background) */
[data-theme="dracula"] .text-success,
[data-bs-theme="dark"] .text-success,
[data-theme="dracula"] .text-success *,
[data-bs-theme="dark"] .text-success * {
    color: #50fa7b !important; /* High-contrast Dracula green */
}

.text-success,
.text-success * {
    color: #15803d !important; /* High-contrast emerald green for light mode (5.5:1) */
}

/* 3. Accessible Danger & Expenses text (5.4:1 ratio against dark background) */
[data-theme="dracula"] .text-danger,
[data-bs-theme="dark"] .text-danger,
[data-theme="dracula"] .text-danger *,
[data-bs-theme="dark"] .text-danger * {
    color: #ff6e6e !important; /* High-contrast Dracula red */
}

.text-danger,
.text-danger * {
    color: #b91c1c !important; /* High-contrast crimson red for light mode (5.2:1) */
}

/* 4. Accessible Primary & Accent Blue */
[data-theme="dracula"] .text-primary,
[data-bs-theme="dark"] .text-primary,
[data-theme="dracula"] a.text-primary,
[data-bs-theme="dark"] a.text-primary {
    color: #93c5fd !important; /* High-contrast soft blue (8.5:1) */
}

.text-primary,
a.text-primary {
    color: #1d4ed8 !important; /* Deep royal blue for light mode (6.2:1) */
}

/* 5. Accessible Muted Subtitles & Labels (6.8:1 ratio) */
[data-theme="dracula"] .text-muted,
[data-bs-theme="dark"] .text-muted,
[data-theme="dracula"] small.text-muted,
[data-bs-theme="dark"] small.text-muted {
    color: #cbd5e1 !important; /* Slate-300 for readable muted text */
}

.text-muted,
small.text-muted {
    color: #475569 !important; /* Slate-600 for light mode (5.5:1) */
}

/* 6. Accessible Warning Text */
[data-theme="dracula"] .text-warning,
[data-bs-theme="dark"] .text-warning {
    color: #f1fa8c !important; /* Bright accessible yellow (11.2:1) */
}

.text-warning {
    color: #b45309 !important; /* Dark amber for light mode (4.8:1) */
}

/* 7. Accessible Info Text */
[data-theme="dracula"] .text-info,
[data-bs-theme="dark"] .text-info {
    color: #8be9fd !important;
}

.text-info {
    color: #0369a1 !important;
}

/* 8. Accessible Secondary Text */
[data-theme="dracula"] .text-secondary,
[data-bs-theme="dark"] .text-secondary {
    color: #e2e8f0 !important;
}

.text-secondary {
    color: #334155 !important;
}

/* 9. Accessible Input Placeholders */
input::placeholder,
textarea::placeholder {
    color: #94a3b8 !important;
    opacity: 1 !important;
}

/* 10. Guaranteed Visibility Overrides */
.d-none {
    display: none !important;
}

/* Desktop New Job Button: Hidden on mobile (< 768px), strictly visible on desktop (>= 768px) */
#desktopNewJobBtn {
    display: none !important;
}

@media (min-width: 768px) {
    #desktopNewJobBtn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    .d-md-none,
    #mobileJobFab,
    button#mobileJobFab {
        display: none !important;
    }
}