/* Punch Clock Styles for Prism Payroll */

/* Mobile-First Base Styles */
:root {
    /* Light theme (default) */
    --bg-primary: #f5f7fa;
    --bg-secondary: #edf2f7;
    --card-bg: #ffffff;
    --card-bg-glass: rgba(255, 255, 255, 0.85);
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --border-color-glass: rgba(226, 232, 240, 0.3);
    --accent: #00b8a5;
    --accent-rgb: 0, 184, 165;
    --accent-hover: #00a090;
    --danger: #dc3545;
    --success: #22c55e;
    --warning: #f59e0b;
    --input-bg: #ffffff;
    --input-bg-glass: rgba(255, 255, 255, 0.9);
    --input-border: #cbd5e0;
    --modal-bg: #ffffff;
    --modal-bg-glass: rgba(255, 255, 255, 0.95);
    --sidebar-width: 280px;
    --sidebar-mobile-height: 60px;
    --card-min-height-mobile: 160px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.25);
    --glass-blur: 10px;
    --glass-blur-mobile: 8px;
    --header-height: 60px;
    --content-padding: 1rem;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --card-bg: #2a2a2a;
    --card-bg-glass: rgba(42, 42, 42, 0.85);
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #999999;
    --border-color: #404040;
    --border-color-glass: rgba(64, 64, 64, 0.3);
    --accent: #00d4be;
    --accent-rgb: 0, 212, 190;
    --accent-hover: #00e6ce;
    --input-bg: #333333;
    --input-bg-glass: rgba(51, 51, 51, 0.9);
    --input-border: #404040;
    --modal-bg: #2a2a2a;
    --modal-bg-glass: rgba(42, 42, 42, 0.95);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 6px 8px rgba(0, 0, 0, 0.4);
}

/* General Styles */
html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw; /* Use viewport width to prevent overflow */
    min-height: 100vh;
    /* iOS Safe Area - Respect notch and home bar */
    min-height: -webkit-fill-available;
    box-sizing: border-box;
    position: relative;
}

*, *::before, *::after {
    box-sizing: border-box;
    max-width: 100%; /* Prevent any element from exceeding parent */
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: clamp(0.875rem, 1vw, 1rem);
    transition: color 0.3s ease;
    position: relative;
    min-height: 100vh;
    /* iOS Safe Area Support */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Parallax gradient animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Responsive Typography */
h1, .h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    line-height: 1.2;
    white-space: normal;
    word-wrap: break-word;
}

h2, .h2 {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: normal;
    word-wrap: break-word;
    color: var(--text-primary);
}

h3, .h3 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: normal;
    word-wrap: break-word;
}

/* Section subtitles */
.content-section h2 + p.text-muted {
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

h4, .h4 {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    line-height: 1.3;
}

h5, .h5 {
    font-size: clamp(1rem, 2vw, 1.25rem);
    line-height: 1.4;
}

h6, .h6 {
    font-size: clamp(0.9rem, 1.5vw, 1.125rem);
    line-height: 1.4;
}

p {
    font-size: clamp(0.875rem, 1.2vw, 1rem);
    line-height: 1.6;
}

.btn {
    font-size: clamp(0.875rem, 1.2vw, 1rem);
    white-space: nowrap;
}

.form-label {
    font-size: clamp(0.875rem, 1.2vw, 1rem);
}

.form-control, .form-select {
    font-size: clamp(0.875rem, 1.2vw, 1rem);
}

.table {
    font-size: clamp(0.75rem, 1vw, 0.875rem);
}

.modal-title {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
}

/* Dark theme gradient - same as light mode */
[data-theme="dark"] body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
}

/* Login Screen */
.login-container {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    /* Account for iOS safe areas */
    padding-top: max(2rem, env(safe-area-inset-top));
    padding-bottom: max(2rem, calc(env(safe-area-inset-bottom) + 60px));
    position: relative;
}

.login-card {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 420px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .login-card {
    background-color: rgba(42, 42, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    width: 100%;
}

.main-content {
    flex: 1;
    padding: 2rem;
    /* Space for Umbral footer + iOS home bar */
    padding-bottom: max(80px, calc(80px + env(safe-area-inset-bottom)));
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    /* NO BACKGROUND - cards sit directly on gradient */
}

.container-fluid {
    max-width: 100%;
    padding-left: 2rem;
    padding-right: 2rem;
}

/* Responsive Breakpoints */
@media (min-width: 1200px) {
    .container-fluid {
        padding-left: 3rem;
        padding-right: 3rem;
    }
}

@media (min-width: 1440px) {
    .container-fluid {
        padding-left: 4rem;
        padding-right: 4rem;
    }
}

@media (min-width: 1920px) {
    .container-fluid {
        padding-left: 5rem;
        padding-right: 5rem;
    }
}

/* Mobile Optimizations - All Mobile Devices */
@media (max-width: 767.98px) {
    /* Prevent horizontal overflow globally */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
    }
    
    .main-content {
        padding: 0.5rem;
        margin-left: 0 !important;
        margin-top: 0;
        padding-top: 4.5rem;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: visible;
        box-sizing: border-box;
    }
    
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        max-width: 100%;
        width: 100%;
        overflow-x: hidden; /* Prevent horizontal overflow */
    }
    
    /* Ensure payroll section stats cards fit */
    #payrollSection .row {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
        width: 100%;
    }
    
    #payrollSection .row > [class*="col-"] {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .stat-card {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    /* Make tables scrollable horizontally - but don't exceed viewport */
    .table-responsive {
        margin: 0;
        padding: 0;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        font-size: 0.813rem;
        min-width: auto; /* Remove fixed min-width to prevent overflow */
        width: 100%;
        max-width: 100%;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    /* Buttons */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .btn-group {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.25rem;
    }
    
    /* Typography */
    h2, .h3 {
        font-size: 1.5rem;
    }
    
    h4 {
        font-size: 1.25rem;
    }
    
    h5 {
        font-size: 1.1rem;
    }
    
    /* Cards */
    .card {
        margin-bottom: 1rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .card-body {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Modals */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 0.75rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Dashboard content */
    .dashboard-content {
        grid-template-columns: 1fr;
    }
    
    /* Forms */
    .form-control,
    .form-select {
        padding: 0.625rem 0.875rem;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .form-label {
        font-size: 0.9rem;
    }
}

/* Dashboard Grid - ALWAYS 3 columns on desktop, scales with monitor */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Override for mobile only */
@media (max-width: 767.98px) {
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    .dashboard-content {
        margin-top: 1.5rem !important;
    }
}

.dashboard-stats.cards-5 {
    grid-template-columns: repeat(auto-fit, minmax(240px, 300px));
    justify-content: center;
}

.dashboard-stats.cards-6 {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* Browser support for :has() - progressive enhancement */
@supports selector(:has(*)) {
    /* When there are 3 cards, ensure they don't stretch too much */
    .dashboard-stats:has(.stat-card:nth-child(3):last-child) {
        grid-template-columns: repeat(auto-fit, minmax(240px, 320px));
        justify-content: center;
    }

    /* When there's only 1 card, center it and limit width */
    .dashboard-stats:has(.stat-card:only-child) {
        grid-template-columns: 1fr;
        max-width: 380px;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* 5 cards */
    .dashboard-stats:has(.stat-card:nth-child(5):last-child) {
        grid-template-columns: repeat(auto-fit, minmax(240px, 300px));
        justify-content: center;
    }
}

.dashboard-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 2rem;
}

@media (min-width: 992px) {
    .dashboard-content {
        grid-template-columns: 2fr 1fr;
    }
}

/* Sidebar Navigation */
.sidebar-vertical {
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100vh;
}

.sidebar-logo {
    padding: 2rem;
    display: flex;
    align-items: center;
    flex-direction: column;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.5rem;
}

.sidebar-logo .fw-bold {
    font-size: 1.5rem;
}

.sidebar-menu {
    padding: 1rem 0;
    flex: 1;
}

.sidebar-menu .nav-link {
    color: var(--text-secondary);
    border-radius: 6px;
    margin: 0.25rem 1rem;
    padding: 0.75rem 1.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
}

.sidebar-menu .nav-link:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.sidebar-menu .nav-link.active {
    background-color: rgba(var(--accent-rgb), 0.1);
    color: var(--accent);
}

.sidebar-bottom {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.sidebar-icon-btn {
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.sidebar-icon-btn:hover {
    color: var(--accent);
    background-color: var(--bg-primary);
    text-decoration: none;
}

.sidebar-icon-btn span {
    margin-left: 0.5rem;
}

/* Mobile - Small phones (up to 575px) */
@media (max-width: 575.98px) {
    .sidebar-vertical {
        position: fixed;
        top: 0;
        left: -100%;
        width: 90%;
        max-width: 280px;
        height: 100vh;
        z-index: 1050;
        flex-direction: column;
        transition: left 0.3s ease;
    }
    
    .sidebar-vertical.active {
        left: 0;
    }

    .sidebar-logo {
        padding: 1.5rem 1rem;
        flex-direction: column;
    }

    .sidebar-menu {
        display: flex;
        flex-direction: column;
    }

    .sidebar-bottom {
        margin-top: auto;
        padding: 1rem;
        border-top: 1px solid var(--border-color);
    }
    
    .stat-card {
        padding: 0.85rem 0.65rem;
        min-height: 80px;
    }
    
    .stat-value {
        font-size: 1.15rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
        line-height: 1.3;
    }
    
    /* Improve touch targets on mobile */
    .stat-card-header {
        -webkit-tap-highlight-color: rgba(0, 123, 255, 0.2);
        min-height: 80px;
    }
    
    /* Dashboard grid on mobile */
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.65rem;
    }
    
    /* Customize dashboard button on mobile */
    .d-flex.justify-content-end.mb-3 {
        justify-content: center !important;
        margin-bottom: 1rem !important;
    }
    
    .d-flex.justify-content-end.mb-3 .btn {
        width: 100%;
        max-width: 300px;
    }
    
    /* Expandable stat cards on mobile */
    .stat-card-expandable .stat-card-header {
        padding: 1rem 0.75rem;
        min-height: 80px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .stat-card-expandable .stat-value {
        font-size: 1.15rem;
    }
    
    .stat-card-expandable .stat-label {
        font-size: 0.7rem;
        padding-right: 1.5rem;
    }
    
    .expand-icon {
        top: 0.75rem;
        right: 0.6rem;
        font-size: 1rem;
        padding: 0.5rem;
    }
}

/* Mobile - Standard phones (576px to 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .sidebar-vertical {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 300px;
        height: 100vh;
        z-index: 1050;
        flex-direction: column;
        transition: left 0.3s ease;
    }
    
    .sidebar-vertical.active {
        left: 0;
    }

    .sidebar-logo {
        padding: 1.5rem 1rem;
        flex-direction: column;
    }

    .sidebar-menu {
        display: flex;
        flex-direction: column;
    }

    .sidebar-bottom {
        margin-top: auto;
        padding: 1rem;
        border-top: 1px solid var(--border-color);
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* Better stat card sizing for medium phones */
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.6rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
}

/* Tablets and Small Laptops (768px to 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .dashboard-stats {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
        gap: 0.85rem;
    }
    
    .stat-card {
        padding: 0.9rem 0.7rem;
        min-height: 110px;
    }
    
    .stat-value {
        font-size: 1.3rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .sidebar-vertical {
        position: fixed;
        top: 0;
        left: 0;
        width: 240px;
        height: 100vh;
        z-index: 1030;
    }

    .sidebar-toggle {
        display: none;
    }
    
    .main-content {
        margin-left: 240px;
        padding: 1.5rem;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .container-fluid {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    .sidebar-menu .nav-link {
        padding: 0.65rem 1rem;
        font-size: 0.95rem;
    }
    
    .sidebar-menu .nav-link i {
        width: 20px;
    }
}

/* Desktop - Standard (992px to 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .sidebar-vertical {
        position: fixed;
        top: 0;
        left: 0;
        width: 260px;
        height: 100vh;
        z-index: 1030;
    }

    .sidebar-toggle {
        display: none;
    }
    
    .main-content {
        margin-left: 260px;
        padding: 2rem;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        max-width: 1600px;
    }
    
    /* With 3 cards, limit max width */
    .dashboard-stats.cards-3 {
        grid-template-columns: repeat(auto-fit, minmax(280px, 380px));
    }
    
    .dashboard-stats.cards-5 {
        grid-template-columns: repeat(auto-fit, minmax(280px, 360px));
    }
    
    @supports selector(:has(*)) {
        .dashboard-stats:has(.stat-card:nth-child(3):last-child) {
            grid-template-columns: repeat(auto-fit, minmax(280px, 380px));
        }
        .dashboard-stats:has(.stat-card:nth-child(5):last-child) {
            grid-template-columns: repeat(auto-fit, minmax(280px, 360px));
        }
    }
    
    .container-fluid {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Desktop - Large (1200px to 1439px) */
@media (min-width: 1200px) and (max-width: 1439.98px) {
    .sidebar-vertical {
        position: fixed;
        top: 0;
        left: 0;
        width: var(--sidebar-width);
        height: 100vh;
        z-index: 1030;
    }

    .sidebar-toggle {
        display: none;
    }
    
    .main-content {
        margin-left: var(--sidebar-width);
        padding: 2rem 2.5rem;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
        max-width: 1600px;
    }
    
    /* With 3 cards, limit max width */
    .dashboard-stats.cards-3 {
        grid-template-columns: repeat(auto-fit, minmax(300px, 400px));
    }
    
    .dashboard-stats.cards-5 {
        grid-template-columns: repeat(auto-fit, minmax(300px, 380px));
    }
    
    @supports selector(:has(*)) {
        .dashboard-stats:has(.stat-card:nth-child(3):last-child) {
            grid-template-columns: repeat(auto-fit, minmax(300px, 400px));
        }
        .dashboard-stats:has(.stat-card:nth-child(5):last-child) {
            grid-template-columns: repeat(auto-fit, minmax(300px, 380px));
        }
    }
    
    .container-fluid {
        padding-left: 2.5rem;
        padding-right: 2.5rem;
        max-width: 1400px;
    }
}

/* Desktop - Extra Large (1440px and up) */
/* MacBook Air and small laptops (1200px - 1439px) */
@media (min-width: 1200px) and (max-width: 1439px) {
    .sidebar-vertical {
        position: fixed;
        top: 0;
        left: 0;
        width: 260px;
        height: 100vh;
        z-index: 1030;
    }

    .sidebar-toggle {
        display: none;
    }
    
    .main-content {
        margin-left: 260px;
        padding: 1.5rem 2rem;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
        max-width: 100%;
    }
    
    .dashboard-stats.cards-1,
    .dashboard-stats.cards-2 {
        grid-template-columns: repeat(2, 1fr);
        max-width: 700px;
    }
    
    .dashboard-stats.cards-4,
    .dashboard-stats.cards-5,
    .dashboard-stats.cards-6 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stat-card {
        padding: 1.25rem;
        min-height: 130px;
    }
    
    .container-fluid {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    .card {
        margin-bottom: 1.25rem;
    }
}

@media (min-width: 1440px) {
    .sidebar-vertical {
        position: fixed;
        top: 0;
        left: 0;
        width: var(--sidebar-width);
        height: 100vh;
        z-index: 1030;
    }

    .sidebar-toggle {
        display: none;
    }
    
    .main-content {
        margin-left: var(--sidebar-width);
        padding: 2.5rem 3rem;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 2rem;
        max-width: 1800px;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* With 3 cards, limit max width for better appearance */
    .dashboard-stats.cards-3 {
        grid-template-columns: repeat(auto-fit, minmax(320px, 450px));
    }
    
    /* With 5 cards, ensure they wrap nicely */
    .dashboard-stats.cards-5 {
        grid-template-columns: repeat(auto-fit, minmax(320px, 400px));
    }
    
    @supports selector(:has(*)) {
        .dashboard-stats:has(.stat-card:nth-child(3):last-child) {
            grid-template-columns: repeat(auto-fit, minmax(320px, 450px));
        }
        .dashboard-stats:has(.stat-card:nth-child(5):last-child) {
            grid-template-columns: repeat(auto-fit, minmax(320px, 400px));
        }
    }
    
    .stat-card {
        padding: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .container-fluid {
        padding-left: 3rem;
        padding-right: 3rem;
        max-width: 1600px;
        margin: 0 auto;
    }
    
    .card {
        transition: all 0.3s ease;
    }
    
    .card:hover {
        transform: translateY(-2px);
    }
}

/* Ultra-wide monitors (1920px and up) */
@media (min-width: 1920px) {
    .container-fluid {
        max-width: 1800px;
        padding-left: 4rem;
        padding-right: 4rem;
    }
    
    .dashboard-stats {
        gap: 2.5rem;
        grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    }
    
    /* With 3 cards on ultra-wide, keep them reasonable */
    .dashboard-stats.cards-3 {
        grid-template-columns: repeat(auto-fit, minmax(340px, 480px));
    }
    
    /* With 5 cards on ultra-wide */
    .dashboard-stats.cards-5 {
        grid-template-columns: repeat(auto-fit, minmax(340px, 420px));
    }
    
    @supports selector(:has(*)) {
        .dashboard-stats:has(.stat-card:nth-child(3):last-child) {
            grid-template-columns: repeat(auto-fit, minmax(340px, 480px));
        }
        .dashboard-stats:has(.stat-card:nth-child(5):last-child) {
            grid-template-columns: repeat(auto-fit, minmax(340px, 420px));
        }
    }
    
    .main-content {
        padding: 3rem 4rem;
    }
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 1.5rem;
    transition: box-shadow 0.3s ease;
    height: 100%;
    color: var(--text-primary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-body {
    flex: 1;
}

.card-footer,
.card .btn-group,
.card .text-end {
    margin-top: auto;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 24px 24px 0 0;
    color: var(--text-primary);
}

.card-body {
    padding: 1.5rem;
    color: var(--text-primary);
}

.card-title {
    color: var(--text-primary);
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Tables */
.table {
    width: 100%;
    margin-bottom: 1rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.table th {
    font-weight: 600;
    padding: 1rem;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    white-space: nowrap;
}

/* Teal table headers in dark mode for better visibility */
[data-theme="dark"] .table th {
    background-color: #00b8a5;
    color: #ffffff;
}

/* Make table header teal color stretch across entire section */
/* Target the card-body that contains only the table */
#payrollSection .card > .card-body {
    padding: 0 !important;
}

#payrollSection .table-responsive {
    margin: 0;
    padding: 0;
    border-radius: 0;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
}

#payrollSection .table {
    margin: 0;
    border-radius: 0;
    width: 100%;
    table-layout: auto;
    min-width: 100%;
}

/* Make thead extend to full width of card */
#payrollSection .table thead {
    display: table-header-group;
    width: 100%;
}

#payrollSection .table thead tr {
    display: table-row;
    width: 100%;
}

#payrollSection .table thead th {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    display: table-cell;
    background-color: #0dcaf0 !important;
    color: #000 !important;
    border: none !important;
}

#payrollSection .table tbody td {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/* Ensure card has proper border radius only on outer edges */
#payrollSection .card {
    overflow: hidden;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    background-color: var(--card-bg);
}

.table tbody tr:hover td {
    background-color: var(--bg-secondary);
}

/* Table Responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0.25rem;
    width: 100%;
    border-radius: inherit;
}

/* Specific styling for payroll section table */
#payrollSection .table-responsive {
    padding: 0.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#payrollSection .table-responsive::-webkit-scrollbar {
    height: 8px;
}

#payrollSection .table-responsive::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

#payrollSection .table-responsive::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

#payrollSection .table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Better spacing for payroll section cards on desktop */
@media (min-width: 768px) {
    /* Keep table card with no padding */
    #payrollSection .card > .card-body {
        padding: 0 !important;
    }
    
    #payrollSection .table-responsive {
        padding: 0;
    }
    
    /* Stat cards in payroll section */
    #payrollSection .row.mb-4 .card-body.text-center {
        padding: 1.5rem 1rem;
        min-height: 120px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    #payrollSection .row.mb-4 .card-body.text-center h6 {
        margin-bottom: 0.75rem;
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--text-secondary);
    }
    
    #payrollSection .row.mb-4 .card-body.text-center h4 {
        font-size: 1.75rem;
        font-weight: 700;
        margin-bottom: 0;
        color: var(--text-primary);
    }
}

/* Wider screens - give more room to columns */
@media (min-width: 1200px) {
    #timeEntriesTable th:nth-child(1),
    #timeEntriesTable td:nth-child(1) {
        width: 130px; /* Date */
    }
    
    #timeEntriesTable th:nth-child(2):not(:last-child),
    #timeEntriesTable td:nth-child(2):not(:last-child) {
        width: 180px; /* Technician name */
    }
    
    #timeEntriesTable th:nth-child(3),
    #timeEntriesTable td:nth-child(3) {
        min-width: 180px; /* Job Type */
    }
    
    #timeEntriesTable th.text-end,
    #timeEntriesTable td.text-end {
        width: 110px; /* Hours, Rate, Pay columns */
    }
    
    .notes-cell {
        min-width: 250px;
        max-width: 450px;
    }
    
    #timeEntriesTable th:last-child,
    #timeEntriesTable td:last-child {
        width: 150px; /* Actions column */
    }
}

/* Extra wide screens - even more room */
@media (min-width: 1440px) {
    #timeEntriesTable th:nth-child(1),
    #timeEntriesTable td:nth-child(1) {
        width: 140px; /* Date */
    }
    
    #timeEntriesTable th:nth-child(2):not(:last-child),
    #timeEntriesTable td:nth-child(2):not(:last-child) {
        width: 200px; /* Technician name */
    }
    
    #timeEntriesTable th:nth-child(3),
    #timeEntriesTable td:nth-child(3) {
        min-width: 200px; /* Job Type */
    }
    
    #timeEntriesTable th.text-end,
    #timeEntriesTable td.text-end {
        width: 120px; /* Hours, Rate, Pay columns */
    }
    
    .notes-cell {
        min-width: 300px;
        max-width: 500px;
    }
    
    #timeEntriesTable th:last-child,
    #timeEntriesTable td:last-child {
        width: 160px; /* Actions column */
    }
}

/* Time Entries Table Column Alignment */
#timeEntriesTable {
    table-layout: auto;
    width: 100%;
    font-size: 0.95rem;
}

/* Better spacing for table cells */
#timeEntriesTable th,
#timeEntriesTable td {
    padding: 1rem 1rem;
    vertical-align: middle;
    line-height: 1.5;
    white-space: nowrap;
}

#timeEntriesTable thead th {
    padding-top: 1rem;
    padding-bottom: 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

#timeEntriesTable th:nth-child(1),
#timeEntriesTable td:nth-child(1) {
    width: 120px; /* Date */
    padding-left: 1.25rem;
}

/* Admin view has Technician column as 2nd column */
#timeEntriesTable th:nth-child(2):not(:last-child),
#timeEntriesTable td:nth-child(2):not(:last-child) {
    width: 160px; /* Technician name */
}

/* Job Type column - allow wrapping but keep readable */
#timeEntriesTable th:nth-child(3),
#timeEntriesTable td:nth-child(3) {
    width: auto; /* Job Type - flexible */
    min-width: 150px;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    white-space: normal !important; /* Allow wrapping for job type */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#timeEntriesTable td:nth-child(3) .badge {
    display: inline-block;
    white-space: nowrap;
    margin-right: 0.25rem;
}

#timeEntriesTable th.text-end,
#timeEntriesTable td.text-end {
    width: 100px; /* Hours, Rate, Pay columns */
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    text-align: right;
}

.notes-cell {
    width: auto; /* Notes column - flexible to accommodate title text */
    min-width: 200px;
    max-width: 400px;
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#timeEntriesTable th:last-child,
#timeEntriesTable td:last-child {
    width: 140px; /* Actions column */
    padding-right: 1.25rem;
    white-space: nowrap;
}

/* Month and Week header rows - ensure proper alignment */
#timeEntriesTable .table-primary td,
#timeEntriesTable .table-secondary td {
    padding: 0.85rem 1rem;
    font-weight: 600;
}

/* Better button spacing in actions column */
#timeEntriesTable td:last-child .btn-group {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

#timeEntriesTable td:last-child .btn {
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    white-space: nowrap;
    flex-shrink: 0;
}

#timeEntriesTable td:last-child .btn i {
    font-size: 0.875rem;
}

/* Add subtle row borders for better separation */
#timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) {
    border-bottom: 1px solid var(--border-color);
}

#timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary):hover {
    background-color: var(--bg-secondary);
}

/* Better spacing for data rows */
#timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td {
    padding-top: 1.1rem;
    padding-bottom: 1.1rem;
}

/* Notes Button Styling */
.btn-notes {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: rgba(13, 110, 253, 0.1);
    border: 1px solid rgba(13, 110, 253, 0.3);
    color: #0d6efd;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
    font-size: 0.9rem;
}

[data-theme="dark"] .btn-notes {
    background-color: rgba(13, 110, 253, 0.15);
    border-color: rgba(13, 110, 253, 0.4);
    color: #6ea8fe;
}

.btn-notes:hover {
    background-color: rgba(13, 110, 253, 0.2);
    border-color: rgba(13, 110, 253, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .btn-notes:hover {
    background-color: rgba(13, 110, 253, 0.25);
    border-color: rgba(13, 110, 253, 0.6);
}

.btn-notes i {
    flex-shrink: 0;
    font-size: 0.875rem;
}

.notes-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

/* Mobile Table Optimizations - Card-based layout for better UX */
@media (max-width: 768px) {
    /* Ensure payroll section fits screen */
    #payrollSection {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }
    
    #payrollSection .card {
        margin-left: 0;
        margin-right: 0;
        border-left: none;
        border-right: none;
        border-radius: 0;
    }
    
    /* Table card should have no padding to allow header to extend full width */
    #payrollSection .card > .card-body {
        padding: 0 !important;
    }
    
    /* Other card-bodies in payroll section (like stat cards) keep their padding */
    #payrollSection .row.mb-4 .card-body {
        padding: 0.75rem;
    }
    
    /* Remove table-responsive padding that causes overflow */
    #payrollSection .table-responsive {
        margin: 0;
        padding: 0;
        overflow-x: visible;
        width: 100%;
        max-width: 100%;
    }
    
    /* Ensure table fits container */
    #timeEntriesTable {
        width: 100%;
        max-width: 100%;
        margin: 0;
        table-layout: auto;
    }
    
    /* Hide table headers on mobile - we'll use card layout instead */
    #timeEntriesTable thead {
        display: none;
    }
    
    /* Convert table rows to cards on mobile */
    #timeEntriesTable tbody tr {
        display: block;
        width: 100%;
        max-width: 100%;
        margin-bottom: 1rem;
        margin-left: 0;
        margin-right: 0;
        background-color: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 0.75rem;
        box-shadow: var(--shadow-sm);
        box-sizing: border-box;
    }
    
    /* Month/Week headers - keep as full-width banners */
    #timeEntriesTable tbody tr.table-primary,
    #timeEntriesTable tbody tr.table-secondary {
        display: block;
        width: 100%;
        max-width: 100%;
        background-color: var(--bg-secondary);
        border-radius: 0;
        padding: 0.75rem 0.5rem;
        margin-bottom: 0.5rem;
        margin-left: 0;
        margin-right: 0;
        box-shadow: none;
        box-sizing: border-box;
    }
    
    #timeEntriesTable tbody tr.table-primary td,
    #timeEntriesTable tbody tr.table-secondary td {
        display: block;
        width: 100%;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        font-weight: 600;
        text-align: left;
    }
    
    #timeEntriesTable tbody tr.table-primary td:first-child,
    #timeEntriesTable tbody tr.table-secondary td:first-child {
        font-size: 0.9rem;
        padding-bottom: 0.25rem;
    }
    
    /* Regular entry rows - card layout */
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td {
        display: block;
        width: 100%;
        max-width: 100%;
        padding: 0.5rem 0;
        border: none;
        text-align: left !important;
        box-sizing: border-box;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Date row - prominent at top */
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:first-child {
        font-size: 1rem;
        font-weight: 600;
        color: var(--accent);
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 0.5rem;
    }
    
    /* Technician name (admin only) */
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:nth-child(2):not(:last-child) {
        font-size: 0.9rem;
        font-weight: 500;
        color: var(--text-secondary);
        padding-bottom: 0.25rem;
    }
    
    /* Job type - with icon */
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:nth-child(3) {
        font-size: 0.95rem;
        font-weight: 500;
        padding: 0.5rem 0;
    }
    
    /* Hours, Rate, Pay - stacked on mobile for better fit */
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:nth-child(4),
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:nth-child(5),
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:nth-child(6) {
        display: block;
        width: 100%;
        padding: 0.4rem 0;
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }
    
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:nth-child(6) {
        margin-bottom: 0;
    }
    
    /* Hours label */
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:nth-child(4)::before {
        content: "Hours: ";
        color: var(--text-muted);
        font-weight: normal;
    }
    
    /* Rate label */
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:nth-child(5)::before {
        content: "Rate: ";
        color: var(--text-muted);
        font-weight: normal;
    }
    
    /* Pay - prominent */
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:nth-child(6) {
        font-weight: 600;
        color: var(--accent);
        font-size: 1rem;
    }
    
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:nth-child(6)::before {
        content: "Pay: ";
        color: var(--text-muted);
        font-weight: normal;
    }
    
    /* Notes cell - full width */
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td.notes-cell {
        padding: 0.75rem 0 0.5rem 0;
        border-top: 1px solid var(--border-color);
        margin-top: 0.5rem;
    }
    
    .btn-notes {
        width: 100%;
        max-width: 100%;
        justify-content: center;
        padding: 0.5rem;
        font-size: 0.85rem;
        box-sizing: border-box;
    }
    
    /* Actions - full width button row */
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:last-child {
        padding: 0.75rem 0 0 0;
        border-top: 1px solid var(--border-color);
        margin-top: 0.5rem;
        width: 100%;
        max-width: 100%;
    }
    
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:last-child .btn-group {
        width: 100%;
        max-width: 100%;
        display: flex;
        gap: 0.5rem;
        box-sizing: border-box;
    }
    
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:last-child .btn {
        flex: 1;
        min-width: 0;
        padding: 0.5rem;
        font-size: 0.85rem;
        box-sizing: border-box;
    }
    
    /* Hide empty cells */
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:empty {
        display: none;
    }
    
    /* Better spacing for card layout */
    #timeEntriesTable tbody {
        display: block;
        width: 100%;
        max-width: 100%;
    }
    
    /* Ensure no horizontal overflow */
    #timeEntriesTable tbody tr {
        overflow: hidden;
    }
    
    /* Empty state */
    #timeEntriesTable tbody tr td[colspan] {
        display: block;
        width: 100%;
        max-width: 100%;
        text-align: center;
        padding: 2rem 1rem;
        color: var(--text-muted);
        box-sizing: border-box;
    }
    
    /* Remove table wrapper constraints on mobile */
    .table-responsive {
        overflow-x: visible;
        margin: 0;
        padding: 0;
        width: 100%;
        max-width: 100%;
    }
    
    /* Fix header row on mobile */
    #payrollSection .row.mb-4 {
        margin-left: 0;
        margin-right: 0;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    #payrollSection .row.mb-4 > [class*="col-"] {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Ensure buttons fit */
    #payrollSection .btn-group {
        width: 100%;
        max-width: 100%;
    }
    
    #payrollSection .btn-group .btn {
        flex: 1;
        min-width: 0;
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Extra small mobile devices - even more compact */
@media (max-width: 480px) {
    .main-content {
        padding: 0.25rem;
    }
    
    .container-fluid {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    
    /* Table card should have no padding to allow header to extend full width */
    #payrollSection .card > .card-body {
        padding: 0 !important;
    }
    
    /* Other card-bodies in payroll section (like stat cards) keep their padding */
    #payrollSection .row.mb-4 .card-body {
        padding: 0.5rem;
    }
    
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) {
        padding: 0.75rem 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:first-child {
        font-size: 0.9rem;
        padding-bottom: 0.5rem;
    }
    
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:nth-child(4),
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:nth-child(5),
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:nth-child(6) {
        font-size: 0.85rem;
        padding: 0.3rem 0;
    }
    
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:nth-child(6) {
        font-size: 0.95rem;
    }
    
    .btn-notes {
        font-size: 0.8rem;
        padding: 0.4rem;
    }
    
    #timeEntriesTable tbody tr:not(.table-primary):not(.table-secondary) td:last-child .btn {
        font-size: 0.8rem;
        padding: 0.4rem;
    }
    
    /* Button groups on mobile */
    .btn-group {
        flex-direction: column;
        width: 100%;
        max-width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        max-width: 100%;
        margin-bottom: 0.5rem;
        box-sizing: border-box;
    }
    
    .btn-group .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Stats cards on very small screens */
    #payrollSection .row.mb-4 .col-md-3 {
        margin-bottom: 0.5rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Prevent all rows from exceeding viewport */
    .row {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    .row > [class*="col-"] {
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* Table Status Badges */
.table .badge {
    padding: 0.5em 0.75em;
    font-weight: 500;
}

.badge.bg-success {
    background-color: var(--success) !important;
    color: #ffffff;
}

.badge.bg-danger {
    background-color: var(--danger) !important;
    color: #ffffff;
}

/* Table Action Buttons */
.btn-group {
    display: inline-flex;
    gap: 0.25rem;
}

.btn-action {
    padding: 0.5rem;
    line-height: 1;
    border-radius: 4px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.btn-action i {
    font-size: 0.875rem;
}

.btn-edit {
    color: var(--accent);
    background-color: rgba(var(--accent-rgb), 0.1);
}

.btn-pause {
    color: var(--warning);
    background-color: rgba(245, 158, 11, 0.1);
}

.btn-delete {
    color: var(--danger);
    background-color: rgba(220, 53, 69, 0.1);
}

.btn-action:hover {
    opacity: 0.8;
}

/* Table Alignment */
.table td.text-end {
    text-align: right;
}

.table td.text-center {
    text-align: center;
}

.table th:last-child {
    text-align: right;
    min-width: 120px;
}

/* Job Types List */
.table ul.list-unstyled {
    margin: 0;
    padding: 0;
    list-style: none;
}

.table ul.list-unstyled li {
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.table ul.list-unstyled li:last-child {
    margin-bottom: 0;
}

/* Buttons */
.btn {
    border-radius: 6px;
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-outline-primary {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-outline-primary:hover {
    background-color: var(--accent);
    color: #ffffff;
}

/* Forms */
.form-control, .form-select {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* Badges */
.badge {
    padding: 0.5em 0.75em;
    font-size: 0.875em;
    font-weight: 500;
    border-radius: 4px;
}

.badge.bg-success {
    background-color: var(--success) !important;
    color: #ffffff;
}

.badge.bg-danger {
    background-color: var(--danger) !important;
    color: #ffffff;
}

/* Modals */
.modal-content {
    background-color: var(--modal-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    border-radius: 12px 12px 0 0;
    padding: 1.25rem;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.25rem;
    color: var(--text-primary);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    border-radius: 0 0 12px 12px;
    padding: 1.25rem;
}

/* Modal Styles */
.modal-content {
    background-color: var(--modal-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

/* Job Type Entry Styles */
.job-type-entry {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.job-type-entry:last-child {
    margin-bottom: 0;
}

.job-type-entry .input-group {
    gap: 0.5rem;
}

.job-type-entry .form-control {
    background-color: var(--input-bg);
}

.job-type-entry .btn-outline-danger {
    border-color: var(--border-color);
    color: var(--danger);
    padding: 0.375rem 0.75rem;
}

.job-type-entry .btn-outline-danger:hover {
    background-color: var(--danger);
    border-color: var(--danger);
    color: #ffffff;
}

/* Add Job Type Button */
.add-job-type-btn {
    margin-bottom: 1rem;
    width: 100%;
    padding: 0.75rem;
    border: 1px dashed var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--accent);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.add-job-type-btn:hover {
    background-color: var(--bg-primary);
    border-color: var(--accent);
    color: var(--accent);
}

/* Form Group Spacing */
.modal .form-label {
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
}

.modal .form-control {
    padding: 0.75rem 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
}

.modal .form-control::placeholder {
    color: var(--text-muted);
}

.modal .mb-3 {
    margin-bottom: 1.5rem !important;
}

.modal .modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Rate Input Specific */
.rate-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rate-input-group .input-group-text {
    background-color: var(--bg-secondary);
    border-color: var(--input-border);
    color: var(--text-primary);
}

.rate-input {
    width: 120px !important;
}

/* Responsive Design */
/* Ensure proper layout structure for all desktop sizes */
@media (min-width: 768px) {
    .app-container {
        flex-direction: row;
    }
    
    .dashboard-content {
        grid-template-columns: 2fr 1fr;
    }
    
    /* Better form layouts on desktop */
    .row {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
    }
    
    .row > [class*="col-"] {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Optimize dashboard layout for larger screens */
@media (min-width: 992px) {
    .dashboard-content {
        grid-template-columns: 2.5fr 1fr;
        gap: 2rem;
        margin-top: 2.5rem;
    }
}

/* Enhanced layouts for extra large screens */
@media (min-width: 1440px) {
    .dashboard-content {
        grid-template-columns: 3fr 1fr;
        margin-top: 3rem;
    }
    
    .table th,
    .table td {
        padding: 1.25rem;
    }
}

/* Card expand/collapse animation */
@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 400px;
    }
}

/* Stats Cards */
.stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: clamp(1rem, 2vw, 2rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: clamp(120px, 15vh, 160px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
}

/* Clickable stat cards */
.stat-card-clickable {
    cursor: pointer;
    position: relative;
}

.stat-card[style*="cursor: pointer"],
.stat-card > div[style*="cursor: pointer"] {
    cursor: pointer;
    position: relative;
}

.stat-card > div[style*="cursor: pointer"]::after {
    content: '';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M12 5l7 7-7 7'/%3E%3C/svg%3E");
    background-size: contain;
    opacity: 0.3;
}


.stat-value {
    font-size: clamp(1.25rem, 2.5vw, 2rem);
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    max-width: 100%;
}

.stat-label {
    color: var(--text-secondary);
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Expandable Stat Cards */
.stat-card-expandable {
    padding: 0;
    overflow: hidden;
    min-height: auto;
    display: block;
    text-align: left;
}

.stat-card-header {
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.stat-card-header:active {
    background-color: var(--bg-secondary);
    opacity: 0.9;
}

.expand-icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.stat-card-details {
    border-top: 1px solid var(--border-color);
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
    animation: slideDown 0.3s ease-out;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.stat-card-details::-webkit-scrollbar {
    width: 8px;
}

.stat-card-details::-webkit-scrollbar-track {
    background: transparent;
}

.stat-card-details::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.stat-card-details::-webkit-scrollbar-thumb:hover {
    background-color: var(--accent);
}


/* Technician Breakdown List */
.tech-breakdown-list {
    padding: 0.75rem;
}

.tech-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 0.65rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.tech-breakdown-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.tech-breakdown-item.inactive {
    opacity: 0.6;
}

.tech-name {
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.tech-stats {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}

.tech-hours {
    color: var(--text-secondary);
    font-size: 0.85rem;
    min-width: 80px;
    text-align: right;
    white-space: nowrap;
}

.tech-pay {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 90px;
    text-align: right;
    white-space: nowrap;
}

/* Technician Breakdown Total Row */
.tech-breakdown-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-top: 0.5rem;
    border-top: 2px solid var(--accent);
    background-color: rgba(var(--accent-rgb), 0.05);
    border-radius: 6px;
}

.tech-breakdown-total .tech-name {
    color: var(--text-primary);
    font-size: 1rem;
}

.tech-breakdown-total .tech-hours,
.tech-breakdown-total .tech-pay {
    font-size: 1rem;
    color: var(--text-primary);
}

.tech-breakdown-total .tech-pay {
    color: var(--accent);
}

/* Mobile adjustments for tech breakdown */
@media (max-width: 768px) {
    .tech-breakdown-list {
        padding: 0.5rem;
    }
    
    .tech-breakdown-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.65rem 0.75rem;
    }
    
    .tech-name {
        font-size: 0.85rem;
        margin-bottom: 0.4rem;
    }
    
    .tech-stats {
        width: 100%;
        justify-content: space-between;
        padding-top: 0.4rem;
        border-top: 1px solid var(--border-color);
        gap: 0.5rem;
    }
    
    .tech-hours,
    .tech-pay {
        font-size: 0.8rem;
    }
    
    .tech-breakdown-total {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.65rem 0.85rem;
    }
    
    .tech-breakdown-total .tech-name {
        margin-bottom: 0.4rem;
        font-size: 0.9rem;
    }
    
    .tech-breakdown-total .tech-stats {
        width: 100%;
        padding-top: 0.4rem;
    }
    
    .tech-breakdown-total .tech-hours,
    .tech-breakdown-total .tech-pay {
        font-size: 0.9rem;
    }
    
    /* Stat card details scrolling on mobile */
    .stat-card-details {
        max-height: 250px;
    }
    
    /* Dashboard customize modal on mobile */
    #customizeDashboardModal .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    #dashboardStatsOptions .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .stat-option {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .stat-option .form-check-label {
        font-size: 0.95rem;
    }
}

/* Icons */
.fa-2x {
    font-size: 1.5rem;
}

/* Job Type Entry */
.job-type-entry {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Utility Classes */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gap-2 {
    gap: 0.5rem;
} 

/* Content Sections */
.content-section {
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    margin: 1rem;
}

[data-theme="dark"] .content-section {
    background: rgba(26, 26, 26, 0.95);
}

/* Grid Spacing */
.row {
    margin-left: -1rem;
    margin-right: -1rem;
}

.row > [class*="col-"] {
    padding-left: 1rem;
    padding-right: 1rem;
}

.g-4 {
    --bs-gutter-x: 2rem;
    --bs-gutter-y: 2rem;
} 

/* Reports Section */
#reportsSection .row {
    margin: 0;
    width: 100%;
}

#reportContent {
    display: grid;
    gap: 1.5rem;
}

/* Ensure payroll report content matches container width */
#payrollReportContent {
    width: 100%;
    max-width: 100%;
}

#payrollReportContent .card {
    width: 100%;
    max-width: 100%;
}

@media (min-width: 992px) {
    #reportsSection .col-md-6 {
        max-width: 800px;
    }
}

/* Technicians Section */
#techniciansSection .card {
    width: 100%;
}

/* Time Entries Section */
#payrollSection .row {
    margin: 0;
    width: 100%;
}

.stat-card {
    padding: 1.5rem;
    text-align: center;
    border-radius: 8px;
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
}

/* Sidebar Improvements */
.sidebar-vertical {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1030;
}

@media (max-width: 768px) {
    .sidebar-vertical {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 300px;
        height: 100vh;
        height: -webkit-fill-available;
        z-index: 1050;
        transition: left 0.3s ease;
        box-shadow: none;
        /* iOS safe area support */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .sidebar-vertical.active {
        left: 0;
        box-shadow: var(--shadow-lg);
    }
    
    .sidebar-toggle {
        position: fixed;
        /* Position below notch/Dynamic Island on iOS */
        top: max(1rem, calc(env(safe-area-inset-top) + 0.5rem));
        left: max(1rem, calc(env(safe-area-inset-left) + 1rem));
        z-index: 1040;
        width: 48px;
        height: 48px;
        border-radius: 8px;
        background: var(--accent);
        color: white;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: var(--shadow-md);
        transition: all 0.2s ease;
    }
    
    .sidebar-toggle:hover {
        background: var(--accent-hover);
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        height: -webkit-fill-available;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1045;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

/* Hide mobile-specific elements on desktop */
@media (min-width: 768px) {
    .mobile-header {
        display: none;
    }
    
    .sidebar-toggle {
        display: none !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    .main-content {
        padding-top: 2rem;
    }
}

/* Form Improvements */
.form-control, .btn {
    border-radius: 6px;
}

.input-group {
    flex-wrap: nowrap;
}

/* Modal Improvements */
.modal-dialog {
    margin: 1.5rem;
    max-width: 600px;
}

@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
    }
}

@media (min-width: 1200px) {
    .modal-dialog {
        max-width: 700px;
    }
}

/* Modal Styling */
.modal {
    display: none;
}

.modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.modal-dialog {
    margin: 1.75rem auto;
    width: 100%;
    max-width: 600px; /* Set consistent width for all modals */
}

.modal-dialog.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

.modal-content {
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1rem; /* Add some padding to the content */
}

.modal-body {
    padding: 1.5rem;
    max-height: calc(100vh - 210px);
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Form controls in modals */
.modal .form-control,
.modal .form-select {
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.modal .form-control-lg,
.modal .form-select-lg {
    padding: 1rem 1.25rem;
    font-size: 1.1rem;
}

.modal .form-label {
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.modal textarea.form-control {
    min-height: 100px;
}

.modal .btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

/* Alert Messages - Auto-dismissing with slide-up animation */
.alert {
    position: relative;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

[data-theme="dark"] .alert-success {
    color: #75b798;
    background-color: #1a3a2e;
    border-color: #2d5a46;
}

.alert-danger {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

[data-theme="dark"] .alert-danger {
    color: #f5b8bf;
    background-color: #3a1a1d;
    border-color: #5a2d32;
}

.alert-warning {
    color: #664d03;
    background-color: #fff3cd;
    border-color: #ffecb5;
}

[data-theme="dark"] .alert-warning {
    color: #ffe69c;
    background-color: #3a3015;
    border-color: #5a4a25;
}

.alert-info {
    color: #055160;
    background-color: #cff4fc;
    border-color: #b6effb;
}

[data-theme="dark"] .alert-info {
    color: #9eeaf9;
    background-color: #1a2f35;
    border-color: #2d4a52;
}

/* Alert icon styles */
.alert::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    vertical-align: middle;
    background-size: contain;
    background-repeat: no-repeat;
}

.alert-success::before {
    content: '✓';
    color: #0f5132;
    font-weight: bold;
    font-size: 1.2rem;
}

[data-theme="dark"] .alert-success::before {
    color: #75b798;
}

.alert-danger::before {
    content: '✕';
    color: #842029;
    font-weight: bold;
    font-size: 1.2rem;
}

[data-theme="dark"] .alert-danger::before {
    color: #f5b8bf;
}

.alert-warning::before {
    content: '⚠';
    color: #664d03;
    font-weight: bold;
    font-size: 1.2rem;
}

[data-theme="dark"] .alert-warning::before {
    color: #ffe69c;
}

.alert-info::before {
    content: 'ℹ';
    color: #055160;
    font-weight: bold;
    font-size: 1.2rem;
}

[data-theme="dark"] .alert-info::before {
    color: #9eeaf9;
}

/* Slide-up animation for dismissing */
.alert.slide-up {
    opacity: 0;
    transform: translateY(-20px);
}

/* Mobile alert adjustments */
@media (max-width: 768px) {
    .alert {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }
}

/* Umbral Software Branding Footer */
.umbral-footer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: #ffffff;
    padding: 12px 20px;
    /* iOS home bar safe area */
    padding-bottom: max(12px, calc(12px + env(safe-area-inset-bottom)));
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
    border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.umbral-footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.umbral-footer i {
    font-size: 1.1rem;
    animation: pulse 2s ease-in-out infinite;
}

.umbral-footer strong {
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.umbral-text {
    color: #6b46c1;
    /* Darker purple color for "Umbral" for better visibility */
}

/* Pulse animation for icon */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* Desktop - footer accounts for sidebar */
@media (min-width: 769px) {
    .umbral-footer-app {
        left: var(--sidebar-width) !important;
        width: calc(100% - var(--sidebar-width)) !important;
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .umbral-footer {
        font-size: 0.8rem;
        padding: 8px 12px;
        /* Ensure iOS home bar doesn't overlap */
        padding-bottom: max(12px, calc(12px + env(safe-area-inset-bottom)));
    }
    
    .umbral-footer-content {
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .umbral-footer-content span {
        font-size: 0.8rem;
        line-height: 1.3;
    }
}

/* Extra small mobile devices */
@media (max-width: 375px) {
    .umbral-footer {
        font-size: 0.75rem;
        padding: 6px 10px;
        padding-bottom: max(10px, calc(10px + env(safe-area-inset-bottom)));
    }
    
    .umbral-footer-content {
        gap: 4px;
    }
    
    .umbral-footer-content span {
        font-size: 0.75rem;
    }
    
    .umbral-footer i {
        font-size: 0.9rem;
    }
}

/* Dark mode support */
[data-theme="dark"] .umbral-footer {
    background: linear-gradient(135deg, #00d4be 0%, #00b8a5 100%);
    border-top-color: rgba(255, 255, 255, 0.3);
}

/* Print Styles */
@media print {
    .sidebar-vertical,
    .btn-group,
    .card-header button,
    .alert,
    .umbral-footer {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .card {
        border: none;
        box-shadow: none;
    }
    
    .table {
        font-size: 12px;
    }
}

/* ============================================
   iOS & MOBILE OPTIMIZATIONS
   ============================================ */

/* iOS Smooth Scrolling & Touch Improvements */
html {
    -webkit-overflow-scrolling: touch;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-text-size-adjust: 100%;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent iOS zoom on input focus */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
textarea,
select {
    font-size: 16px !important; /* iOS won't zoom if font is 16px or larger */
}

/* iOS-optimized touch targets and table improvements preserved */
@media (max-width: 768px) {
    button,
    .btn,
    a.btn,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        padding: 0.75rem 1.25rem;
    }
    
    .btn-sm {
        min-height: 38px;
        padding: 0.5rem 1rem;
    }
}

/* Duplicate mobile improvement rules removed - handled by existing mobile styles section */

/* Removed conflicting sidebar mobile rules that were hiding the toggle button */

/* Footer mobile rules handled in main section above */

/* Notes Modal Content - Ensure proper text visibility in both modes */
#notesModalContent {
    background-color: var(--bg-secondary);
    color: var(--text-primary) !important;
    border-color: var(--border-color);
}

/* Ensure all text elements within notes modal are visible */
.modal-body .form-label,
.modal-body p,
.modal-body div {
    color: var(--text-primary);
}

/* Dashboard Customization Modal */
.stat-option {
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.stat-option:hover {
    background-color: var(--card-bg);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.stat-option input[type="checkbox"]:checked + label {
    color: var(--accent);
    font-weight: 500;
}

.stat-option .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
    cursor: pointer;
}

.stat-option .form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.stat-option .form-check-label {
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
}

#dashboardStatsOptions .col-md-6 {
    display: flex;
}

/* iOS Specific Fixes */
@supports (-webkit-touch-callout: none) {
    /* Fix for iOS input shadows */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    input[type="time"],
    textarea,
    select {
        -webkit-appearance: none;
        appearance: none;
    }
    
    /* Fix for iOS button styling */
    button,
    .btn {
        -webkit-appearance: none;
        appearance: none;
    }
    
    /* Fix for iOS select arrows */
    select.form-control,
    select.form-select {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        background-size: 16px 12px;
        padding-right: 2.5rem;
    }
    
    [data-theme="dark"] select.form-control,
    [data-theme="dark"] select.form-select {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    }
}

/* Removed duplicate performance and selection rules */

/* Time Entries Table Improvements */
.notes-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notes-title {
    display: inline-block;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.btn-notes {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Make action buttons more compact and visible */
.btn-group-sm .btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.875rem;
    min-width: 36px;
}

/* Ensure action column has enough space */
td:last-child {
    white-space: nowrap;
}

/* Clickable technician items in dashboard cards */
.clickable-tech {
    transition: all 0.2s ease;
}

.clickable-tech:hover {
    background-color: var(--accent) !important;
    color: white !important;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.3);
}

.clickable-tech:hover .tech-name,
.clickable-tech:hover .tech-stats {
    color: white !important;
}

.clickable-tech:active {
    transform: translateX(2px) scale(0.98);
}

/* Clickable rows in payroll reports */
.clickable-row {
    transition: background-color 0.15s ease;
}

.clickable-row:hover {
    background-color: var(--bg-secondary) !important;
}

.entry-details {
    transition: all 0.2s ease;
}

.entry-details td {
    border-top: none !important;
    padding-top: 0.25rem !important;
    padding-bottom: 0.75rem !important;
}

/* Entry notes cell - theme-aware background */
.entry-notes-cell {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    padding: 0.75rem !important;
    border-radius: 4px;
}

[data-theme="dark"] .entry-notes-cell {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-primary) !important;
}

[data-theme="light"] .entry-notes-cell {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

/* Settings page sidebar fixes */
#settingsSection .row {
    align-items: flex-start; /* Prevent stretching */
}

#settingsSection .col-lg-4 {
    position: sticky;
    top: 20px;
    align-self: flex-start;
}

#settingsSection .card {
    height: auto !important;
    min-height: auto !important;
}

#settingsSection .card-body {
    padding: 1rem;
}

/* Make sure cards don't stretch unnecessarily */
.card {
    display: flex;
    flex-direction: column;
}

.card-body {
    flex: 0 1 auto; /* Don't grow, allow shrink, auto size */
}

/* SMTP Info Card - Theme-aware styling */
/* Light mode */
html[data-theme="light"] .smtp-info-card,
html:not([data-theme="dark"]) .smtp-info-card,
.smtp-info-card {
    background-color: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
}

html[data-theme="light"] .smtp-info-card .card-body,
html:not([data-theme="dark"]) .smtp-info-card .card-body,
.smtp-info-card .card-body {
    color: #212529 !important;
    background-color: transparent !important;
}

html[data-theme="light"] .smtp-info-card .card-body small,
html:not([data-theme="dark"]) .smtp-info-card .card-body small,
.smtp-info-card .card-body small {
    color: #495057 !important;
}

/* Dark mode - super specific selectors */
html[data-theme="dark"] .smtp-info-card,
html[data-theme="dark"] div.smtp-info-card,
html[data-theme="dark"] .card.smtp-info-card {
    background-color: #2a2a2a !important;
    border: 1px solid #444 !important;
}

html[data-theme="dark"] .smtp-info-card .card-body,
html[data-theme="dark"] div.smtp-info-card .card-body,
html[data-theme="dark"] .card.smtp-info-card .card-body {
    color: #e8e8e8 !important;
    background-color: transparent !important;
}

html[data-theme="dark"] .smtp-info-card .card-body small,
html[data-theme="dark"] .smtp-info-card small,
html[data-theme="dark"] div.smtp-info-card small {
    color: #d0d0d0 !important;
}

html[data-theme="dark"] .smtp-info-card .card-body strong,
html[data-theme="dark"] .smtp-info-card strong,
html[data-theme="dark"] div.smtp-info-card strong {
    color: #ffffff !important;
}

.smtp-link {
    color: #0d6efd !important;
    text-decoration: none;
}

.smtp-link:hover {
    text-decoration: underline;
}

[data-theme="dark"] .smtp-link {
    color: #6ea8fe !important;
}

[data-theme="dark"] .smtp-link:hover {
    color: #9ec5fe !important;
}

/* Bootstrap alert overrides for dark mode */
.theme-alert-info {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

[data-theme="dark"] .theme-alert-info {
    background-color: rgba(13, 202, 240, 0.1) !important;
    border-color: rgba(13, 202, 240, 0.2) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .theme-alert-info h6,
[data-theme="dark"] .theme-alert-info p,
[data-theme="dark"] .theme-alert-info small {
    color: var(--text-primary) !important;
}

/* Force 3-column dashboard on all non-mobile screens */
@media (min-width: 992px) {
    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1.5rem !important;
    }
}

@media (min-width: 1440px) {
    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 2rem !important;
        max-width: 1600px;
    }
}

@media (min-width: 1920px) {
    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 2.5rem !important;
        max-width: 1800px;
        margin: 0 auto;
    }
}

/* MacBook-specific responsive fixes */
/* MacBook Air 13" (1440x900) and MacBook Pro 13" (1280x800 scaled) */
@media (min-width: 1024px) and (max-width: 1440px) {
    /* Adjust sidebar for smaller laptop screens */
    :root {
        --sidebar-width: 240px;
    }
    
    .sidebar-vertical {
        width: var(--sidebar-width);
    }
    
    .main-content {
        margin-left: var(--sidebar-width);
        padding: 1.5rem;
    }
    
    /* Reduce font sizes slightly for better fit */
    h2 {
        font-size: 1.5rem;
    }
    
    h5 {
        font-size: 1rem;
    }
    
    /* Make cards more compact */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Optimize dashboard stats grid */
    .dashboard-stats {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
        gap: 1rem;
    }
    
    /* Compact table styling */
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
    
    /* Optimize button spacing */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .btn-sm {
        padding: 0.35rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    /* Modal optimization */
    .modal-dialog {
        max-width: 600px;
        margin: 1rem auto;
    }
    
    /* Form controls */
    .form-control,
    .form-select {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Container fluid optimization */
    .container-fluid {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
        max-width: 100%;
    }
    
    /* Reduce stat card padding */
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card h3 {
        font-size: 1.75rem;
    }
    
    .stat-card p {
        font-size: 0.875rem;
    }
}

/* MacBook Pro 14" and 16" (1512x982, 1728x1117 scaled) */
@media (min-width: 1441px) and (max-width: 1728px) {
    :root {
        --sidebar-width: 260px;
    }
    
    .sidebar-vertical {
        width: var(--sidebar-width);
    }
    
    .main-content {
        margin-left: var(--sidebar-width);
        padding: 2rem;
    }
    
    /* Optimize for medium-large screens */
    .dashboard-stats {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
        gap: 1.25rem;
    }
    
    .container-fluid {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Fix for retina displays - ensure crisp rendering */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .card,
    .btn,
    .form-control,
    .modal-content {
        backface-visibility: hidden;
        transform: translateZ(0);
    }
}

/* Prevent horizontal scroll on all MacBook sizes */
@media (min-width: 1024px) and (max-width: 1920px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    .app-container {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    .main-content {
        overflow-x: hidden;
        max-width: calc(100vw - var(--sidebar-width));
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ensure modals fit on screen */
    .modal-dialog {
        max-width: min(90vw, 800px);
    }
}

/* Specific fix for MacBook viewport height issues */
@media (min-width: 1024px) and (max-height: 900px) {
    /* Reduce vertical spacing on shorter screens */
    .main-content {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    .card {
        margin-bottom: 0.75rem;
    }
    
    h2 {
        margin-bottom: 0.5rem;
    }
    
    .mb-4 {
        margin-bottom: 1rem !important;
    }
    
    .mb-3 {
        margin-bottom: 0.75rem !important;
    }
    
    /* Compact stat cards for vertical space */
    .stat-card {
        padding: 0.875rem;
    }
    
    .stat-card h3 {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
}

/* Responsive 3-column dashboard for different monitor sizes */
/* All cards fill available width equally - NO breaking out of container */
@media (min-width: 768px) {
    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
        margin-bottom: 2.5rem !important;
    }
}

@media (min-width: 992px) {
    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1.5rem !important;
        margin-bottom: 2.5rem !important;
    }
}

@media (min-width: 1200px) {
    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1.5rem !important;
        margin-bottom: 3rem !important;
    }
}

@media (min-width: 1440px) {
    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 2rem !important;
        margin-bottom: 3rem !important;
    }
}

@media (min-width: 1920px) {
    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 2.5rem !important;
        margin-bottom: 3.5rem !important;
    }
}

/* Ensure stat cards scale text and padding based on available space */
@media (min-width: 768px) and (max-width: 991px) {
    .stat-card {
        padding: 1rem;
        min-height: 120px;
    }
    
    .stat-value {
        font-size: clamp(1rem, 2vw, 1.5rem);
    }
    
    .stat-label {
        font-size: clamp(0.7rem, 1vw, 0.8rem);
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .stat-card {
        padding: 1.25rem;
        min-height: 130px;
    }
    
    .stat-value {
        font-size: clamp(1.25rem, 2.2vw, 1.75rem);
    }
    
    .stat-label {
        font-size: clamp(0.75rem, 1.1vw, 0.85rem);
    }
}

@media (min-width: 1200px) and (max-width: 1439px) {
    .stat-card {
        padding: 1.5rem;
        min-height: 140px;
    }
    
    .stat-value {
        font-size: clamp(1.5rem, 2.3vw, 1.85rem);
    }
    
    .stat-label {
        font-size: clamp(0.8rem, 1.15vw, 0.9rem);
    }
}

@media (min-width: 1440px) and (max-width: 1919px) {
    .stat-card {
        padding: 1.75rem;
        min-height: 150px;
    }
    
    .stat-value {
        font-size: clamp(1.65rem, 2.4vw, 2rem);
    }
    
    .stat-label {
        font-size: clamp(0.85rem, 1.2vw, 0.95rem);
    }
}

@media (min-width: 1920px) {
    .stat-card {
        padding: 2rem;
        min-height: 160px;
    }
    
    .stat-value {
        font-size: clamp(1.75rem, 2.5vw, 2.25rem);
    }
    
    .stat-label {
        font-size: clamp(0.9rem, 1.25vw, 1rem);
    }
}