/* Local DM Sans & DM Mono (same bundle as PDF export; works offline on native) */
@font-face {
    font-family: 'DM Sans';
    src: url('../fonts/DM_Mono%2CDM_Sans/DM_Sans/static/DMSans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'DM Sans';
    src: url('../fonts/DM_Mono%2CDM_Sans/DM_Sans/static/DMSans-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'DM Sans';
    src: url('../fonts/DM_Mono%2CDM_Sans/DM_Sans/static/DMSans-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'DM Sans';
    src: url('../fonts/DM_Mono%2CDM_Sans/DM_Sans/static/DMSans-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'DM Mono';
    src: url('../fonts/DM_Mono%2CDM_Sans/DM_Mono/DMMono-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'DM Mono';
    src: url('../fonts/DM_Mono%2CDM_Sans/DM_Mono/DMMono-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

/* Performance Optimizations */
* {
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* iOS WebView keyboard optimizations */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    background-color: var(--bg-secondary);
}


/* CSS Variables for Theme */
:root {
    /* Dark Theme (default) */
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --bg-tertiary: #4a5568;
    --bg-card: #374151;
    --text-primary: #292a2e;
    --text-secondary: #e2e8f0;
    --text-tertiary: #F2F2F7;
    --text-muted: #a0aec0;
    --text-icons: #f1f5f9;
    --border-color: #4a5568;
    --shadow: rgba(0,0,0,0.3);
    --shadow-lg: rgba(0,0,0,0.5);
    
    /* Status colors */
    --status-in-progress: #68d391;
    --status-upcoming: #f6ad55;
    --status-on-hold: #fc8181;
    --status-completed: #9ae6b4;
    --status-all: #4a5568;
    
    /* Accent colors */
    --accent-primary: #68d391;
    --accent-danger: #fc8181;
    --accent-link: #1a202c;
    --accent-green: #68d391;
    --accent-red: #fc8181;
    --accent-blue: #63b3ed;
    --accent-yellow: #f6ad55;
    --accent-purple: #9f7aea;
    
    /* Calendar task status colors */
    --overdue-color: #ef4444;
    --due-soon-color: #f59e0b;
    --completed-color: #10b981;
    --calendar-day-bg: rgba(74, 85, 104, 0.42);
    
    /* Accent tint for dark backgrounds - stronger for visibility */
    --accent-green-tint: rgba(104, 211, 145, 0.25);
    
    --photo-selection-icon: #ffffff;
    
    /* App typography — DM Sans / DM Mono (+ system fallbacks) */
    --font-family-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-mono: 'DM Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --mono: var(--font-family-mono); /* invoice-styles & PDF-style UI */
    
    /* Apple iOS Font Sizes - Simplified (5 sizes only) */
    --font-size-special: 1.625rem;      /* 26px - Large display numbers, prominent stats */
    --font-size-default: 1.0625rem;     /* 17px - Everything (titles, body, buttons, stats) */
    --font-size-base: 0.9375rem;        /* 15px - Alias for default (backward compatibility) */
    --font-size-secondary: 0.9375rem;   /* 15px - Secondary text, labels */
    --font-size-tertiary: 0.8125rem;    /* 13px - Captions, small details */
    --font-size-secondaryallest: 0.625rem;     /* 10px - Tab bar only (don't go smaller) */
    
    /* iOS Letter Spacing (Tracking) */
    --tracking-tight: -0.02em;          /* For large text (≥20px) */
    --tracking-normal: 0;               /* For medium text */
    --tracking-loose: 0.015em;          /* For small text (<17px) */
    
    /* Font Weights - iOS Standard (3-weight system) */
    --font-weight-semibold: 600;        /* Buttons, headlines, titles */
    --font-weight-medium: 500;          /* Emphasized text, labels, captions */
    --font-weight-regular: 400;         /* Body text, descriptions */
    --font-weight-normal: 400;          /* Alias for regular (backward compatibility) */
    
    /* iOS Spacing System (8pt grid) */
    --spacing-xs: 0.25rem;   /* 4pt - Tight spacing */
    --spacing-sm: 0.5rem;    /* 8pt - Small spacing */
    --spacing-md: 1rem;      /* 16pt - Standard spacing */
    --spacing-lg: 1.5rem;    /* 24pt - Large spacing */
    --spacing-xl: 2rem;      /* 32pt - Extra large spacing */
    
    /* iOS Standard Values */
    --touch-target-min: 44px;    /* Minimum touch target */
    --list-row-height: 44px;     /* Standard list row height */
    --section-spacing: 1rem;    /* 16pt between sections */
    --content-padding: 1rem;     /* 16pt content padding */
    --modal-padding: 1rem;      /* 16pt modal padding */
    --card-padding: 1rem;        /* 16pt card padding */
    --card-radius: 6px;          /* Standard card radius */
    --button-padding-v: 0.75rem; /* 12pt vertical button padding */
    --button-padding-h: 1rem;    /* 16pt horizontal button padding */
    
    /* Glass effect variables - GPU optimized */
    --glass-bg-dark: #2d3748;
    --glass-bg-light: rgba(255, 255, 255, 0.85);
    --glass-blur: blur(8px) saturate(120%); /* Reduced from 12px/150% for better performance */
    --glass-shadow-dark: none;
    --glass-shadow-light: none;

    /* Finance chart / spending category palette (dark default)
       Collected/profit = sage green; spent cats avoid that green */
    --finance-bar-estimated: #7f9bb8;
    --finance-bar-invoiced: #6b8fc7;
    --finance-bar-collected: #6f9e8f;
    --finance-bar-profit-pos: #6f9e8f;
    --finance-bar-profit-neg: #c4928e;
    --finance-bar-spent-labor: #c9a06c;
    --finance-bar-spent-materials: #7d8fb3;
    --finance-bar-spent-equipment: #a890b0;
    --finance-bar-spent-other: #9a9590;
    --finance-track: color-mix(in srgb, var(--border-color) 55%, transparent);
    --finance-btn-pay-bg: color-mix(in srgb, var(--finance-bar-collected) 22%, transparent);
    --finance-btn-pay-border: color-mix(in srgb, var(--finance-bar-collected) 55%, var(--border-color));
    --finance-btn-pay-text: #c5e0d4;
    --finance-btn-spend-bg: color-mix(in srgb, var(--finance-bar-spent-labor) 20%, transparent);
    --finance-btn-spend-border: color-mix(in srgb, var(--finance-bar-spent-labor) 50%, var(--border-color));
    --finance-btn-spend-text: #e4c9a8;
}

/* Dark theme counterpart for primary text variable. */
body:not(.light-theme) {
    --text-primary: #f7fafc;
}

/* Theme vars live on body, so html cannot resolve the light values itself. */
html:has(> body.light-theme) {
    background-color: #ffffff;
}

/* Light Theme */
body.light-theme {
    --bg-primary: #f7f7f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f7f7f7;
    --bg-card: #f7f7f7;
    --transparent-bg-light: #f7f7f000;
    --text-primary: #1a202c;
    --text-secondary: #2d3748;
    --text-tertiary: #4a5568;
    --text-muted: #718096;
    --text-icons: #1a202c;
    /* Slightly stronger than #f0f0f0 so borders/dividers read (cards still use rgba borders in many places) */
    --border-color: #e2e8f0;
    --shadow: rgba(0,0,0,0.1);
    --shadow-lg: rgba(0,0,0,0.15);
    /* Full box-shadow stacks — use where `box-shadow: var(--shadow)` needs a valid value (e.g. Workshop) */
    --elevation-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06), 0 2px 10px rgba(0, 0, 0, 0.08);
    --elevation-shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.05), 0 14px 36px rgba(0, 0, 0, 0.12);
    --elevation-shadow-modal: 0 16px 48px rgba(0, 0, 0, 0.14);
    --surface-pressed: #e2e8f0;
    --accent-link: #1a202c;
    --accent-green: #68d391;
    --accent-red: #fc8181;
    --accent-blue: #63b3ed;
    --accent-yellow: #f6ad55;
    --accent-purple: #9f7aea;
    --calendar-day-bg: var(--transparent-bg-light);
    
    /* Calendar task status colors for light theme */
    --overdue-color: #e53e3e;
    --due-soon-color: #ed8936;
    --completed-color: #38a169;
    
    /* Accent tint for light backgrounds - subtler */
    --accent-green-tint: rgba(104, 211, 145, 0.15);
    
    --photo-selection-icon: #ffffff;
    
    /* Finance chart / spending category palette (light)
       Equipment uses mauve so it never collides with Collected sage */
    --finance-bar-estimated: #7a92ad;
    --finance-bar-invoiced: #5b7db5;
    --finance-bar-collected: #5a8f7c;
    --finance-bar-profit-pos: #5a8f7c;
    --finance-bar-profit-neg: #b87974;
    --finance-bar-spent-labor: #b8885c;
    --finance-bar-spent-materials: #6a7fa8;
    --finance-bar-spent-equipment: #8f759e;
    --finance-bar-spent-other: #8a8580;
    --finance-track: color-mix(in srgb, var(--border-color) 80%, #fff);
    --finance-btn-pay-bg: color-mix(in srgb, var(--finance-bar-collected) 14%, #fff);
    --finance-btn-pay-border: color-mix(in srgb, var(--finance-bar-collected) 40%, var(--border-color));
    --finance-btn-pay-text: #3d6b5c;
    --finance-btn-spend-bg: color-mix(in srgb, var(--finance-bar-spent-labor) 14%, #fff);
    --finance-btn-spend-border: color-mix(in srgb, var(--finance-bar-spent-labor) 42%, var(--border-color));
    --finance-btn-spend-text: #8a5f35;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Prevent text selection and dragging on UI elements */
body, button, select, .status-card, .menu-item, .job-site-item, 
h1, h2, h3, h4, h5, h6, p, span, div, label, a, 
.btn, .card, .modal, header, nav, footer, section, article {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection in input and textarea elements */
input, textarea, [contenteditable="true"] {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
}

/* iOS input focus optimization - reduce keyboard warnings */
input:focus, textarea:focus, select:focus {
    /* Prevent iOS zoom on focus */
    font-size: var(--font-size-tertiary);
}


/* Prevent image dragging and selection for native app feel */
img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    pointer-events: auto;
}

/* Prevent SVG and icon selection */
svg, i, .icon {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: auto;
}

body {
    font-family: var(--font-family-sans);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: var(--font-size-default);
    /* iOS-optimized text rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    touch-action: pan-y; /* Allow vertical scrolling only */
    -webkit-overflow-scrolling: touch;
    position: relative;
    
    /* Minimal fix for rendering artifacts */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Fix for iOS WebView scrolling issue */
html, body {
    height: 100vh;
    overflow: hidden;
}

/* App layout */
.app {
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    z-index: 1;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain; /* Let our custom pull-to-refresh handle top overscroll */
    will-change: scroll-position;
}

/* Header */
.header {
    background: transparent;
    padding: 0.5rem 1rem;
    padding-top: calc(env(safe-area-inset-top, 0px) + 0.5rem);
    padding-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    min-height: 48px;
}

.header-title {
    font-size: var(--font-size-default);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-title--transient {
    font-size: var(--font-size-tertiary);
    letter-spacing: var(--tracking-tight);
    justify-content: center;
    position: absolute;
    left: 50%;
    top: calc(50% + env(safe-area-inset-top, 0px) / 2);
    transform: translate(-50%, -50%);
    line-height: 1.15;
    max-width: calc(100% - 160px);
    min-width: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.header-title--transient.is-visible {
    opacity: 1;
}

.header-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* View titles are shown briefly in the header on view switch instead. */
.main-content .view-title {
    display: none !important;
}

/* Sync Indicator */
.sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    opacity: 0.95;
    margin-left: 8px;
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.sync-text {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    opacity: 0.85;
    letter-spacing: 0.01em;
}

/* Sync states */
.sync-indicator[data-state="synced"] .sync-dot {
    background: #4ade80;
}

.sync-indicator[data-state="syncing"] .sync-dot {
    background: #fbbf24;
    animation: pulse 1.5s ease-in-out infinite;
}

.sync-indicator[data-state="offline"] .sync-dot {
    background: #ef4444;
}

.sync-indicator[data-state="pending"] .sync-dot {
    background: #f59e0b;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

/* Hide sync indicator when using SQLite */
.sync-indicator[data-state="hidden"] {
    display: none;
}

.settings-sync-row {
    display: flex;
    justify-content: center;
    margin: 0 0 0.75rem;
}

.settings-sync-row .sync-indicator {
    margin-left: 0;
}

.settings-sync-row:has(> .sync-indicator[data-state="hidden"]) {
    display: none;
}

.menu-btn,
.theme-toggle,
.header-icon-btn {
    background: none;
    border: none;
    color: var(--text-icons);
    font-size: var(--font-size-default);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

@media (hover: hover) and (pointer: fine) {
.menu-btn:hover,
.theme-toggle:hover,
.header-icon-btn:hover {
    background-color: var(--bg-card);
    transform: scale(1.1);
    will-change: transform;
}
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Team presence (owner only): members currently connected via Realtime */
.header-team-presence {
    position: relative;
    margin-right: 4px;
}

.header-team-presence-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 10px 0 8px;
    border: none;
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.header-team-presence-btn:active {
    transform: scale(0.98);
}

@media (hover: hover) and (pointer: fine) {
    .header-team-presence-btn:hover {
        background: var(--bg-secondary);
    }
}

.header-team-presence-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.25);
}

.header-team-presence-count {
    min-width: 1ch;
    line-height: 1.2;
}

.header-team-presence-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    max-width: min(280px, 85vw);
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 200;
}

body.light-theme .header-team-presence-dropdown {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.header-team-presence-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.75;
    margin-bottom: 8px;
}

.header-team-presence-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
}

.header-team-presence-item {
    font-size: 13px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    word-break: break-word;
}

body.light-theme .header-team-presence-item {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

.header-team-presence-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* .header-chat-btn uses .header-icon-btn (same as .theme-toggle): 40px, padding 0.5rem, border-radius 12px, background on hover */
.header-chat-btn img {
    display: block;
    object-fit: contain;
    /* Dark theme: white icon (matches --text-icons) */
    filter: brightness(0) invert(1);
}
body.light-theme .header-chat-btn img {
    /* Light theme: black icon (matches --text-icons) */
    filter: brightness(0);
}

.header-announcements-btn {
    position: relative;
}

.header-announcements-btn i {
    color: var(--text-icons);
}

.theme-toggle i {
    transition: transform 0.3s ease;
}

.theme-toggle:active i {
    transform: rotate(180deg);
}

/* Main content */
.main-content {
    position: relative;
    z-index: 1; /* Above pull-to-refresh indicator */
    padding: 0.25rem;
    padding-top: calc(70px + env(safe-area-inset-top, 0px)); /* Space for fixed header + safe area */
    padding-bottom: 100px; /* Space for floating button */
    background: var(--bg-secondary); /* Opaque so indicator stays hidden until pull */
}

/* View Container - Multi-view system */
.view-container {
    display: none;
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
}

.view-container.active {
    display: block;
    opacity: 1;
    position: relative;
}

/* Slide animations for view transitions */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutToRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes slideOutToLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

/* Apply slide animations */
.view-container.slide-in-right {
    animation: slideInFromRight 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.view-container.slide-in-left {
    animation: slideInFromLeft 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.view-container.slide-out-right {
    animation: slideOutToRight 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.view-container.slide-out-left {
    animation: slideOutToLeft 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Pull to Refresh Indicator - above main content so visible when pulling */
.pull-to-refresh-indicator {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 52px); /* Just below header */
    left: 0;
    right: 0;
    height: 56px;
    margin-top: 10px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    opacity: 0;
    z-index: 50; /* Above main content so not hidden behind blocks when pulling */
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.1s ease;
    will-change: opacity;
    background: transparent;
}

.refresh-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-green);
    border-radius: 50%;
}

.pull-to-refresh-indicator.ready,
.pull-to-refresh-indicator.refreshing {
    opacity: 1 !important;
    visibility: visible !important;
}

.pull-to-refresh-indicator.refreshing .refresh-spinner,
.pull-to-refresh-indicator.ready .refresh-spinner {
    animation: spin 0.8s linear infinite;
}

.refresh-text {
    color: var(--text-secondary);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* In-modal saving indicator (Create Job Site, etc.) */
.modal-saving-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}
.modal-saving-indicator[hidden] {
    display: none !important;
}
.modal-saving-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color, rgba(255,255,255,0.2));
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.modal-saving-indicator.is-done .modal-saving-spinner {
    animation: none;
    border: none;
    width: auto;
    height: auto;
    color: var(--accent-primary);
}

/* Button in saving state: center spinner + text */
.btn--saving {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
/* Spinner inside primary button (Create Job Site saving state) */
.btn-saving-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    flex-shrink: 0;
}
/* Checkmark when done – same size/style as spinner */
.btn-saving-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

/* will-change: transform removed — it creates a new containing block which breaks
   position:fixed children (keypad sheet, overlays) by making them position relative
   to this element instead of the viewport */

/* View Title - iOS Typography Scale */
.view-title {
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: var(--tracking-tight);
    line-height: 1.15;
}

.view-title i {
    color: var(--primary-color);
    font-size: var(--font-size-default);
    line-height: 1;
}

#laborView .view-title {
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
}

/* iPhone: Optimized for smaller screens */
@media (max-width: 480px) {
    .view-title {
        font-size: var(--font-size-tertiary);
        margin-bottom: 1.25rem;
        letter-spacing: var(--tracking-tight);
    }
    
    .view-title i {
        font-size: var(--font-size-default);
    }
}

/* Tasks View */
.tasks-filter {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.6rem 1.2rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    font-size: var(--font-size-base);
    transition: all 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
.filter-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}
}


.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Task row base – shared with checklist-row and list-task-item */
/* Task row: single .checklist-item card (checkbox + body live inside the card) */
.task-item {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-bottom: 0.625rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Exit: squeeze / zoom out (shrink then disappear), then task pops in elsewhere */
@-webkit-keyframes task-burst-exit {
    0% {
        opacity: 1;
        -webkit-transform: scale(1, 1) translateZ(0);
        transform: scale(1, 1) translateZ(0);
    }
    50% {
        opacity: 1;
        -webkit-transform: scale(0.92, 0.82) translateZ(0);
        transform: scale(0.92, 0.82) translateZ(0);
    }
    100% {
        opacity: 0;
        -webkit-transform: scale(0.4, 0.2) translateZ(0);
        transform: scale(0.4, 0.2) translateZ(0);
    }
}
@keyframes task-burst-exit {
    0% {
        opacity: 1;
        transform: scale(1, 1) translateZ(0);
    }
    50% {
        opacity: 1;
        transform: scale(0.92, 0.82) translateZ(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.4, 0.2) translateZ(0);
    }
}

/* Enter: pop up in the new place (small → slight overshoot → normal) */
@-webkit-keyframes task-pop-in {
    0% {
        opacity: 0;
        -webkit-transform: scale(0.35, 0.2) translateZ(0);
        transform: scale(0.35, 0.2) translateZ(0);
    }
    65% {
        opacity: 1;
        -webkit-transform: scale(1.06, 1.02) translateZ(0);
        transform: scale(1.06, 1.02) translateZ(0);
    }
    100% {
        opacity: 1;
        -webkit-transform: scale(1, 1) translateZ(0);
        transform: scale(1, 1) translateZ(0);
    }
}
@keyframes task-pop-in {
    0% {
        opacity: 0;
        transform: scale(0.35, 0.2) translateZ(0);
    }
    65% {
        opacity: 1;
        transform: scale(1.06, 1.02) translateZ(0);
    }
    100% {
        opacity: 1;
        transform: scale(1, 1) translateZ(0);
    }
}

/* task-item-exit / task-item-enter: see unified .checklist-row.*-exit/enter block */

/* task-item / list-task-item: one card — row = checkbox + stacked title/meta (.list-task-card-body) */
.task-item .checklist-item,
.list-task-item .checklist-item {
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-start;
    /* horizontal gap checkbox ↔ body: see “Task list + calendar” block below */
}

.list-task-item .list-task-card-body,
.task-item .list-task-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: stretch;
}

/* task-item hover/active: see unified block with checklist-row */

/* Overdue tasks get RED border */
.task-item.overdue:not(.completed) .checklist-item {
    border-left-color: var(--overdue-color);
}

/* Due soon tasks get ORANGE border */
.task-item.due-soon:not(.completed) .checklist-item {
    border-left-color: var(--due-soon-color);
}

/* Completed tasks have GREEN border */
.task-item.completed .checklist-item {
    opacity: 0.7;
    border-left-color: var(--completed-color);
}

.task-item .checklist-item > .checklist-checkbox,
.list-task-item .checklist-item > .checklist-checkbox {
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 0.06rem;
}

/* list-task-item now uses checklist-checkbox (left side); task-checkbox removed */

/* Minimalistic icon styling */
.checklist-item i,
.checklist-due-date i,
.checklist-delete i {
    font-size: var(--font-size-secondary);
    opacity: 0.8;
    font-weight: var(--font-weight-normal);
}

.task-item-content {
    flex: 1;
}

/* Calendar / summary view task items - same styling as checklist */
.task-item .list-task-header {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    margin-bottom: 0.12rem;
    gap: 0.5rem;
}

.task-item .list-task-title {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    font-size: var(--font-size-tertiary);
    flex: 0 1 auto;
    line-height: 1.2;
}

.task-item .list-task-meta {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.4rem;
    font-size: var(--font-size-secondary);
    color: var(--text-muted);
    flex-wrap: wrap;
    font-weight: var(--font-weight-medium);
}

/* Match donut section colors */
.task-item .list-task-status-badge.overdue {
    background: #fc8181;
    color: white;
}

.task-item .list-task-status-badge.due-soon {
    background: #f6ad55;
    color: white;
}

.task-item .list-task-status-badge.completed {
    background: #38a169;
    color: white;
}

.task-item .list-task-status-badge.normal {
    background: var(--accent-green);
    color: white;
}

/* One-line task row: calendar, list, donut legend, job checklist folder */
#taskList .task-item .calendar-task-checklist-row,
#listContent .list-task-item .calendar-task-checklist-row,
.legend-task-list .task-item .calendar-task-checklist-row,
#checklistItemsContainer .checklist-row .checklist-item.calendar-task-checklist-row {
    align-items: center;
}

#taskList .task-item .calendar-task-checklist-row > .checklist-checkbox,
#listContent .list-task-item .calendar-task-checklist-row > .checklist-checkbox,
.legend-task-list .task-item .calendar-task-checklist-row > .checklist-checkbox,
#checklistItemsContainer .checklist-row .checklist-item.calendar-task-checklist-row > .checklist-checkbox {
    align-self: center;
    margin-top: 0;
}

#taskList .task-item .calendar-task-line,
#listContent .list-task-item .calendar-task-line,
.legend-task-list .task-item .calendar-task-line,
#checklistItemsContainer .checklist-row .checklist-item .calendar-task-line {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    gap: 0.35rem 0.55rem;
    flex-wrap: nowrap;
    font-size: var(--font-size-tertiary);
    color: var(--text-primary);
    font-weight: var(--font-weight-medium);
}

/* Job checklist: checkbox + line + delete inside one card */
#checklistItemsContainer .checklist-row > .checklist-item {
    flex: 1;
    min-width: 0;
}

#checklistItemsContainer .checklist-row .checklist-item.checklist-folder-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 0.5rem;
}

#checklistItemsContainer .checklist-row .checklist-item.checklist-folder-card .calendar-task-line {
    flex: 1 1 auto;
    min-width: 0;
}

/* Time + badge grouped next to delete on job checklist */
#checklistItemsContainer .checklist-row .checklist-item.checklist-folder-card .checklist-trailing {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-shrink: 0;
    gap: 0.45rem;
    margin-left: auto;
}

#checklistItemsContainer .checklist-row .checklist-item.checklist-folder-card .calendar-task-meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    min-width: 0;
}

#checklistItemsContainer .checklist-row .checklist-item.checklist-folder-card .checklist-actions {
    flex-shrink: 0;
    margin-left: 0;
}

/* Width follows task name; shrinks + ellipsis only when row is tight (no flex-grow ratio) */
#taskList .task-item .calendar-task-title,
#listContent .list-task-item .calendar-task-title,
.legend-task-list .task-item .calendar-task-title,
#checklistItemsContainer .checklist-row .checklist-item .calendar-task-title {
    flex: 0 1 auto;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--font-size-tertiary);
    font-weight: inherit;
    color: inherit;
    line-height: 1.25;
}

#taskList .task-item .calendar-task-job-num,
#listContent .list-task-item .calendar-task-job-num,
.legend-task-list .task-item .calendar-task-job-num,
#checklistItemsContainer .checklist-row .checklist-item .calendar-task-job-num {
    flex: 0 0 auto;
    font-family: var(--font-family-mono, ui-monospace, monospace);
    font-size: var(--font-size-tertiary);
    font-weight: inherit;
    color: inherit;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

#taskList .task-item .calendar-task-job-num--empty,
#listContent .list-task-item .calendar-task-job-num--empty,
.legend-task-list .task-item .calendar-task-job-num--empty,
#checklistItemsContainer .checklist-row .checklist-item .calendar-task-job-num--empty {
    color: inherit;
    opacity: 1;
}

#taskList .task-item .calendar-task-project-name,
#listContent .list-task-item .calendar-task-project-name,
.legend-task-list .task-item .calendar-task-project-name,
#checklistItemsContainer .checklist-row .checklist-item .calendar-task-project-name {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--font-size-tertiary);
    color: inherit;
    font-weight: inherit;
}

#taskList .task-item .calendar-task-time,
#listContent .list-task-item .calendar-task-time,
.legend-task-list .task-item .calendar-task-time,
#checklistItemsContainer .checklist-row .checklist-item .calendar-task-time {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: var(--font-size-tertiary);
    color: inherit;
    font-weight: inherit;
}

#taskList .task-item .calendar-task-line .list-task-status-badge,
#listContent .list-task-item .calendar-task-line .list-task-status-badge,
.legend-task-list .task-item .calendar-task-line .list-task-status-badge,
#checklistItemsContainer .checklist-row .checklist-item .calendar-task-line .list-task-status-badge,
#checklistItemsContainer .checklist-row .checklist-item .calendar-task-meta .list-task-status-badge {
    flex: 0 0 auto;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    padding: 0.15rem 0.4rem;
}

/* Override .checklist-item i (secondary) for row icons; clock matches row text */
#taskList .task-item .calendar-task-checklist-row i,
#listContent .list-task-item .calendar-task-checklist-row i,
.legend-task-list .task-item .calendar-task-checklist-row i,
#checklistItemsContainer .checklist-row .checklist-item.calendar-task-checklist-row i {
    font-size: var(--font-size-tertiary);
    color: inherit;
    opacity: 1;
}

#taskList .task-item .calendar-task-time i,
#listContent .list-task-item .calendar-task-time i,
.legend-task-list .task-item .calendar-task-time i,
#checklistItemsContainer .checklist-row .checklist-item .calendar-task-time i {
    margin-right: 0.28rem;
}

@media (max-width: 520px) {
    #taskList .task-item .calendar-task-inline-wide,
    #listContent .list-task-item .calendar-task-inline-wide,
    .legend-task-list .task-item .calendar-task-inline-wide,
    #checklistItemsContainer .checklist-row .checklist-item .calendar-task-inline-wide {
        display: none !important;
    }

    #taskList .task-item .calendar-task-line,
    #listContent .list-task-item .calendar-task-line,
    .legend-task-list .task-item .calendar-task-line,
    #checklistItemsContainer .checklist-row .checklist-item .calendar-task-line {
        gap: 0.35rem 0.45rem;
    }
}

.task-item-title {
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 0.3rem;
    line-height: 1.2;
}

.task-item-title.completed {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.task-item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-secondary);
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
}

.task-job-site {
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: var(--font-size-tertiary);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.task-due-date {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
}

.task-due-date.overdue {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.task-due-date.due-soon {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.task-due-date:not(.overdue):not(.due-soon):not(.completed) {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.task-due-date.completed {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.task-completed-date {
    font-size: var(--font-size-tertiary);
    color: var(--text-secondary);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.task-completed-date i {
    color: #10b981;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
    margin: 0;
    min-height: 60px;
}

.empty-state i {
    font-size: var(--font-size-special);
    color: var(--border-color);
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: var(--font-size-secondary);
    margin: 0;
    color: var(--text-muted);
}

#jobSitesList .empty-state h4,
#jobSitesList .empty-state p {
    font-size: var(--font-size-tertiary);
}

/* Empty copy overlays the whisper ghost cards (does not take a grid row). */
#jobSitesList:has(.job-sites-empty-copy) {
    position: relative;
}

#jobSitesList .job-sites-empty-copy {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.35rem;
    width: auto;
    padding: 1.5rem 1.25rem;
    pointer-events: none;
    box-sizing: border-box;
}

#jobSitesList .job-sites-empty-copy h4 {
    margin: 0;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
}

#jobSitesList .job-sites-empty-copy p {
    margin: 0;
    max-width: 28rem;
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    line-height: 1.4;
}

/* Same fade-in as .job-site-item when status/search filter swaps the list. */
#jobSitesList .job-sites-empty-copy.fade-in {
    -webkit-animation: jobSiteFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation: jobSiteFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

#jobSitesList .job-sites-ghost-card {
    --job-sites-ghost-opacity: 0.1;
    cursor: default;
    pointer-events: none;
    opacity: var(--job-sites-ghost-opacity);
    border-color: var(--border-color);
    background: var(--bg-card);
}

#jobSitesList .job-sites-ghost-card:hover {
    transform: none;
}

/* Ghost fade-in must end at whisper opacity — jobSiteFadeIn ends at 1 and was overriding. */
#jobSitesList .job-sites-ghost-card.fade-in,
#jobSitesList .job-sites-ghost-card.fade-in:hover {
    -webkit-animation: jobSitesGhostFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation: jobSitesGhostFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@-webkit-keyframes jobSitesGhostFadeIn {
    from {
        opacity: 0;
        -webkit-transform: translateY(15px);
        transform: translateY(15px);
    }
    to {
        opacity: var(--job-sites-ghost-opacity, 0.1);
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }
}

@keyframes jobSitesGhostFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: var(--job-sites-ghost-opacity, 0.1);
        transform: translateY(0);
    }
}

#jobSitesList .job-sites-ghost-bar {
    display: block;
    height: 10px;
    max-width: 100%;
    border-radius: 2px;
    background: var(--border-color);
    opacity: 1;
}

#jobSitesList .job-site-header .job-sites-ghost-bar {
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.4rem;
}

#jobSitesList .job-sites-ghost-badge {
    height: 1.75rem;
    border-radius: 8px;
    flex-shrink: 0;
}

#jobSitesList .job-sites-ghost-action {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    flex-shrink: 0;
}

#jobSitesList .job-sites-ghost-card .job-site-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#jobSitesList .job-sites-ghost-card .job-site-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    #jobSitesList .job-sites-ghost-card .job-site-right {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: auto;
    }
}

/* Help View */
.help-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.help-category {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.help-category-title {
    color: var(--text-primary);
    font-size: var(--font-size-default);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.5px;
}

.help-category-title i {
    color: var(--primary-color);
    font-size: var(--font-size-default);
}

.help-card {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.2s ease;
    position: relative;
}

.help-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-green);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
.help-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}
}


@media (hover: hover) and (pointer: fine) {
.help-card:hover::before {
    opacity: 0.03;
}
}


.help-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

.help-card-header i {
    color: var(--primary-color);
    font-size: var(--font-size-default);
    flex-shrink: 0;
}

.help-card-header h4 {
    color: var(--text-primary);
    font-size: var(--font-size-default);
    font-weight: var(--font-weight-semibold);
    margin: 0;
    letter-spacing: -0.3px;
}

.help-card-content {
    padding: 1.25rem;
}

.help-card-content p {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.help-card-content p:last-child {
    margin-bottom: 0;
}

.help-card-content strong {
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
}

body.light-theme .help-card {
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .help-card:hover {
    border-color: rgba(0, 0, 0, 0.12);
}
}


body.light-theme .help-card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.02);
}

/* Settings View */
.settings-content {
    display: flex;
    flex-direction: column;
    font-size: var(--font-size-tertiary);
}

/* Settings: tertiary copy; icons match side menu / view-title (default size, 24px column) */
#settingsView .settings-category-title {
    font-size: var(--font-size-tertiary);
}

#settingsView .settings-category-title > span > i:first-child,
#settingsView .settings-card-info > i {
    font-size: var(--font-size-default);
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

#settingsView .settings-category-title > span > i:first-child {
    color: #68d391;
}

#settingsView .category-chevron {
    font-size: var(--font-size-tertiary);
}

#settingsView .settings-card-text h4,
#settingsView .settings-card-text p {
    font-size: var(--font-size-tertiary);
}

#settingsView .setting-btn {
    font-size: var(--font-size-tertiary);
    padding: 0.5rem 0.85rem;
}

#settingsView .setting-btn i {
    font-size: var(--font-size-default);
}

#settingsView .setting-item label,
#settingsView .setting-item input[type="time"],
#settingsView .setting-item select {
    font-size: var(--font-size-tertiary);
}

#settingsView .settings-card-content {
    font-size: var(--font-size-tertiary);
}

#settingsView .language-dropdown-trigger {
    font-size: var(--font-size-tertiary);
    min-width: 120px;
    padding: 0.35rem 0.6rem;
}

#settingsView .language-dropdown-menu .lang-btn {
    font-size: var(--font-size-tertiary);
}

.settings-card-header {
    cursor: pointer;
    transition: background-color 0.2s;
}

@media (hover: hover) and (pointer: fine) {
.settings-card-header:hover {
    background-color: rgba(0, 0, 0, 0.02);
}
}


@media (hover: hover) and (pointer: fine) {
body.light-theme .settings-card-header:hover {
    background-color: rgba(0, 0, 0, 0.03);
}
}


/* Company Profile Styles */
.logo-upload-section {
    margin-top: 0.5rem;
}

.logo-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 120px;
    border: 1px dashed var(--border-color);
    border-radius: var(--card-radius);
    background: var(--bg-secondary);
    margin-bottom: 1rem;
    padding: 1rem;
}

.logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: var(--font-size-secondary);
}

.logo-placeholder i {
    font-size: var(--font-size-special);
    opacity: 0.5;
}

.logo-upload-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.logo-upload-buttons .btn {
    flex: 1;
    min-width: 120px;
}

.form-hint {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    margin-top: 0.5rem;
    margin-bottom: 0;
}

#companyLogoImage {
    max-width: 100%;
    max-height: 100px;
    object-fit: contain;
    border-radius: var(--card-radius-sm);
}

/* Company Profile Modal - Ensure proper spacing */
#companyProfileModal .modal-body {
    padding-bottom: 1.5rem;
}

#companyProfileModal .form-group:last-child {
    margin-bottom: 0.5rem;
}

/* Business Card Modal */
.business-card-modal-content .modal-body {
    padding: 1rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.business-card-qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.business-card-qr-hint {
    font-size: var(--font-size-secondary);
    color: var(--text-secondary);
    margin: 0 0 1rem 0;
    width: 100%;
}

.business-card-qr-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: transparent;
    margin-bottom: 1rem;
}

body.dark-theme .business-card-qr-wrap {
    background: transparent;
}

.business-card-qr-wrap canvas,
.business-card-qr-wrap img {
    display: block;
    width: 220px;
    height: 220px;
    max-width: 100%;
    border-radius: 8px;
    object-fit: contain;
    background: transparent !important;
}

/* Logo Crop Modal Styles */
.crop-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.crop-instructions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--primary-color);
    color: white;
    border-radius: var(--card-radius-sm);
    font-size: var(--font-size-secondary);
}

.crop-instructions i {
    font-size: var(--font-size-default);
}

.crop-canvas-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    overflow: hidden;
}

#logoCropCanvas {
    display: block;
    width: 100%;
    height: auto;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#logoCropCanvas:active {
    cursor: grabbing;
}

.crop-zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.btn-zoom {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: var(--font-size-default);
    transition: all 0.2s;
}

@media (hover: hover) and (pointer: fine) {
.btn-zoom:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}
}


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

.crop-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.crop-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--font-size-secondary);
    padding: 0.5rem;
    background: var(--bg-card);
    border-radius: var(--card-radius-sm);
}

.crop-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.crop-buttons .btn {
    min-width: 100px;
}

.settings-card-content {
    padding: 1rem 1.5rem 0.5rem 1.5rem;
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
    display: none;
    animation: slideDown 0.3s ease;
}

.settings-card-content.active {
    display: block;
}

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

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    margin-right: 1rem;
    font-size: var(--font-size-tertiary);
}

.setting-item input[type="time"],
.setting-item select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 6px;
    font-size: var(--font-size-tertiary);
    min-width: 120px;
}

.setting-item input[type="time"]:focus,
.setting-item select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.settings-category {
    display: flex;
    flex-direction: column;
}

.settings-category-title {
    color: var(--text-primary);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    letter-spacing: -0.5px;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 12px;
    transition: all 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
.settings-category-title:hover {
    background: rgba(255, 255, 255, 0.03);
}
}


.settings-category-title span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-category-title i {
    color: #68d391;
}

.category-chevron {
    color: var(--text-secondary);
    font-size: var(--font-size-tertiary);
    transition: transform 0.3s ease;
}

.settings-category-content {
    display: block;
    opacity: 1;
}

.settings-category:not(.collapsed) > .settings-category-content {
    overflow: visible;
}

.settings-category.collapsed .settings-category-content {
    height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.settings-category.collapsed .category-chevron {
    -webkit-transform: rotate(-90deg);
    transform: rotate(-90deg);
}

.settings-card {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: hidden;
    transition: all 0.2s ease;
    position: relative;
    margin-bottom: 0.25rem;
}

/* Dropdown menus extend below the card — avoid clip and stack above sibling cards */
.settings-card:has(.language-dropdown) {
    overflow: visible;
    position: relative;
    z-index: 1;
}

.settings-card:has(.language-dropdown.is-open) {
    z-index: 200;
}

.settings-card::before {
    display: none;
}


.settings-card.danger {
}

.settings-card.danger::before {
    background: var(--accent-red);
}

@media (hover: hover) and (pointer: fine) {
.settings-card.danger:hover {
}
}

/* ========== My Account redesigned (profile header + cards + list groups) ========== */
.account-panel {
    padding-bottom: 2rem;
}

#myAccountView .account-panel {
    display: flex;
    flex-direction: column;
}

#myAccountView .account-stack,
#myAccountView .account-stack > .collapsible-section + .collapsible-section,
#myAccountView .account-panel > .collapsible-section,
#myAccountView .account-panel > .account-list-item.danger {
    width: 100%;
}

#myAccountView .account-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#myAccountView .account-panel > .collapsible-section + .collapsible-section,
#myAccountView .account-panel > .account-stack + .collapsible-section {
    margin-top: 0.5rem;
}

#myAccountView .collapsible-section {
    margin-bottom: 0;
    overflow: visible;
    background: transparent;
    border: none;
    border-radius: 0;
    position: relative;
}

#myAccountView .collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    padding: 0.625rem 0.75rem;
    height: 2.375rem;
    min-height: 2.375rem;
    background: var(--bg-secondary);
    border: 0.0625rem solid var(--border-color);
    border-radius: 0.125rem;
    box-sizing: border-box;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease, color 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    #myAccountView .collapsible-header:hover {
        background: var(--finance-track, var(--bg-tertiary));
        color: var(--text-primary);
    }
}

#myAccountView .collapsible-section:not(.collapsed) .collapsible-header {
    background: var(--finance-track, var(--bg-tertiary));
    color: var(--text-primary);
}

#myAccountView .collapsible-header .collapse-icon {
    width: 0.625rem;
    font-size: var(--font-size-secondaryallest);
    color: var(--text-muted);
    line-height: 1;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(0deg);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), color 0.15s ease;
}

#myAccountView .collapsible-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

#myAccountView .collapsible-content {
    display: block;
    padding: 0.5rem 0 0;
    margin: 0;
    overflow: hidden;
    opacity: 1;
}

#myAccountView .collapsible-section.collapsed .collapsible-content {
    height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    opacity: 0;
    pointer-events: none;
}

#myAccountView .collapsible-section:not(.collapsed) .collapsible-content {
    overflow: visible;
}

.account-profile-header {
    text-align: center;
    padding: 1rem 0 1.25rem;
}

.account-profile-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 0.0625rem dashed var(--border-color);
    margin: 0 auto 0.75rem;
    cursor: pointer;
    overflow: hidden;
    transition: background 0.2s, border-color 0.2s;
}

@media (hover: hover) and (pointer: fine) {
.account-profile-logo-wrap:hover {
    background: var(--finance-track, var(--bg-tertiary));
    border-color: var(--accent-green);
}
}

.account-profile-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-profile-logo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.5rem;
}

.account-profile-name {
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-semibold);
    margin: 0 0 0.25rem;
    color: var(--text-primary);
}

.account-profile-name-hint {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    margin: 0 0 0.5rem;
}

.account-profile-name-hint.hidden {
    display: none;
}

.account-support-line {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
}

.account-support-id {
    font-family: var(--font-family-mono);
    letter-spacing: 0.02em;
}

.account-copy-id {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.25rem;
    cursor: pointer;
    border-radius: 0.125rem;
}

@media (hover: hover) and (pointer: fine) {
.account-copy-id:hover {
    color: var(--text-primary);
}
}

.account-cards-row {
    display: flex;
    flex-direction: column;
}

.account-cards-row.account-cards-row--member {
    display: flex;
    flex-direction: column;
}

.account-cloud-storage-card {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.account-quota-meter {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.account-quota-meter-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.account-quota-meter-label {
    font-size: var(--font-size-secondaryallest);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.account-quota-meter-value {
    font-size: var(--font-size-secondaryallest);
    color: var(--text-secondary);
    white-space: nowrap;
}

.account-quota-meter-hint {
    margin: 0.15rem 0 0;
    font-size: var(--font-size-secondaryallest);
    color: var(--text-muted);
    line-height: 1.25;
}

.account-quota-meter.account-quota-meter--warn .account-pdf-quota-bar-fill {
    background: #d97706;
}

.account-quota-meter.account-quota-meter--full .account-pdf-quota-bar-fill {
    background: #ef4444;
}

.account-profile-logo-wrap.account-ui-member-restricted {
    pointer-events: none;
    cursor: default;
    opacity: 0.88;
}

.account-card {
    background: var(--bg-secondary);
    border: 0.0625rem solid var(--border-color);
    border-radius: 0.125rem;
    padding: 0.75rem 0.875rem;
    text-align: left;
    box-shadow: inset 0.1875rem 0 0 var(--ov-accent, var(--accent-green));
    box-sizing: border-box;
}

.account-plan-card {
    min-height: 0;
    --ov-accent: var(--accent-green);
}

.account-cloud-storage-card {
    --ov-accent: var(--accent-blue);
}

.account-pdf-quota-card {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.account-pdf-quota-bar {
    width: 100%;
    height: 0.375rem;
    border-radius: 0.125rem;
    background: var(--finance-track, var(--bg-tertiary));
    overflow: hidden;
    margin-top: 0.15rem;
}

body.light-theme .account-pdf-quota-bar {
    background: var(--finance-track, var(--bg-tertiary));
}

.account-pdf-quota-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 0.125rem;
    background: var(--accent-green);
    transition: width 0.25s ease;
}

.account-pdf-quota-card.account-pdf-quota-card--warn .account-pdf-quota-bar-fill {
    background: #d97706;
}

.account-pdf-quota-card.account-pdf-quota-card--full .account-pdf-quota-bar-fill {
    background: #ef4444;
}

.account-action-card {
    width: 100%;
    cursor: pointer;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.account-action-card i:first-child {
    font-size: 1.25rem;
    color: var(--accent-primary);
}

.account-card-label {
    font-size: var(--font-size-secondaryallest);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    font-weight: var(--font-weight-semibold);
}

.account-card-title {
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.account-card-sub {
    font-size: var(--font-size-secondaryallest);
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.account-card-sub.hidden {
    display: none;
}

.account-card-meta {
    font-size: var(--font-size-secondaryallest);
    color: var(--text-muted);
    margin: 0.35rem 0 0;
}

.account-list-group {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
    margin-bottom: 0;
}

.account-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    min-height: 2.375rem;
    box-sizing: border-box;
    color: var(--text-primary);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: background-color 0.15s ease;
    border: 0.0625rem solid var(--border-color);
    border-radius: 0.125rem;
    background: var(--bg-secondary);
    width: 100%;
    text-align: left;
}

.account-list-group .account-list-item + .account-list-item {
    margin-top: 0.25rem;
}

@media (hover: hover) and (pointer: fine) {
.account-list-item:hover {
    background: var(--finance-track, var(--bg-tertiary));
}
}

.account-list-item i:first-child {
    width: 0.875rem;
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
}

.account-list-item > span:nth-of-type(1) {
    flex: 1;
}

.account-list-value {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    font-family: var(--font-family-mono);
    font-weight: var(--font-weight-regular, 400);
}

.account-list-chevron {
    font-size: var(--font-size-secondaryallest);
    color: var(--text-muted);
}

.account-list-copy {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.25rem;
    cursor: pointer;
}

.account-list-item.danger {
    color: var(--accent-danger);
    margin-top: 0.5rem;
}

.account-list-item.danger i:first-child {
    color: var(--accent-danger);
}

.account-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    text-align: center;
    font-size: var(--font-size-secondaryallest);
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.account-version,
.account-last-login {
    display: block;
}


.settings-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    gap: 1rem;
    border: none;
}

.settings-card-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.settings-card-info i {
    color: #68d391;
    font-size: var(--font-size-default);
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.settings-card.danger .settings-card-info i {
    color: #ef4444;
}

.settings-card-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.settings-card-text h4 {
    color: var(--text-primary);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    margin: 0;
    letter-spacing: -0.3px;
}

.settings-card-text p {
    color: var(--text-secondary);
    font-size: var(--font-size-tertiary);
    margin: 0;
    line-height: 1.5;
}

.setting-btn {
    padding: 0.5rem 0.85rem;
    background: #68d391;
    color: #1a202c;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.setting-btn i {
    font-size: var(--font-size-default);
}

@media (hover: hover) and (pointer: fine) {
.setting-btn:hover {
    background: #48bb78;
    transform: translateY(-2px);
}
}


.setting-btn.danger {
    background: #ef4444;
    color: white;
}

@media (hover: hover) and (pointer: fine) {
.setting-btn.danger:hover {
    background: #dc2626;
}
}


/* Toggle Switch — flat sheet control (matches Labor / view-mode tabs) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 2.75rem;
    height: 1.5rem;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    box-sizing: border-box;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 1.125rem;
    width: 1.125rem;
    left: 0.1875rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-muted);
    border-radius: 2px;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translate(1.25rem, -50%);
    background: #000000;
}

.toggle-switch input:focus-visible + .toggle-slider {
    outline: 1px solid var(--border-color);
    outline-offset: 0.125rem;
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.language-selector.language-dropdown {
    gap: 0;
    display: inline-flex;
    position: relative;
    align-items: flex-start;
}

.language-dropdown.is-open {
    z-index: 1;
}

.language-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.4rem 0.75rem;
    background: transparent;
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-semibold);
    transition: opacity 0.2s ease;
    min-width: 148px;
}

@media (hover: hover) and (pointer: fine) {
.language-dropdown-trigger:hover {
    opacity: 0.88;
}
}

.language-dropdown-chevron {
    font-size: 0.7em;
    opacity: 0.85;
    transition: transform 0.2s ease;
}

.language-dropdown.is-open .language-dropdown-chevron {
    transform: rotate(180deg);
}

.language-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    min-width: 168px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

/* Author `display:flex` must not override the HTML `hidden` attribute (would leave menu visible). */
.language-dropdown-menu[hidden] {
    display: none;
}

.language-dropdown--center .language-dropdown-menu {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}

.language-dropdown-menu .lang-btn {
    width: 100%;
    min-width: auto;
    justify-content: flex-start;
    transform: none;
    background: transparent;
    border: none;
    box-shadow: none;
}

@media (hover: hover) and (pointer: fine) {
.language-dropdown-menu .lang-btn:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    opacity: 1;
}
}

.language-dropdown-menu .lang-btn.active {
    background: rgba(104, 211, 145, 0.2);
    border: none;
    color: var(--accent-green);
    font-weight: var(--font-weight-semibold);
}

body.light-theme .language-dropdown-menu .lang-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

body.light-theme .language-dropdown-menu .lang-btn.active {
    background: rgba(104, 211, 145, 0.25);
}

.lang-btn {
    padding: 0.4rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    cursor: pointer;
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-semibold);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 60px;
}

@media (hover: hover) and (pointer: fine) {
.lang-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}
}


.lang-btn.active {
    background: #68d391;
    border-color: #68d391;
    color: #1a202c;
}

@media (max-width: 480px) {
    .language-selector:not(.language-dropdown) {
        gap: 4px;
    }
    
    .language-selector:not(.language-dropdown) .lang-btn {
        flex: 1;
        padding: 0.35rem 0.6rem;
        font-size: var(--font-size-secondary);
        min-width: auto;
    }

    .language-dropdown-trigger {
        min-width: 132px;
        padding: 0.35rem 0.6rem;
    }
}

body.light-theme .settings-card {
    background: transparent;
    border: none;
}


body.light-theme .settings-card.danger {
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .settings-card.danger:hover {
}
}


body.light-theme .toggle-slider {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

body.light-theme .toggle-slider:before {
    background: var(--text-muted);
}

body.light-theme .toggle-switch input:checked + .toggle-slider {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

body.light-theme .toggle-switch input:checked + .toggle-slider:before {
    background: #000000;
}


body.light-theme .history-section {
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .history-section:hover {
    border-color: rgba(0, 0, 0, 0.12);
}
}


body.light-theme .history-section .section-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .activity-item {
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .activity-item:hover {
    border-color: rgba(0, 0, 0, 0.15);
}
}


.content-panel {
    background-color: var(--glass-bg-dark);
    border: 1px solid transparent;
    border-radius: var(--card-radius);
    padding: 1.5rem;
}

/* Light theme glass effect */
body.light-theme .content-panel {
    background-color: var(--glass-bg-light);
}

/* Search */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: 1.5rem;
}

/* Search — flat sheet row (matches Labor / task header) */
.search-input {
    flex: 1;
    min-width: 0;
    width: auto;
    padding: 0.2rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    outline: none;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    min-height: 2.25rem;
    line-height: 1.25;
    box-shadow: none;
}

.search-container .search-input {
    padding-right: 2.5rem;
}

.search-input::placeholder {
    color: var(--text-muted);
    font-weight: var(--font-weight-semibold);
}

.search-input:focus {
    border-color: var(--border-color);
    background: var(--bg-tertiary);
}

body.light-theme .search-input {
    background: var(--transparent-bg-light);
}

body.light-theme .search-input:focus {
    background: var(--transparent-bg-light);
}

/* Status Cards */
.status-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
    margin-bottom: 1.5rem;
}

.status-card:first-child {
    grid-column: 1 / -1;
}

.status-card {
    padding: var(--spacing-lg) var(--spacing-md);
    border-radius: var(--card-radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: var(--touch-target-min);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    border: none;
}

@media (hover: hover) and (pointer: fine) {
.status-card:hover {
    -webkit-transform: translateY(-1px);
    transform: translateY(-1px);
}
}


.status-card:active {
    -webkit-transform: scale(0.97);
    transform: scale(0.97);
    -webkit-transition: transform 0.1s ease;
    transition: transform 0.1s ease;
}

.status-card.active {
    -webkit-transform: scale(1);
    transform: scale(1);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.2);
}

.status-card.drag-over {
    transform: scale(1.05);
    border: 1px solid rgba(74, 222, 128, 0.8);
    will-change: transform;
    transition: transform 0.15s ease;
}

.status-card.status-dropped {
    animation: statusDropGlow 0.6s ease-out;
    will-change: transform;
}

@keyframes statusDropGlow {
    0% {
        transform: scale(1.1);
    }
    25%, 50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.status-card.all {
    background: #4a5568;
    color: #ffffff;
}

.status-card.in-progress {
    background: var(--accent-blue);
    color: #ffffff;
}

.status-card.upcoming {
    background: #f6ad55;
    color: var(--text-primary);
}

.status-card.on-hold {
    background: #fc8181;
    color: var(--text-primary);
}

.status-card.completed {
    background: #68d391;
    color: var(--text-primary);
}

.status-count {
    font-size: var(--font-size-special);
    font-weight: 900;
    line-height: 1.2;
}

.status-label {
    font-size: var(--font-size-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: var(--font-weight-semibold);
    line-height: 1.4;
}

/* History icon button — sits inside the right edge of the search input */
.history-btn {
    position: absolute;
    z-index: 1;
    top: 0;
    right: 0;
    bottom: 0;
    width: 2.5rem;
    height: auto;
    min-width: 2.5rem;
    min-height: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: 2px;
    font-size: var(--font-size-tertiary);
    cursor: pointer;
    transition: color 0.2s ease;
    margin: 0;
    line-height: 1;
}

@media (hover: hover) and (pointer: fine) {
    .history-btn:hover {
        background: transparent;
        color: var(--text-primary);
        transform: none;
    }
}


/* Job Sites Section - stacking above history-btn when dropdown overlaps (iOS WebView fix) */
.job-sites-section {
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 2;
}

.job-sites-section-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-bottom: var(--spacing-sm);
}

.job-sites-section-header .job-sites-sort-dropdown {
    margin: 0;
    flex-shrink: 0;
}

.job-sites-section:has(.job-sites-sort-dropdown.is-open) {
    z-index: 10050;
}

.section-title {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    line-height: 1.4;
}

.section-title i {
    color: var(--accent-primary);
    font-size: var(--font-size-base);
    width: 18px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Job Sites List - Responsive Grid */
.job-sites-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: 5px;
}

/* Tablet: 2-column grid (iPad portrait) */
@media (min-width: 768px) {
    .job-sites-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
        contain: layout style paint;
        will-change: transform;
    }
}

/* Desktop: 3-column grid (iPad landscape, desktop) */
@media (min-width: 1024px) {
    .job-sites-list {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-sm);
        contain: layout style paint;
        will-change: transform;
    }
}

/* Large Desktop: 4-column grid (big screens) */
@media (min-width: 1440px) {
    .job-sites-list {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--spacing-sm);
        contain: layout style paint;
        will-change: transform;
    }
}

/* Extra Large: 4-column grid (ultra-wide monitors) */
@media (min-width: 1920px) {
    .job-sites-list {
        grid-template-columns: repeat(4, 1fr);
        gap: var(--spacing-sm);
        contain: layout style paint;
        will-change: transform;
    }
}

.job-site-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1rem;
    border-radius: var(--card-radius);
    cursor: grab;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid var(--border-color);
    overflow: hidden;
    contain: layout style paint;
    will-change: transform;
    min-height: auto;
    background: var(--bg-card);
}

@media (hover: hover) and (pointer: fine) {
.job-site-item:hover {
    transform: translateY(-2px);
}
}


/* Fade in animation for job site items when filtering */
.job-site-item.fade-in {
    -webkit-animation: jobSiteFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation: jobSiteFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@-webkit-keyframes jobSiteFadeIn {
    from {
        opacity: 0;
        -webkit-transform: translateY(15px);
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }
}

@keyframes jobSiteFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.job-site-item.holding {
    -webkit-transform: scale(1.02);
    transform: scale(1.02);
    -webkit-transition: transform 0.15s ease;
    transition: transform 0.15s ease;
}

.job-site-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
    will-change: transform, opacity;
    transition: none;
}

/* Grid layout adjustments for tablets and above */
@media (min-width: 768px) {
    .job-site-item {
        flex-direction: column; /* Stack content vertically */
        align-items: flex-start;
        padding: var(--spacing-md);
        justify-content: space-between;
    }
    
    /* Job site info - takes up most space */
    .job-site-info {
        flex: 1;
        width: 100%;
        padding-right: 0;
        display: flex;
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .job-site-header {
        margin-bottom: var(--spacing-sm);
    }
    
    .job-site-name {
        font-size: var(--font-size-secondary);
        font-weight: var(--font-weight-semibold);
        margin-bottom: var(--spacing-xs);
        line-height: 1.4;
    }
    
    .job-site-client,
    .job-site-address,
    .job-site-description {
        font-size: var(--font-size-secondary);
        line-height: 1.4;
        margin-bottom: var(--spacing-xs);
        opacity: 0.9;
    }
    
    /* Right side with status and actions */
    .job-site-right {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-shrink: 0;
    }
    
    /* Status dropdown - left side */
    .status-select {
        width: 140px;
        margin-right: 0.75rem;
        background: var(--bg-secondary);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 14px;
        padding: 0.6rem 1rem;
        font-size: var(--font-size-tertiary);
        font-weight: var(--font-weight-semibold);
        color: inherit;
        cursor: pointer;
        transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                    background 0.2s ease,
                    border-color 0.2s ease;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        background-image: 
            var(--bg-secondary),
            url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' opacity='0.9' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
        background-position: center, right 0.75rem center;
        background-repeat: no-repeat, no-repeat;
        background-size: cover, 12px;
        padding-right: 3.5rem;
        min-width: 160px;
    }
    
    @media (hover: hover) and (pointer: fine) {
    .status-select:hover {
        background: var(--bg-secondary);
        border-color: rgba(255, 255, 255, 0.35);
        transform: translateY(-2px) scale(1.02);
    }
}

    .status-select:active {
        transform: translateY(0) scale(0.98);
    }
    
    .status-select:focus {
        outline: none !important;
        background: var(--bg-secondary);
        border-color: rgba(255, 255, 255, 0.4);
        -webkit-tap-highlight-color: transparent !important;
        -webkit-focus-ring-color: transparent !important;
    }
    
    /* Action buttons - right side */
    .job-site-actions {
        display: flex;
        gap: 0.4rem;
        align-items: center;
    }
    
    .action-btn {
        background: rgba(255, 255, 255, 0.12);
        border: 3px solid rgba(255, 255, 255, 0.18);
        color: inherit;
        padding: 0;
        border-radius: var(--card-radius);
        font-size: 0.75rem;
        cursor: pointer;
        transition: all 0.2s ease;
        min-width: 60px;
        width: 60px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    @media (hover: hover) and (pointer: fine) {
.action-btn:hover {
        background: rgba(255, 255, 255, 0.25);
        border-color: rgba(255, 255, 255, 0.3);
        transform: translateY(-1px);
    }
}

    
    .action-btn.delete-btn {
        background: rgba(255, 255, 255, 0.15);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    @media (hover: hover) and (pointer: fine) {
.action-btn.delete-btn:hover {
        background: rgba(255, 255, 255, 0.25);
        border-color: rgba(255, 255, 255, 0.3);
        transform: translateY(-1px);
    }
}

    
    /* Task count badge */
    .task-count-badge {
        background: rgba(255, 255, 255, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 8px;
        padding: 0;
        font-size: var(--font-size-tertiary);
        font-weight: var(--font-weight-semibold);
        margin-left: 0;
        min-width: 0;
        justify-content: center;
    }
    
    /* Finance count badge */
    .finance-count-badge {
        background: rgba(255, 255, 255, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 8px;
        padding: 0;
        font-size: var(--font-size-tertiary);
        font-weight: var(--font-weight-semibold);
        margin-left: 0;
        min-width: 0;
        justify-content: center;
    }
    
    /* Make hover effect more subtle in grid */
    @media (hover: hover) and (pointer: fine) {
.job-site-item:hover {
        transform: translateY(-4px) scale(1.02);
    }
}

}

.job-site-item.in-progress {
    background: var(--accent-blue);
    color: #ffffff;
}

.job-site-item.in-progress .job-site-name,
.job-site-item.in-progress .job-site-client,
.job-site-item.in-progress .job-site-address,
.job-site-item.in-progress .job-site-description,
.job-site-item.in-progress .status-badge,
.job-site-item.in-progress i {
    color: #ffffff !important;
}

.job-site-item.upcoming {
    background: #f6ad55;
    color: #ffffff;
}

.job-site-item.upcoming .job-site-name,
.job-site-item.upcoming .job-site-client,
.job-site-item.upcoming .job-site-address,
.job-site-item.upcoming .job-site-description,
.job-site-item.upcoming .status-badge,
.job-site-item.upcoming i {
    color: #ffffff !important;
}

.job-site-item.on-hold {
    background: #fc8181;
    color: #ffffff;
}

.job-site-item.on-hold .job-site-name,
.job-site-item.on-hold .job-site-client,
.job-site-item.on-hold .job-site-address,
.job-site-item.on-hold .job-site-description,
.job-site-item.on-hold .status-badge,
.job-site-item.on-hold i {
    color: #ffffff !important;
}

.job-site-item.completed {
    background: #68d391;
    color: #ffffff;
}

.job-site-item.completed .job-site-name,
.job-site-item.completed .job-site-client,
.job-site-item.completed .job-site-address,
.job-site-item.completed .job-site-description,
.job-site-item.completed .status-badge,
.job-site-item.completed i {
    color: #ffffff !important;
}

/* Job site number colors on status cards */
.job-site-item.in-progress .job-site-number,
.job-site-item.upcoming .job-site-number,
.job-site-item.on-hold .job-site-number,
.job-site-item.completed .job-site-number {
    color: #ffffff !important;
    font-weight: 800;
}


.job-site-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    padding-right: 0.75rem;
}

.job-site-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.job-site-number {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-secondary);
    color: var(--text-primary);
    letter-spacing: 0.5px;
    display: inline-block;
    flex-shrink: 0;
    opacity: 0.85;
}

.job-site-name {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-secondary);
    color: var(--text-primary);
    line-height: 1.3;
    letter-spacing: -0.01em;
}

/* Professional Badge Pills - Transparent */
.job-site-badges {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem 0.3rem 0.55rem;
    border-radius: 6px;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.01em;
    white-space: nowrap;
    transition: all 0.15s ease;
    background: rgba(255, 255, 255, 0.11);
    border: none;
    color: var(--text-primary);
}

.badge-pill i {
    font-size: var(--font-size-tertiary);
    opacity: 1;
}

/* Light theme adjustments */
body.light-theme .badge-pill {
    color: #FFFFFF;
}

.task-count-badge {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: inherit;
    min-width: 0;
    justify-content: center;
}

.task-count-badge i {
    font-size: var(--font-size-tertiary);
    opacity: 0.8;
}

.finance-count-badge {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: inherit;
    min-width: 0;
    justify-content: center;
    margin-left: 0;
}

.finance-count-badge i {
    font-size: var(--font-size-tertiary);
    opacity: 0.8;
}

.task-count {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
}

.job-site-client {
    font-size: var(--font-size-secondary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: var(--font-weight-medium);
    line-height: 1.3;
}

.job-site-client i {
    font-size: var(--font-size-secondary);
    opacity: 0.8;
    min-width: 16px;
}

.job-site-address {
    font-size: var(--font-size-secondary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: var(--font-weight-medium);
    line-height: 1.3;
}

.job-site-address i {
    font-size: var(--font-size-secondary);
    opacity: 0.8;
    min-width: 16px;
}

.job-site-description {
    font-size: var(--font-size-tertiary);
    color: var(--text-secondary);
    line-height: 1.4;
    font-weight: var(--font-weight-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-top: 0.25rem;
}

.job-site-right {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.job-site-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.action-btn {
    background: rgba(0,0,0,0);
    border: 3px solid rgba(255,255,255,0.14);
    color: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    border-radius: var(--card-radius);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 32px;
    flex-shrink: 0;
}

@media (hover: hover) and (pointer: fine) {
.action-btn:hover {
    background-color: rgba(0,0,0,0.3);
    transform: scale(1.15);
}
}


@media (hover: hover) and (pointer: fine) {
.phone-btn:hover {
    background-color: rgba(104, 211, 145, 0.3);
    color: var(--text-primary);
}
}


@media (hover: hover) and (pointer: fine) {
.directions-btn:hover {
    background-color: rgba(66, 153, 225, 0.3);
    color: var(--text-primary);
}
}


.status-select {
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 14px;
    padding: 0.5rem 1rem;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: inherit;
    cursor: pointer;
    width: 140px;
    min-width: 140px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.2s ease,
                border-color 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-focus-ring-color: transparent;
    background-image: 
        var(--bg-tertiary),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' opacity='0.85' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-position: center, right 0.75rem center;
    background-repeat: no-repeat, no-repeat;
    background-size: cover, 12px;
    padding-right: 3.5rem;
}

@media (hover: hover) and (pointer: fine) {
.status-select:hover {
    background: var(--bg-tertiary);
    border-color: rgba(0, 0, 0, 0.25);
    transform: translateY(-2px) scale(1.02);
}
}

.status-select:active {
    transform: translateY(0) scale(0.98);
}

.status-select:focus {
    outline: none !important;
    background: var(--bg-tertiary);
    border-color: rgba(0, 0, 0, 0.3);
    -webkit-tap-highlight-color: transparent !important;
    -webkit-focus-ring-color: transparent !important;
}

/* Subtle success pulse when status changes (add .status-changed via JS) */
.status-select.status-changed {
    animation: statusChangePulse 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes statusChangePulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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

@media (hover: hover) and (pointer: fine) {
.delete-btn:hover {
    background-color: rgba(252, 129, 129, 0.4);
    transform: scale(1.1) rotate(90deg);
}
}


/* Floating Add Button */
.floating-add-btn {
    position: fixed !important;
    bottom: 2rem !important;
    right: 2rem !important;
    width: 64px !important;
    height: 64px !important;
    border-radius: 50% !important;
    background: var(--accent-green) !important;
    color: var(--text-icons) !important;
    border: none !important;
    font-size: var(--font-size-special) !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 9999 !important;
    pointer-events: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    visibility: visible !important;
    opacity: 1 !important;
}

@media (hover: hover) and (pointer: fine) {
.floating-add-btn:hover {
    transform: scale(1.15) rotate(90deg);
    background: var(--accent-green) !important;
}
}


.floating-add-btn:active {
    transform: scale(1.05) rotate(90deg);
}

/* Remove all shadows from floating button in all states */
.floating-add-btn {
}

@media (hover: hover) and (pointer: fine) {
    .floating-add-btn:hover,
    .floating-add-btn:active,
    .floating-add-btn:focus {
    }
}


/* Hide floating button when any modal is open */
body.modal-open .floating-add-btn {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Prevent layout shift when modal opens */
body.modal-open {
    overflow: hidden;
    width: 100%;
    max-width: 100vw;
    /* Position fixed prevents any scrollbar-related layout shifts */
    position: relative;
}

/* Side Menu - Capacitor/iOS GPU-accelerated (transform only, no left/width/margin) */
.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 75%;
    height: 100vh;
    background-color: rgba(31, 41, 55, 0.97);
    z-index: 1000;
    border-right: 1px solid rgba(75, 85, 99, 0.3);
    font-size: var(--font-size-secondary);
    /* GPU layer: translateX + translateZ(0), no backdrop-filter */
    -webkit-transform: translateX(-100%) translateZ(0);
    transform: translateX(-100%) translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
    will-change: transform;
    contain: layout style paint;
    -webkit-transition: -webkit-transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.side-menu.active {
    -webkit-transform: translateX(0) translateZ(0);
    transform: translateX(0) translateZ(0);
}

/* Tablet and up - use fixed width */
@media (min-width: 768px) {
    .side-menu {
        width: 300px;
    }
}

/* Light theme side menu - solid, no transparency */
body.light-theme .side-menu {
    background-color: #ffffff;
    border-right: 1px solid rgba(209, 213, 219, 0.3);
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .menu-item:hover {
    background-color: rgba(209, 213, 219, 0.3);
}
}


@media (hover: hover) and (pointer: fine) {
body.light-theme .menu-close:hover {
    background-color: rgba(209, 213, 219, 0.3);
}
}


.menu-header {
    padding: 1.25rem 1.5rem;
    padding-top: calc(env(safe-area-inset-top, 0px) + 1.25rem);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.menu-header h3 {
    color: var(--text-primary);
    padding: 0.6rem;
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-semibold);
}

.menu-account-btn {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.5rem 0.35rem 0.25rem;
    margin: 0;
    border: none;
    border-radius: 2px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}

.menu-account-btn:active {
    background: color-mix(in srgb, var(--bg-tertiary, rgba(255, 255, 255, 0.06)) 80%, transparent);
}

@media (hover: hover) and (pointer: fine) {
    .menu-account-btn:hover {
        background: color-mix(in srgb, var(--bg-tertiary, rgba(255, 255, 255, 0.06)) 80%, transparent);
    }
}

.menu-account-avatar {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary, var(--text-secondary));
    font-size: 1.75rem;
    line-height: 1;
}

.menu-account-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.menu-account-name {
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.menu-account-caption {
    font-size: 0.7rem;
    font-weight: var(--font-weight-medium, 500);
    color: var(--text-muted, var(--text-secondary));
    line-height: 1.2;
}

.menu-close {
    background: none;
    border: none;
    color: var(--text-icons);
    font-size: var(--font-size-secondary);
    cursor: pointer;
    padding: 0.6rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (hover: hover) and (pointer: fine) {
.menu-close:hover {
    background-color: rgba(75, 85, 99, 0.3);
    transform: scale(1.1);
}
}


/* Menu Header Actions Container */
.menu-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Notification Bell Button */
.notification-bell-btn {
    background: none;
    border: none;
    color: var(--text-icons);
    font-size: var(--font-size-secondary);
    cursor: pointer;
    padding: 0.6rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

@media (hover: hover) and (pointer: fine) {
.notification-bell-btn:hover {
    background-color: rgba(75, 85, 99, 0.3);
    transform: scale(1.1);
}
}


.notification-bell-btn i {
    color: var(--accent-primary);
}

.notification-bell-btn.has-notifications i,
.header-announcements-btn.has-notifications i {
    animation: bellRing 0.5s ease-in-out;
}

@keyframes bellRing {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(15deg); }
    50% { transform: rotate(-15deg); }
    75% { transform: rotate(10deg); }
}

/* Announcement Badge */
.announcement-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--accent-red);
    color: white;
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-bold);
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.header-announcements-btn .announcement-badge {
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    font-size: 10px;
    border-radius: 8px;
    padding: 0 3px;
}

.menu-content {
    padding: 1rem;
}

.menu-item {
    width: 100%;
    padding: 1.2rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-secondary);
    min-height: 52px;
}

/* Desktop-only shortcut replacing hidden floating plus button. */
.desktop-create-jobsite-menu-item {
    display: none;
}

@media (hover: hover) and (pointer: fine) {
.menu-item:hover {
    background-color: rgba(75, 85, 99, 0.3);
    transform: translateX(4px);
}
}


.menu-item.active {
    background-color: var(--primary-color);
    color: white;
}

.menu-item.active i {
    color: white;
}

/* User flow "New" badge (driven by user-flow-features.json; app shows when feature not yet opened) */
.user-flow-badge {
    display: none;
    margin-left: auto;
    padding: 0.2rem 0.5rem;
    font-size: var(--font-size-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--accent-primary);
    color: #fff;
    border-radius: 6px;
}
.user-flow-badge.visible {
    display: inline-flex;
    align-items: center;
}
.menu-item.active .user-flow-badge.visible {
    background: rgba(255,255,255,0.3);
    color: #fff;
}

.menu-item i {
    color: var(--text-primary);
    font-size: var(--font-size-secondary);
    width: 24px;
    text-align: center;
}

/* Overlay - no transition so only the menu animates on web */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    z-index: 999;
    transition: none;
    -webkit-transition: none;
}


.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* iOS-Style Slide Animations (translate3d for compositor layer on WebKit) */
@keyframes slideInFromRight {
    from {
        transform: translate3d(calc(100% + 16px), 0, 0);
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideOutToRight {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        transform: translate3d(calc(100% + 16px), 0, 0);
    }
}

/* Top slide animations for keyboard-friendly modals */
@keyframes slideInFromTop {
    from {
        transform: translate3d(0, calc(-100% - 16px), 0);
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideOutToTop {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        transform: translate3d(0, calc(-100% - 16px), 0);
    }
}

/*
 * Modal-only exit: transform + opacity (both compositor props on .modal-content).
 * Not used by Capacitator iOS WAAPI path (transform-only for WKWebView FPS).
 * Separate names so view-container slides stay transform-only.
 */
@keyframes modalSlideOutToRight {
    from {
        transform: translate3d(0, 0, 0);
        opacity: 1;
    }
    to {
        transform: translate3d(calc(100% + 16px), 0, 0);
        opacity: 0;
    }
}

@keyframes modalSlideOutToTop {
    from {
        transform: translate3d(0, 0, 0);
        opacity: 1;
    }
    to {
        transform: translate3d(0, calc(-100% - 16px), 0);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes modalFadeInCenter {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes modalFadeOutCenter {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.98);
    }
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    background-color: transparent;
    z-index: 2000;
    align-items: center;
    justify-content: flex-end;
    padding: 0;
    overflow: hidden;
    box-sizing: border-box;
    touch-action: pan-y;
    --modal-backdrop-duration: 0.32s;
    --modal-slide-duration: 0.32s;
    --modal-slide-out-duration: 0.28s;
    /* iOS-sheet style: soft decelerate in, accelerate out (avoids end-of-exit crawl). */
    --modal-slide-easing: cubic-bezier(0.32, 0.72, 0, 1);
    --modal-slide-out-easing: cubic-bezier(0.32, 0, 0.67, 0);
}

.modal::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    /* Always off — shade is driven only by JS WAAPI on modal.backgroundColor (avoids double-dim flicker). */
    opacity: 0 !important;
    transition: none !important;
    -webkit-transition: none !important;
    pointer-events: none;
}

.modal.active {
    display: flex;
}

.modal.active::before {
    opacity: 0 !important;
}

.modal.slide-out::before,
.modal.slide-out-top::before {
    opacity: 0 !important;
    transition: none !important;
    -webkit-transition: none !important;
}

/* Legacy job-site / iOS overrides — keep ::before dead so only one backdrop exists. */
#jobSiteDetailModal::before,
#jobSiteDetailModal.active::before,
#jobSiteDetailModal.slide-out::before,
.modal.modal-js-backdrop::before,
.modal.modal-js-backdrop.active::before,
.modal.modal-js-backdrop.slide-out::before,
.modal.modal-js-backdrop.slide-out-top::before,
body.platform-ios .modal::before,
body.platform-ios .modal.active::before,
body.platform-ios #jobSiteDetailModal::before,
body.platform-ios #jobSiteDetailModal.active::before,
body.platform-ios #jobSiteDetailModal.slide-out::before,
body.platform-ios .modal.modal-js-backdrop::before,
body.platform-ios .modal.modal-js-backdrop.active::before,
body.platform-ios #jobSiteDetailModal.modal-js-backdrop::before,
body.platform-ios #jobSiteDetailModal.modal-js-backdrop.active::before,
body.platform-ios #jobSiteDetailModal.modal-js-backdrop.slide-out::before {
    opacity: 0 !important;
    transition: none !important;
    -webkit-transition: none !important;
}

/* Logo crop modal should appear above company profile modal */
#logoCropModal {
    z-index: 3000 !important;
}

/* Invoice/estimate line type picker (bottom sheet above modals z-index 2000) */
#invoiceLineModePickerOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 2500;
    opacity: 0;
    transition: opacity 0.22s ease;
}
#invoiceLineModePickerOverlay.visible {
    opacity: 1;
}
#invoiceLineModePickerSheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-radius: var(--card-radius) var(--card-radius) 0 0;
    z-index: 2600;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    max-width: 31.25rem;
    margin: 0 auto;
    box-shadow: none;
    border: none;
}
#invoiceLineModePickerSheet.visible {
    transform: translateY(0);
}
#invoiceLineModePickerSheet .tc-sheet-handle {
    display: none;
}
#invoiceLineModePickerSheet .tc-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    height: 2.375rem;
    min-height: 2.375rem;
    box-sizing: border-box;
    border-bottom: 0.0625rem solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
}
#invoiceLineModePickerSheet .tc-sheet-title {
    margin: 0;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    line-height: 1.25;
}
#invoiceLineModePickerSheet .tc-sheet-cancel {
    width: 1.75rem;
    height: 1.75rem;
    min-width: 1.75rem;
    min-height: 1.75rem;
    border-radius: 0.125rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.2s ease, color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) and (pointer: fine) {
    #invoiceLineModePickerSheet .tc-sheet-cancel:hover {
        background: var(--finance-track, var(--bg-tertiary));
        color: var(--text-primary);
    }
}
#invoiceLineModePickerSheet .tc-sheet-body {
    padding: 0.75rem;
}
#invoiceLineModePickerSheet .tc-mode-picker-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}
#invoiceLineModePickerSheet .tc-mode-pick-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.35rem;
    padding: 0.75rem 0.875rem;
    background: var(--bg-secondary);
    border: 0.0625rem solid var(--border-color);
    border-radius: 0.125rem;
    text-align: left;
    box-shadow: inset 0.1875rem 0 0 var(--ov-accent, var(--accent-green));
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    width: 100%;
    min-height: 4rem;
    color: inherit;
    cursor: pointer;
    box-sizing: border-box;
}
#invoiceLineModePickerSheet .tc-mode-pick-btn[data-mode="simple"] { --ov-accent: var(--text-muted); }
#invoiceLineModePickerSheet .tc-mode-pick-btn[data-mode="area"] { --ov-accent: var(--accent-green); }
#invoiceLineModePickerSheet .tc-mode-pick-btn[data-mode="perimeter"] { --ov-accent: var(--accent-blue); }
#invoiceLineModePickerSheet .tc-mode-pick-btn[data-mode="volume"] { --ov-accent: var(--accent-yellow); }
#invoiceLineModePickerSheet .tc-mode-pick-btn[data-mode="materials"] { --ov-accent: var(--accent-red); }
#invoiceLineModePickerSheet .tc-mode-pick-btn[data-mode="labor"] { --ov-accent: var(--accent-purple); }
#invoiceLineModePickerSheet .tc-mode-pick-btn[data-mode="custom"] { --ov-accent: var(--text-muted); }
@media (hover: hover) and (pointer: fine) {
    #invoiceLineModePickerSheet .tc-mode-pick-btn:hover,
    #invoiceLineModePickerSheet .tc-mode-pick-btn:active {
        background: var(--finance-track, var(--bg-tertiary));
    }
}
#invoiceLineModePickerSheet .tc-mode-pick-icon {
    width: auto;
    height: auto;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: transparent;
    color: var(--accent-green);
    font-size: var(--font-size-default);
    line-height: 1;
}
#invoiceLineModePickerSheet .tc-mode-pick-icon.simple,
#invoiceLineModePickerSheet .tc-mode-pick-icon.area,
#invoiceLineModePickerSheet .tc-mode-pick-icon.perimeter,
#invoiceLineModePickerSheet .tc-mode-pick-icon.volume,
#invoiceLineModePickerSheet .tc-mode-pick-icon.materials,
#invoiceLineModePickerSheet .tc-mode-pick-icon.labor,
#invoiceLineModePickerSheet .tc-mode-pick-icon.custom {
    background: transparent;
    color: var(--accent-green);
}
#invoiceLineModePickerSheet .tc-mode-pick-icon svg {
    width: 1.0625rem;
    height: 1.0625rem;
}
#invoiceLineModePickerSheet .tc-mode-pick-body {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
    width: 100%;
}
#invoiceLineModePickerSheet .tc-mode-pick-name {
    font-size: var(--font-size-secondaryallest);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
}
#invoiceLineModePickerSheet .tc-mode-pick-desc {
    font-size: var(--font-size-secondaryallest);
    color: var(--text-muted);
    line-height: 1.35;
}

/* Add payment modal should always be on top of other modals */
#addPaymentModal {
    z-index: 5000 !important;
}

/* Payment / Spending forms — match Financial Overview filter controls */
#addPaymentModal .payment-form-grid,
#addSpendingModal .payment-form-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#addPaymentModal .control-group,
#addSpendingModal .control-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    min-width: 0;
}

#addPaymentModal .control-label,
#addSpendingModal .control-label {
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

#addPaymentModal .payment-picker,
#addSpendingModal .payment-picker {
    width: 100%;
    max-width: none;
    flex: none;
    z-index: 1;
}

#addPaymentModal .payment-picker.is-open,
#addSpendingModal .payment-picker.is-open {
    z-index: 40;
}

#addPaymentModal .payment-picker .filter-dropdown-btn,
#addSpendingModal .payment-picker .filter-dropdown-btn {
    width: 100%;
    justify-content: flex-start;
    border-radius: 2px;
    min-height: 32px;
    height: 32px;
    padding: 6px 10px;
    font-size: var(--font-size-tertiary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    box-sizing: border-box;
}

@media (hover: hover) and (pointer: fine) {
    #addPaymentModal .payment-picker .filter-dropdown-btn:hover,
    #addSpendingModal .payment-picker .filter-dropdown-btn:hover {
        background: var(--finance-track, var(--bg-secondary));
        border-color: var(--border-color);
    }
}

#addPaymentModal .payment-picker .financial-picker-label,
#addSpendingModal .payment-picker .financial-picker-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    white-space: nowrap;
}

#addPaymentModal .payment-picker .financial-picker-menu,
#addSpendingModal .payment-picker .financial-picker-menu {
    left: 0;
    right: 0;
    width: 100%;
    min-width: 0;
    max-width: none;
    max-height: none;
    overflow: visible;
    border-radius: 2px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
    z-index: 41;
}

/* Pinned to body so iOS WebView does not clip inside transformed modals */
.finance-entry-menu-fixed {
    position: fixed !important;
    z-index: 10060 !important;
    display: flex !important;
    flex-direction: column;
    margin: 0;
    border-radius: 2px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
    box-sizing: border-box;
}

#addPaymentModal .payment-field-input,
#addSpendingModal .payment-field-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.2rem 0.75rem;
    min-height: 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    outline: none;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

#addPaymentModal .payment-field-input::placeholder,
#addSpendingModal .payment-field-input::placeholder {
    color: var(--text-muted);
    font-weight: var(--font-weight-semibold);
}

#addPaymentModal .payment-field-input:focus,
#addSpendingModal .payment-field-input:focus {
    border-color: var(--border-color);
    background: var(--bg-tertiary);
}

#addPaymentModal .payment-field-input.is-readonly,
#addPaymentModal .payment-field-input[readonly] {
    opacity: 0.85;
    cursor: default;
}

body.light-theme #addPaymentModal .payment-picker .filter-dropdown-btn,
body.light-theme #addPaymentModal .payment-field-input,
body.light-theme #addSpendingModal .payment-picker .filter-dropdown-btn,
body.light-theme #addSpendingModal .payment-field-input {
    background: var(--transparent-bg-light);
}

body.light-theme #addPaymentModal .payment-field-input:focus,
body.light-theme #addSpendingModal .payment-field-input:focus {
    background: var(--transparent-bg-light);
}

.modal.slide-in,
.modal.slide-in-top,
.modal.slide-out,
.modal.slide-out-top {
    animation: none;
}

.modal-content {
    background-color: var(--glass-bg-dark);
    border-radius: var(--card-radius);
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    height: fit-content;
    min-height: 0;
    align-self: center;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: none;
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* Light theme modals - solid, no transparency (covers .modal-header and .modal-body) */
body.light-theme .modal-content {
    background-color: #ffffff;
}

body.light-theme .modal-content.large {
    background-color: var(--bg-secondary);
}

/* Left edge swipe indicator */
.modal-content::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60px;
    background: var(--accent-primary);
    border-radius: 0 4px 4px 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
.modal.active .modal-content:hover::before {
    opacity: 0.3;
}
}


.modal.slide-in .modal-content {
    animation: slideInFromRight var(--modal-slide-duration) var(--modal-slide-easing) forwards;
}

.modal.slide-out .modal-content {
    animation: modalSlideOutToRight var(--modal-slide-out-duration) var(--modal-slide-out-easing) forwards;
}

/* Top slide animations for keyboard-friendly modals */
.modal.slide-in-top .modal-content {
    animation: slideInFromTop var(--modal-slide-duration) var(--modal-slide-easing) forwards;
}

.modal.slide-out-top .modal-content {
    animation: modalSlideOutToTop var(--modal-slide-out-duration) var(--modal-slide-out-easing) forwards;
}

.modal-content.large {
    max-width: 100%;
}

/*
 * iOS native (Capacitor): match .side-menu — fixed GPU layer + transform only.
 * Backdrop shade is JS-only (modal.backgroundColor); ::before stays at opacity 0.
 */
body.platform-ios .modal::before {
    opacity: 0 !important;
    -webkit-transition: none !important;
    transition: none !important;
}

body.platform-ios .modal.active::before {
    opacity: 0 !important;
}

body.platform-ios #jobSiteDetailModal::before,
body.platform-ios #jobSiteDetailModal.active::before,
body.platform-ios #jobSiteDetailModal.slide-out::before {
    opacity: 0 !important;
    -webkit-transition: none !important;
    transition: none !important;
}

/* Job site detail: keep scroll, hide scrollbar handle */
#jobSiteDetailModal .modal-content,
#jobSiteDetailModal .modal-body {
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#jobSiteDetailModal .modal-content::-webkit-scrollbar,
#jobSiteDetailModal .modal-body::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
    background: transparent;
}

body.platform-ios .modal.active .modal-content {
    contain: layout style paint;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
    -webkit-transition: none !important;
    transition: none !important;
}

body.platform-ios .modal.active.modal-ios-animating .modal-content {
    overflow: hidden !important;
    pointer-events: none;
    -webkit-overflow-scrolling: auto;
}

body.platform-ios .modal.slide-in .modal-content,
body.platform-ios .modal.slide-out .modal-content,
body.platform-ios .modal.slide-in-top .modal-content,
body.platform-ios .modal.slide-out-top .modal-content {
    -webkit-animation: none !important;
    animation: none !important;
}

/* Desktop: Center modals with max-width */
@media (min-width: 769px) {
    .modal {
        justify-content: center;
        padding: 1rem;
    }

    .modal-content {
        max-width: 750px;
        max-height: 90vh;
        height: fit-content;
        align-self: center;
        border-radius: var(--card-radius);
    }
    
    body.light-theme .modal-content {
    }
    
    .modal-content.large {
        max-width: 750px;
    }
    
    /* Body grows with content; outer .modal-content scrolls when taller than max-height */
    .modal-body {
        max-height: none;
    }
    
    /* Desktop: modal content fades/scales from center (no side slide). */
    .modal.slide-in .modal-content,
    .modal.slide-in-top .modal-content {
        animation: modalFadeInCenter 0.32s cubic-bezier(0.32, 0.72, 0, 1) forwards;
    }
    
    .modal.slide-out .modal-content,
    .modal.slide-out-top .modal-content {
        animation: modalFadeOutCenter 0.26s cubic-bezier(0.32, 0, 0.67, 0) forwards;
    }
}

/* Forms within modals should also use flex */
.modal-content form {
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-height: 0;
    overflow: visible;
}
/* Don't clip forms that contain the date-time row (fixes Due Date/Time overlap on iOS) */
.modal-content form:has(.date-time-row) {
    overflow: visible !important;
}

/* Modal Header - iOS Style */
.modal-header {
    padding: calc(env(safe-area-inset-top, 0px) + 1rem) 1rem 0 1rem;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    flex-shrink: 0;
}

/* iPhone iOS: avoid double top spacing in modal headers. */
body.platform-ios .modal-header {
    padding-top: 1rem;
}

/* iPad: Enhanced header spacing (no safe area needed) */
@media (min-width: 768px) {
    .modal-header {
        padding: 1rem 1rem 0 1rem;
    }
}

.modal-header h3 {
    color: var(--text-primary);
    font-size: var(--font-size-default);
    font-weight: var(--font-weight-semibold);
    margin: 0;
    line-height: 1.3;
    letter-spacing: var(--tracking-tight);
}

/* iPad: Larger header text */
@media (min-width: 768px) {
    .modal-header h3 {
        font-size: var(--font-size-default);
        letter-spacing: var(--tracking-tight);
    }
}

/* Modal Close Button - iOS Circular Button */
.modal-close {
    background: var(--bg-tertiary);
    border: none;
    font-size: var(--font-size-default);
    font-weight: var(--font-weight-normal);
    cursor: pointer;
    color: var(--text-primary);
    padding: 0;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--card-radius);
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Keep close button size consistent on all breakpoints */
@media (min-width: 768px) {
    .modal-close {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: var(--font-size-default);
    }
}

@media (hover: hover) and (pointer: fine) {
.modal-close:hover {
    background-color: var(--bg-secondary);
    transform: scale(1.08);
}
}


.modal-close:active {
    transform: scale(0.95);
    opacity: 0.9;
}

/* Modal Body - iOS Optimized */
.modal-body {
    padding: 0.5rem 0.5rem 0rem;
    overflow-x: hidden;
    overflow-y: visible;
    flex: 0 1 auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    max-height: none;
    scroll-behavior: smooth;
}
/* LAYOUT SHIFT FIX: give focused inputs breathing room above the keyboard */
.modal-body input,
.modal-body textarea,
.modal-body select,
.review-feedback-card input,
.review-feedback-card textarea,
.review-feedback-card select,
.auth-form-wrapper input,
.auth-form-wrapper textarea,
.auth-form-wrapper select {
    scroll-margin-bottom: calc(var(--kb-padding, 0px) + 20px);
}
/* Allow flex shrink when body contains date-time row (fixes Due Date/Time layout) */
.modal-body:has(.date-time-row) {
    min-width: 0 !important;
}

/* iPad: Enhanced body spacing */
@media (min-width: 768px) {
    .modal-body {
        padding: 0.5rem 1rem 0.5rem;
    }
}

/* Modal Footer - Fixed at bottom */
.modal-footer {
    display: flex;
    gap: 1rem;
    padding: 1rem 1rem;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin-top: auto;
    flex-shrink: 0;
}

.modal-footer .btn {
    flex: 1;
    font-size: var(--font-size-default);
    font-weight: var(--font-weight-semibold);
}

/* iPad: Enhanced footer spacing */
@media (min-width: 768px) {
    .modal-footer {
        padding: 1rem 1.5rem;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
    }
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--tracking-normal);
}

.form-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    font-style: italic;
    letter-spacing: var(--tracking-normal);
}

.form-group:not(.date-time-group) input,
.form-group:not(.date-time-group) textarea,
.form-group:not(.date-time-group) select,
#addChecklistEnhancedModal .enhanced-subtask-input,
#addChecklistEnhancedModal .edit-subtask-input,
#editChecklistEnhancedModal .enhanced-subtask-input,
#editChecklistEnhancedModal .edit-subtask-input {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: var(--font-size-tertiary);
    transition: all 0.3s ease;
    box-sizing: border-box;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Light theme: white/secondary surfaces — fields use secondary, not gray tertiary */
body.light-theme .form-group:not(.date-time-group) input,
body.light-theme .form-group:not(.date-time-group) textarea,
body.light-theme .form-group:not(.date-time-group) select,
body.light-theme #addChecklistEnhancedModal .enhanced-subtask-input,
body.light-theme #addChecklistEnhancedModal .edit-subtask-input,
body.light-theme #editChecklistEnhancedModal .enhanced-subtask-input,
body.light-theme #editChecklistEnhancedModal .edit-subtask-input {
    background: var(--bg-secondary);
}

body.light-theme #addChecklistModal input:not(.date-time-row input),
body.light-theme #editChecklistModal input:not(.date-time-row input) {
    background-color: var(--bg-secondary) !important;
}

body.light-theme .form-group:not(.date-time-group) input:focus,
body.light-theme .form-group:not(.date-time-group) textarea:focus,
body.light-theme .form-group:not(.date-time-group) select:focus,
body.light-theme #addChecklistEnhancedModal .enhanced-subtask-input:focus,
body.light-theme #addChecklistEnhancedModal .edit-subtask-input:focus,
body.light-theme #editChecklistEnhancedModal .enhanced-subtask-input:focus,
body.light-theme #editChecklistEnhancedModal .edit-subtask-input:focus,
body.light-theme #invoiceModal .form-group input:not([type="date"]):focus,
body.light-theme #invoiceModal .form-group select:focus,
body.light-theme #invoiceModal .form-group textarea:focus,
body.light-theme #estimateModal .form-group input:not([type="date"]):focus,
body.light-theme #estimateModal .form-group select:focus,
body.light-theme #estimateModal .form-group textarea:focus,
body.light-theme #invoiceModal .form-group input[readonly],
body.light-theme #estimateModal .form-group input[readonly],
body.light-theme #invoiceModal .inv-template-dropdown-btn,
body.light-theme #estimateModal .inv-template-dropdown-btn {
    background: transparent;
}

.form-group:not(.date-time-group) textarea {
    resize: vertical;
}

/* Date input specific styling - iOS WebView optimized (NOT date-time-group) */
.form-group:not(.date-time-group) input[type="date"],
.form-group:not(.date-time-group) input[type="time"] {
    padding: 0.875rem 1rem;
    font-family: inherit;
    cursor: pointer;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    min-height: 44px; /* iOS minimum touch target */
    line-height: normal;
    /* iOS WebView optimization */
    touch-action: manipulation;
    -webkit-touch-callout: default;
}

.form-group:not(.date-time-group) input[type="date"]::-webkit-calendar-picker-indicator,
.form-group:not(.date-time-group) input[type="time"]::-webkit-calendar-picker-indicator {
    /* Simplified to reduce iOS WebKit constraint conflicts */
    cursor: pointer;
    opacity: 0.7;
}

@media (hover: hover) and (pointer: fine) {
.form-group:not(.date-time-group) input[type="date"]::-webkit-calendar-picker-indicator:hover,
.form-group:not(.date-time-group) input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}
}


.form-group:not(.date-time-group) input:focus,
.form-group:not(.date-time-group) textarea:focus,
.form-group:not(.date-time-group) select:focus,
#addChecklistEnhancedModal .enhanced-subtask-input:focus,
#addChecklistEnhancedModal .edit-subtask-input:focus,
#editChecklistEnhancedModal .enhanced-subtask-input:focus,
#editChecklistEnhancedModal .edit-subtask-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

/* Subtask inputs: no lift on focus (compact row) */
#addChecklistEnhancedModal .enhanced-subtask-input:focus,
#addChecklistEnhancedModal .edit-subtask-input:focus,
#editChecklistEnhancedModal .enhanced-subtask-input:focus,
#editChecklistEnhancedModal .edit-subtask-input:focus {
    transform: none;
}

.form-group:not(.date-time-group) input::placeholder,
.form-group:not(.date-time-group) textarea::placeholder,
#addChecklistEnhancedModal .enhanced-subtask-input::placeholder,
#addChecklistEnhancedModal .edit-subtask-input::placeholder,
#editChecklistEnhancedModal .enhanced-subtask-input::placeholder,
#editChecklistEnhancedModal .edit-subtask-input::placeholder {
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
}

/* New Job Site form - compact layout on desktop/tablet */
#newJobSiteForm.form-compact-when-wide .form-row {
    margin-bottom: 0.75rem;
}

#newJobSiteForm.form-compact-when-wide .form-row .form-group {
    margin-bottom: 0;
}

/* form-row-1 overrides global .form-row 2-column grid so Info/Status are full width */
#newJobSiteForm .form-row-1 {
    display: block;
    grid-template-columns: unset;
}

#newJobSiteForm .form-row-1 .form-group,
#newJobSiteForm #jobSiteDescription {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    #newJobSiteForm.form-compact-when-wide .form-row-2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem 1rem;
    }

    #newJobSiteForm.form-compact-when-wide .form-row-3 {
        display: grid;
        grid-template-columns: 2fr 1fr 0.9fr;
        gap: 0.75rem 1rem;
    }

    #newJobSiteForm.form-compact-when-wide .form-row-1 {
        margin-bottom: 0.75rem;
        width: 100%;
    }

    #newJobSiteForm.form-compact-when-wide .form-row-1 .form-group,
    #newJobSiteForm.form-compact-when-wide .form-row-1 label,
    #newJobSiteForm.form-compact-when-wide #jobSiteDescription {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    #newJobSiteForm.form-compact-when-wide .form-row .form-group {
        margin-bottom: 0;
    }

    #newJobSiteForm.form-compact-when-wide .form-group input,
    #newJobSiteForm.form-compact-when-wide .form-group textarea,
    #newJobSiteForm.form-compact-when-wide .form-group select {
        padding: 0.625rem 1rem;
    }

    #newJobSiteForm.form-compact-when-wide .form-group label {
        margin-bottom: 0.35rem;
    }

    #newJobSiteForm.form-compact-when-wide textarea {
        min-height: 3.5rem;
    }
}

/* Checklist modal specific styling (NOT enhanced date-time modals) */
#addChecklistModal .form-group:not(.date-time-group) {
    margin-bottom: 1.25rem;
    width: 100%;
    display: block;
}

#addChecklistModal .form-group:last-of-type {
    margin-bottom: 0;
}

#addChecklistModal .form-group:not(.date-time-group) input {
    display: block;
    width: 100% !important;
}

#addChecklistModal .form-actions {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

#addChecklistModal .form-actions .btn,
#editChecklistModal .form-actions .btn {
    border-radius: var(--card-radius);
}

/* Enhanced task / Note / Job site Cancel / Save — flat sheet (matches payment/spending) */
#addChecklistEnhancedModal .form-actions,
#editChecklistEnhancedModal .form-actions,
#addNoteModal .form-actions,
#editJobSiteModal .form-actions,
#newJobSiteModal .form-actions {
    display: flex;
    justify-content: stretch;
    align-items: stretch;
    gap: 0.5rem;
    margin-top: 0.75rem;
    margin-bottom: 0;
    flex-direction: row;
    flex-wrap: nowrap;
}

#addChecklistEnhancedModal .form-actions,
#addNoteModal .form-actions {
    padding-bottom: 0.5rem;
}

#addNoteModal .modal-header,
#addChecklistEnhancedModal .modal-header,
#editChecklistEnhancedModal .modal-header,
#addPaymentModal .modal-header,
#addSpendingModal .modal-header,
#drawingNameModal .modal-header {
    padding-top: 0.5rem;
    padding-bottom: 0;
}

#addChecklistEnhancedModal .form-actions .btn,
#editChecklistEnhancedModal .form-actions .btn,
#addNoteModal .form-actions .btn,
#editJobSiteModal .form-actions .btn,
#newJobSiteModal .form-actions .btn {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    min-height: 2.25rem;
    height: auto;
    padding: 0.5rem 0.75rem;
    border-radius: 2px;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    line-height: 1.25;
    white-space: nowrap;
    box-shadow: none;
    transform: none;
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.15s ease, border-color 0.2s ease;
}

#addChecklistEnhancedModal .form-actions .btn-secondary,
#addChecklistEnhancedModal .form-actions .btn-cancel,
#addChecklistEnhancedModal .form-actions .modal-cancel,
#editChecklistEnhancedModal .form-actions .btn-secondary,
#editChecklistEnhancedModal .form-actions .btn-cancel,
#editChecklistEnhancedModal .form-actions .modal-cancel,
#addNoteModal .form-actions .btn-secondary,
#addNoteModal .form-actions .btn-cancel,
#addNoteModal .form-actions .modal-cancel,
#editJobSiteModal .form-actions .btn-secondary,
#editJobSiteModal .form-actions .btn-cancel,
#editJobSiteModal .form-actions .modal-cancel,
#newJobSiteModal .form-actions .btn-secondary,
#newJobSiteModal .form-actions .btn-cancel,
#newJobSiteModal .form-actions .modal-cancel {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

#addChecklistEnhancedModal .form-actions .btn-primary,
#editChecklistEnhancedModal .form-actions .btn-primary,
#addNoteModal .form-actions .btn-primary,
#editJobSiteModal .form-actions .btn-primary,
#newJobSiteModal .form-actions .btn-primary {
    background: var(--accent-green);
    color: #1a202c;
    border: 1px solid var(--accent-green);
}

@media (hover: hover) and (pointer: fine) {
    #addChecklistEnhancedModal .form-actions .btn:hover,
    #editChecklistEnhancedModal .form-actions .btn:hover,
    #addNoteModal .form-actions .btn:hover,
    #editJobSiteModal .form-actions .btn:hover,
    #newJobSiteModal .form-actions .btn:hover {
        transform: none;
    }

    #addChecklistEnhancedModal .form-actions .btn-secondary:hover,
    #addChecklistEnhancedModal .form-actions .modal-cancel:hover,
    #editChecklistEnhancedModal .form-actions .btn-secondary:hover,
    #editChecklistEnhancedModal .form-actions .modal-cancel:hover,
    #addNoteModal .form-actions .btn-secondary:hover,
    #addNoteModal .form-actions .modal-cancel:hover,
    #editJobSiteModal .form-actions .btn-secondary:hover,
    #newJobSiteModal .form-actions .btn-secondary:hover,
    #newJobSiteModal .form-actions .modal-cancel:hover {
        color: var(--text-primary);
        background: var(--finance-track, var(--bg-secondary));
        border-color: var(--border-color);
    }

    #addChecklistEnhancedModal .form-actions .btn-primary:hover,
    #editChecklistEnhancedModal .form-actions .btn-primary:hover,
    #addNoteModal .form-actions .btn-primary:hover,
    #editJobSiteModal .form-actions .btn-primary:hover,
    #newJobSiteModal .form-actions .btn-primary:hover {
        filter: brightness(1.04);
        background: var(--accent-green);
    }
}

#addChecklistEnhancedModal .form-actions .btn:active,
#editChecklistEnhancedModal .form-actions .btn:active,
#addNoteModal .form-actions .btn:active,
#editJobSiteModal .form-actions .btn:active,
#newJobSiteModal .form-actions .btn:active {
    opacity: 0.9;
    transform: none;
}

body.light-theme #addChecklistEnhancedModal .form-actions .btn-secondary,
body.light-theme #addChecklistEnhancedModal .form-actions .modal-cancel,
body.light-theme #editChecklistEnhancedModal .form-actions .btn-secondary,
body.light-theme #editChecklistEnhancedModal .form-actions .modal-cancel,
body.light-theme #addNoteModal .form-actions .btn-secondary,
body.light-theme #addNoteModal .form-actions .modal-cancel,
body.light-theme #editJobSiteModal .form-actions .btn-secondary,
body.light-theme #newJobSiteModal .form-actions .btn-secondary,
body.light-theme #newJobSiteModal .form-actions .modal-cancel {
    background: var(--transparent-bg-light);
    color: var(--text-muted);
}

body:not(.light-theme) #addChecklistEnhancedModal .form-actions .btn-primary,
body:not(.light-theme) #editChecklistEnhancedModal .form-actions .btn-primary,
body:not(.light-theme) #addNoteModal .form-actions .btn-primary,
body:not(.light-theme) #editJobSiteModal .form-actions .btn-primary,
body:not(.light-theme) #newJobSiteModal .form-actions .btn-primary {
    color: #000000;
}

/* Payment / Spending modal actions — flat sheet, match financial controls */
#addPaymentModal .modal-actions,
#addSpendingModal .modal-actions {
    display: flex;
    justify-content: stretch;
    align-items: stretch;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-bottom: 0.5rem;
}

#addPaymentModal .modal-actions .btn,
#addSpendingModal .modal-actions .btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 2.25rem;
    height: auto;
    padding: 0.5rem 0.75rem;
    border-radius: 2px;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    line-height: 1.25;
    box-shadow: none;
    transform: none;
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.15s ease, border-color 0.2s ease;
}

#addPaymentModal .modal-actions .btn-cancel,
#addSpendingModal .modal-actions .btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

#addPaymentModal .modal-actions .btn-primary,
#addSpendingModal .modal-actions .btn-primary {
    background: var(--accent-green);
    color: #1a202c;
    border: 1px solid var(--accent-green);
}

@media (hover: hover) and (pointer: fine) {
    #addPaymentModal .modal-actions .btn:hover,
    #addSpendingModal .modal-actions .btn:hover {
        transform: none;
    }

    #addPaymentModal .modal-actions .btn-cancel:hover,
    #addSpendingModal .modal-actions .btn-cancel:hover {
        color: var(--text-primary);
        background: var(--finance-track, var(--bg-secondary));
    }

    #addPaymentModal .modal-actions .btn-primary:hover,
    #addSpendingModal .modal-actions .btn-primary:hover {
        filter: brightness(1.04);
    }
}

#addPaymentModal .modal-actions .btn:active,
#addSpendingModal .modal-actions .btn:active {
    opacity: 0.9;
    transform: none;
}

body.light-theme #addPaymentModal .modal-actions .btn-cancel,
body.light-theme #addSpendingModal .modal-actions .btn-cancel {
    background: var(--transparent-bg-light);
    color: var(--text-muted);
}

body:not(.light-theme) #addPaymentModal .modal-actions .btn-primary,
body:not(.light-theme) #addSpendingModal .modal-actions .btn-primary {
    color: #000000;
}

/* Force exact same dimensions for both input types (NOT enhanced modals) */
#addChecklistModal input:not(.date-time-row input),
#editChecklistModal input:not(.date-time-row input) {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0.875rem 1rem !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    background-color: var(--bg-tertiary) !important;
    font-size: var(--font-size-base) !important;
    font-family: inherit !important;
    line-height: 1.5 !important;
    height: 48px !important;
    display: block !important;
    overflow: hidden !important;
}

/* Date and time inputs - iOS forces minimum width for picker controls (NOT enhanced modals) */
#addChecklistModal input[type="date"]:not(.date-time-row input[type="date"]),
#addChecklistModal input[type="time"]:not(.date-time-row input[type="time"]),
#editChecklistModal input[type="date"]:not(.date-time-row input[type="date"]),
#editChecklistModal input[type="time"]:not(.date-time-row input[type="time"]) {
    height: 48px !important;
    width: 280px !important;
    max-width: 280px !important;
    margin: 0 auto !important;
}

/* Enhanced modals: date/time in flex layout (single source of truth — no inline style overrides) */
.date-time-row {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.date-time-row > div {
    flex: 1 1 0;
    min-width: 0;
    box-sizing: border-box;
}

.date-time-row input[type="date"],
.date-time-row input[type="time"] {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0.5rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-tertiary);
    cursor: pointer;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

/* Prevent date/time inputs from growing or moving on focus */
.date-time-row input[type="date"]:focus,
.date-time-row input[type="time"]:focus {
    transform: none;
    font-size: var(--font-size-tertiary);
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 0.5rem 0.5rem;
    transition: none;
}

#addChecklistEnhancedModal .modal-content form,
#editChecklistEnhancedModal .modal-content form {
    overflow: visible;
}


#addChecklistEnhancedModal .modal-body,
#editChecklistEnhancedModal .modal-body,
#addChecklistEnhancedModal .date-time-group,
#editChecklistEnhancedModal .date-time-group {
    min-width: 0;
    max-width: 100%;
}

/* Enhanced subtask rows (add + edit) – styles from styles.css, no inline */
#addChecklistEnhancedModal .enhanced-subtask-row,
#editChecklistEnhancedModal .enhanced-subtask-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

/* Same appearance/disappearance as .task-item (task-pop-in / task-burst-exit) */
#addChecklistEnhancedModal .enhanced-subtask-row.subtask-row-exit,
#editChecklistEnhancedModal .enhanced-subtask-row.subtask-row-exit {
    -webkit-animation: task-burst-exit 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation: task-burst-exit 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: none;
}
#addChecklistEnhancedModal .enhanced-subtask-row.subtask-row-enter,
#editChecklistEnhancedModal .enhanced-subtask-row.subtask-row-enter {
    opacity: 0;
    -webkit-transform: scale(0.35, 0.2) translateZ(0);
    transform: scale(0.35, 0.2) translateZ(0);
    -webkit-animation: task-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation: task-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Subtask checkbox: spring bounce + draw checkmark + particle burst (translateZ(0) + -webkit- for smooth iOS) */
@keyframes subtask-springBounce {
    0%   { -webkit-transform: scale(1) translateZ(0); transform: scale(1) translateZ(0); }
    30%  { -webkit-transform: scale(1.45) translateZ(0); transform: scale(1.45) translateZ(0); }
    60%  { -webkit-transform: scale(0.88) translateZ(0); transform: scale(0.88) translateZ(0); }
    80%  { -webkit-transform: scale(1.12) translateZ(0); transform: scale(1.12) translateZ(0); }
    100% { -webkit-transform: scale(1) translateZ(0); transform: scale(1) translateZ(0); }
}
@keyframes subtask-particleBurst {
    0%   { opacity: 1; -webkit-transform: translate(0, 0) scale(1) translateZ(0); transform: translate(0, 0) scale(1) translateZ(0); }
    100% { opacity: 0; -webkit-transform: var(--particle-tx, translate(0,0)) scale(0.4) translateZ(0); transform: var(--particle-tx, translate(0,0)) scale(0.4) translateZ(0); }
}

#addChecklistEnhancedModal .enhanced-subtask-checkbox,
#addChecklistEnhancedModal .edit-subtask-checkbox,
#editChecklistEnhancedModal .enhanced-subtask-checkbox,
#editChecklistEnhancedModal .edit-subtask-checkbox {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}
@media (hover: hover) and (pointer: fine) {
#addChecklistEnhancedModal .enhanced-subtask-checkbox:hover:not(.checked),
#addChecklistEnhancedModal .edit-subtask-checkbox:hover:not(.checked),
#editChecklistEnhancedModal .enhanced-subtask-checkbox:hover:not(.checked),
#editChecklistEnhancedModal .edit-subtask-checkbox:hover:not(.checked) {
    border-color: var(--accent-green, #68d391);
    background: rgba(104, 211, 145, 0.1);
}
}
#addChecklistEnhancedModal .enhanced-subtask-checkbox.checked,
#addChecklistEnhancedModal .edit-subtask-checkbox.checked,
#editChecklistEnhancedModal .enhanced-subtask-checkbox.checked,
#editChecklistEnhancedModal .edit-subtask-checkbox.checked {
    border: none;
    background: var(--accent-green, #4ade6e);
    will-change: transform;
    -webkit-animation: subtask-springBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: subtask-springBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Drawn checkmark (SVG path) */
#addChecklistEnhancedModal .enhanced-subtask-checkbox .checkmark,
#addChecklistEnhancedModal .edit-subtask-checkbox .checkmark,
#editChecklistEnhancedModal .enhanced-subtask-checkbox .checkmark,
#editChecklistEnhancedModal .edit-subtask-checkbox .checkmark {
    width: 13px;
    height: 11px;
    flex-shrink: 0;
    pointer-events: none;
    overflow: visible;
}
#addChecklistEnhancedModal .enhanced-subtask-checkbox .checkmark path,
#addChecklistEnhancedModal .edit-subtask-checkbox .checkmark path,
#editChecklistEnhancedModal .enhanced-subtask-checkbox .checkmark path,
#editChecklistEnhancedModal .edit-subtask-checkbox .checkmark path {
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    transition: none;
}
#addChecklistEnhancedModal .enhanced-subtask-checkbox.checked .checkmark path,
#addChecklistEnhancedModal .edit-subtask-checkbox.checked .checkmark path,
#editChecklistEnhancedModal .enhanced-subtask-checkbox.checked .checkmark path,
#editChecklistEnhancedModal .edit-subtask-checkbox.checked .checkmark path {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.28s cubic-bezier(0.4, 0, 0.2, 1) 0.08s;
}
/* Particles (burst when checked) */
#addChecklistEnhancedModal .enhanced-subtask-checkbox .subtask-particle,
#addChecklistEnhancedModal .edit-subtask-checkbox .subtask-particle,
#editChecklistEnhancedModal .enhanced-subtask-checkbox .subtask-particle,
#editChecklistEnhancedModal .edit-subtask-checkbox .subtask-particle {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 2px;
    left: 50%;
    top: 50%;
    margin-left: -2.5px;
    margin-top: -2.5px;
    pointer-events: none;
    opacity: 0;
}
#addChecklistEnhancedModal .enhanced-subtask-checkbox.checked .subtask-particle,
#addChecklistEnhancedModal .edit-subtask-checkbox.checked .subtask-particle,
#editChecklistEnhancedModal .enhanced-subtask-checkbox.checked .subtask-particle,
#editChecklistEnhancedModal .edit-subtask-checkbox.checked .subtask-particle {
    will-change: transform, opacity;
    -webkit-animation: subtask-particleBurst 0.55s cubic-bezier(0.22, 0.68, 0, 1) forwards;
    animation: subtask-particleBurst 0.55s cubic-bezier(0.22, 0.68, 0, 1) forwards;
}
#addChecklistEnhancedModal .subtask-particle-1, #editChecklistEnhancedModal .subtask-particle-1 { --particle-tx: translate(-22px, -20px); animation-delay: 0s;     background: #4ade6e; }
#addChecklistEnhancedModal .subtask-particle-2, #editChecklistEnhancedModal .subtask-particle-2 { --particle-tx: translate(22px, -20px);  animation-delay: 0.03s; background: #f6ad55; }
#addChecklistEnhancedModal .subtask-particle-3, #editChecklistEnhancedModal .subtask-particle-3 { --particle-tx: translate(-26px, 4px);   animation-delay: 0.05s; background: #63b3ed; }
#addChecklistEnhancedModal .subtask-particle-4, #editChecklistEnhancedModal .subtask-particle-4 { --particle-tx: translate(26px, 4px);    animation-delay: 0.02s; background: #fc8181; }
#addChecklistEnhancedModal .subtask-particle-5, #editChecklistEnhancedModal .subtask-particle-5 { --particle-tx: translate(-12px, 24px);  animation-delay: 0.04s; background: #c084fc; }
#addChecklistEnhancedModal .subtask-particle-6, #editChecklistEnhancedModal .subtask-particle-6 { --particle-tx: translate(12px, 24px);   animation-delay: 0.01s; background: #f472b6; }
/* Layout: wrap fills row; input inside gets form-group styles */
#addChecklistEnhancedModal .subtask-input-wrap,
#editChecklistEnhancedModal .subtask-input-wrap {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: none !important;
    position: relative;
    display: flex;
}
#addChecklistEnhancedModal .subtask-input-wrap .enhanced-subtask-input,
#addChecklistEnhancedModal .subtask-input-wrap .edit-subtask-input,
#editChecklistEnhancedModal .subtask-input-wrap .enhanced-subtask-input,
#editChecklistEnhancedModal .subtask-input-wrap .edit-subtask-input {
    flex: 1 1 0% !important;
    min-width: 0 !important;
}
#addChecklistEnhancedModal .enhanced-subtask-checkbox.checked + .subtask-input-wrap .enhanced-subtask-input,
#addChecklistEnhancedModal .edit-subtask-checkbox.checked + .subtask-input-wrap .edit-subtask-input,
#editChecklistEnhancedModal .enhanced-subtask-checkbox.checked + .subtask-input-wrap .enhanced-subtask-input,
#editChecklistEnhancedModal .edit-subtask-checkbox.checked + .subtask-input-wrap .edit-subtask-input {
    color: var(--text-muted, #4a5568);
    background: var(--accent-green-tint);
}
#addChecklistEnhancedModal .enhanced-subtask-remove,
#addChecklistEnhancedModal .edit-subtask-remove,
#editChecklistEnhancedModal .enhanced-subtask-remove,
#editChecklistEnhancedModal .edit-subtask-remove {
    flex-shrink: 0 !important;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.08);
    cursor: pointer;
    font-size: 20px;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
}
@media (hover: hover) and (pointer: fine) {
#addChecklistEnhancedModal .enhanced-subtask-remove:hover,
#addChecklistEnhancedModal .edit-subtask-remove:hover,
#editChecklistEnhancedModal .enhanced-subtask-remove:hover,
#editChecklistEnhancedModal .edit-subtask-remove:hover {
    background: rgba(0, 0, 0, 0.15);
}
}

/* Desktop/iPad: fixed 410px and center (NOT enhanced modals) */
@media (min-width: 769px) {
    #addChecklistModal input[type="date"]:not(.date-time-row input[type="date"]),
    #addChecklistModal input[type="time"]:not(.date-time-row input[type="time"]),
    #editChecklistModal input[type="date"]:not(.date-time-row input[type="date"]),
    #editChecklistModal input[type="time"]:not(.date-time-row input[type="time"]) {
        width: 410px !important;
        max-width: 410px !important;
        margin: 0 auto !important;
    }
}

/* Simplified picker indicator - reduce constraint conflicts */
#addChecklistModal input[type="date"]::-webkit-calendar-picker-indicator,
#addChecklistModal input[type="time"]::-webkit-calendar-picker-indicator,
#editChecklistModal input[type="date"]::-webkit-calendar-picker-indicator,
#editChecklistModal input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer !important;
    opacity: 0.7 !important;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 12px;
    font-family: var(--font-family-sans);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

@media (hover: hover) and (pointer: fine) {
.btn:hover {
    transform: translateY(-2px);
    will-change: transform;
}
}


.btn-primary {
    background: var(--accent-green);
    color: #1a202c;
}

@media (hover: hover) and (pointer: fine) {
.btn-primary:hover {
    background: var(--accent-green);
}
}


.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: none;
}

@media (hover: hover) and (pointer: fine) {
.btn-secondary:hover {
    background: var(--bg-card);
}
}


.btn-danger {
    background: var(--accent-danger);
    color: #1a202c;
}

@media (hover: hover) and (pointer: fine) {
.btn-danger:hover {
    background: var(--accent-danger);
    opacity: 0.9;
}
}


/* Trash icon: use <i class="fas fa-trash-alt"></i> inside .btn.btn-danger, or it’s added via ::before */
.btn.btn-danger:not(:has(i))::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f2ed";
    display: inline-block;
    margin-right: 0.5rem;
}

.btn-danger .fa-trash-alt,
.btn-danger i {
    color: currentColor;
}

/* Detail Actions */
/* Job Info Card - Redesigned layout */
.job-info-card {
    background: var(--bg-card);
    border-radius: var(--card-radius);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.job-info-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem 1rem 0.25rem;
    gap: 0.625rem;
}

.job-info-header .header-left {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex: 1;
    min-width: 0;
}

.job-info-header .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 3px;
    flex-shrink: 0;
    background: var(--status-in-progress);
}

.job-info-header .status-dot.in-progress {
    background: var(--status-in-progress);
}

.job-info-header .status-dot.upcoming {
    background: var(--status-upcoming);
}

.job-info-header .status-dot.on-hold {
    background: var(--status-on-hold);
}

.job-info-header .status-dot.completed {
    background: var(--status-completed);
}

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

.job-info-name {
    color: var(--text-primary);
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-semibold);
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.job-info-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.job-info-card .btn-icon-edit {
    width: 64px;
    height: 30px;
    min-width: 64px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0;
    border-radius: var(--card-radius);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.job-info-card .btn-icon-edit i {
    font-size: 0.875rem;
}

@media (hover: hover) and (pointer: fine) {
.job-info-card .btn-icon-edit:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}
}

.job-info-details {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 1rem;
}

.job-info-assign-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.35rem 1rem 0.75rem;
    margin-top: 0;
}

.job-info-assign-title {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
    line-height: 1.25;
}

.job-info-assign-controls {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 0.5rem;
    width: 100%;
}

.job-assign-employee-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.job-assign-employee-btn {
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--text-muted);
    padding: 0.25rem;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border-radius: var(--card-radius);
    transition: color 0.15s ease, opacity 0.15s ease;
}

.job-assign-employee-btn i {
    font-size: 1.15rem;
    color: inherit;
}

@media (hover: hover) and (pointer: fine) {
.job-assign-employee-btn:hover {
    color: var(--text-primary);
    background: transparent;
}
}

.job-assign-employee-btn.active,
.job-assign-employee-dropdown.is-open .job-assign-employee-btn {
    color: var(--text-primary);
}

.job-assign-team-avatars {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-height: 1.75rem;
}

.job-assign-team-avatar {
    width: 1.75rem;
    height: 1.75rem;
    min-width: 1.75rem;
    border-radius: 5px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.65rem;
    font-weight: var(--font-weight-semibold, 600);
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-transform: uppercase;
    user-select: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
}

.job-assign-team-avatar--placeholder {
    background: transparent;
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
    opacity: 0.7;
    cursor: default;
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
.job-assign-team-avatar:not(.job-assign-team-avatar--placeholder):hover {
    border-color: var(--text-muted);
    background: var(--bg-card);
}

.job-assign-team-avatar.is-clocked-in:hover {
    background: var(--accent-green);
    border-color: var(--accent-green);
    filter: brightness(1.05);
}
}

.job-assign-team-avatar.is-clocked-in {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: #0f1a14;
}

.job-info-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem;
    gap: 0.75rem;
    color: var(--text-primary);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-normal);
    line-height: 1.4;
    min-height: 24px;
    transition: background 0.12s ease;
    cursor: default;
}

@media (hover: hover) and (pointer: fine) {
.job-info-item:hover {
    background: var(--bg-tertiary);
}
}

.job-info-item .info-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.job-info-item > i:first-child {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.job-info-item span {
    flex: 1;
    font-size: var(--font-size-tertiary);
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.btn-info-action {
    width: 64px;
    height: 28px;
    min-width: 64px;
    background: var(--accent-green);
    border: none;
    color: #292a2e;
    padding: 0;
    border-radius: var(--card-radius);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-info-action i {
    color: #292a2e;
    font-size: 0.875rem;
}

.filter-dropdown-menu.job-directions-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    width: max-content;
    min-width: 160px;
    max-width: min(90vw, 240px);
    z-index: 10060;
}

.job-directions-menu .filter-dropdown-item {
    font-size: var(--font-size-tertiary);
    white-space: nowrap;
    justify-content: flex-start;
}

@media (hover: hover) and (pointer: fine) {
.btn-info-action:hover {
    background: var(--completed-color);
    transform: scale(1.05);
}
}

.job-info-item + .job-info-item {
}

/* Footer with tag (description) */
.job-info-footer {
    margin-top: 0.25rem;
}

.job-info-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 0.25rem 0.5625rem;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
}

.job-info-tag i {
    color: var(--accent-green);
    font-size: 0.625rem;
}


.detail-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.detail-actions .btn {
    flex: 1 1 100%;
    min-width: 0;
    justify-content: center;
    padding: var(--button-padding-v) var(--button-padding-h);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    min-height: var(--touch-target-min);
    border-radius: var(--card-radius);
}

/* Quick Actions: original green fill, new 38px / 2px chrome */
#quickActionsBtn,
.detail-actions #quickActionsBtn.btn.btn-primary {
    background: var(--accent-green);
    border: none;
    border-radius: 2px;
    height: 38px;
    min-height: 38px;
    padding: 0.625rem 0.75rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    color: #292a2e;
    transition: background-color 0.2s ease;
}

#quickActionsBtn i {
    color: #292a2e;
    font-size: var(--font-size-tertiary);
    line-height: 1;
}

#quickActionsBtn span {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: #292a2e;
    letter-spacing: 0;
}

@media (hover: hover) and (pointer: fine) {
#quickActionsBtn:hover {
    background: var(--completed-color);
}
#quickActionsBtn:active {
    opacity: 0.92;
}
}

/* Compact button styling */
.btn-compact {
    padding: 0.75rem 0.875rem;
    font-size: var(--font-size-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1 1 auto;
    min-height: 44px;
}

.btn-compact i {
    font-size: var(--font-size-base);
    color: #ffffff;
    flex-shrink: 0;
}

.btn-compact .btn-label {
    font-size: var(--font-size-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Light theme - dark icons for compact buttons */
body.light-theme .btn-compact i {
    color: #1a202c;
}

/* Sections */
.section {
    background: var(--bg-card);
    border-radius: var(--card-radius);
    padding: 0;
    margin-bottom: var(--section-spacing);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.section.collapsible {
    background: none;
}

/* Detail content - collapsible sections (reference layout) */
.detail-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-content .section.collapsible {
    background: transparent;
    border-radius: 0;
    overflow: visible;
    border: none;
    margin-bottom: 0;
}

.detail-content .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    gap: 0.75rem;
    height: 38px;
    min-height: 38px;
    box-sizing: border-box;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    color: var(--text-muted);
    transition: background-color 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
.detail-content .section-header:hover {
    background: var(--finance-track, var(--bg-tertiary));
    color: var(--text-primary);
}
}

.detail-content .section:not(.collapsed) .section-header {
    background: var(--finance-track, var(--bg-tertiary));
    color: var(--text-primary);
}

.detail-content .section-header .section-title {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
    margin: 0;
}

.detail-content .section-header .section-title .section-count {
    margin-left: auto;
}

.detail-content .section-header .section-title > i:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    min-width: 14px;
    height: 14px;
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    background: none;
    border-radius: 0;
    line-height: 1;
    flex-shrink: 0;
}

.detail-content .section-header .section-title span[data-i18n] {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: inherit;
    letter-spacing: 0;
    flex: 0 1 auto;
    white-space: nowrap;
}

.detail-content .section-count {
    background: transparent;
    color: inherit;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    padding: 0;
    border-radius: 0;
    min-width: 0;
    text-align: left;
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.detail-content .section-count.empty {
    background: transparent;
    color: inherit;
}

.detail-content .toggle-icon {
    width: 10px;
    font-size: var(--font-size-secondaryallest);
    color: var(--text-muted);
    line-height: 1;
    margin: 0;
    padding: 0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), color 0.15s ease;
}

.detail-content .section:not(.collapsed) .toggle-icon {
    color: var(--text-muted);
}

.detail-content .section-content {
    padding: 0.5rem 0 0;
}

/* Empty state in detail sections */
.detail-content .empty-state {
    text-align: center;
    padding: 0.5rem 0 0.25rem;
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
}

/* Task progress bar - reference layout */
.detail-content .task-progress,
.detail-content .checklist-progress {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-content .checklist-progress {
    padding: 0.875rem 1rem;
    margin: 0;
    background: transparent;
    border-radius: 0;
}

.detail-content .section.collapsed .checklist-progress {
    display: none !important;
}

.detail-content .progress-track,
.detail-content .progress-bar-container {
    height: 5px;
    background: var(--bg-tertiary);
    border-radius: 99px;
    overflow: hidden;
}

.detail-content .progress-fill,
.detail-content .progress-bar-fill {
    height: 100%;
    width: 100%;
    background: var(--accent-green);
    border-radius: 99px;
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease;
    will-change: transform;
}

.detail-content .progress-label,
.detail-content .progress-text {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Finance rows - reference layout */
.detail-content .finance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3125rem 0;
}

.detail-content .finance-row + .finance-row {
    border-top: 1px solid var(--border-color);
}

.detail-content .finance-label {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
}

.detail-content .finance-value {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.detail-content .finance-stat-label {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
}

.detail-content .summary-value.green,
.detail-content .finance-stat-value.green {
    color: var(--accent-green);
}

.detail-content .summary-value.red,
.detail-content .finance-stat-value.red {
    color: var(--accent-red);
}

/* Photo grid - reference layout */
.detail-content .photos-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.375rem;
}

/* Desktop drag & drop photo upload overlay */
#photosSection {
    position: relative;
}

.photo-drop-overlay {
    position: absolute;
    inset: 38px 0 0 0; /* below section header */
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(104, 211, 145, 0.10); /* subtle accent tint */
    border: 2px dashed rgba(104, 211, 145, 0.55);
    border-radius: 14px;
    margin: 12px;
    z-index: 5;
    pointer-events: none; /* don't block clicks */
}

#photosSection.photo-drop-active .photo-drop-overlay {
    display: flex;
}

/* (no text/icon on overlay by request) */

.detail-content .photo-item,
.detail-content .photo-placeholder {
    aspect-ratio: 1;
    border-radius: 8px;
}

.detail-content .photo-item img {
    height: 100%;
    object-fit: cover;
}

.detail-content .photo-placeholder {
    background: var(--accent-green-tint);
    border: 1px dashed var(--accent-green);
    height: 100%;
    width: 100%;
}

.section-header {
    color: var(--text-primary);
    margin: 0 !important;
    padding: 0 var(--spacing-md);
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-semibold);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    background: var(--bg-tertiary);
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
    height: 44px;
    line-height: 1;
    box-sizing: border-box;
}

@media (hover: hover) and (pointer: fine) {
.section-header:hover {
    background: var(--bg-tertiary);
}
}


.section-header:active {
    opacity: 0.8;
}

/* Light theme specific improvements for sections */
body.light-theme .section {
    border: 1px solid var(--border-color);
}

body.light-theme .section.collapsible {
    background: none;
}

body.light-theme .section-header {
    background: #f7f7f700;
    border-bottom: 1px solid #e2e8f000;
    color: var(--text-primary) !important;
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .section-header:hover {
    background: var(--bg-tertiary);
}
}


body.light-theme .section-header:active {
    opacity: 0.8;
}

/* Light theme improvements for items */
body.light-theme .measurement-item,
body.light-theme .note-item,
body.light-theme .finance-stat-card,
body.light-theme .finance-progress {
    background: var(--transparent-bg-light);
    border-color: var(--border-color);
}

/* Checkbox on light task cards: readable ring on pale background */
body.light-theme .task-item .checklist-item > .checklist-checkbox,
body.light-theme .list-task-item .checklist-item > .checklist-checkbox {
    border-color: #94a3b8;
    background: rgba(255, 255, 255, 0.85);
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .task-item .checklist-item > .checklist-checkbox:hover:not(.checked),
body.light-theme .list-task-item .checklist-item > .checklist-checkbox:hover:not(.checked) {
    border-color: var(--accent-green, #48bb78);
    background: rgba(72, 187, 120, 0.12);
}
}

body.light-theme .task-item .checklist-item > .checklist-checkbox.checked,
body.light-theme .list-task-item .checklist-item > .checklist-checkbox.checked {
    background: var(--accent-green, #48bb78);
    border-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .measurement-item:hover,
body.light-theme .note-item:hover {
    background: var(--transparent-bg-light);
}
}


@media (hover: hover) and (pointer: fine) {
body.light-theme .checklist-item:hover {
    transform: translateY(-4px);
}
}


body.light-theme .job-info-card {
    background: var(--bg-secondary);
}

body.light-theme .detail-content .section.collapsible {
    background: transparent;
    border: none;
}

body.light-theme .detail-content .section-header {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-muted) !important;
}

@media (hover: hover) and (pointer: fine) {
    body.light-theme .detail-content .section-header:hover {
        background: var(--finance-track, var(--bg-tertiary));
        color: var(--text-primary) !important;
    }
}

body.light-theme .detail-content .section:not(.collapsed) .section-header {
    background: var(--finance-track, var(--bg-tertiary));
    color: var(--text-primary) !important;
}

body.light-theme .toggle-icon {
    color: var(--text-icons) !important;
}

/* Exceptions: Elements with colored backgrounds should keep white text */
body.light-theme .task-job-site,
body.light-theme .task-job-site *,
body.light-theme .setting-btn,
body.light-theme .setting-btn *,
body.light-theme .filter-btn.active,
body.light-theme .filter-btn.active * {
    color: white !important;
}

/* Additional exceptions for elements outside .section-content */
body.light-theme .task-job-site,
body.light-theme .task-job-site i {
    color: white !important;
}

/* Light theme menu active items - dark text/icons on light background */
body.light-theme .menu-item.active {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

body.light-theme .menu-item.active i {
    color: var(--text-primary) !important;
}

.section-header .section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1;
    flex: 1;
    margin: 0;
    padding: 0;
}

.section-header .section-title i {
    font-size: var(--font-size-default);
    color: var(--accent-primary);
    flex-shrink: 0;
    width: 18px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.section-header .section-title span[data-i18n] {
    display: inline-flex;
    align-items: center;
    font-size: var(--font-size-tertiary);
    line-height: 1;
    font-weight: var(--font-weight-semibold);
    flex-shrink: 0;
    margin: 0;
    padding: 0;
}

/* Remove old CSS - all sections now use .section-title wrapper */

.section-header .section-count {
    margin-left: 0.375rem;
}

.section-count {
    background: #ededed1c;
    color: #bfc0c2;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    min-width: 20px;
    text-align: center;
    line-height: 1;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 10px 0 0;
    font-variant-numeric: tabular-nums;
}

.toggle-icon {
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
    font-size: var(--font-size-secondaryallest);
    flex-shrink: 0;
    width: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.section.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.section-content {
    padding: var(--spacing-sm) var(--spacing-md);
    overflow: visible; /* Changed from hidden to visible to ensure gap is visible */
    opacity: 1;
}

.section.collapsed .section-content {
    height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    overflow: hidden;
    opacity: 0;
}

.section h3:not(.section-header) {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: var(--font-size-default);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Photos grid */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem; /* 16px desktop - accounts for 1px borders (visible gap ~14px) */
}

/* Empty state in photos grid: span full width so it stays centered on wide screens */
.photos-grid .empty-state {
    grid-column: 1 / -1;
}

/* Mobile: 3 columns for compact layout */
@media (max-width: 768px) {
    .photos-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem; /* 12px mobile - accounts for 1px borders (visible gap ~10px) */
    }
    
    .photo-item {
        border-radius: 6px;
    }
    
    .photo-item img {
        height: 100px;
    }
    
    .photo-placeholder {
        height: 100px;
    }
}

.photo-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border-color); /* Restored to original 1px */
    transform-origin: center;
    contain: layout style paint;
    box-sizing: border-box; /* Ensure borders don't affect spacing */
    /* Ensure items don't fill entire grid cell - let gap be visible */
    width: 100%;
    max-width: 100%;
    /* Ensure no margin that could hide gap */
    margin: 0;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.2s ease,
                border-width 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
.photo-item:hover {
    transform: scale(1.03);
}
}


.photo-item img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
    backface-visibility: hidden;
}

/* PHASE 2: Photo Placeholder (for lazy loading thumbnails) */
.photo-placeholder {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: var(--font-size-special);
}

.photo-item.loading .photo-placeholder {
    animation: none;
}

.photo-placeholder--spinner .photo-operation-overlay-content {
    gap: 0;
}

.photo-placeholder--spinner .photo-operation-spinner {
    width: 24px;
    height: 24px;
}

body.light-theme .photo-placeholder--spinner .photo-operation-spinner {
    border: 3px solid rgba(15, 23, 42, 0.22);
    border-top-color: rgba(15, 23, 42, 0.88);
}

/* Photo operation overlay - single overlay for upload/delete */
.photo-operation-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001; /* Above photo viewer (10000) so visible when deleting from fullscreen viewer */
    border-radius: 0;
    min-height: 80px;
}

.photo-operation-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-size: var(--font-size-tertiary);
}

.photo-operation-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.6);
    border-top-color: transparent;
    border-radius: 50%;
    animation: financial-lists-spin 0.7s linear infinite;
}

/* PDF upload — above page picker (2600) and photo viewer (10000) */
.pdf-upload-overlay {
    z-index: 12000;
}

@keyframes photoItemPulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Photo Selection Styles */
.photo-item.selected {
    border: 1px solid var(--accent-blue);
    transform: scale(0.96);
}

.photo-selection-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    color: white;
    border-radius: 50%;
    width: 10px;
    height: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-default);
}

.photo-item:not(.selected) .photo-selection-indicator {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.9);
    color: transparent;
}

.photo-item:not(.selected) .photo-selection-indicator i {
    display: none;
}

.photo-item.selected .photo-selection-indicator {
    border: none;
    color: var(--photo-selection-icon);
}

.photo-selection-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 12px;
    position: sticky;
    z-index: 10;
    animation: slideDown 0.3s ease;
}

.photo-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

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

.photo-selection-toolbar button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: all 0.2s ease;
}

.photo-selection-toolbar .btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: var(--font-size-tertiary);
}

.photo-selection-toolbar .btn-share {
    background: var(--accent-blue);
    color: white;
}

.photo-selection-toolbar .btn-delete {
    background: var(--accent-danger);
    color: white;
}

@media (hover: hover) and (pointer: fine) {
.photo-selection-toolbar button:hover {
    transform: scale(1.05);
}
}


.photo-selection-toolbar .selection-count {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .photo-selection-toolbar {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .photo-selection-toolbar button {
        padding: 0.4rem 0.8rem;
        font-size: var(--font-size-secondary);
    }
    
    .photo-selection-toolbar .selection-count {
        font-size: var(--font-size-tertiary);
    }
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (hover: hover) and (pointer: fine) {
.photo-item:hover .photo-overlay {
    opacity: 1;
}
}


.photo-actions {
    display: flex;
    gap: 0.5rem;
}

.photo-actions .btn {
    padding: 0.5rem;
    font-size: var(--font-size-secondary);
}

/* Measurements list */
.measurements-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.measurement-item {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: var(--spacing-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
}

.measurement-item:last-child {
    margin-bottom: 0;
}

@media (hover: hover) and (pointer: fine) {
.measurement-item:hover {
    background: var(--bg-secondary);
}
}


.measurement-item:active {
    opacity: 0.8;
}

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

.measurement-info h4 {
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-semibold);
}

.measurement-value {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: #68d391;
}

.measurement-original {
    font-size: var(--font-size-tertiary);
    color: #a0aec0;
    margin-top: 0.125rem;
}

.measurement-notes {
    color: #cbd5e0;
    font-size: var(--font-size-tertiary);
    margin-top: 0.125rem;
}

.measurement-actions {
    display: flex;
    gap: 0.375rem;
    align-items: center;
    flex-shrink: 0;
}

.measurement-actions .btn {
    padding: 0.5rem;
    font-size: var(--font-size-tertiary);
    min-width: 36px;
    min-height: 36px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Notes list */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Checklists */
.checklist-progress {
    padding: 0.75rem 0.875rem;
    background: var(--bg-secondary);
    border-radius: 10px;
    margin: 0 0.875rem 0.75rem 0.875rem;
}

.progress-bar-container {
    width: 100%;
    height: 20px;
    background: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    width: 100%;
    background: var(--accent-green);
    border-radius: 10px;
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease;
    will-change: transform;
}

.progress-text {
    font-size: var(--font-size-secondary);
    color: var(--text-secondary);
    text-align: center;
    font-weight: var(--font-weight-semibold);
}

.checklist-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

body.light-theme #checklistList {
    background: var(--bg-secondary);
}

/* Row: checkbox (left) + checklist-item; equal horizontal padding */
.checklist-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 0.625rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.checklist-row:last-child,
.task-item:last-child,
.list-task-item:last-child {
    margin-bottom: 0;
}

/* Unified enter/exit animations (checklist-row reference – used by task-item, list-task-item) */
.checklist-row.checklist-row-exit,
.task-item.task-item-exit,
.list-task-item.list-task-item-exit {
    -webkit-animation: task-burst-exit 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation: task-burst-exit 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: none;
}
.checklist-row.checklist-row-enter,
.task-item.task-item-enter,
.list-task-item.list-task-item-enter {
    opacity: 0;
    -webkit-transform: scale(0.35, 0.2) translateZ(0);
    transform: scale(0.35, 0.2) translateZ(0);
    -webkit-animation: task-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation: task-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Match .task-item styles and layout */
.checklist-item {
    flex: 1;
    min-width: 0;
    background: transparent;
    padding: 0.25rem;
    border-radius: 0;
    border: 1px solid transparent;
    border-left: 4px solid var(--accent-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: transform 0.2s ease, opacity 0.25s ease;
    position: relative;
    overflow: hidden;
    margin-bottom: 0;
    min-height: 50px;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Unified hover/active: checklist-row, task-item, list-task-item – hover/active removed per request */

.checklist-item.completed {
    opacity: 0.7;
}

/* Checklist checkbox: same sizes/styles as enhanced-subtask-checkbox; 44px touch target */
.checklist-checkbox {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 1px solid var(--text-muted);
    border-radius: var(--card-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.25s ease, background 0.25s ease, border-width 0.2s ease, box-shadow 0.25s ease;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
    padding: 0;
    margin: 0;
    margin-right: 0.65rem;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.checklist-checkbox * {
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
.checklist-checkbox:hover:not(.checked) {
    border-color: var(--accent-primary);
    background: var(--accent-green-tint);
}
}

.checklist-checkbox.checked {
    border-width: 0;
    border-color: transparent;
    background: var(--accent-green, #4ade6e);
    box-shadow: 0 0 0 0 rgba(74, 222, 110, 0.4);
}

/* Spring bounce only on the checkbox we just toggled (.animating), so others don’t re-bounce */
.checklist-checkbox.checked.animating {
    will-change: transform;
    -webkit-animation: subtask-springBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: subtask-springBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Particle burst only when toggling to checked (same as edit-subtask-checkbox) */

.checklist-checkbox .checkmark {
    width: 13px;
    height: 11px;
    flex-shrink: 0;
    pointer-events: none;
    overflow: visible;
}

.checklist-checkbox .checkmark path {
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    transition: none;
}

.checklist-checkbox.checked .checkmark path {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.28s cubic-bezier(0.4, 0, 0.2, 1) 0.08s;
}

.checklist-checkbox .subtask-particle {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 2px;
    left: 50%;
    top: 50%;
    margin-left: -2.5px;
    margin-top: -2.5px;
    pointer-events: none;
    opacity: 0;
}

/* Splash only when we just checked (completed) – .animating added by JS on toggle */
.checklist-checkbox.checked.animating .subtask-particle {
    will-change: transform, opacity;
    -webkit-animation: subtask-particleBurst 0.55s cubic-bezier(0.22, 0.68, 0, 1) forwards;
    animation: subtask-particleBurst 0.55s cubic-bezier(0.22, 0.68, 0, 1) forwards;
}

.checklist-checkbox .subtask-particle-1 { --particle-tx: translate(-22px, -20px); animation-delay: 0s;     background: #4ade6e; }
.checklist-checkbox .subtask-particle-2 { --particle-tx: translate(22px, -20px);  animation-delay: 0.03s; background: #f6ad55; }
.checklist-checkbox .subtask-particle-3 { --particle-tx: translate(-26px, 4px);   animation-delay: 0.05s; background: #63b3ed; }
.checklist-checkbox .subtask-particle-4 { --particle-tx: translate(26px, 4px);    animation-delay: 0.02s; background: #fc8181; }
.checklist-checkbox .subtask-particle-5 { --particle-tx: translate(-12px, 24px);  animation-delay: 0.04s; background: #c084fc; }
.checklist-checkbox .subtask-particle-6 { --particle-tx: translate(12px, 24px);   animation-delay: 0.01s; background: #f472b6; }

/* Task checkbox: solid box, visible in both themes (not a hole) */
.task-checkbox {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 1px solid #718096;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: #5a6578;
    flex-shrink: 0;
    position: relative;
}

@media (hover: hover) and (pointer: fine) {
.task-checkbox:hover {
    border-color: var(--accent-green);
    background: rgba(104, 211, 145, 0.25);
}
}

.task-checkbox.checked {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

/* Light theme: solid light box with visible border */
body.light-theme .task-checkbox {
    background: #e5e7eb;
    border-color: #9ca3af;
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .task-checkbox:hover {
    border-color: var(--accent-green);
    background: rgba(104, 211, 145, 0.2);
}
}

body.light-theme .task-checkbox.checked {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

/* Checkmark: always present so we can animate opacity/scale when .checked is toggled */
.task-checkbox::after {
    content: '✓';
    color: white;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
    pointer-events: none;
}

.task-checkbox.checked::after {
    opacity: 1;
    transform: scale(1);
}

.checklist-text {
    flex: 1;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    line-height: 1.2;
}

.checklist-item.completed .checklist-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.checklist-item.completed .calendar-task-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.checklist-date {
    font-size: var(--font-size-secondary);
    color: var(--text-muted);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
}

/* Due date styling */
.checklist-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.checklist-dates {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

/* Match .list-task-status-badge: pill style, donut colors, white text */
.checklist-due-date,
.completed-date {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.02em;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.checklist-due-date.overdue {
    background: #fc8181;
    color: white;
}

.checklist-due-date.due-today,
.checklist-due-date.due-soon {
    background: #f6ad55;
    color: white;
}

.checklist-due-date.due-normal {
    background: var(--accent-green);
    color: white;
}

.completed-date {
    background: #38a169;
    color: white;
}

.checklist-due-date i,
.completed-date i {
    font-size: 0.75em;
    opacity: 0.95;
}

/* Status left border – match .task-item */
.checklist-item.overdue:not(.completed) {
    border-left-color: var(--overdue-color);
}

.checklist-item.due-today:not(.completed) {
    border-left-color: var(--due-soon-color);
}

.checklist-item.due-soon:not(.completed) {
    border-left-color: var(--due-soon-color);
}

.checklist-item.due-normal:not(.completed) {
    border-left-color: var(--accent-primary);
}

.checklist-item.completed {
    border-left-color: var(--completed-color);
}

.checklist-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

.checklist-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.625rem;
    min-width: 44px;
    min-height: 44px;
    font-size: var(--font-size-base);
    transition: all 0.2s ease;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
.checklist-delete:hover {
    background: rgba(107, 114, 128, 0.1);
    color: var(--accent-danger);
    opacity: 1;
    transform: scale(1.05);
}
}


.note-item {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: var(--spacing-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    word-wrap: break-word;
}

.note-item:last-child {
    margin-bottom: 0;
}

@media (hover: hover) and (pointer: fine) {
.note-item:hover {
    background: var(--bg-secondary);
}
}


.note-item:active {
    opacity: 0.8;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.note-title {
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-secondary);
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.note-date {
    color: #cbd5e0;
    font-size: var(--font-size-tertiary);
    flex-shrink: 0;
    white-space: nowrap;
}

.note-content {
    color: #e2e8f0;
    line-height: 1.4;
    font-size: var(--font-size-secondary);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    white-space: pre-wrap;
}

.note-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.note-actions .btn {
    padding: 0.5rem 0.75rem;
    font-size: var(--font-size-tertiary);
    min-width: auto;
    min-height: 36px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    flex-shrink: 0;
}

/* ===== Project History modal (plain list) ===== */
#historyModal {
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* In-app confirm above open modals (Capacitor Dialog often fails to show). */
.forma-in-app-confirm {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm);
    box-sizing: border-box;
}

.forma-in-app-confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.forma-in-app-confirm-card {
    position: relative;
    z-index: 1;
    width: min(100%, 320px);
    background: var(--bg-secondary, #2d3748);
    color: var(--text-primary, #fff);
    border: 1px solid var(--border-color, rgba(255,255,255,0.12));
    border-radius: var(--card-radius);
    padding: var(--spacing-sm) 0.65rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.forma-in-app-confirm-title {
    margin: 0 0 var(--spacing-xs);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--tracking-loose);
}

.forma-in-app-confirm-message {
    margin: 0 0 var(--spacing-sm);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-regular);
    line-height: 1.4;
    letter-spacing: var(--tracking-loose);
    color: var(--text-secondary, rgba(255,255,255,0.8));
}

.forma-in-app-confirm-dont-ask {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin: 0 0 var(--spacing-sm);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.forma-in-app-confirm-dont-ask-input {
    width: 0.875rem;
    height: 0.875rem;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--accent-primary, #68d391);
    cursor: pointer;
}

.forma-in-app-confirm-dont-ask-text {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-regular);
    letter-spacing: var(--tracking-loose);
    color: var(--text-muted, rgba(255,255,255,0.7));
    line-height: 1.3;
}

.forma-in-app-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-xs);
}

.forma-in-app-confirm-cancel,
.forma-in-app-confirm-ok {
    appearance: none;
    border: none;
    border-radius: var(--card-radius);
    padding: 0.35rem 0.65rem;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    letter-spacing: var(--tracking-loose);
    cursor: pointer;
}

.forma-in-app-confirm-cancel {
    background: transparent;
    color: var(--text-muted, rgba(255,255,255,0.7));
}

.forma-in-app-confirm-ok {
    background: var(--bg-tertiary, #4a5568);
    color: var(--text-primary, #fff);
}

.forma-in-app-confirm-ok.is-danger {
    background: var(--accent-red, #ef4444);
    color: #fff;
}

body.light-theme .forma-in-app-confirm-card {
    background: #fff;
    color: #1a202c;
}

body.light-theme .forma-in-app-confirm-message {
    color: #4a5568;
}

.forma-in-app-confirm.has-issues .forma-in-app-confirm-card {
    width: min(100%, 380px);
}

.forma-in-app-confirm-issues {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin: 0 0 var(--spacing-sm);
    max-height: 50vh;
    overflow-y: auto;
}

.forma-in-app-confirm-issue-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.forma-in-app-confirm-issue-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--tracking-loose);
}

.forma-in-app-confirm-issue-pill.is-warning {
    color: var(--accent-yellow, #f6ad55);
    background: rgba(246, 173, 85, 0.14);
}

.forma-in-app-confirm-issue-pill.is-error {
    color: var(--accent-red, #fc8181);
    background: rgba(252, 129, 129, 0.14);
}

.forma-in-app-confirm-issue {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.45rem 0.55rem;
    border-radius: var(--card-radius);
    border-left: 3px solid currentColor;
}

.forma-in-app-confirm-issue.is-warning {
    color: var(--accent-yellow, #f6ad55);
    background: rgba(246, 173, 85, 0.08);
}

.forma-in-app-confirm-issue.is-error {
    color: var(--accent-red, #fc8181);
    background: rgba(252, 129, 129, 0.08);
}

.forma-in-app-confirm-issue > i {
    margin-top: 0.15rem;
    font-size: var(--font-size-tertiary);
}

.forma-in-app-confirm-issue-text {
    min-width: 0;
}

.forma-in-app-confirm-issue-title {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--tracking-loose);
}

.forma-in-app-confirm-issue-detail {
    margin-top: 0.1rem;
    font-size: var(--font-size-tertiary);
    line-height: 1.4;
    letter-spacing: var(--tracking-loose);
    color: var(--text-secondary, rgba(255,255,255,0.8));
}

body.light-theme .forma-in-app-confirm-issue-detail {
    color: #4a5568;
}

body.light-theme .forma-in-app-confirm-issue-pill.is-warning,
body.light-theme .forma-in-app-confirm-issue.is-warning {
    color: #c05621;
}

body.light-theme .forma-in-app-confirm-issue-pill.is-error,
body.light-theme .forma-in-app-confirm-issue.is-error {
    color: #c53030;
}

.history-modal-content {
    max-width: 640px;
    max-height: min(90vh, 920px);
    height: auto;
    display: flex;
    flex-direction: column;
    touch-action: pan-y;
    pointer-events: auto;
    overflow: hidden; /* scroll lives in .modal-body */
}

#historyModal .modal-header {
    flex-shrink: 0;
}

#historyModal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Hide scrollbar handle; keep scroll */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#historyModal .modal-body::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
    background: transparent;
}

#historyModal * {
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#historyModal input,
#historyModal textarea {
    user-select: text;
    -webkit-user-select: text;
    -webkit-touch-callout: default;
}

#historyModal .history-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 0;
    padding-right: 0;
    font-size: var(--font-size-tertiary);
}

#historyModal .ph-section {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
}

#historyModal .ph-section::before {
    display: none;
}

#historyModal .ph-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 0 0.75rem;
    padding: 0 0 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

#historyModal .ph-section-title {
    margin: 0;
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

#historyModal .ph-count {
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

#historyModal .ph-list,
#historyModal .ph-activity {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

#historyModal .ph-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border-color);
}

#historyModal .ph-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

#historyModal .ph-row-title {
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    line-height: 1.35;
}

#historyModal .ph-row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
}

#historyModal .ph-meta-sep {
    opacity: 0.5;
}

#historyModal .ph-status {
    text-transform: capitalize;
    color: var(--text-secondary);
}

#historyModal .ph-row-desc {
    margin: 0.4rem 0 0;
    color: var(--text-secondary);
    font-size: var(--font-size-tertiary);
    line-height: 1.45;
}

#historyModal .ph-btn {
    appearance: none;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 0.25rem 0.5rem;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    line-height: 1.3;
    min-height: auto;
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

#historyModal .ph-btn-ghost {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 0.25rem 0.4rem;
    min-height: auto;
    width: auto;
}

#historyModal .ph-activity-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.35rem;
}

#historyModal .ph-link {
    appearance: none;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    line-height: 1.2;
}

#historyModal .ph-link-restore {
    color: #68d391;
}

#historyModal .ph-link-danger {
    color: var(--accent-red, #ef4444);
}

@media (hover: hover) and (pointer: fine) {
    #historyModal .ph-btn-ghost:hover {
        color: var(--accent-red, #ef4444);
    }
    #historyModal .ph-link-restore:hover {
        text-decoration: underline;
    }
    #historyModal .ph-link-danger:hover {
        text-decoration: underline;
    }
}

/* History list scrolls via .modal-body; keep row overflow visible for action icons. */
#historyModal .history-list,
#historyModal .ph-section,
#historyModal .ph-row,
#historyModal .ph-activity-row {
    overflow: visible;
}

body.platform-ios #historyModal.modal.active .modal-content {
    contain: none;
}

#historyModal .ph-activity-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

#historyModal .ph-activity-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

#historyModal .ph-activity-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

#historyModal .ph-activity-text {
    color: var(--text-primary);
    font-size: var(--font-size-tertiary);
    line-height: 1.45;
}

#historyModal .ph-activity-text strong {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

#historyModal .ph-activity-time {
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
}

#historyModal .ph-activity-trailing {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}

#historyModal .ph-activity-remove {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#historyModal .ph-activity-restore {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #68d391;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (hover: hover) and (pointer: fine) {
    #historyModal .ph-activity-remove:hover {
        color: #ef4444;
        background: rgba(239, 68, 68, 0.08);
    }
    #historyModal .ph-activity-restore:hover {
        color: #48bb78;
        background: rgba(104, 211, 145, 0.12);
    }
}

#historyModal .ph-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}

#historyModal .ph-empty i {
    font-size: 1.75rem;
    opacity: 0.45;
    margin-bottom: 0.75rem;
}

#historyModal .ph-empty h4 {
    margin: 0 0 0.4rem;
    color: var(--text-secondary);
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-semibold);
}

#historyModal .ph-empty p {
    margin: 0 auto;
    max-width: 28rem;
    font-size: var(--font-size-tertiary);
    line-height: 1.5;
    color: var(--text-muted);
}

body.light-theme #historyModal .ph-count {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme #historyModal .ph-link-restore {
    color: #059669;
}

/* Modern Project Cards (drawing tool / shared) */
.history-cards {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.project-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: var(--card-padding);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

@media (hover: hover) and (pointer: fine) {
.project-card:hover {
    transform: translateY(-1px);
    border-color: var(--border-color);
}
}


.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-sm);
}

.project-title {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
}

.project-meta {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.project-description {
    color: var(--text-secondary);
    font-size: var(--font-size-tertiary);
    line-height: 1.4;
    margin: 0;
}

.project-status {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 20px;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    width: fit-content;
}

.project-status.completed {
    background: #68d391;
    color: var(--text-primary);
}

.project-status.in-progress {
    background: var(--accent-blue);
    color: #ffffff;
}

.project-status.upcoming {
    background: #f6ad55;
    color: var(--text-primary);
}

.project-status.on-hold {
    background: #fc8181;
    color: var(--text-primary);
}

.project-date {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.project-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    margin-top: var(--spacing-xs);
}

.btn-restore {
    background: var(--accent-green);
    color: #1a202c;
    border: none;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 8px;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

@media (hover: hover) and (pointer: fine) {
.btn-restore:hover {
    background: var(--accent-green);
    opacity: 0.9;
}
}


.btn-delete-forever {
    background: var(--accent-red);
    color: #1a202c;
    border: none;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 8px;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

@media (hover: hover) and (pointer: fine) {
.btn-delete-forever:hover {
    background: var(--accent-red);
    opacity: 0.9;
}
}


/* Enhanced Empty State */
.section-content .empty-state {
    text-align: center;
    padding: 1.5rem 0.75rem;
    color: var(--text-muted);
    background: transparent;
    border-radius: 0;
    border: none;
}

.section-content .empty-state i {
    font-size: var(--font-size-special);
    margin-bottom: 0.5rem;
    opacity: 0.4;
    color: var(--text-muted);
}

.section-content .empty-state h4 {
    font-size: var(--font-size-secondary);
    margin-bottom: 0.375rem;
    color: var(--text-secondary);
    font-weight: var(--font-weight-semibold);
}

.section-content .empty-state p {
    font-size: var(--font-size-tertiary);
    line-height: 1.4;
    color: var(--text-muted);
    max-width: 100%;
    margin: 0;
}

.btn-icon {
    padding: 0.5rem 0.75rem;
    min-width: auto;
    font-size: var(--font-size-base);
}

/* Deleted Sites */
.deleted-sites-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.history-info {
    flex: 1;
}

.history-info h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: var(--font-size-tertiary);
}

.history-info p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-size: var(--font-size-tertiary);
}

.history-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.history-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-status.in-progress {
    background: #fef3c7;
    color: #92400e;
}

.history-status.upcoming {
    background: #f6ad55;
    color: #1a202c;
}

.history-status.on-hold {
    background: #fc8181;
    color: #1a202c;
}

.history-date {
    color: var(--text-secondary);
    font-size: var(--font-size-tertiary);
}

.history-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 140px;
}

.history-actions .btn {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-tertiary);
    justify-content: center;
}

/* Empty states */
.section-content .empty-state {
    text-align: center;
    padding: 1.5rem 0.75rem;
    color: #cbd5e0;
}

.section-content .empty-state i {
    font-size: var(--font-size-special);
    margin-bottom: 0.5rem;
    opacity: 0.4;
}

.section-content .empty-state h4 {
    margin-bottom: 0.375rem;
    color: var(--text-primary);
    font-size: var(--font-size-secondary);
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        padding: 0.25rem;
        padding-top: calc(70px + env(safe-area-inset-top, 0px)); /* Space for fixed header + safe area on mobile */
        padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); /* Space for floating button + safe area on mobile */
    }
    
    .content-panel {
        padding: 1rem;
    }
    
    .floating-add-btn {
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
        font-size: var(--font-size-default);
    }
    
    .legend {
        padding: 0.5rem 0.75rem;
        margin-top: 0.75rem;
    }
    
    .legend-title {
        font-size: var(--font-size-tertiary);
        margin-bottom: 0.4rem;
    }
    
    .legend-items {
        gap: 0.5rem;
    }
    
    .legend-item {
        font-size: var(--font-size-tertiary);
        padding: 0.2rem 0.4rem;
    }
    
    .legend-dot {
        width: 6px;
        height: 6px;
    }
    
    .job-site-item {
        padding: 0.6rem 0.85rem;
        flex-direction: column;
        align-items: flex-start;
        min-height: auto;
    }
    
    .job-site-info {
        padding-right: 0;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .job-site-header {
        margin-bottom: 0.25rem;
    }
    
    .job-site-name {
        font-size: var(--font-size-secondary);
    }
    
    .task-count-badge {
        padding: 0;
        font-size: var(--font-size-smallest);
    }
    
    .task-count-badge i {
        font-size: var(--font-size-smallest);
    }
    
    .job-site-client,
    .job-site-address {
        display: none;
    }
    
    .job-site-description {
        font-size: var(--font-size-tertiary);
        margin-top: 0.5rem;
        max-width: 100%;
    }
    
    .job-site-right {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .status-select {
        font-size: var(--font-size-tertiary);
        padding: 0.4rem 0.6rem;
        width: 160px !important;
        min-width: 160px !important;
        max-width: 160px !important;
        border-radius: 12px;
    }
    
    .job-site-actions {
        gap: 0.3rem;
    }
    
    .detail-actions {
        flex-direction: row;
        gap: 0.4rem;
    }
    
    .detail-actions .btn {
        min-width: auto;
    }
    
    .btn-compact {
        padding: 14px 10px;
        font-size: var(--font-size-base);
        flex-direction: column;
        gap: 4px;
        min-width: 50px;
    }
    
    .btn-compact i {
        font-size: var(--font-size-default);
    }
    
    /* Light theme - dark icons for compact buttons */
    body.light-theme .btn-compact i {
        color: #1a202c;
    }
    
    /* Hide labels on mobile for cleaner look */
    .btn-compact .btn-label {
        display: none;
    }
    
    /* Compact finance buttons on mobile */
    .finance-actions {
        gap: 0.5rem;
        flex-direction: row;
    }
    
    .finance-actions .btn {
        padding: 0.75rem 0.875rem;
        font-size: var(--font-size-tertiary);
        min-height: 44px;
        gap: 0.375rem;
        flex: 1;
    }
    
    .finance-actions .btn i {
        font-size: var(--font-size-tertiary);
        flex-shrink: 0;
    }
    
    .finance-actions .btn span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Finance stat card on mobile */
    .finance-stat-card {
        padding: 0.875rem;
        margin-bottom: 0.875rem;
        border-radius: 10px;
    }
    
    .finance-stat-label {
        font-size: var(--font-size-tertiary);
        margin-bottom: 0.375rem;
    }
    
    .finance-stat-value {
        font-size: var(--font-size-tertiary);
        margin-bottom: 0.25rem;
    }
    
    .finance-stat-subtitle {
        font-size: var(--font-size-tertiary);
        margin-top: 0.25rem;
    }
    
    /* Compact contract amount save button on mobile */
    .contract-amount-input {
        padding: 12px;
    }
    
    .amount-input-wrapper {
        gap: 4px;
    }
    
    .currency-symbol {
        font-size: var(--font-size-base);
        min-width: 20px;
    }
    
    .amount-input-wrapper input {
        padding: 10px 8px;
        font-size: var(--font-size-base);
        min-width: 0;
    }
    
    .btn-save-contract {
        padding: 10px 12px;
        font-size: var(--font-size-default);
        min-width: 40px;
        flex-shrink: 0;
    }
    
    /* Transaction items on mobile */
    .transaction-item {
        padding: 0.4rem 0.55rem;
        margin-bottom: 0;
        min-height: 0;
    }
    
    .transaction-actions {
        margin-left: 0;
        gap: 0.2rem;
    }
    
    .btn-delete-transaction {
        min-width: 28px;
        height: 28px;
        padding: 0.25rem;
        font-size: var(--font-size-tertiary);
    }
    
    .modal-content {
        margin: 0.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }

    /* Keep employee modal actions in one equal-width row on tablet/small screens */
    #employeeCardModal .form-actions {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: stretch;
        align-items: stretch;
        gap: 0.5rem;
    }

    #employeeCardModal .form-actions > .btn,
    #employeeCardModal .form-actions .employee-actions-section .btn-employee-action {
        width: auto;
        min-width: 0;
        flex: 1 1 0;
        white-space: nowrap;
    }
    
    .history-item {
        flex-direction: column;
        gap: 1rem;
    }
    
    .history-actions {
        flex-direction: row;
        min-width: auto;
    }
    
    .history-actions .btn {
        flex: 1;
    }
    
    .activity-item {
        padding: 0.75rem;
    }
    
    .activity-info {
        gap: 0.75rem;
    }
    
    .activity-icon {
        width: 32px;
        height: 32px;
        font-size: var(--font-size-base);
    }
    
    .activity-text {
        font-size: var(--font-size-tertiary);
    }
    
    .activity-time {
        font-size: var(--font-size-tertiary);
    }
}

@media (max-width: 480px) {
    .status-cards {
        gap: 0.5rem;
    }
    
    .status-card {
        padding: 0.75rem;
    }
    
    /* Mobile status select - smaller and responsive */
    .status-select {
        width: 160px !important;
        min-width: 160px !important;
        max-width: 160px !important;
        font-size: var(--font-size-tertiary);
        padding: 0.3rem 0.4rem;
        padding-right: 2rem;
    }
}

/* Tablet breakpoint for status select */
@media (max-width: 768px) and (min-width: 481px) {
    .status-select {
        width: 140px;
        min-width: 140px;
        padding-right: 3rem;
    }
    
    .photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .photo-item img {
        height: 100px;
    }
}

/* Photo Viewer - Mobile-First Design */
.photo-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    background: var(--bg-primary);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    -webkit-transform: scale(0.98);
    transform: scale(0.98);
    -webkit-transition: opacity 0.3s ease, visibility 0s linear 0.3s, -webkit-transform 0.3s ease;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s, transform 0.3s ease;
    overflow: hidden;
    pointer-events: none;
}

.photo-viewer.active {
    opacity: 1;
    visibility: visible;
    -webkit-transform: scale(1);
    transform: scale(1);
    -webkit-transition: opacity 0.3s ease, visibility 0s linear 0s, -webkit-transform 0.3s ease;
    transition: opacity 0.3s ease, visibility 0s linear 0s, transform 0.3s ease;
    pointer-events: auto;
}

/* PDF-style: native one-finger pan (overflow scroll); JS only handles pinch. */
.photo-viewer-content {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
}

.photo-viewer.zoomed .photo-viewer-content {
    overflow: auto;
    touch-action: pan-x pan-y;
}

.photo-viewer.zoomed.gesturing .photo-viewer-content {
    touch-action: none;
}

.photo-viewer-scroll-shell {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100%;
    min-height: 100%;
    width: max-content;
}

.photo-viewer-stage {
    position: relative;
    display: block;
    line-height: 0;
    flex-shrink: 0;
    transform: none !important;
    transition: none;
}

.photo-viewer-content img {
    max-width: 100vw;
    max-height: 100vh;
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    pointer-events: auto;
    transition: none;
    transform: none !important;
    position: relative;
    display: block;
}

.photo-viewer.zoomed .photo-viewer-content img {
    max-width: none;
    max-height: none;
    width: 100%;
    height: 100%;
}

.photo-viewer-content img.dragging {
    transition: none;
}

/* Offline overlay - shown when cloud photo can't load */
.photo-viewer-offline-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(30, 41, 59, 0.9);
    color: #94a3b8;
    z-index: 5;
    padding: 2rem;
}
.photo-viewer-offline-icon {
    opacity: 0.5;
    margin-bottom: 1rem;
}
.photo-viewer-offline-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}
.photo-viewer-offline-hint {
    font-size: 0.875rem;
    margin: 0;
    opacity: 0.8;
}

/* Offline placeholder for photo grid thumbnails */
.photo-thumbnail-offline {
    width: 100%;
    height: 100%;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #334155;
    color: #94a3b8;
    font-size: 0.7rem;
}
.photo-thumbnail-offline i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
    opacity: 0.7;
}

/* Prevent pull-to-refresh on iOS */
.photo-viewer {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Photo viewer chrome — match drawing floating toolbar (dark glass + 2px radius) */
.photo-viewer-close,
.photo-viewer-save,
.photo-viewer-delete {
    position: fixed;
    top: env(safe-area-inset-top, 20px);
    top: max(env(safe-area-inset-top), 20px);
    width: 48px;
    height: 48px;
    padding: 0;
    box-sizing: border-box;
    background: rgba(34, 37, 43, 0.92);
    border: 1px solid rgba(56, 61, 72, 0.95);
    border-radius: 2px;
    color: #e8eaed;
    font-size: 18px;
    cursor: pointer;
    z-index: 10002;
    transition: transform 0.15s ease, opacity 0.1s ease, color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    -webkit-tap-highlight-color: transparent;
    font-weight: 600;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.photo-viewer-close { right: 20px; }
.photo-viewer-delete { right: 80px; }
.photo-viewer-save { right: 140px; }

.photo-viewer-close:active,
.photo-viewer-save:active,
.photo-viewer-delete:active {
    transform: scale(0.94);
    opacity: 0.85;
}

body.light-theme .photo-viewer-close,
body.light-theme .photo-viewer-save,
body.light-theme .photo-viewer-delete {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1f2937;
}

.photo-viewer-counter {
    position: fixed;
    bottom: env(safe-area-inset-bottom, 30px);
    bottom: max(env(safe-area-inset-bottom, 10px), 30px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.82);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    z-index: 10002;
    border: none;
    pointer-events: none;
}

/* Thumbnail Picker */
.thumbnail-picker {
    position: fixed;
    bottom: env(safe-area-inset-bottom, 20px);
    bottom: max(env(safe-area-inset-bottom, 10px), 90px);
    left: 0;
    right: 0;
    height: 80px;
    z-index: 10003;
    overflow-x: scroll;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.thumbnail-picker::-webkit-scrollbar {
    display: none;
}

.thumbnail-container {
    display: flex;
    gap: 10px;
    padding: 0 calc(50vw - 35px);
    height: 100%;
    align-items: center;
    min-width: max-content;
}

.thumbnail-item {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.5;
}

.thumbnail-item.selected {
    width: 70px;
    height: 70px;
    border-color: #68d391;
    opacity: 1;
    transform: scale(1.05);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* Hide controls when zoomed or auto-hidden */
.photo-viewer.hide-controls .photo-viewer-close,
.photo-viewer.hide-controls .photo-viewer-save,
.photo-viewer.hide-controls .photo-viewer-delete,
.photo-viewer.hide-controls .photo-viewer-edit-toggle,
.photo-viewer.hide-controls .photo-viewer-counter,
.photo-viewer.hide-controls .thumbnail-picker {
    opacity: 0;
    pointer-events: none;
}

.photo-viewer.hide-controls .photo-viewer-close,
.photo-viewer.hide-controls .photo-viewer-save,
.photo-viewer.hide-controls .photo-viewer-delete,
.photo-viewer.hide-controls .photo-viewer-edit-toggle {
    transform: translateX(30px);
}

.photo-viewer.hide-controls .thumbnail-picker {
    transform: translateY(100px);
}

/* Hide controls when zoomed in AND hide-controls is active */
.photo-viewer.zoomed.hide-controls .photo-viewer-close,
.photo-viewer.zoomed.hide-controls .photo-viewer-save,
.photo-viewer.zoomed.hide-controls .photo-viewer-delete,
.photo-viewer.zoomed.hide-controls .photo-viewer-edit-toggle,
.photo-viewer.zoomed.hide-controls .photo-viewer-counter,
.photo-viewer.zoomed.hide-controls .thumbnail-picker {
    opacity: 0;
    pointer-events: none;
}

/* Completion Warning Modal */
#completionWarningModal {
    justify-content: center;
    align-items: center;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
}

#completionWarningModal.active {
    background: rgba(0, 0, 0, 0.75);
}

.completion-warning-modal {
    max-width: 480px !important;
    width: calc(100% - 1rem);
    max-height: 90vh;
    height: auto !important;
    border-radius: 20px !important;
    overflow: hidden;
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#completionWarningModal.active .completion-warning-modal {
    transform: scale(1);
    opacity: 1;
}

.completion-warning-modal .modal-body {
    padding: 1.25rem;
    max-height: 65vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.warning-header {
    background: var(--accent-yellow);
    border-bottom: 1px solid rgba(255, 193, 7, 0.2);
    padding: 1rem;
}

.warning-header h3 {
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    flex: 1;
    margin: 0;
    line-height: 1.3;
}

.warning-header .modal-close {
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.warning-header h3 i {
    font-size: var(--font-size-special);
    color: #ffa726;
    animation: warningPulse 2s ease-in-out infinite;
}

@keyframes warningPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.7;
    }
}

.warning-message {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    line-height: 1.5;
    font-weight: var(--font-weight-medium);
}

.warning-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.warning-list li {
    padding: 0.85rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-left: 1px solid #ffa726;
    border-radius: 12px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-medium);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    line-height: 1.4;
}

.warning-list li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-yellow);
}

@media (hover: hover) and (pointer: fine) {
.warning-list li:hover {
    transform: translateX(4px);
}
}


.warning-list li i {
    color: #ffa726;
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 167, 38, 0.1);
    border-radius: 8px;
}

.warning-footer {
    display: flex;
    gap: 0.65rem;
    padding: 1rem;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
    border-top: 1px solid var(--border-color);
    flex-direction: column;
    background: var(--bg-secondary);
}

.warning-footer .btn {
    flex: 1;
    padding: 0.9rem 1.25rem;
    font-size: 0.95rem;
    font-weight: var(--font-weight-semibold);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}

.warning-footer .btn:active {
    transform: scale(0.98);
}

.warning-footer .btn-primary {
    background: var(--accent-green);
    color: #1a202c;
    font-weight: var(--font-weight-semibold);
}

@media (hover: hover) and (pointer: fine) {
.warning-footer .btn-primary:hover {
    background: var(--accent-green);
    transform: translateY(-2px);
}
}


.warning-footer .btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

@media (hover: hover) and (pointer: fine) {
.warning-footer .btn-secondary:hover {
    background: var(--bg-card);
    transform: translateY(-2px);
}
}


/* Mobile optimizations */
@media (max-width: 400px) {
    .warning-header h3 {
        font-size: 1rem;
        gap: 0.4rem;
    }
    
    .warning-header h3 i {
        font-size: 1.3rem;
    }
    
    .warning-message {
        font-size: var(--font-size-secondary);
    }
    
    .warning-list li {
        padding: 0.75rem 0.85rem;
        font-size: var(--font-size-tertiary);
    }
    
    .warning-list li i {
        width: 24px;
        height: 24px;
        font-size: 1rem;
    }
    
    .warning-footer .btn {
        font-size: var(--font-size-secondary);
        padding: 0.85rem 1rem;
    }
}

/* Tablet and desktop */
@media (min-width: 600px) {
    #completionWarningModal {
        padding: 1rem;
    }
    
    .completion-warning-modal {
        width: 90%;
        max-height: 85vh;
    }
    
    .completion-warning-modal .modal-body {
        padding: 1.5rem;
        max-height: 60vh;
    }
    
    .warning-header {
        padding: 1.25rem 1.5rem;
    }
    
    .warning-header h3 {
        font-size: 1.3rem;
        gap: 0.75rem;
    }
    
    .warning-message {
        font-size: var(--font-size-base);
        margin-bottom: 1.5rem;
    }
    
    .warning-list {
        gap: 0.75rem;
    }
    
    .warning-list li {
        padding: 1rem 1.25rem;
        font-size: var(--font-size-base);
        gap: 1rem;
    }
    
    .warning-list li i {
        width: 28px;
        height: 28px;
        font-size: var(--font-size-default);
    }
    
    .warning-footer {
        flex-direction: row;
        gap: 0.75rem;
        padding: 1rem 1.5rem;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
    }
    
    .warning-footer .btn {
        font-size: var(--font-size-base);
        padding: 1rem 1.5rem;
    }
}

/* Completion Celebration Animation - Reusable for payments, invoices, completions */
/* Modal-style: centered card with subtle backdrop */
.completion-celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    animation: fadeIn 0.3s ease;
    pointer-events: none;
    padding: 1.5rem;
}

.completion-celebration--dismissible {
    pointer-events: auto;
}

.celebration-content,
.celebration-popup-card,
.payment-popup-card {
    text-align: center;
    animation: celebrationBounce 0.6s ease;
    background: var(--glass-bg-dark);
    border-radius: var(--card-radius);
    padding: 2rem;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
}

.celebration-checkmark {
    position: relative;
    width: 70px;
    height: 70px;
    margin: 0 auto 1.5rem;
}

.celebration-circle {
    position: absolute;
    top: 0;
    left: 0;
    width: 70px;
    height: 70px;
}

.celebration-circle svg {
    width: 100%;
    height: 100%;
}

.celebration-circle circle {
    fill: none;
    stroke: #10b981;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 0 377;
    transform-origin: center;
    animation: drawCircle 1s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.celebration-check {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 2.25rem;
    color: #10b981;
    animation: checkPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.8s forwards;
}

.celebration-text {
    font-size: var(--font-size-default);
    font-weight: 900;
    color: #10b981;
    margin-bottom: 0.5rem;
    opacity: 0;
    animation: fadeInUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) 1.1s forwards;
}

.celebration-subtext {
    font-size: var(--font-size-default);
    font-weight: 600;
    color: var(--text-secondary);
    opacity: 0;
    animation: fadeInUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) 1.3s forwards;
}

.celebration-dismiss-btn {
    margin-top: 1.25rem;
    opacity: 0;
    animation: fadeInUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) 1.5s forwards;
    pointer-events: auto;
    background: #10b981;
    color: #fff;
    border: none;
}

body.light-theme .celebration-popup-card {
    background: var(--glass-bg-light);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

body.light-theme .celebration-dismiss-btn {
    background: #10b981;
    color: #fff;
}

/* Celebration Animations */
@keyframes drawCircle {
    0% {
        stroke-dasharray: 0 377;
        transform: rotate(-90deg);
    }
    100% {
        stroke-dasharray: 377 377;
        transform: rotate(270deg);
    }
}

@keyframes checkPop {
    0% {
        transform: translate(-50%, -50%) scale(0);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes celebrationBounce {
    0% {
        transform: scale(0.3) translateY(100px);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Measurement Type Selector */
.measurement-type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.type-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

@media (hover: hover) and (pointer: fine) {
.type-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}
}


.type-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.type-icon {
    font-size: var(--font-size-special);
    line-height: 1;
}

.type-label {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
}

.type-btn.active .type-label {
    color: white;
}

/* Dynamic Dimension Fields */
#dimensionFields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#dimensionFields .form-group {
    margin-bottom: 0;
}

/* Light theme adjustments */
body.light-theme .type-btn {
    background: #f8fafc;
    border-color: #d1d5db;
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .type-btn:hover {
    background: #f1f5f9;
    border-color: #3b82f6;
}
}


body.light-theme .type-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
}

/* Add Measurement Button */
.btn-add-measurement {
    background: var(--accent-green);
    border: none;
    border-radius: 12px;
    padding: 0.875rem 1.5rem;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: #000000;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.5rem;
}

@media (hover: hover) and (pointer: fine) {
.btn-add-measurement:hover {
    background: var(--accent-green);
    transform: translateY(-2px);
}
}


.btn-add-measurement i {
    font-size: var(--font-size-base);
    color: #000000;
}

/* Measurement Fields Container */
#measurementFieldsContainer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.measurement-field-row {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.measurement-field-inputs {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.measurement-field-inputs input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.875rem 1rem;
    font-size: var(--font-size-default);
    color: var(--text-primary);
    box-sizing: border-box;
}

.measurement-field-inputs input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.measurement-field-label {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: var(--font-weight-semibold);
}

.btn-remove-measurement {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0.5rem;
    font-size: var(--font-size-default);
}

@media (hover: hover) and (pointer: fine) {
.btn-remove-measurement:hover {
    color: #ef4444;
    transform: scale(1.2);
}
}


/* Light theme */
body.light-theme .btn-add-measurement {
    background: var(--accent-green);
    color: #000000;
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .btn-add-measurement:hover {
    background: var(--accent-green);
    transform: translateY(-2px);
}
}


body.light-theme .btn-add-measurement i {
    color: #000000;
}

body.light-theme .measurement-field-row {
    background: #f8fafc;
    border-color: #e5e7eb;
}

body.light-theme .measurement-field-inputs input {
    background: var(--bg-secondary);
    border-color: #d1d5db;
    color: #1a202c;
}

/* Measurement Display */
.measurement-type-icon {
    font-size: var(--font-size-default);
    margin-right: 0.5rem;
}

.measurement-dimensions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.dimension-item {
    display: flex;
    gap: 0.5rem;
    font-size: var(--font-size-base);
}

.dimension-label {
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
    min-width: 70px;
}

.dimension-value {
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family-mono);
}

/* 3-Dot Menu for Measurements */
.measurement-item {
    position: relative;
}

.measurement-actions {
    position: relative;
}

.btn-more {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-size-default);
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

@media (hover: hover) and (pointer: fine) {
.btn-more:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
}


.measurement-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: none;
    z-index: 9999;
    min-width: 150px;
    overflow: hidden;
}

.measurement-menu.active {
    display: block;
    animation: slideDown 0.2s ease;
}

.measurement-menu button {
    width: 100%;
    text-align: left;
    padding: 0.875rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
}

@media (hover: hover) and (pointer: fine) {
.measurement-menu button:hover {
    background: var(--bg-tertiary);
}
}


.measurement-menu button.menu-delete {
    color: #ef4444;
}

@media (hover: hover) and (pointer: fine) {
.measurement-menu button.menu-delete:hover {
    background: rgba(239, 68, 68, 0.1);
}
}


.measurement-menu button i {
    font-size: var(--font-size-base);
    width: 16px;
    text-align: center;
}

/* Slide down animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Light theme */
body.light-theme .measurement-menu {
    background: var(--bg-secondary);
    border-color: #e5e7eb;
}

body.light-theme .measurement-menu button {
    color: #1a202c;
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .measurement-menu button:hover {
    background: #f3f4f6;
}
}


body.light-theme .measurement-menu button.menu-delete {
    color: #dc2626;
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .measurement-menu button.menu-delete:hover {
    background: rgba(220, 38, 38, 0.1);
}
}


/* Light theme */
body.light-theme .btn-add-dim {
    background: #f8fafc;
    border-color: #d1d5db;
    color: #374151;
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .btn-add-dim:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}
}


/* View Mode Tabs — same inset sheet control as Labor Employees/Payroll */
.view-mode-tabs {
    display: flex;
    width: 100%;
    gap: 0.125rem;
    padding: 0.1875rem;
    margin-bottom: var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    box-sizing: border-box;
}

.view-mode-tab {
    flex: 1 1 0;
    min-width: 0;
    min-height: 1.875rem;
    padding: 0.375rem 0.625rem;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    line-height: 1.25;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

@media (hover: hover) and (pointer: fine) {
    .view-mode-tab:not(.active):hover {
        color: var(--text-primary);
    }
}

.view-mode-tab.active {
    background: var(--finance-track, var(--bg-tertiary));
    color: var(--text-primary);
    transform: none;
}

.view-mode-tab:focus {
    outline: none;
}

.view-mode-tab:focus-visible {
    outline: 1px solid var(--border-color);
    outline-offset: 0;
}

.view-mode-tab:active {
    opacity: 0.92;
}

/* Light: track tertiary, active chip white (finance-track is nearly invisible) */
body.light-theme .view-mode-tabs,
body.light-theme .view-mode-tabs.financial-tabs {
    background: var(--bg-tertiary);
}

body.light-theme .view-mode-tab.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

@media (hover: hover) and (pointer: fine) {
    body.light-theme .view-mode-tab:not(.active):hover {
        background: var(--surface-pressed, #e2e8f0);
        color: var(--text-primary);
    }
}

/* Calendar View Styles */



.calendar-container {
    /* background: var(--bg-tertiary); */
    /* backdrop-filter: blur(12px); */
    /* -webkit-backdrop-filter: blur(12px); */
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
}

body.light-theme .calendar-container {
    /* background: var(--bg-card); */
    /* backdrop-filter: blur(12px); */
    /* -webkit-backdrop-filter: blur(12px); */
}

/* Tasks (calendar shell): above ~700px cap width so 7-column + aspect-ratio grid does not fill the viewport. */
@media (min-width: 701px) {
    #calendarView .view-mode-tabs {
        max-width: 640px;
        margin-left: auto;
        margin-right: auto;
    }

    #calendarView .calendar-container,
    #calendarView .list-view-container,
    #calendarView .donut-view-container {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
        box-sizing: border-box;
    }

    #calendarView .task-details-panel {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    #calendarView .legend {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Month row. Wide layout (1024px and up) lives in css/calendar.css — search CALENDAR-WIDE-1024. */
.calendar-task-row {
    width: 100%;
    box-sizing: border-box;
}

/* CALENDAR-WIDE-1024 moved to css/calendar.css */

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.calendar-header h3,
#currentMonth {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

.calendar-nav {
    display: flex;
    gap: 6px;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    border-radius: 2px;
    cursor: pointer;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    line-height: 1;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.nav-btn i {
    font-size: var(--font-size-secondaryallest);
    width: 1em;
    height: 1em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (hover: hover) and (pointer: fine) {
.nav-btn:hover {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}
}


.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
}

.calendar-day-header {
    text-align: center;
    padding: 0.5rem;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-tertiary);
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: var(--calendar-day-bg);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    transition: transform 0.12s ease-out, background 0.12s ease-out, border-color 0.12s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 0;
    min-height: 0;
}

body.light-theme .calendar-day {
    border: 1px solid rgba(203, 213, 224, 0.4);
}

@media (hover: hover) and (pointer: fine) {
.calendar-day:hover {
    background: rgba(104, 211, 145, 0.15);
    transform: scale3d(1.05, 1.05, 1);
    border-color: var(--accent-primary);
}
}


@media (hover: hover) and (pointer: fine) {
body.light-theme .calendar-day:hover {
    background: rgba(72, 187, 120, 0.1);
    border-color: var(--accent-primary);
}
}


.calendar-day.today .day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 1.5em;
    height: 1.5em;
    padding: 0 0.2em;
    margin-bottom: 0;
    border: 1.5px solid var(--accent-primary);
    border-radius: 0.25rem;
    background: transparent;
    line-height: 1;
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day.selected {
    background: rgba(104, 211, 145, 0.1);
}

body.light-theme .calendar-day.selected {
    background: rgba(72, 187, 120, 0.08);
}

.day-number {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 0.2rem;
}

.task-indicators {
    --calendar-task-dot-size: 8px;
    --calendar-task-dot-radius: 25%;
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
}

.task-dot {
    width: var(--calendar-task-dot-size);
    height: var(--calendar-task-dot-size);
    min-width: var(--calendar-task-dot-size);
    min-height: var(--calendar-task-dot-size);
    border-radius: var(--calendar-task-dot-radius);
    flex-shrink: 0;
    box-sizing: border-box;
}

.task-dot.overdue {
    background: var(--overdue-color);
}

.task-dot.due-soon {
    background: var(--due-soon-color);
}

.task-dot.completed {
    background: var(--completed-color);
}

.task-dot.normal {
    background: var(--accent-primary);
}

.task-item {
    cursor: grab;
}

.task-item.dragging,
.list-task-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
    will-change: transform, opacity;
    transition: none;
}

.calendar-day.drag-over {
    background: rgba(104, 211, 145, 0.3) !important;
    border-color: var(--accent-primary) !important;
    transform: scale3d(1.05, 1.05, 1);
    will-change: transform, background;
    transition: transform 0.15s ease, background 0.15s ease;
}

body.light-theme .calendar-day.drag-over {
    background: rgba(72, 187, 120, 0.3) !important;
}

/* Task drop success animation */
.calendar-day.task-dropped {
    animation: taskDropGlow 0.6s ease-out;
    will-change: transform;
}

@keyframes taskDropGlow {
    0% {
        background: rgba(104, 211, 145, 0.4);
        transform: scale3d(1.1, 1.1, 1);
    }
    25% {
        background: rgba(104, 211, 145, 0.3);
    }
    50% {
        background: rgba(104, 211, 145, 0.2);
    }
    100% {
        background: var(--calendar-day-bg);
        transform: scale3d(1, 1, 1);
    }
}

body.light-theme .calendar-day.task-dropped {
    animation: taskDropGlowLight 1.2s ease-out;
}

@keyframes taskDropGlowLight {
    0% {
        background: rgba(72, 187, 120, 0.4);
        transform: scale3d(1.1, 1.1, 1);
    }
    25% {
        background: rgba(72, 187, 120, 0.3);
    }
    50% {
        background: rgba(72, 187, 120, 0.2);
    }
    100% {
        background: var(--calendar-day-bg);
        transform: scale3d(1, 1, 1);
    }
}

/* Echo lines effect */
.calendar-day.task-dropped::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 2px;
    border: 1px solid var(--accent-primary);
    animation: echoLines 1.2s ease-out;
    pointer-events: none;
}

@keyframes echoLines {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.3;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.task-details-panel {
    background: rgba(45, 55, 72, 0.88);
    border-radius: 2px;
    margin-top: 1rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.32s cubic-bezier(0.32, 0.72, 0, 1),
        transform 0.4s cubic-bezier(0.32, 0.72, 0, 1),
        max-height 0.45s ease-out;
}

.task-details-panel.active {
    max-height: none;
    opacity: 1;
    transform: translateY(0);
}

body.light-theme .task-details-panel {
    background: rgba(255, 255, 255, 0.94);
}

/* List: JS-animated in toggleTaskDetails; CSS provides initial/collapsed state only */
.task-details-panel.active .task-list {
    overflow: hidden;
}

.task-details-panel.active:not(.list-expanded) .task-list {
    max-height: 0;
    opacity: 0;
}

.task-details-panel.active.list-expanded .task-list {
    max-height: 80vh;
    opacity: 1;
}

/* Task day header — flat sheet row (matches donut legend / Labor controls) */
.task-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.625rem;
    padding: 0.2rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    margin-bottom: 0;
    transition: background-color 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.task-details-panel.active.list-expanded .task-details-header {
    margin-bottom: 0.625rem;
}

.task-details-header h4,
.task-details-header-title {
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    line-height: 1.25;
    user-select: none;
}

.task-details-header-title {
    flex: 1;
    min-width: 0;
    margin: 0;
}

#selectedDate {
    font-size: var(--font-size-tertiary);
}

.task-details-panel.active.list-expanded .task-details-header-title {
    color: var(--text-primary);
}

.task-details-header-actions {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    flex-shrink: 0;
}

.task-details-add-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    font-size: var(--font-size-tertiary);
    line-height: 1;
    transition: color 0.15s ease, opacity 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .task-details-add-btn:hover {
        color: var(--text-primary);
        opacity: 1;
    }
}

.task-details-add-btn:active {
    opacity: 0.72;
}

body.light-theme .task-details-add-btn {
    color: var(--text-muted);
}

#addChecklistEnhancedModal .enhanced-task-project-filter {
    position: relative;
    z-index: 2;
    max-width: none;
    width: 100%;
}

#addChecklistEnhancedModal .enhanced-task-project-filter.is-open {
    z-index: 40;
}

#addChecklistEnhancedModal.enhanced-task-project-open .modal-content,
#addChecklistEnhancedModal.enhanced-task-project-open .modal-body {
    overflow: visible;
}

#addChecklistEnhancedModal .enhanced-task-project-filter .filter-dropdown-btn,
#invoiceModal .enhanced-task-datetime-filter .filter-dropdown-btn {
    width: 100%;
    box-sizing: border-box;
    border-radius: 2px;
    white-space: nowrap;
    min-height: 32px;
    height: 32px;
    padding: 6px 10px;
    font-size: var(--font-size-tertiary);
    gap: 0.35rem;
}

#addChecklistEnhancedModal .enhanced-task-project-filter .filter-dropdown-btn #enhancedTaskProjectFilterLabel {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

body .enhanced-task-project-menu {
    left: 0;
    right: 0;
    width: 100%;
    min-width: 0;
    max-width: none;
    max-height: min(320px, 50vh);
    border-radius: 2px;
    z-index: 41;
    overflow: hidden;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
}

body .enhanced-task-project-menu.active {
    display: flex;
}

body .enhanced-task-project-menu.opens-up {
    top: auto;
    bottom: calc(100% + 4px);
}

body .enhanced-task-status-label {
    padding: 8px 12px 2px;
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

body .enhanced-task-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 10px 8px;
    border-bottom: 1px solid var(--border-color);
}

body .enhanced-task-status-chip {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    border-radius: 2px;
    padding: 4px 8px;
    font-size: var(--font-size-tertiary);
    font-family: inherit;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    line-height: 1.2;
}

body .enhanced-task-status-chip.active {
    background: var(--accent-green);
    color: var(--bg-primary);
    border-color: transparent;
    font-weight: var(--font-weight-semibold);
}

body .enhanced-task-project-list {
    overflow-y: auto;
    max-height: min(240px, 36vh);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body .enhanced-task-project-list::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
    background: transparent;
}

body .enhanced-task-project-list .filter-dropdown-item {
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    text-align: left;
    font-size: var(--font-size-tertiary);
    justify-content: flex-start;
}

body .enhanced-task-project-empty {
    padding: 10px 12px;
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
}

body .enhanced-task-datetime-filter .filter-dropdown-btn > span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

body .enhanced-task-datetime-filter .filter-dropdown-btn .fa-calendar-day,
body .enhanced-task-datetime-filter .filter-dropdown-btn .fa-clock {
    color: var(--accent-green);
}

body .enhanced-task-date-menu,
body .enhanced-task-time-menu {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

body .enhanced-task-date-menu {
    min-width: 248px;
    width: max(100%, 248px);
    max-width: none;
    max-height: none;
    overflow: hidden;
}

body .enhanced-task-time-menu {
    left: auto;
    right: 0;
    min-width: 196px;
    width: max(100%, 196px);
    max-width: none;
    max-height: none;
    overflow: hidden;
}

body .enhanced-task-date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px 8px 4px;
}

body .enhanced-task-date-nav-label {
    flex: 1;
    text-align: center;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

body .enhanced-task-date-nav-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

body .enhanced-task-date-weekdays,
body .enhanced-task-date-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    padding: 0 8px;
}

body .enhanced-task-date-grid {
    padding-bottom: 8px;
}

body .enhanced-task-date-weekday {
    text-align: center;
    font-size: 10px;
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 4px 0;
}

body .enhanced-task-date-day {
    aspect-ratio: 1;
    border: none;
    border-radius: 2px;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 12px;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    padding: 0;
}

body .enhanced-task-date-day.is-outside {
    color: var(--text-muted);
}

body .enhanced-task-date-day.is-today {
    box-shadow: inset 0 0 0 1px var(--accent-green);
}

body .enhanced-task-date-day.is-selected {
    background: var(--accent-green);
    color: var(--bg-primary);
    font-weight: var(--font-weight-semibold);
}

body .enhanced-task-date-day:disabled {
    opacity: 0.35;
    cursor: default;
}

body .enhanced-task-date-clear,
body .enhanced-task-time-clear {
    width: 100%;
    border: none;
    border-top: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    padding: 8px 10px;
    cursor: pointer;
    text-align: left;
}

body .enhanced-task-time-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-height: 200px;
}

body .enhanced-task-time-col {
    overflow-y: auto;
    max-height: 200px;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body .enhanced-task-time-col::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
    background: transparent;
}

body .enhanced-task-time-col + .enhanced-task-time-col {
    border-left: 1px solid var(--border-color);
}

body .enhanced-task-time-col .filter-dropdown-item {
    justify-content: center;
    font-size: var(--font-size-tertiary);
    border-bottom: none;
}

body .enhanced-task-menu-fixed {
    position: fixed !important;
    z-index: 12000;
    right: auto;
    bottom: auto;
    margin: 0;
    min-width: 0;
    max-width: calc(100vw - 16px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

/* Chevron: match .legend-chevron */
.collapse-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 2px;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
}

@media (hover: hover) and (pointer: fine) {
    .collapse-btn:hover {
        color: var(--text-primary);
    }

    .task-details-header:hover .task-details-header-title {
        color: var(--text-primary);
    }
}

.task-details-header:active {
    opacity: 0.92;
}

.collapse-btn i {
    transition: transform 0.2s ease;
}

.task-details-panel.active.list-expanded .collapse-btn i {
    transform: rotate(180deg);
}

.legend {
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
}

/* Dark theme: solid background */
body:not(.light-theme) .legend {
    background: transparent;
}

body.light-theme .legend {
    background: transparent;
}

.legend-title {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    text-align: center;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: var(--font-size-tertiary);
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    background: var(--bg-tertiary);
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
}

@media (hover: hover) and (pointer: fine) {
.legend-item:hover {
    transform: translateY(-1px);
}
}


.legend-item:active {
    transform: translateY(0);
}

.legend-item.active {
    color: var(--accent-primary);
    transform: translateY(-1px);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* List View Styles */
.list-view-container {
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
    overflow: visible;
    min-height: 200px;
}

.list-controls {
    margin-bottom: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.list-sort-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: 12px;
    font-size: var(--font-size-tertiary);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

body.light-theme .list-sort-toggle {
    background: var(--transparent-bg-light);
}

body:not(.light-theme) .list-sort-toggle {
    background: var(--bg-tertiary);
}

.sort-btn {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
}

@media (hover: hover) and (pointer: fine) {
.sort-btn:hover {
    color: var(--text-primary);
}
}


.sort-btn.active {
    background: var(--accent-green);
    color: #000000;
    font-weight: var(--font-weight-semibold);
}

.sort-btn.active i {
    color: #000000;
}

.sort-btn:active {
    transform: scale(0.98);
}

.list-filter-dropdown {
    position: relative;
    z-index: 1000;
    max-width: 160px;
}

/* Calendar list filter: same chrome as the payroll and task dropdowns */
#listViewContainer .list-filter-dropdown {
    max-width: none;
    width: max-content;
}

#listViewContainer .list-filter-dropdown .filter-dropdown-btn {
    border-radius: 2px;
    white-space: nowrap;
    min-height: 32px;
    padding: 6px 10px;
    font-size: var(--font-size-tertiary);
    width: max-content;
    max-width: none;
    gap: 0.35rem;
    box-sizing: border-box;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

#listViewContainer .list-filter-dropdown .filter-dropdown-menu {
    border-radius: 2px;
    width: max(100%, 200px);
    min-width: 200px;
    max-width: none;
    max-height: none;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

#listViewContainer .list-filter-dropdown .filter-dropdown-item {
    font-size: var(--font-size-tertiary);
    white-space: nowrap;
    box-sizing: border-box;
}

#listViewContainer #filterDropdownBtn .filter-count {
    background: transparent;
    color: inherit;
    border-radius: 2px;
    padding: 0;
    min-width: 0;
    font-size: inherit;
    font-weight: inherit;
}

#listViewContainer .list-filter-dropdown .filter-dropdown-item .filter-count {
    border-radius: 2px;
    color: var(--text-primary);
    background: color-mix(in srgb, var(--text-primary) 8%, transparent);
}

#listViewContainer .list-filter-dropdown .filter-dropdown-item.active .filter-count {
    background: rgba(0, 0, 0, 0.2);
    color: var(--bg-primary);
}

#listViewContainer .list-filter-sort-label {
    padding: 8px 12px 2px;
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

#listViewContainer .list-filter-sort-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 10px 8px;
    border-bottom: 1px solid var(--border-color);
}

#listViewContainer .list-filter-sort-chip {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    border-radius: 2px;
    padding: 4px 8px;
    font-size: var(--font-size-tertiary);
    font-family: inherit;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    line-height: 1.2;
}

#listViewContainer .list-filter-sort-chip.active {
    background: var(--accent-green);
    color: var(--bg-primary);
    border-color: transparent;
    font-weight: var(--font-weight-semibold);
}

.filter-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 36px;
}

@media (hover: hover) and (pointer: fine) {
.filter-dropdown-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-green);
}
}

/* Ghost triggers — match workshop calc mode button (no fill, no border) */
#dashboardProjectsSortBtn,
#overviewDisplayBtn,
#financialFilterGroupBtn,
#laborPeriodFilterBtn,
#payrollPresetFilterBtn,
#listViewContainer #filterDropdownBtn {
    background: transparent;
    border: 1px solid var(--border-color);
}

@media (hover: hover) and (pointer: fine) {
    #dashboardProjectsSortBtn:hover,
    #overviewDisplayBtn:hover,
    #financialFilterGroupBtn:hover,
    #laborPeriodFilterBtn:hover,
    #payrollPresetFilterBtn:hover,
    #listViewContainer #filterDropdownBtn:hover {
        background: transparent;
        border-color: var(--border-color);
    }
}


.filter-dropdown-btn .fa-filter {
    color: var(--accent-green);
}

.filter-dropdown-btn .fa-chevron-down {
    margin-left: auto;
    font-size: var(--font-size-secondaryallest);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotate(0deg) translateZ(0);
    transform-origin: 50% 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    min-width: 1em;
    min-height: 1em;
    flex-shrink: 0;
    flex-grow: 0;
    backface-visibility: hidden;
    contain: layout style;
}

.filter-dropdown-btn.active .fa-chevron-down {
    transform: rotate(180deg) translateZ(0);
}

/* Status select dropdown (job sites) – same look as list filter dropdown */
.status-select-dropdown {
    width: max-content;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.status-select-dropdown .filter-dropdown-btn {
    width: max-content;
    gap: 0.25rem;
    padding: 6px 10px;
    min-height: 32px;
    font-size: var(--font-size-tertiary);
    background: color-mix(in srgb, rgba(247, 247, 247, 0.19) 50%, transparent);
    border: 1px solid transparent;
    border-radius: var(--card-radius);
}

/* Status label: same text color in light theme as in dark theme */
body.light-theme .status-select-label {
    color: #f7fafc;
}

.status-select-dropdown .filter-dropdown-btn .fa-chevron-down {
    margin-left: 0;
}

/* Menu on top of card and following cards */
.status-select-dropdown .filter-dropdown-menu,
.status-select-dropdown .status-select-menu {
    min-width: 140px;
    z-index: 10001;
    border: 1px solid transparent;
    border-radius: 12px;
}

.filter-dropdown-menu.status-select-menu.active {
    background: color-mix(in srgb, var(--bg-card) 90%, transparent);
}

/* When dropdown is open, card can overflow and stacks above others */
.job-site-item.status-dropdown-open {
    z-index: 1000;
    overflow: visible;
    contain: none;
}

/* Allow dropdown to extend outside list when open (iOS WebView: contain:paint clips otherwise) */
.job-sites-list.status-dropdown-open {
    contain: layout style;
    overflow: visible;
}

.filter-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    overflow: hidden;
    z-index: 9999;
    display: none;
    max-height: 200px;
    overflow-y: auto;
    width: 200px;
    min-width: 200px;
    max-width: 200px;
}

.filter-dropdown-menu.active {
    display: block;
    animation: dropdownSlideIn 0.2s ease;
}

/* On desktop (hover devices), skip transform in animation to avoid clipping
   when parent has contain/transform - status dropdown works on iPhone/tablet */
@media (hover: hover) and (pointer: fine) {
    .status-select-dropdown .filter-dropdown-menu.active,
    .status-select-dropdown .status-select-menu.active {
        animation: dropdownSlideInDesktop 0.2s ease;
    }
}

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

@keyframes dropdownSlideInDesktop {
    from { opacity: 0; }
    to { opacity: 1; }
}

.filter-dropdown-menu.closing,
.status-select-menu.closing {
    animation: dropdownSlideIn 0.2s ease reverse forwards;
}

@media (hover: hover) and (pointer: fine) {
    .status-select-dropdown .status-select-menu.closing,
    .status-select-menu.closing {
        animation: dropdownSlideInDesktop 0.2s ease reverse forwards;
    }
}

.filter-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    min-height: 32px;
}

.filter-dropdown-item:last-child {
    border-bottom: none;
}

@media (hover: hover) and (pointer: fine) {
.filter-dropdown-item:hover {
    background: var(--bg-tertiary);
}
}


.filter-dropdown-item.active {
    background: var(--accent-green);
    color: var(--bg-primary);
    font-weight: var(--font-weight-semibold);
}

.filter-count {
    background: var(--bg-tertiary);
    padding: 0.15rem 0.4rem;
    border-radius: 8px;
    font-size: var(--font-size-tertiary);
    min-width: 20px;
    text-align: center;
    font-weight: var(--font-weight-semibold);
    color: white;
}

.filter-dropdown-item.active .filter-count {
    background: rgba(0, 0, 0, 0.2);
    color: var(--bg-primary);
}

/* All filter counts are now white for consistency */

.list-content {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 100px;
    padding-top: 0.5rem;
}

.list-content .empty-state,
.section-content .empty-state {
    padding: 1.5rem 0.75rem;
    margin: 0;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.section-content .empty-state i {
    font-size: 1.5rem !important;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}

.section-content .empty-state p {
    font-size: var(--font-size-tertiary) !important;
    margin: 0;
    color: var(--text-muted);
}

.list-group {
    margin-bottom: 1rem;
    overflow: hidden;
    width: 100%;
}

/* Match donut legend-item rows */
.list-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    margin-bottom: 0;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color 0.2s ease;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
}

@media (hover: hover) and (pointer: fine) {
.list-group-header:hover {
    background: var(--finance-track, var(--bg-tertiary));
    transform: none;
}
}

.list-group-header:active {
    opacity: 0.92;
}

.list-group.expanded .list-group-header {
    margin-bottom: 0.75rem;
    background: var(--finance-track, var(--bg-tertiary));
}

.list-group-title {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    line-height: 1.25;
}

.list-group-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.list-group-badge {
    background: transparent;
    color: var(--text-muted);
    padding: 0;
    border-radius: 0;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    font-variant-numeric: tabular-nums;
    min-width: 0;
    text-align: right;
    line-height: 1.25;
}

.list-group-collapse-icon {
    transition: transform 0.2s ease;
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    flex-shrink: 0;
}

@media (hover: hover) and (pointer: fine) {
    .list-group-header:hover .list-group-title,
    .list-group-header:hover .list-group-badge {
        color: var(--text-primary);
    }
}

.list-group.expanded .list-group-title,
.list-group.expanded .list-group-badge {
    color: var(--text-primary);
}

body.light-theme .list-group-header {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.light-theme .list-group-title,
body.light-theme .list-group-badge {
    color: var(--text-muted);
}

body.light-theme .list-group.expanded .list-group-title,
body.light-theme .list-group.expanded .list-group-badge {
    color: var(--text-primary);
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .list-group-header:hover {
    background: var(--bg-tertiary);
}
}

body.light-theme .list-group.expanded .list-group-header {
    background: var(--bg-tertiary);
}

.list-group.expanded .list-group-collapse-icon {
    transform: rotate(180deg);
}

.collapse-icon,
.collapse-indicator {
    font-size: var(--font-size-secondaryallest);
}

/* list-task-items: JS-animated in toggleListGroup */
.list-task-items {
    display: flex;
    flex-direction: column;
    height: 0;
    overflow: hidden;
    opacity: 0;
    width: 100%;
    box-sizing: border-box;
}

.list-group.expanded .list-task-items {
    height: auto;
    opacity: 1;
    margin-top: 0.5rem;
}

/* One card per row (.checklist-item); outer row is for drag + full width */
.list-task-item {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-bottom: 0.625rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    cursor: grab;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    width: 100%;
    box-sizing: border-box;
}

/* list-task-item uses .checklist-item (layout override above) */

.list-task-item.overdue .checklist-item {
    border-left-color: var(--overdue-color);
}

.list-task-item.due-soon .checklist-item {
    border-left-color: var(--due-soon-color);
}

.list-task-item.completed .checklist-item {
    opacity: 0.7;
    border-left-color: var(--completed-color);
}

.list-task-item.hidden,
#taskList .task-item.hidden {
    display: none;
}

.list-task-header {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    margin-bottom: 0.12rem;
    gap: 0.5rem;
}

.list-task-title {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    font-size: var(--font-size-tertiary);
    flex: 0 1 auto;
    line-height: 1.2;
}

.list-task-actions {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    flex-shrink: 0;
    justify-content: flex-end;
}

.list-task-meta {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.4rem;
    font-size: var(--font-size-secondary);
    color: var(--text-muted);
    flex-wrap: wrap;
    font-weight: var(--font-weight-medium);
}

.list-task-date,
.list-task-time {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--font-size-tertiary);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
    border: 1px solid transparent;
}

.list-task-date {
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent-primary);
    border-color: rgba(34, 197, 94, 0.2);
}

.list-task-time {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.2);
}

.list-task-date i,
.list-task-time i {
    font-size: var(--font-size-tertiary);
    opacity: 0.8;
}

/* Job/site chip: natural width + ellipsis; do not flex-grow (avoids empty middle gap) */
.list-task-job {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 1 auto;
    max-width: min(100%, 16rem);
    min-width: 0;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.25rem 0.55rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-task-status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-tertiary);
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

/* Match donut section colors */
.list-task-status-badge.overdue {
    background: var(--overdue-color);
    color: white;
}

.list-task-status-badge.due-soon {
    background: var(--due-soon-color);
    color: white;
}

.list-task-status-badge.completed {
    background: var(--completed-color);
    color: white;
}

.list-task-status-badge.normal {
    background: var(--accent-green);
    color: white;
}

/* Task list + calendar: inner card spacing (same all breakpoints — tight card) */
.list-task-item .checklist-item,
.task-item .checklist-item {
    gap: 0.25rem;
    padding: 0.25rem;
}

.list-task-header,
.task-item .list-task-header {
    align-items: center;
    min-width: 0;
}

.list-task-title,
.task-item .list-task-title {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.list-task-meta,
.task-item .list-task-meta {
    width: 100%;
    row-gap: 0.25rem;
    column-gap: 0.25rem;
    justify-content: flex-start;
}

@media (min-width: 769px) {
    .list-task-title,
    .task-item .list-task-title {
        font-size: var(--font-size-base);
    }

    .list-task-job {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        max-width: none;
    }
}

.empty-list {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-tertiary);
}

.empty-list i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

@media (max-width: 480px) {
    .calendar-grid {
        gap: 0.25rem;
    }

    .calendar-day-header {
        font-size: var(--font-size-tertiary);
        padding: 0.25rem;
    }

    .calendar-day {
        padding: 0.25rem;
    }

    .day-number {
        font-size: var(--font-size-tertiary);
    }

    .task-indicators,
    .payroll-date-cell.has-unpaid-labor .payroll-unpaid-dot,
    .payroll-unpaid-dot.payroll-legend-dot,
    .payroll-range-handle {
        --calendar-task-dot-size: 6px;
        gap: 1px;
    }

    .task-details-panel.active.list-expanded .task-list {
        max-height: none;
    }

    .task-list {
        padding: 0 0.75rem 0.75rem 0.75rem;
    }

    .task-details-header {
        padding: 0.2rem 0.75rem;
    }

    .filter-dropdown-btn {
        padding: 6px 10px;
        font-size: var(--font-size-secondary);
        min-height: 32px;
    }

    .filter-dropdown-item {
        padding: 6px 10px;
        font-size: var(--font-size-secondary);
        min-height: 28px;
    }

    .list-task-item,
    .task-item {
        gap: 0;
        align-items: stretch;
    }

    .list-task-title {
        font-size: var(--font-size-tertiary);
        margin-bottom: 0.25rem;
    }

    .list-task-meta {
        font-size: var(--font-size-tertiary);
        gap: 0.3rem;
    }
    
    .list-task-header {
        margin-bottom: 0.2rem;
    }
    
    
    .list-task-date,
    .list-task-time {
        font-size: var(--font-size-tertiary);
        gap: 0.2rem;
        padding: 0.15rem 0.35rem;
    }
    
    .list-task-status-badge {
        font-size: var(--font-size-tertiary);
        padding: 0.15rem 0.4rem;
    }
    
    .task-checkbox {
        width: 18px;
        height: 18px;
        min-width: 18px;
        border-radius: 3px;
    }
    
    .task-checkbox.checked::after {
        font-size: var(--font-size-tertiary);
    }
    
    .task-item .list-task-header {
        margin-bottom: 0.2rem;
    }
    
    .task-item .list-task-title {
        font-size: var(--font-size-tertiary);
        margin-bottom: 0.25rem;
    }
    
    
    .task-item .list-task-meta {
        font-size: var(--font-size-tertiary);
        gap: 0.3rem;
    }
    
    .task-item .list-task-status-badge {
        font-size: var(--font-size-tertiary);
        padding: 0.15rem 0.4rem;
    }

    .sort-btn {
        font-size: var(--font-size-tertiary);
        padding: 10px 8px;
    }

    .list-group-header {
        padding: 0.625rem 0.75rem;
        font-size: var(--font-size-tertiary);
    }

    .list-group-badge {
        font-size: var(--font-size-tertiary);
        padding: 0;
    }

    .list-group-collapse-icon {
        font-size: var(--font-size-tertiary);
    }

    .list-group-header-right {
        gap: 0.5rem;
    }

    .list-content {
        max-height: 500px;
    }
}

/* ========================================
   FINANCE TRACKING STYLES
   ======================================== */

/* Contract Amount Input */
.contract-amount-input {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
}

.contract-amount-input label {
    display: block;
    color: var(--text-muted);
    font-size: var(--font-size-secondary);
    margin-bottom: 0.5rem;
    font-weight: var(--font-weight-semibold);
}

.amount-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.currency-symbol {
    font-size: var(--font-size-base);
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
    flex-shrink: 0;
}

.amount-input-wrapper input {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-size: var(--font-size-secondary);
    min-height: 44px;
}

.amount-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.btn-save-contract {
    background: var(--accent-primary);
    color: #1a202c;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: var(--font-size-secondary);
    transition: opacity 0.2s;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.light-theme .btn-save-contract {
    color: #1a202c;
}

@media (hover: hover) and (pointer: fine) {
.btn-save-contract:hover {
    opacity: 0.9;
}
}


.btn-save-contract:active {
    transform: scale(0.98);
}

/* Finance Progress */
.finance-progress {
    background: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
}

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: var(--font-size-tertiary);
    gap: 0.5rem;
}

.progress-label span {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-percentage {
    text-align: center;
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Mobile optimizations for progress bar */
@media (max-width: 480px) {
    .finance-progress {
        padding: 0.625rem;
        margin-bottom: 0.625rem;
    }
    
    .progress-label {
        font-size: var(--font-size-tertiary);
        margin-bottom: 0.375rem;
        flex-wrap: wrap;
    }
    
    .progress-label span {
        font-size: var(--font-size-tertiary);
    }
    
    .progress-percentage {
        font-size: var(--font-size-tertiary);
    }
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: var(--font-size-tertiary);
    gap: 0.5rem;
}

.amount-collected {
    color: var(--accent-primary);
    font-weight: var(--font-weight-semibold);
    flex: 1;
    min-width: 0;
}

.amount-remaining {
    color: var(--text-muted);
    flex: 1;
    min-width: 0;
    text-align: right;
}

.progress-percentage {
    text-align: center;
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Finance Action Buttons */
/* Finance Stat Card (for Total Invoiced display) */
.finance-stat-card {
    background: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: center;
}

.finance-overview-group {
    border-radius: var(--card-radius);
    margin-bottom: 0.75rem;
}

.finance-overview-group .finance-stat-card {
    margin-bottom: 0;
}

/* Finance overview bar chart */
.finance-bar-chart {
    background: transparent;
    border: none;
    border-radius: var(--card-radius);
    padding: 0.35rem 0 0.5rem;
    margin-bottom: 0.5rem;
}

.finance-bar-chart-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.finance-bar-chart-title {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.finance-bar-chart-net {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
    white-space: nowrap;
}

.finance-bar-chart-net.is-positive,
.finance-bar-chart-net.is-negative {
    color: var(--text-muted);
}

.finance-bar-rows {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.finance-bar-row {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
}

.finance-bar-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.finance-bar-label {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
}

.finance-bar-amount {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.finance-bar-amount--spent,
.finance-bar-amount--profit-pos,
.finance-bar-amount--profit-neg {
    color: var(--text-primary);
}

.finance-bar-amount--profit-pos {
    color: var(--finance-bar-profit-pos);
}

.finance-bar-amount--profit-neg {
    color: var(--finance-bar-profit-neg);
}

.finance-bar-track {
    height: 20px;
    border-radius: 2px;
    background: var(--finance-track);
    overflow: hidden;
}

.finance-bar-fill {
    height: 100%;
    border-radius: 2px;
    width: 0;
    transform-origin: left center;
    animation: financeBarGrow 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
    transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.finance-bar-fill--estimated { background: var(--finance-bar-estimated); }
.finance-bar-fill--invoiced { background: var(--finance-bar-invoiced); }
.finance-bar-fill--collected { background: var(--finance-bar-collected); }
.finance-bar-fill--profit-pos { background: var(--finance-bar-profit-pos); }
.finance-bar-fill--profit-neg { background: var(--finance-bar-profit-neg); }

.finance-bar-track--stacked {
    background: var(--finance-track);
}

.finance-bar-stack {
    display: flex;
    height: 100%;
    border-radius: 2px;
    overflow: hidden;
    min-width: 0;
    animation: financeBarGrow 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
    transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.finance-bar-seg {
    display: block;
    height: 100%;
    min-width: 0;
}

.finance-bar-seg--empty {
    background: transparent;
}

.finance-bar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.85rem;
    margin-top: 0.65rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border-color);
}

.finance-bar-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-family-sans);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-regular);
    color: var(--text-muted);
}

.finance-bar-legend-swatch {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 2px;
    flex-shrink: 0;
}

.finance-bar-legend-label {
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary, var(--text-muted));
}

.finance-bar-legend-amount {
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
}

@keyframes financeBarGrow {
    from { transform: scaleX(0.04); opacity: 0.55; }
    to { transform: scaleX(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .finance-bar-fill,
    .finance-bar-stack {
        animation: none;
        transition: none;
    }
}

.finance-stat-label {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.finance-stat-value {
    font-size: var(--font-size-tertiary);
    font-weight: 900;
    color: var(--accent-primary);
    margin-bottom: 0.25rem;
    line-height: 1.2;
    word-break: break-word;
}

.finance-stat-subtitle {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.finance-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
    width: 100%;
}

.finance-actions .btn {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 0.85rem;
    font-family: var(--font-family-sans);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    min-height: 40px;
    border-radius: var(--card-radius);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: none;
}

.finance-actions .btn i {
    font-size: var(--font-size-tertiary);
    flex-shrink: 0;
}

/* Subtle tinted actions — readable CTAs without traffic-light solids */
.btn-payment,
.finance-actions .btn-primary {
    background: var(--finance-btn-pay-bg);
    color: var(--finance-btn-pay-text);
    border: 1px solid var(--finance-btn-pay-border);
}

body.light-theme .btn-payment,
body.light-theme .finance-actions .btn-primary {
    background: var(--finance-btn-pay-bg);
    color: var(--finance-btn-pay-text);
    border-color: var(--finance-btn-pay-border);
}

.btn-spending,
.finance-actions .btn-spending {
    background: var(--finance-btn-spend-bg);
    color: var(--finance-btn-spend-text);
    border: 1px solid var(--finance-btn-spend-border);
}

body.light-theme .btn-spending,
body.light-theme .finance-actions .btn-spending {
    background: var(--finance-btn-spend-bg);
    color: var(--finance-btn-spend-text);
    border-color: var(--finance-btn-spend-border);
}

@media (hover: hover) and (pointer: fine) {
    .finance-actions .btn-primary:hover {
        filter: brightness(1.06);
    }
    .finance-actions .btn-spending:hover {
        filter: brightness(1.06);
    }
    body.light-theme .finance-actions .btn-primary:hover,
    body.light-theme .finance-actions .btn-spending:hover {
        filter: brightness(0.98);
    }
}

/* Mobile optimizations for finance section */
@media (max-width: 480px) {
    .finance-stat-card {
        padding: 0.875rem;
        margin-bottom: 0.875rem;
        border-radius: 10px;
    }
    
    .finance-stat-label {
        font-size: var(--font-size-tertiary);
        margin-bottom: 0.375rem;
    }
    
    .finance-stat-value {
        font-size: var(--font-size-tertiary);
        margin-bottom: 0.25rem;
    }
    
    .finance-stat-subtitle {
        font-size: var(--font-size-tertiary);
        margin-top: 0.25rem;
    }
    
    .finance-actions {
        gap: 0.5rem;
        margin-bottom: 0.75rem;
        flex-direction: row;
    }
    
    .finance-actions .btn {
        padding: 0.75rem 0.875rem;
        font-size: var(--font-size-tertiary);
        min-height: 44px;
        gap: 0.375rem;
    }
    
    .finance-actions .btn i {
        font-size: var(--font-size-tertiary);
    }
    
    .finance-actions .btn span {
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ============================================
   Job Site Invoice/Estimate Items - Mobile Optimized
   ============================================ */
.job-site-invoices-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Project PDF card grid: services/project-pdfs.css (linked in index.html) */

.invoice-group h4 {
    font-size: var(--font-size-tertiary);
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.invoice-item {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.invoice-item:last-child {
    margin-bottom: 0;
}

@media (hover: hover) and (pointer: fine) {
.invoice-item:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
}
}


.invoice-item:active {
    transform: translateY(0);
    opacity: 0.8;
}

/* Left side - Invoice number and status */
.invoice-item > div:first-child {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
}

/* Right side - Amounts */
.invoice-item > div:last-child {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex: 0 0 auto;
    min-width: 0;
    max-width: 50%;
}

.invoice-num {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    font-size: var(--font-size-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.invoice-stat {
    padding: 0.1rem 0.25rem;
    border-radius: 2px;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.invoice-stat.status-open {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-primary);
}

.invoice-stat.status-paid {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.invoice-stat.status-overdue {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.invoice-stat.status-draft {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-muted);
}

.invoice-stat.status-pending {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.invoice-stat.status-accepted {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.invoice-stat.status-declined {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.invoice-amt {
    font-size: var(--font-size-primary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    word-break: break-all;
}

/* Collected and Due amounts in invoice items */
.invoice-item > div:last-child > div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    font-size: var(--font-size-tertiary);
    word-break: break-all;
}

.empty-invoice-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: var(--font-size-secondary);
}

/* Light theme support for invoice items */
body.light-theme .invoice-item {
    background: var(--bg-card);
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .invoice-item:hover {
    background: var(--bg-tertiary);
}
}


/* Mobile optimization - stack items on very small screens */
@media (max-width: 380px) {
    .invoice-item {
        flex-direction: column;
        align-items: stretch;
        padding: 0.625rem;
    }
    
    .invoice-item > div:first-child,
    .invoice-item > div:last-child {
        max-width: 100%;
    }
    
    .invoice-item > div:last-child {
        align-items: flex-start;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border-color);
    }
    
    .invoice-num {
        font-size: var(--font-size-tertiary);
    }
    
    .invoice-stat {
        padding: 0.1rem 0.25rem;
        font-size: 10px;
    }
    
    .invoice-amt {
        font-size: var(--font-size-secondary);
    }
}

/* Transaction List */
.transactions-list {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-right: 0.15rem;
}

.transaction-item {
    background: transparent;
    padding: 0.45rem 0.35rem 0.45rem 0.1rem;
    border-radius: var(--card-radius);
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border: none;
    transition: opacity 0.15s ease;
    min-height: 0;
    gap: 0.75rem;
}

body.light-theme .transaction-item {
    background: transparent;
}

.transaction-item:last-child {
    margin-bottom: 0;
}

@media (hover: hover) and (pointer: fine) {
.transaction-item:hover {
    background: transparent;
    opacity: 0.92;
}
body.light-theme .transaction-item:hover {
    background: transparent;
}
}


.transaction-item:active {
    opacity: 0.8;
}

.transaction-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    padding-top: 0.1rem;
}

.transaction-type {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
    line-height: 1.25;
}

.transaction-item[data-type="payment"] .transaction-type i,
.transaction-item[data-type="spending"] .transaction-type i {
    color: var(--text-muted);
}

.transaction-type i {
    font-size: 0.75em;
    flex-shrink: 0;
    width: 0.9em;
    text-align: center;
    opacity: 0.85;
}

.transaction-memo,
.transaction-invoice {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-tertiary);
    margin: 0;
    line-height: 1.3;
    padding-left: calc(0.9em + 0.3rem); /* align under type label, not icon */
}

.transaction-memo {
    color: var(--text-secondary, var(--text-primary));
    font-weight: var(--font-weight-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transaction-invoice {
    color: var(--text-secondary, var(--text-muted));
}

.transaction-invoice i {
    display: none;
}

.transaction-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-shrink: 0;
    margin: 0;
    padding-right: 0.2rem;
}

.transaction-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 0.12rem;
    line-height: 1.25;
    min-width: 5.5rem;
}

.transaction-date {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.25;
}

.transaction-amount {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    margin: 0;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    text-align: right;
    color: var(--text-primary);
}

.transaction-amount.payment,
.transaction-amount.spending {
    color: var(--text-primary);
}

.payment-type-badge,
.transaction-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    background: color-mix(in srgb, var(--text-primary) 4%, transparent);
    padding: 0 0.35rem 0 0.28rem;
    border-radius: var(--card-radius);
    font-family: var(--font-family-sans);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    margin: 0;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    line-height: 1.2;
    height: 1.3em;
}

body.light-theme .payment-type-badge,
body.light-theme .transaction-category-badge {
    background: #f8fafc;
}

.transaction-category-swatch {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 2px;
    flex-shrink: 0;
    background: var(--finance-bar-spent-other);
}

.transaction-category-badge[data-category="labor"] .transaction-category-swatch {
    background: var(--finance-bar-spent-labor);
}

.transaction-category-badge[data-category="materials"] .transaction-category-swatch {
    background: var(--finance-bar-spent-materials);
}

.transaction-category-badge[data-category="equipment"] .transaction-category-swatch {
    background: var(--finance-bar-spent-equipment);
}

.transaction-category-badge[data-category="other"] .transaction-category-swatch {
    background: var(--finance-bar-spent-other);
}

.transaction-category-badge::before {
    content: none;
    display: none;
}

.transaction-category-badge[data-category="labor"],
.transaction-category-badge[data-category="materials"],
.transaction-category-badge[data-category="equipment"],
.transaction-category-badge[data-category="other"] {
    border-color: var(--border-color);
    color: var(--text-muted);
}

.btn-delete-transaction {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: var(--font-size-tertiary);
    transition: color 0.15s, opacity 0.2s;
    min-width: 1.5rem;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--card-radius);
    flex-shrink: 0;
    margin-top: 0.05rem;
}

@media (hover: hover) and (pointer: fine) {
.btn-delete-transaction:hover {
    color: var(--accent-danger);
    opacity: 1;
}
}


/* Finance Summary */
.finance-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.finance-overview-group .finance-summary {
    margin-top: 0.5rem;
    padding-top: 0;
    border-top: none;
}

.summary-card {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.summary-label {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

.summary-value {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
}

.finance-summary .summary-label,
.finance-summary .summary-value {
    font-size: var(--font-size-tertiary);
}

.summary-value.green {
    color: var(--accent-primary);
}

.summary-value.red {
    color: var(--accent-danger);
}

/* Congratulations Banner */
.congrats-banner {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 2000;
    background: var(--accent-green);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    max-width: 90%;
}

.congrats-banner.active {
    display: block;
}

@keyframes popIn {
    to {
        transform: translate(-50%, -50%) scale(1);
    }
}

.congrats-banner h2 {
    font-size: var(--font-size-special);
    margin-bottom: 10px;
    color: #1a202c;
    font-weight: var(--font-weight-semibold);
}

.congrats-banner p {
    font-size: var(--font-size-default);
    color: #1a202c;
    margin-bottom: 20px;
}

.congrats-banner .btn {
    background: white;
    color: #1a202c;
    margin-top: 10px;
}

.congrats-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Financial Overview Styles */

/* Financial Controls - Period & Status Filters */
/* Financial Controls - iOS Design */
.financial-controls {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0 1.75rem 0;
    align-items: center;
    flex-wrap: wrap;
}

.financial-filter-group-dropdown {
    margin: 0 0 1rem;
    z-index: 1002;
}

.financial-top-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
    margin: 0 0 1rem;
}

.financial-top-actions .financial-filter-group-dropdown {
    margin: 0;
}

/* Match Labor period filter button size */
.financial-top-actions #generateFinancialReportBtn {
    width: max-content;
    min-width: 0;
    max-width: none;
    flex: 0 0 auto;
    height: 32px;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 2px;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    gap: 0.35rem;
    justify-content: center;
    white-space: nowrap;
    box-sizing: border-box;
}

.financial-filter-group-btn {
    width: max-content;
    min-width: 0;
    max-width: none;
    height: 32px;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 2px;
    font-size: var(--font-size-tertiary);
    gap: 0.35rem;
    white-space: nowrap;
    box-sizing: border-box;
}

/* Matches the Tasks list filter menu (#filterDropdownMenu) */
.financial-filter-group-menu {
    width: max(100%, 200px);
    min-width: 200px;
    max-width: none;
    right: auto;
    max-height: none;
    overflow: visible;
    padding: 10px;
    box-sizing: border-box;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

.financial-filter-group-menu .financial-controls {
    margin: 0;
    gap: 8px;
    flex-direction: column;
    align-items: stretch;
}

.financial-filter-group-menu .control-group {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-width: 0;
}

.financial-filter-group-menu .control-label {
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.2;
}

/* Pickers: same control as the labor period filter, full menu width */
.financial-filter-group-menu .financial-picker {
    width: 100%;
    max-width: none;
    flex: none;
}

.financial-filter-group-menu .financial-picker .filter-dropdown-btn {
    width: 100%;
    justify-content: flex-start;
}

.financial-filter-group-menu .financial-picker-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.financial-filter-group-menu .financial-picker-menu {
    left: 0;
    right: 0;
    width: 100%;
    min-width: 0;
    max-width: none;
}

.financial-filter-group-menu .financial-picker.opens-up .financial-picker-menu {
    top: auto;
    bottom: calc(100% + 4px);
}

/* iPad: Enhanced spacing */
@media (min-width: 768px) {
    .financial-controls {
        gap: 1.25rem;
        margin: 2rem 0 2rem 0;
    }
}

/* iPhone: iOS standard spacing */
@media (max-width: 480px) {
    .financial-controls {
        gap: 0.75rem;
        margin: 1.25rem 0 1.5rem 0;
    }
}

/* Control Group - iOS Layout */
.control-group {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex: 1;
    min-width: 160px;
}

.control-group.full-width {
    flex: 1 1 100%;
    width: 100%;
}

/* Control Label - iOS Typography */
.control-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    line-height: 1.4;
    letter-spacing: -0.1px;
}

/* iPad: Better readability */
@media (min-width: 768px) {
    .control-label {
        font-size: 0.9375rem;
    }
}

/* iPhone: iOS caption sizing */
@media (max-width: 480px) {
    .control-label {
        font-size: 0.8125rem;
    }
}

/* Financial Select - iOS Picker Style */
.financial-select {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 0;
    line-height: 1.3;
    letter-spacing: var(--tracking-normal);
    min-height: 36px;
}

/* iPad: Enhanced select */
@media (min-width: 768px) {
    .financial-select {
        font-size: var(--font-size-base);
        border-radius: 8px;
    }
}

/* iPhone: iOS standard sizing */
@media (max-width: 480px) {
    .financial-select {
        padding: 8px 12px;
        font-size: var(--font-size-base);
    }
}

.financial-select:focus {
    outline: none;
    border-color: var(--accent-green);
}

@media (hover: hover) and (pointer: fine) {
.financial-select:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-green);
}
}

.financial-filter-dropdown {
    flex: 1;
    min-width: 0;
    z-index: 1;
}

.financial-select-wrap {
    position: relative;
}

.financial-select--dropdown {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.2rem;
}

.financial-select-chevron {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%) rotate(0deg) translateZ(0);
    transform-origin: 50% 50%;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: var(--font-size-secondaryallest);
    color: var(--text-secondary);
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    backface-visibility: hidden;
}

.financial-select-wrap:focus-within .financial-select-chevron {
    transform: translateY(-50%) rotate(180deg) translateZ(0);
}


/* Financial Tabs - iOS Segmented Control Style */
.financial-tabs {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
}

/* iPad: Enhanced spacing */
@media (min-width: 768px) {
    .financial-tabs {
        margin-bottom: 1.125rem;
    }
}

/* iPhone: iOS standard spacing */
@media (max-width: 480px) {
    .financial-tabs {
        margin-bottom: 0.875rem;
    }
}

.financial-report-actions-modal-content {
    width: min(420px, calc(100vw - 2rem)) !important;
    max-width: min(420px, calc(100vw - 2rem)) !important;
    border-radius: var(--card-radius) !important;
    overflow: hidden;
}

.financial-report-actions-modal-body {
    padding-top: 0.75rem !important;
    border-radius: var(--card-radius);
}

.financial-report-actions-panel.report-actions {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    border-radius: var(--card-radius);
}

#financialReportActionsModal .modal-header {
    border-radius: var(--card-radius);
}

#financialReportActionsModal .report-ready,
#financialReportActionsModal .btn-report-action,
#financialReportActionsModal .btn-archived-reports {
    border-radius: var(--card-radius) !important;
}

/* Financial Overview - iOS Optimized */
.financial-overview {
    padding: 0;
}

/* Overview Grid - iOS Layout */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.875rem;
    margin-bottom: 0.5rem;
}

/* iPad: Enhanced grid */
@media (min-width: 768px) {
    .overview-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
        margin-bottom: 0.5rem;
    }
}

/* Large screens: 4 columns, then 5 (two rows of 5 when all 10 cards show) */
@media (min-width: 1024px) {
    .overview-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }

}

@media (min-width: 1280px) {
    .overview-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Tablet: horizontal scroll, ~3–4 cards visible + peek; hidden scrollbar (same pattern as mode-rail) */
@media (min-width: 481px) and (max-width: 1023px) {
    .overview-grid {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 1rem;
        margin-bottom: 0.5rem;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        scroll-padding-inline: 0;
        overscroll-behavior-x: contain;
        padding-bottom: 0.25rem;
    }

    .overview-grid::-webkit-scrollbar {
        display: none;
    }

    .overview-grid .big-stat-card {
        flex: 0 0 auto;
        width: calc((100% - 3rem) / 4.15);
        min-width: calc((100% - 3rem) / 4.15);
        max-width: none;
        scroll-snap-align: start;
        box-sizing: border-box;
    }
}

/* iPhone: horizontal scroll — 2 full cards + peek of 3rd (scroll affordance) */
@media (max-width: 480px) {
    .overview-grid {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.75rem;
        margin-bottom: 0.5rem;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        scroll-padding-inline: 0;
        overscroll-behavior-x: contain;
        padding-bottom: 0.25rem;
    }

    .overview-grid::-webkit-scrollbar {
        display: none;
    }

    .overview-grid .big-stat-card {
        flex: 0 0 auto;
        width: calc((100% - 0.75rem) / 2.2);
        min-width: calc((100% - 0.75rem) / 2.2);
        max-width: none;
        scroll-snap-align: start;
        box-sizing: border-box;
    }
    
    .financial-tabs {
        flex-direction: row;
    }
}

/* Big Stat Card - iOS Card Design */
.big-stat-card {
    background: var(--bg-tertiary);
    padding: 0.625rem 0.75rem;
    border-radius: var(--card-radius);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    cursor: default;
}

/* iPad: Enhanced card */
@media (min-width: 768px) {
    .big-stat-card {
        padding: 0.625rem 0.75rem;
    }
}

/* iPhone: iOS compact card */
@media (max-width: 480px) {
    .big-stat-card {
        padding: 0.625rem 0.75rem;
    }
}

@media (hover: hover) and (pointer: fine) {
.big-stat-card:hover {
    transform: translateY(-2px);
}
}



/* Big Stat Label - iOS Typography */
.big-stat-label {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: var(--font-weight-semibold);
    line-height: 1.3;
}

/* iPad: Enhanced readability */
@media (min-width: 768px) {
    .big-stat-label {
        font-size: var(--font-size-tertiary);
        margin-bottom: 0.25rem;
        letter-spacing: 0.1em;
    }
}

/* iPhone: iOS SF Pro style sizing */
@media (max-width: 480px) {
    .big-stat-label {
        font-size: var(--font-size-tertiary);
        margin-bottom: 0.25rem;
        letter-spacing: 0.06em;
    }
}

/* Big Stat Value - Large display size for prominence */
.big-stat-value {
    font-size: var(--font-size-special);
    font-weight: 900;
    margin-bottom: 0;
    color: var(--text-primary);
    line-height: 1.15;
    letter-spacing: var(--tracking-tight);
    position: relative;
    min-height: 1.5em;
}

.big-stat-value-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    min-height: 1.5em;
}

.big-stat-value-row .big-stat-value {
    margin-bottom: 0;
    min-height: 0;
}

.big-stat-compare {
    margin-top: 0;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.big-stat-compare i {
    font-size: 0.65rem;
}

.big-stat-compare.up {
    color: var(--accent-success, #22c55e);
}

.big-stat-compare.down {
    color: var(--accent-danger, #ef4444);
}

.big-stat-compare.up.is-inverse {
    color: var(--accent-danger, #ef4444);
}

.big-stat-compare.down.is-inverse {
    color: var(--accent-success, #22c55e);
}

.big-stat-compare.flat,
.big-stat-compare.na {
    color: var(--text-muted);
}

/* Loading spinner on overview stat cards */
.overview-grid.loading .big-stat-value {
    color: transparent;
    user-select: none;
}

.overview-grid.loading .big-stat-compare {
    visibility: hidden;
}

.overview-grid.loading .big-stat-value::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 22px;
    height: 22px;
    border: 3px solid var(--text-muted);
    border-top-color: transparent;
    border-radius: 50%;
    animation: financial-stat-spin 0.7s linear infinite;
}

@keyframes financial-stat-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Job list area loading (before skeletons) */
.financial-lists-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2.5rem 1rem;
    min-height: 140px;
}

.financial-lists-loading.hidden {
    display: none;
}

.financial-lists-loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--text-muted);
    border-top-color: transparent;
    border-radius: 50%;
    animation: financial-lists-spin 0.7s linear infinite;
}

@keyframes financial-lists-spin {
    to { transform: rotate(360deg); }
}

.financial-lists-loading-text {
    margin: 0;
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
}

/* iPad: Same special size */
@media (min-width: 768px) {
    .big-stat-value {
        font-size: var(--font-size-special);
        margin-bottom: 0;
        letter-spacing: var(--tracking-tight);
    }
}

/* Big Stat Subtitle - iOS Caption Style */
.big-stat-subtitle {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    line-height: 1.4;
    letter-spacing: var(--tracking-normal);
    font-weight: var(--font-weight-normal);
}

/* iPad: Better readability */
@media (min-width: 768px) {
    .big-stat-subtitle {
        font-size: var(--font-size-tertiary);
    }
}

/* iPhone: iOS standard caption */
@media (max-width: 480px) {
    .big-stat-subtitle {
        font-size: var(--font-size-tertiary);
    }
}


/* Section Title - iOS Typography */
.section-title {
    font-size: var(--font-size-default);
    margin: 2rem 0 1rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-secondary);
    font-weight: var(--font-weight-semibold);
    padding: 0;
    line-height: 1.3;
    letter-spacing: var(--tracking-normal);
}

/* iPad: Enhanced title */
@media (min-width: 768px) {
    .section-title {
        font-size: var(--font-size-default);
        margin: 2.5rem 0 1.25rem 0;
    }
}

/* iPhone: iOS standard title */
@media (max-width: 480px) {
    .section-title {
        font-size: var(--font-size-secondary);
        margin: 1.5rem 0 1rem 0;
    }
}

/* Job Card - iOS Card Design */
.job-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-height: 100px;
}

/* iPad: Enhanced card */
@media (min-width: 768px) {
    .job-card {
        padding: 1.25rem;
        margin-bottom: 0;
    }
}

/* iPhone: iOS compact card */
@media (max-width: 480px) {
    .job-card {
        padding: 0.875rem;
    }
}

/* Left accent bar - iOS style */
.job-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--border-color);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@media (hover: hover) and (pointer: fine) {
.job-card:hover {
    transform: translateY(-2px);
}
}


.job-card:active {
    transform: scale(0.98);
}

/* Status-based accent colors */
.job-card.urgent::before {
    background: var(--accent-red);
    width: 5px;
}

.job-card.warning::before {
    background: var(--accent-yellow);
    width: 5px;
}

.job-card.completed::before {
    background: var(--accent-green);
    width: 5px;
}

/* Job Header - iOS Layout */
.job-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.625rem;
    gap: 0.75rem;
}

/* iPad: Enhanced spacing */
@media (min-width: 768px) {
    .job-header {
        margin-bottom: 0.75rem;
    }
}

/* Job Name - iOS Headline */
.job-name {
    font-size: var(--font-size-default);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 0.375rem;
    line-height: 1.3;
    color: var(--text-primary);
    letter-spacing: var(--tracking-normal);
}

/* iPad: Larger name */
@media (min-width: 768px) {
    .job-name {
        font-size: var(--font-size-default);
        letter-spacing: var(--tracking-normal);
    }
}

/* iPhone: iOS standard headline */
@media (max-width: 480px) {
    .job-name {
        font-size: var(--font-size-secondary);
        letter-spacing: var(--tracking-normal);
    }
}

.job-card .job-site-number {
    font-size: var(--font-size-default);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-right: 0.375rem;
    letter-spacing: -0.1px;
}

/* Job Address - iOS Subheadline */
.job-address {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    line-clamp: 1;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.1px;
}

/* iPad: Better readability */
@media (min-width: 768px) {
    .job-address {
        font-size: 0.875rem;
    }
}

/* Job Amount - iOS Callout */
.job-amount {
    font-size: var(--font-size-default);
    font-weight: var(--font-weight-semibold);
    text-align: right;
    white-space: nowrap;
    line-height: 1.2;
    letter-spacing: var(--tracking-tight);
}

/* iPad: Larger amount */
@media (min-width: 768px) {
    .job-amount {
        font-size: var(--font-size-default);
        letter-spacing: var(--tracking-tight);
    }
}

/* iPhone: iOS callout sizing */
@media (max-width: 480px) {
    .job-amount {
        font-size: var(--font-size-default);
        letter-spacing: var(--tracking-normal);
    }
}

.job-amount.owed {
    color: var(--accent-red);
}

.job-amount.profit {
    color: var(--accent-green);
}

/* Financial job lists - grid layout for tablets+ */
#needsCollectionList,
#fullyPaidList,
#noFinanceList {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.needs-collection-sheet {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    overflow: auto;
    box-shadow: none;
    backdrop-filter: blur(6px);
    font-family: var(--font-family-sans);
    position: relative;
}

.needs-collection-sheet-header,
.needs-collection-sheet-row {
    display: grid;
    grid-template-columns: minmax(110px, 0.9fr) minmax(90px, 0.9fr) minmax(210px, 1.6fr) repeat(5, minmax(130px, 1fr));
    gap: 0;
    align-items: center;
    padding: 0;
    min-width: 1080px;
}

.needs-collection-sheet-header > div:not(:last-child),
.needs-collection-sheet-row > div:not(:last-child) {
    border-right: 0;
}

.needs-collection-sheet-guides {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
}

.needs-collection-sheet-guide {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-color);
}

.needs-collection-sheet-guide.active {
    width: 3px;
    margin-left: -1px;
    background: var(--text-tertiary);
}

.needs-collection-sheet-cell-header {
    position: relative;
    user-select: none;
    cursor: grab;
}

.needs-collection-sheet-header > div,
.needs-collection-sheet-row > div {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: 0 0.7rem;
    overflow: hidden;
    text-align: center;
}

/* Resize handles sit on column edges; header cells must not clip them */
.needs-collection-sheet-header > div {
    overflow: visible;
}

.needs-collection-sheet-cell-header:active {
    cursor: grabbing;
}

.sheet-col-label {
    display: inline-block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 0;
    line-height: 1.2;
}

.sheet-cell-value {
    display: inline-block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

/* Single source-of-truth sheet typography */
.needs-collection-sheet .sheet-col-label,
.needs-collection-sheet .sheet-cell-value {
    font-family: var(--font-family-sans);
    font-size: 0.86rem;
    font-weight: var(--font-weight-medium);
    letter-spacing: normal;
    text-transform: none;
}

.sheet-resize-handle {
    position: absolute;
    top: 0;
    right: -0.7rem;
    width: 1.4rem;
    height: 100%;
    cursor: col-resize;
    touch-action: none;
    z-index: 6;
}

.sheet-resize-handle::after {
    content: none;
}

.needs-collection-sheet-header {
    position: sticky;
    top: 0;
    z-index: 3;
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-tertiary);
    border-top-left-radius: var(--card-radius);
    border-top-right-radius: var(--card-radius);
}

.needs-collection-sheet-row {
    width: max-content;
    min-width: 100%;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: background-color 0.18s ease, transform 0.12s ease;
    z-index: 2;
}

.needs-collection-sheet-row:last-child {
    border-bottom: 0;
    border-bottom-left-radius: var(--card-radius);
    border-bottom-right-radius: var(--card-radius);
}

.needs-collection-sheet-row:nth-child(even) {
    background: rgba(127, 127, 127, 0.06);
}

.needs-collection-sheet-row:hover {
    background: rgba(127, 127, 127, 0.12);
    transform: translateY(-1px);
}

.needs-collection-sheet-row:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: -2px;
}

.needs-collection-sheet-row .red {
    color: var(--accent-red);
}

.needs-collection-sheet-row .green {
    color: var(--accent-green);
}

.sheet-col-money {
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    white-space: nowrap;
    justify-content: center;
}

.sheet-col-project {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    white-space: nowrap;
    font-family: var(--font-family-mono);
}

.sheet-col-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sheet-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--surface-secondary) 75%, transparent);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
}

@media (max-width: 900px) {
    .needs-collection-sheet-header,
    .needs-collection-sheet-row {
        min-width: 960px;
    }
}

/* Tablet: 2-column grid */
@media (min-width: 768px) {
    #fullyPaidList,
    #noFinanceList {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    #needsCollectionList {
        display: block;
    }

    .job-card {
        margin-bottom: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
    }
}

/* Desktop: 3-column grid */
@media (min-width: 1024px) {
    #fullyPaidList,
    #noFinanceList {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-md);
    }
}

/* Job Stats - iOS Design */
.job-stats {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* iPad: Enhanced spacing */
@media (min-width: 768px) {
    .job-stats {
        gap: 1rem;
        margin-top: 1rem;
    }
}

/* iPhone: iOS standard spacing */
@media (max-width: 480px) {
    .job-stats {
        gap: 0.625rem;
        margin-top: 0.625rem;
    }
}

.job-stat {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
}

/* Job Stat Label - iOS Caption */
.job-stat-label {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: var(--font-weight-semibold);
    line-height: 1.3;
}

/* iPad: Better readability */
@media (min-width: 768px) {
    .job-stat-label {
        font-size: 0.75rem;
        letter-spacing: 1px;
    }
}

/* Job Stat Value - iOS Callout */
.job-stat-value {
    font-size: 0.875rem;
    font-weight: var(--font-weight-semibold);
    line-height: 1.3;
    letter-spacing: -0.2px;
    color: var(--text-primary);
}

.job-stat-value.green {
    color: var(--accent-green);
}

.job-stat-value.red {
    color: var(--accent-red);
}

.job-progress {
    margin-top: var(--spacing-sm);
}

.job-progress .progress-bar-container {
    background: var(--bg-secondary);
    height: 20px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: var(--spacing-xs);
}

.job-progress .progress-bar-fill {
    background: var(--accent-green);
    height: 100%;
    width: 100%;
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease;
    will-change: transform;
}

.progress-bar-fill.complete {
    background: var(--accent-primary);
}

.job-progress .progress-label {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    line-height: 1.4;
    gap: var(--spacing-sm);
}


.hidden {
    display: none !important;
}

/* Mobile responsive controls */
@media (max-width: 768px) {
    .financial-controls {
        gap: var(--spacing-sm);
    }
    
    .control-group {
        flex: 1 1 calc(50% - var(--spacing-xs));
        min-width: 140px;
    }
    
    .financial-report-actions {
        justify-content: center;
    }
    
    .financial-report-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .financial-controls {
        flex-direction: column;
        gap: var(--spacing-sm);
        margin: var(--spacing-sm) 0 var(--spacing-md) 0;
    }
    
    .control-group {
        width: 100%;
        min-width: auto;
    }
    
    .control-label {
        font-size: var(--font-size-secondary);
        min-width: 50px;
    }
    
    .financial-select {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: var(--font-size-secondary);
        min-height: var(--touch-target-min);
    }
    
    .financial-report-actions {
        margin-bottom: var(--spacing-md);
    }
}

/* Mobile responsiveness for financial overview */
@media (max-width: 768px) {
    .summary-value {
        font-size: var(--font-size-tertiary);
    }
    
    .job-financials {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
}

/* ================================
   LABOR TRACKER STYLES - iOS OPTIMIZED
   ================================ */

/* Labor Tracker Content Panel - Following iOS Spacing */
#laborView .content-panel {
    padding: 1rem;
    max-width: 100%;
}

/* iPad: Enhanced spacing for larger screens */
@media (min-width: 768px) {
    #laborView .content-panel {
        padding: 2rem;
        margin: 0 auto;
    }
}

/* Large iPad/Desktop: Maximum comfort */
@media (min-width: 1024px) {
    #laborView .content-panel {
        padding: 2.5rem;
    }
}

/* View Title - Apple iOS Style (same size as body, heavier weight) */
#laborView .view-title {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.15;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#laborView .view-title i {
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
    line-height: 1;
}

/* Labor mode control styles live in css/employees-list.css */

.labor-payroll-panel {
    width: 100%;
}

.payroll-inline-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: none;
}

.payroll-inline-footer .payroll-modal-footer-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.payroll-assign-spendings-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-top: 0.25rem;
    margin-left: 10px;
    margin-right: 10px;
    padding: 0.15rem 0.75rem;
}

.payroll-assign-spendings-text {
    min-width: 0;
    flex: 0 1 auto;
}

.payroll-assign-spendings-label {
    display: block;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    line-height: 1.3;
}

#laborPayrollPanel .payroll-assign-spendings-row .toggle-switch {
    flex-shrink: 0;
    margin-left: 0;
}

/* Labor Period Selector */
.labor-period-selector {
    margin-bottom: 1.5rem;
    width: 100%;
    position: relative;
    z-index: 1;
}

.labor-period-selector:has(.labor-period-filter.is-open) {
    z-index: 40;
}

.labor-period-selector-top {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
}

.labor-period-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    flex: 0 0 auto;
    margin-left: auto;
    min-width: 0;
}

.labor-period-filter {
    position: relative;
    z-index: 1000;
    max-width: none;
    width: max-content;
    flex: 0 0 auto;
    margin-left: 0;
}

.labor-period-filter.is-open {
    z-index: 10050;
}

.labor-period-filter .filter-dropdown-btn {
    border-radius: 2px;
    white-space: nowrap;
    min-height: 32px;
    height: 32px;
    padding: 6px 10px;
    font-size: var(--font-size-tertiary);
    width: max-content;
    max-width: none;
    gap: 0.35rem;
    box-sizing: border-box;
}

.labor-period-filter .filter-dropdown-btn #laborPeriodFilterLabel {
    overflow: visible;
    text-overflow: clip;
}

/* Icon-only Add Employee, matches period filter height */
.labor-period-selector .labor-period-add-btn.btn-add-employee {
    flex: 0 0 auto;
    width: auto;
    min-width: 60px;
    max-width: none;
    min-height: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    border-radius: 2px;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    gap: 0.35rem;
    line-height: 1;
    box-sizing: border-box;
}

.labor-period-selector .labor-period-add-btn.btn-add-employee i {
    font-size: var(--font-size-tertiary);
    width: 1em;
    height: 1em;
    line-height: 1;
}

.labor-period-filter-menu {
    left: auto;
    right: 0;
    width: max-content;
    min-width: max-content;
    max-width: min(90vw, 320px);
    max-height: min(280px, 50vh);
    border-radius: 2px;
    z-index: 10051;
    display: none;
    flex-direction: column;
    align-items: stretch;
}

.labor-period-filter-menu.active {
    display: flex;
}

.labor-period-filter-menu .filter-dropdown-item {
    font-size: var(--font-size-tertiary);
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    justify-content: flex-start;
}

/* Project status: same control as the labor period filter, full field width */
#editJobSiteModal .project-status-filter,
#newJobSiteModal .project-status-filter {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: none;
    flex: none;
    margin-left: 0;
}

#editJobSiteModal .project-status-filter.is-open,
#newJobSiteModal .project-status-filter.is-open {
    z-index: 40;
}

#editJobSiteModal .project-status-filter .filter-dropdown-btn,
#newJobSiteModal .project-status-filter .filter-dropdown-btn {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    justify-content: flex-start;
}

#editJobSiteModal .project-status-filter .filter-dropdown-btn > span,
#newJobSiteModal .project-status-filter .filter-dropdown-btn > span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

#editJobSiteModal .project-status-filter-menu,
#newJobSiteModal .project-status-filter-menu {
    left: 0;
    right: 0;
    top: auto;
    bottom: calc(100% + 4px);
    width: 100%;
    min-width: 0;
    max-width: none;
    z-index: 41;
}

/* Labor stats / mode control styles live in css/employees-list.css */
.employee-hours-value,
.employee-earnings-value {
    display: inline-block;
}

/* Add Employee Section - iOS Layout */
.add-employee-section {
    margin: 1.5rem 0 1.25rem;
    display: flex;
    justify-content: flex-start;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: nowrap;
    font-size: var(--font-size-tertiary);
}

.add-employee-section .btn-add-employee,
.add-employee-section .btn-payroll-report {
    flex: 0 0 auto;
    width: auto;
    min-width: 170px;
    max-width: 260px;
}

/* iPhone: Optimized spacing */
@media (max-width: 480px) {
    .add-employee-section {
        margin: 1.25rem 0 1rem;
    }
}

/* iPad: Enhanced spacing */
@media (min-width: 768px) {
    .add-employee-section {
        margin: 2rem 0 1.5rem;
    }
}

/* ================================
   LABOR TRACKER BUTTONS - STANDARDIZED
   ================================ 
   
   All labor tracker buttons now use consistent:
   - Font: SF Pro (Apple) / System Default
   - Weight: Semibold (600) for all buttons
   - Icon sizes: 22px default, 24px iPad, 20px iPhone
   - Font sizes: 17px default, 18px iPad, 15px iPhone
   - Heights: 52px default, 56px iPad, 50px iPhone
   - Letter spacing: -0.2px
   - Transitions: 0.35s cubic-bezier
   
   PRIMARY BUTTONS (Green):
   - .btn-labor-primary
   - .btn-add-employee
   - .btn-payroll-report
   
   SECONDARY BUTTONS (Outlined):
   - .btn-labor-secondary
   - .btn-report-action (with color variants: .blue, .red, .purple)
   - .btn-archived-reports
   
   USAGE:
   <button class="btn-add-employee"><i class="fas fa-user-plus"></i><span>Add Employee</span></button>
   <button class="btn-payroll-report"><i class="fas fa-file-invoice-dollar"></i><span>Get Payroll Report</span></button>
   <button class="btn-report-action blue"><i class="fas fa-download"></i><span>Download PDF</span></button>
   <button class="btn-report-action purple"><i class="fas fa-archive"></i><span>Save to Archive</span></button>
   <button class="btn-archived-reports"><span>View Archived Reports</span><i class="fas fa-chevron-right"></i></button>
   ================================ */

/* Base Style for ALL Labor Tracker Primary Buttons - Apple iOS Standard */
.btn-labor-primary,
.btn-add-employee,
.btn-payroll-report {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.7rem 1rem;
    border-radius: var(--card-radius);
    font-size: var(--font-size-tertiary);
    line-height: 1.3;
    background: var(--accent-green);
    color: #292a2e;
    border: none;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
}

/* Add Employee Button - uses base styles */
.btn-add-employee {
    /* Inherits all styles from .btn-labor-primary base class */
    justify-content: center; /* Center content */
}

/* iPad: Larger buttons for better accessibility */
/* Mobile: Slightly adjust padding only */
@media (max-width: 480px) {
    .btn-labor-primary,
    .btn-add-employee,
    .btn-payroll-report {
        padding: 0.7rem 1rem;
    }
}

/* Hover state - all primary buttons */
@media (hover: hover) and (pointer: fine) {
.btn-labor-primary:hover,
.btn-add-employee:hover,
.btn-payroll-report:hover {
    transform: translateY(-2px);
}
}


/* Active state - all primary buttons */
.btn-labor-primary:active,
.btn-add-employee:active,
.btn-payroll-report:active {
    transform: scale(0.98);
    opacity: 0.9;
}

body:not(.light-theme) .btn-labor-primary,
body:not(.light-theme) .btn-add-employee,
body:not(.light-theme) .btn-payroll-report {
    color: #000000 !important;
}

body:not(.light-theme) .btn-labor-primary span,
body:not(.light-theme) .btn-add-employee span,
body:not(.light-theme) .btn-payroll-report span,
body:not(.light-theme) .btn-labor-primary i,
body:not(.light-theme) .btn-add-employee i,
body:not(.light-theme) .btn-payroll-report i {
    color: #000000 !important;
}

/* Icon sizing - one size for all buttons (Apple iOS standard) */
.btn-labor-primary i,
.btn-add-employee i,
.btn-payroll-report i,
.btn-labor-secondary i,
.btn-report-action i,
.btn-archived-reports i {
    font-size: var(--font-size-default);
    min-width: 22px;
    text-align: center;
    line-height: 1;
}

/* Text color for primary buttons */
.btn-labor-primary span,
.btn-add-employee span,
.btn-payroll-report span {
    color: #000000;
    font-weight: var(--font-weight-semibold);
    letter-spacing: -0.2px;
}

/* Employees List - iOS List Design */
.employees-list {
    background: transparent;
    border-radius: 0;
    padding: 0;
    border: none;
    margin-bottom: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* iPad: 3-column grid for efficient space use */
@media (min-width: 768px) {
    .employees-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
        margin-bottom: 0.25rem;
    }
}

/* Large iPad/Desktop: 3-column grid */
@media (min-width: 1024px) {
    .employees-list {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
}

/* iPhone: iOS standard list spacing */
@media (max-width: 480px) {
    .employees-list {
        gap: 0.75rem;
        margin-bottom: 0.25rem;
    }
}

/* Empty State - iOS Design */
.section-content .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    text-align: center;
    background: transparent;
    border-radius: 0;
    border: none;
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* iPad: More generous spacing */
@media (min-width: 768px) {
    .section-content .empty-state {
        padding: 4rem 2rem;
        font-size: 1rem;
    }
}

/* iPhone: iOS compact empty state */
@media (max-width: 480px) {
    .section-content .empty-state {
        padding: 2.5rem 1rem;
        font-size: 0.9375rem;
    }
}

/* Empty State Icon - iOS SF Symbols Style */
.empty-state-icon {
    font-size: 4rem;
    opacity: 0.25;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

/* iPad: Larger icon */
@media (min-width: 768px) {
    .empty-state-icon {
        font-size: 5rem;
        margin-bottom: 2rem;
    }
}

/* iPhone: iOS standard icon size */
@media (max-width: 480px) {
    .empty-state-icon {
        font-size: 3.5rem;
        margin-bottom: 1.25rem;
    }
}

/* Employee Item Card - iOS Card Style (matches Job Card) */
.employee-item {
    background: var(--bg-tertiary);
    border-radius: var(--card-radius);
    margin-bottom: 0;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: row;
    align-items: stretch;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

/* iPad: Enhanced card */
@media (min-width: 768px) {
    .employee-item {
        height: 100%;
    }
}

/* Hover effect - iOS elevation */
@media (hover: hover) and (pointer: fine) {
.employee-item:hover {
    transform: translateY(-2px);
    border-color: var(--border-color);
}
}


/* Employee Info Section - iOS Layout */
.employee-info {
    flex: 1;
    min-width: 0;
    padding: 0.625rem 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.375rem;
}

/* iPad: Enhanced padding for better breathing */
@media (min-width: 768px) {
    .employee-info {
        padding: 0.625rem 0.75rem;
        gap: 0.375rem;
    }
}

/* iPhone: iOS standard padding */
@media (max-width: 480px) {
    .employee-info {
        padding: 0.625rem 0.75rem;
        gap: 0.375rem;
    }
}

.employee-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

/* Employee Name */
.employee-name {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    flex: 1;
    line-height: 1.3;
}

.employee-secondary-actions {
    position: relative;
    display: flex;
    gap: var(--spacing-xs);
}

/* Menu Toggle Button - iOS Circular Button */
.btn-menu-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* iPad: Slightly larger for better accessibility */
@media (min-width: 768px) {
    .btn-menu-toggle {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        font-size: 1.0625rem;
    }
}

@media (hover: hover) and (pointer: fine) {
.btn-menu-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-secondary);
    color: var(--text-primary);
    transform: scale(1.05);
}
}


.btn-menu-toggle:active {
    transform: scale(0.95);
    opacity: 0.9;
}

/* Employee Dropdown Menu - iOS Popover Style */
.employee-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(44px + 0.5rem);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    z-index: 9999;
    min-width: 200px;
    overflow: hidden;
}

/* iPad: Enhanced dropdown */
@media (min-width: 768px) {
    .employee-dropdown-menu {
        top: calc(48px + 0.5rem);
        min-width: 220px;
        border-radius: 16px;
    }
}

/* Dropdown Menu Item - iOS List Item */
.employee-dropdown-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1rem;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-align: left;
    min-height: 48px;
    line-height: 1.4;
    letter-spacing: -0.2px;
}

/* iPad: Enhanced menu items */
@media (min-width: 768px) {
    .employee-dropdown-menu .menu-item {
        padding: 1rem 1.25rem;
        font-size: 1rem;
        min-height: 52px;
    }
}

@media (hover: hover) and (pointer: fine) {
.employee-dropdown-menu .menu-item:hover {
    background: var(--bg-secondary);
}
}


.employee-dropdown-menu .menu-item:active {
    background: var(--bg-tertiary);
    transform: scale(0.98);
}

.employee-dropdown-menu .menu-item i {
    width: 24px;
    min-width: 24px;
    font-size: 1.125rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* iPad: Larger icons */
@media (min-width: 768px) {
    .employee-dropdown-menu .menu-item i {
        width: 26px;
        min-width: 26px;
        font-size: 1.1875rem;
    }
}

/* Danger Item - iOS Destructive Action */
.employee-dropdown-menu .menu-item-danger {
    color: var(--accent-danger);
}

@media (hover: hover) and (pointer: fine) {
.employee-dropdown-menu .menu-item-danger:hover {
    background: rgba(252, 129, 129, 0.12);
}
}


/* Action Sheet Modal - iOS Native Style */
.action-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 99999;
    display: flex;
    align-items: flex-end;
    transition: background 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.action-sheet-overlay.active {
    background: rgba(0, 0, 0, 0.4);
}

/* Action Sheet - iOS Bottom Sheet */
.action-sheet {
    width: 100%;
    background: var(--bg-tertiary);
    border-radius: 24px 24px 0 0;
    padding: 1.25rem;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    max-width: 500px;
    margin: 0 auto;
}

/* iPad: Enhanced action sheet */
@media (min-width: 768px) {
    .action-sheet {
        border-radius: 28px 28px 0 0;
        padding: 1.5rem;
    }
}

.action-sheet-overlay.active .action-sheet {
    transform: translateY(0);
}

/* Action Sheet Header - iOS Title */
.action-sheet-header {
    font-size: 1.0625rem;
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    padding: 0.625rem 0 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

/* iPad: Larger header */
@media (min-width: 768px) {
    .action-sheet-header {
        font-size: 1.125rem;
        padding: 0.75rem 0 1.25rem;
    }
}

/* Action Sheet Item - iOS Button */
.action-sheet-item {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: none;
    border-radius: 14px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    min-height: 52px;
    line-height: 1.3;
    letter-spacing: -0.2px;
}

/* iPad: Enhanced items */
@media (min-width: 768px) {
    .action-sheet-item {
        padding: 1.125rem 1.5rem;
        font-size: 1rem;
        min-height: 56px;
        border-radius: 16px;
    }
}

@media (hover: hover) and (pointer: fine) {
.action-sheet-item:hover {
    background: var(--bg-primary);
    transform: translateY(-1px);
}
}


.action-sheet-item:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.action-sheet-item i {
    font-size: 1.375rem;
    width: 30px;
    min-width: 30px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* iPad: Larger icons */
@media (min-width: 768px) {
    .action-sheet-item i {
        font-size: var(--font-size-special);
        width: 32px;
        min-width: 32px;
    }
}

/* Danger Action - iOS Destructive */
.action-sheet-item-danger {
    color: var(--accent-danger);
}

/* Cancel Button - iOS Style */
.action-sheet-cancel {
    background: var(--bg-primary);
    margin-top: 1rem;
    justify-content: center;
    font-weight: var(--font-weight-semibold);
}

/* Compact hourly clock-out reason picker */
.clockout-reason-picker .action-sheet {
    max-width: 360px;
    padding: 0.75rem;
    border-radius: 18px 18px 0 0;
}

.clockout-reason-picker .action-sheet-header {
    font-size: var(--font-size-tertiary);
    padding: 0.5rem 0 0.75rem;
    margin-bottom: 0.625rem;
}

.clockout-reason-picker .action-sheet-item {
    min-height: 40px;
    padding: 0.625rem 0.75rem;
    font-size: var(--font-size-tertiary);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.clockout-reason-picker .action-sheet-item i {
    font-size: 0.95rem;
    width: 18px;
    min-width: 18px;
}

.clockout-reason-picker .action-sheet-cancel {
    margin-top: 0.375rem;
}

/* Clock-in project picker — Quick Actions colors/radii + Assigned Projects cards */
.clock-in-project-picker {
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    font-family: var(--font-family-sans);
}

.clock-in-project-picker.active {
    background: rgba(0, 0, 0, 0.5);
}

.clock-in-project-picker .clock-in-project-sheet {
    width: 100%;
    max-width: 500px;
    max-height: min(85vh, 680px);
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: var(--card-radius) var(--card-radius) 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    z-index: 1;
}

.clock-in-project-picker.active .clock-in-project-sheet {
    transform: translateY(0);
}

.clock-in-project-picker .clock-in-project-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
}

.clock-in-project-picker .clock-in-project-header h3 {
    margin: 0;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.clock-in-project-picker .clock-in-project-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.clock-in-project-picker .clock-in-project-filter {
    position: relative;
    z-index: 5;
    max-width: min(210px, 46vw);
}

.clock-in-project-picker .clock-in-project-filter .filter-dropdown-btn {
    border-radius: var(--card-radius);
    white-space: nowrap;
    min-height: 32px;
    padding: 6px 10px;
    font-size: var(--font-size-tertiary);
    max-width: 100%;
}

.clock-in-project-picker .clock-in-project-filter .filter-dropdown-btn [data-clock-in-filter-label] {
    overflow: hidden;
    text-overflow: ellipsis;
}

.clock-in-project-picker .clock-in-project-filter-menu {
    /* Positioned fixed in JS so it stays inside the viewport */
    right: auto;
    left: 0;
    min-width: 180px;
    max-width: min(220px, calc(100vw - 16px));
    max-height: min(260px, calc(100vh - 16px));
    z-index: 100002;
}

.clock-in-project-picker .clock-in-project-filter-menu .filter-dropdown-item,
.clock-in-project-picker .clock-in-project-filter-menu .filter-count {
    font-size: var(--font-size-tertiary);
}

.clock-in-project-picker .clock-in-project-empty {
    padding: 1rem 0.25rem;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
}

.clock-in-project-picker .clock-in-project-close {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
.clock-in-project-picker .clock-in-project-close:hover {
    background: var(--bg-secondary);
    transform: scale(1.05);
}
}

.clock-in-project-picker .clock-in-project-toolbar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 1rem 0.35rem;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.clock-in-project-picker .clock-in-project-search {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
}

.clock-in-project-picker .clock-in-project-search i {
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.clock-in-project-picker .clock-in-project-search input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: var(--font-size-tertiary);
}

.clock-in-project-picker .clock-in-project-search input::placeholder {
    color: var(--text-muted);
}

.clock-in-project-picker .clock-in-project-result-count {
    flex-shrink: 0;
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    white-space: nowrap;
}

.clock-in-project-picker .clock-in-project-body,
.clock-in-project-picker .employee-active-projects-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0.875rem 1rem 1.5rem 1rem;
}

.clock-in-project-picker .employee-active-project-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.55rem 0.65rem;
    margin: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    color: var(--text-primary);
    font: inherit;
    font-size: var(--font-size-tertiary);
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.clock-in-project-picker .employee-active-project-item:hover,
.clock-in-project-picker .employee-active-project-item:focus-visible {
    border-color: var(--accent-color, var(--primary-color, #4a90e2));
    outline: none;
}

.clock-in-project-picker .employee-active-project-number {
    font-weight: var(--font-weight-semibold, 600);
    color: var(--text-muted);
    white-space: nowrap;
}

.clock-in-project-picker .employee-active-project-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clock-in-project-picker .employee-active-project-status {
    white-space: nowrap;
    font-weight: var(--font-weight-medium, 500);
    color: var(--text-muted);
}

.clock-in-project-picker .employee-active-project-status.in-progress {
    color: var(--status-in-progress, #68d391);
}

.clock-in-project-picker .employee-active-project-status.upcoming {
    color: var(--status-upcoming, #63b3ed);
}

.clock-in-project-picker .employee-active-project-status.on-hold {
    color: var(--status-on-hold, #f6ad55);
}

.clock-in-project-picker .employee-active-project-status.completed {
    color: var(--status-completed, #a0aec0);
}

/* Employee Details - Tertiary text */
.employee-details {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    line-height: 1.45;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.employee-details span:not(:last-child)::after {
    content: "•";
    margin-left: 0.25rem;
    color: var(--text-muted);
    opacity: 0.5;
}

/* Employee Stats - iOS Design */
.employee-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.125rem;
    padding-top: 0.375rem;
    border-top: 1px solid var(--border-color);
}

/* iPad: Enhanced spacing */
@media (min-width: 768px) {
    .employee-stats {
        gap: 0.75rem;
        margin-top: 0.125rem;
        padding-top: 0.375rem;
    }
}

/* iPhone: iOS standard spacing */
@media (max-width: 480px) {
    .employee-stats {
        gap: 0.75rem;
        margin-top: 0.125rem;
        padding-top: 0.375rem;
    }
}

/* Employee Hours */
.employee-hours {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--accent-blue);
    line-height: 1.3;
}

/* Employee Earnings */
.employee-earnings {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--accent-green);
    line-height: 1.3;
}

.counter-updated {
    animation: counter-update-pop 320ms ease-out;
}

@keyframes counter-update-pop {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }
    45% {
        transform: scale(1.06);
        filter: brightness(1.12);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

.employee-hours i {
    font-size: var(--font-size-tertiary);
    opacity: 0.85;
    min-width: 14px;
    text-align: center;
    line-height: 1;
}

.employee-earnings i {
    font-size: var(--font-size-tertiary);
    opacity: 0.85;
    min-width: 14px;
    text-align: center;
    line-height: 1;
}

/* iPad */
@media (min-width: 768px) {
    .employee-hours i,
    .employee-earnings i {
        font-size: var(--font-size-tertiary);
        min-width: 14px;
    }
}

/* iPhone */
@media (max-width: 480px) {
    .employee-hours i,
    .employee-earnings i {
        font-size: var(--font-size-tertiary);
        min-width: 14px;
    }
}

.employee-clock-status {
    margin-top: var(--spacing-xs);
}

/* Employee Main Actions - iOS Button Design */
.employee-main-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    align-self: stretch;
    padding: 0;
    width: auto;
    min-width: 96px;
    flex: 0 0 auto;
}

/* iPad: Larger action area */
@media (min-width: 768px) {
    .employee-main-actions {
        min-width: 96px;
        padding: 0;
    }
}

/* iPhone: iOS standard sizing */
@media (max-width: 480px) {
    .employee-main-actions {
        min-width: 88px;
        padding: 0;
    }
}

/* Clock Button - iOS Prominent Action (in / out / break share identical box) */
.btn-clock-main {
    width: 100%;
    min-width: 96px;
    min-height: 72px;
    height: 100%;
    flex: 1 1 auto;
    align-self: stretch;
    border: none;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-base) !important;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    border-radius: 0 var(--card-radius) var(--card-radius) 0;
    padding: 0.5rem;
    box-sizing: border-box;
}

/* Mobile: Slightly adjust padding */
@media (max-width: 480px) {
    .btn-clock-main {
        min-width: 88px;
        min-height: 72px;
        padding: 0.5rem;
    }
}

@media (hover: hover) and (pointer: fine) {
.btn-clock-main:hover {
    transform: scale(1.02);
}
}


.btn-clock-main:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.btn-clock-main i {
    font-size: 22px !important;
    line-height: 1;
}

.btn-clock-main span {
    font-size: var(--font-size-tertiary) !important;
    line-height: 1.3;
    font-weight: var(--font-weight-semibold);
    text-align: center;
    white-space: nowrap;
}

/* Clock In Button - iOS Green Action */
.btn-clock-main.btn-clock-in {
    border-radius: 0 var(--card-radius) var(--card-radius) 0;
    background: var(--accent-green);
    color: #292a2e;
}

@media (hover: hover) and (pointer: fine) {
.btn-clock-main.btn-clock-in:hover {
    background: var(--accent-green);
}
}


.btn-clock-main.btn-clock-in:active {
    background: var(--accent-green);
}

body:not(.light-theme) .btn-clock-main.btn-clock-in {
    color: #000000 !important;
}

body:not(.light-theme) .btn-clock-main.btn-clock-in span,
body:not(.light-theme) .btn-clock-main.btn-clock-in i {
    color: #000000 !important;
}

.btn-clock-main.btn-clock-in.btn-clock-break-resume {
    background: var(--accent-yellow);
    color: #000000;
}

.btn-clock-main.btn-clock-in.btn-clock-break-resume i {
    color: #000000;
}

@media (hover: hover) and (pointer: fine) {
.btn-clock-main.btn-clock-in.btn-clock-break-resume:hover {
    background: var(--accent-yellow);
}
}

.btn-clock-main.btn-clock-in.btn-clock-break-resume:active {
    background: var(--accent-yellow);
}

/* Clock Out Button - iOS Red Action */
.btn-clock-main.btn-clock-out {
    background: var(--accent-red);
    color: #ffffff;
}

@media (hover: hover) and (pointer: fine) {
.btn-clock-main.btn-clock-out:hover {
    background: var(--accent-red);
}
}


.btn-clock-main.btn-clock-out:active {
    background: var(--accent-red);
}

/* Employee Card Modal Styles - iOS Optimized */
.employee-stats-section {
    margin-bottom: 1rem;
}

.employee-stats-scope {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.75;
}

/* iPhone: iOS standard padding */
@media (max-width: 480px) {
    .employee-stats-section {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
        border-radius: 14px;
    }
}

/* Stats Grid - iOS Layout */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
}

/* iPad: 4-column layout for better space use */
@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }
}

/* iPhone: Optimized gaps */
@media (max-width: 480px) {
    .stats-grid {
        gap: 0.75rem;
    }
}

/* Stat Card - iOS Card Design */
.stat-card {
    background: var(--bg-tertiary);
    border-radius: var(--card-radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    border: 1px solid var(--border-color);
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* iPad: Enhanced card */
@media (min-width: 768px) {
    .stat-card {
        padding: 1.125rem;
        border-radius: var(--card-radius);
    }
}

/* iPhone: iOS compact card */
@media (max-width: 480px) {
    .stat-card {
        padding: 0.875rem;
        gap: 0.75rem;
    }
}

@media (hover: hover) and (pointer: fine) {
.stat-card:hover {
    transform: translateY(-2px);
}
}


/* Stat Icon - iOS Design */
.stat-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-green);
    color: #000000;
    font-size: 1.375rem;
    flex-shrink: 0;
}

/* iPad: Larger icons */
@media (min-width: 768px) {
    .stat-icon {
        width: 52px;
        height: 52px;
        min-width: 52px;
        min-height: 52px;
        font-size: var(--font-size-special);
        border-radius: 12px;
    }
}

/* iPhone: iOS standard icon sizing */
@media (max-width: 480px) {
    .stat-icon {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: var(--font-size-default);
        border-radius: 10px;
    }
}

.stat-content {
    flex: 1;
    min-width: 0;
}

/* Stat Value - iOS Typography */
.stat-value {
    font-size: var(--font-size-default);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    line-height: 1.2;
    letter-spacing: -0.3px;
}

/* iPad: Larger values */
@media (min-width: 768px) {
    .stat-value {
        font-size: 1.375rem;
        letter-spacing: -0.4px;
    }
}

/* iPhone: iOS standard sizing */
@media (max-width: 480px) {
    .stat-value {
        font-size: 1.125rem;
        letter-spacing: -0.2px;
    }
}

/* Stat Label - iOS Caption Style */
.stat-label {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: var(--font-weight-semibold);
    line-height: 1.3;
}

/* iPad: Better readability */
@media (min-width: 768px) {
    .stat-label {
        font-size: 0.75rem;
        letter-spacing: 1px;
    }
}

/* iPhone: iOS caption sizing */
@media (max-width: 480px) {
    .stat-label {
        font-size: var(--font-size-tertiary);
        letter-spacing: 0.6px;
    }
}

/* Form Row - iOS Side-by-Side Layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* iPad: Enhanced spacing */
@media (min-width: 768px) {
    .form-row {
        gap: 1.25rem;
    }
}

/* iPhone: Stack vertically for better usability */
@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Compensation Fields - Smooth iOS Transitions */
.compensation-field {
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#employeeCardModal .employee-compensation-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem 1rem;
    align-items: start;
    margin-bottom: 1.25rem;
}

#employeeCardModal .employee-compensation-row .form-group {
    margin-bottom: 0;
}

#employeeCardModal .employee-compensation-row .employee-rate-column {
    min-width: 0;
}

#employeeCardModal .modal-header h3,
#employeeCardModal #employeeCardTitle {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--tracking-loose);
}

#employeeCardModal .collapsible-section {
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    background: var(--bg-secondary);
    margin-bottom: 0.75rem;
    overflow: hidden;
}

#employeeCardModal .collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    cursor: pointer;
    user-select: none;
    color: var(--text-primary);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
}

@media (hover: hover) and (pointer: fine) {
#employeeCardModal .collapsible-header:hover {
    background: var(--bg-tertiary);
}
}

#employeeCardModal .collapsible-content {
    padding: 0.8rem 0.9rem 0.9rem;
}

#employeeCardModal .form-group label,
#employeeCardModal .form-group input,
#employeeCardModal .form-group textarea,
#employeeCardModal .form-group select,
#employeeCardModal .stat-value,
#employeeCardModal .stat-label,
#employeeCardModal .history-empty p,
#employeeCardModal .history-date,
#employeeCardModal .shift-hours,
#employeeCardModal .shift-pay,
#employeeCardModal .shift-open-badge,
#employeeCardModal .shift-event-label,
#employeeCardModal .shift-event-time,
#employeeCardModal .history-calendar-mode-btn,
#employeeCardModal .history-calendar-nav,
#employeeCardModal .history-calendar-header,
#employeeCardModal .history-calendar-day,
#employeeCardModal .history-calendar-clear-btn,
#employeeCardModal .employee-active-project-item,
#employeeCardModal .employee-active-project-number,
#employeeCardModal .employee-active-project-name,
#employeeCardModal .employee-active-project-status {
    font-size: var(--font-size-tertiary);
}

#employeeCardModal .employee-active-projects-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.15rem 0 0.35rem;
}

#employeeCardModal .employee-active-project-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.65rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    color: var(--text-primary);
    line-height: 1.3;
}

#employeeCardModal .employee-active-project-number {
    font-weight: var(--font-weight-semibold, 600);
    color: var(--text-muted);
    white-space: nowrap;
}

#employeeCardModal .employee-active-project-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#employeeCardModal .employee-active-project-status {
    white-space: nowrap;
    font-weight: var(--font-weight-medium, 500);
    color: var(--text-muted);
}

#employeeCardModal .employee-active-project-status.in-progress {
    color: var(--status-in-progress, #68d391);
}

#employeeCardModal .employee-active-project-status.upcoming {
    color: var(--status-upcoming, #63b3ed);
}

#employeeCardModal .employee-active-project-status.on-hold {
    color: var(--status-on-hold, #f6ad55);
}

#employeeCardModal .employee-active-project-status.completed {
    color: var(--status-completed, #a0aec0);
}

#employeeCardModal .collapsible-section.collapsed .collapsible-content,
#archivedReportsModal .collapsible-section.collapsed .collapsible-content {
    display: none;
}

#employeeCardModal .collapsible-section .collapse-icon,
#archivedReportsModal .collapsible-section .collapse-icon {
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#employeeCardModal .collapsible-section.collapsed .collapse-icon,
#archivedReportsModal .collapsible-section.collapsed .collapse-icon {
    transform: rotate(180deg);
}

#employeeCardModal .history-section {
    padding: 0;
}

#employeeCardModal .history-section::before {
    display: none;
}

@media (max-width: 600px) {
    #employeeCardModal .employee-compensation-row {
        grid-template-columns: 1fr;
    }
}

/* Employee Actions Section - iOS Design */
.employee-actions-section {
    display: flex;
    gap: 0.875rem;
    margin-top: 1.75rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--border-color);
}

/* Employee card Cancel / Save — flat sheet (matches payment/spending) */
#employeeCardModal .form-actions {
    display: flex;
    justify-content: stretch;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    margin-bottom: 0;
}

#employeeCardModal .form-actions .employee-actions-section {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    /* When shown, JS sets display:contents so Delete is a flex peer of Cancel/Save */
}

#employeeCardModal .form-actions > .btn,
#employeeCardModal .form-actions .employee-actions-section .btn-employee-action {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    white-space: nowrap;
    margin: 0;
    padding: 0.5rem 0.75rem;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    min-height: 2.25rem;
    height: auto;
    line-height: 1.25;
    border-radius: 2px;
    box-shadow: none;
    transform: none;
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.15s ease, border-color 0.2s ease;
}

#employeeCardModal .form-actions .btn-secondary,
#employeeCardModal .form-actions .modal-cancel,
#employeeCardModal .form-actions .employee-actions-section .btn-employee-action {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

#employeeCardModal .form-actions .btn-primary {
    background: var(--accent-green);
    color: #1a202c;
    border: 1px solid var(--accent-green);
}

@media (hover: hover) and (pointer: fine) {
    #employeeCardModal .form-actions .btn:hover,
    #employeeCardModal .form-actions .employee-actions-section .btn-employee-action:hover {
        transform: none;
    }

    #employeeCardModal .form-actions .btn-secondary:hover,
    #employeeCardModal .form-actions .modal-cancel:hover,
    #employeeCardModal .form-actions .employee-actions-section .btn-employee-action:hover {
        color: var(--text-primary);
        background: var(--finance-track, var(--bg-secondary));
        border-color: var(--border-color);
    }

    #employeeCardModal .form-actions .btn-primary:hover {
        filter: brightness(1.04);
        background: var(--accent-green);
    }
}

#employeeCardModal .form-actions .btn:active,
#employeeCardModal .form-actions .employee-actions-section .btn-employee-action:active {
    opacity: 0.9;
    transform: none;
}

body.light-theme #employeeCardModal .form-actions .btn-secondary,
body.light-theme #employeeCardModal .form-actions .modal-cancel,
body.light-theme #employeeCardModal .form-actions .employee-actions-section .btn-employee-action {
    background: var(--transparent-bg-light);
    color: var(--text-muted);
}

body:not(.light-theme) #employeeCardModal .form-actions .btn-primary {
    color: #000000;
}

/* iPad: Enhanced spacing */
@media (min-width: 768px) {
    .employee-actions-section {
        gap: 1rem;
        margin-top: 2rem;
        padding-top: 2rem;
    }
}

/* iPhone: Keep employee modal actions on one line */
@media (max-width: 480px) {
    #employeeCardModal .employee-actions-section {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem;
        margin-top: 1.25rem;
        padding-top: 1.25rem;
        justify-content: center;
    }

    #employeeCardModal .form-actions {
        flex-wrap: nowrap;
        justify-content: stretch;
    }
}

/* Employee Action Button - iOS Secondary Button */
.btn-employee-action {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    min-height: 50px;
    line-height: 1.3;
    letter-spacing: -0.2px;
}

/* iPad: Enhanced button */
@media (min-width: 768px) {
    .btn-employee-action {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 52px;
        border-radius: 14px;
    }
}

/* iPhone: Compact equal-width row buttons for employee modal */
@media (max-width: 480px) {
    #employeeCardModal .btn-employee-action,
    #employeeCardModal .form-actions > .btn {
        width: auto;
        min-width: 0;
        flex: 1 1 0;
        padding: 0.5rem 0.75rem;
        font-size: var(--font-size-tertiary);
        min-height: 2.25rem;
        border-radius: 2px;
    }
}

@media (hover: hover) and (pointer: fine) {
.btn-employee-action:hover {
    transform: translateY(-2px);
    background: var(--bg-tertiary);
    border-color: var(--text-secondary);
}
}


.btn-employee-action:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* Mobile adjustments for employee modal */
@media (max-width: 480px) {
    .employee-stats-section {
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-lg);
    }
    
    .stats-grid {
        gap: var(--spacing-sm);
    }
    
    .stat-card {
        padding: var(--spacing-sm);
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        font-size: 1.125rem;
    }
    
    .stat-value {
        font-size: var(--font-size-base);
    }
    
    .stat-label {
        font-size: var(--font-size-tertiary);
    }
    
    #employeeCardModal .employee-actions-section {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem;
        margin-top: 1.25rem;
        padding-top: 1.25rem;
        justify-content: center;
    }
    
    #employeeCardModal .btn-employee-action {
        width: auto;
        min-width: 0;
        padding: 0.5rem 0.75rem;
        font-size: var(--font-size-tertiary);
        min-height: 42px;
    }
    
    .btn-employee-action i {
        font-size: var(--font-size-default);
        min-width: 22px;
    }
    
    /* Employee item mobile optimizations */
    .employee-main-actions {
        min-width: 88px;
        padding: 0;
    }
    
    .btn-clock-main {
        min-width: 88px;
        min-height: 72px;
        padding: 0.5rem;
    }
}

/* Shift Timer - Live timer for clocked-in employees */
.shift-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-top: 12px;
    background: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 8px;
    animation: pulse-glow 2s ease-in-out infinite;
}

.shift-timer i {
    color: var(--accent-primary);
    font-size: 1rem;
    min-width: 18px;
    text-align: center;
    animation: rotate-stopwatch 3s linear infinite;
}

.shift-timer .timer-text {
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-semibold);
    color: var(--accent-primary);
    letter-spacing: 0.5px;
    line-height: 1.4;
}

/* Mobile: Larger shift timer */
@media (max-width: 480px) {
    .shift-timer {
        padding: var(--spacing-sm) var(--spacing-md);
        margin-top: var(--spacing-sm);
    }
    
    .shift-timer i {
        font-size: 1.125rem;
        min-width: 20px;
    }
    
    .shift-timer .timer-text {
        font-size: var(--font-size-base);
    }
}

@keyframes pulse-glow {
    0%, 100% {
    }
    50% {
    }
}

@keyframes rotate-stopwatch {
    0% { transform: rotate(0deg); }
    10% { transform: rotate(20deg); }
    20% { transform: rotate(0deg); }
    30% { transform: rotate(-20deg); }
    40% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

/* Payroll Summary Section */
/* Payroll Summary Section - iOS Card Design */
.payroll-summary-section {
    border-radius: 16px;
    padding: 1.75rem;
    margin-top: 2rem;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

/* iPad: Enhanced spacing */
@media (min-width: 768px) {
    .payroll-summary-section {
        padding: 2rem;
        margin-top: 2.5rem;
        border-radius: 18px;
    }
}

/* iPhone: iOS standard card */
@media (max-width: 480px) {
    .payroll-summary-section {
        padding: 1.5rem;
        margin-top: 1.5rem;
        border-radius: 14px;
    }
}

body.light-theme .employee-item {
    background: var(--bg-secondary);
}

body.light-theme #laborView .content-panel {
    background-color: var(--glass-bg-light);
}

/* Light theme - Financial controls */
body.light-theme .financial-select {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

@media (hover: hover) and (pointer: fine) {
body.light-theme .financial-select:hover {
    border-color: var(--accent-green);
}
}


body.light-theme .financial-select:focus {
    border-color: var(--accent-green);
}

/* Light theme - Financial view cards lighter */
body.light-theme .big-stat-card {
    background-color: var(--transparent-bg-light);
}

body.light-theme .job-card {
    background: var(--bg-card);
}

body.light-theme .job-progress .progress-bar-container {
    background: var(--border-color);
}

body.light-theme #financialView .content-panel {
    background-color: var(--glass-bg-light);
}

@media (hover: hover) and (pointer: fine) {
.payroll-summary-section:hover {
    transform: translateY(-2px);
}
}


/* Payroll Header - iOS Layout */
.payroll-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

/* iPad: Enhanced spacing */
@media (min-width: 768px) {
    .payroll-header {
        margin-bottom: 2rem;
        padding-bottom: 2rem;
    }
}

/* iPhone: iOS standard spacing */
@media (max-width: 480px) {
    .payroll-header {
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* Payroll Label - Secondary text */
.payroll-label {
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.4;
}

.payroll-label i {
    font-size: 1.125rem;
    min-width: 20px;
    text-align: center;
    line-height: 1;
}

/* Payroll Amount - Large display size for prominence */
.payroll-amount {
    font-size: var(--font-size-special);
    font-weight: 900;
    color: var(--accent-primary);
    line-height: 1.15;
}


/* Payroll Report Button */
.btn-payroll-report {
    width: 100%;
    /* Inherits all styles from base class */
}

/* Report Actions - iOS Design */
.report-actions {
    margin-top: 1.75rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--border-color);
}

/* iPad: Enhanced spacing */
@media (min-width: 768px) {
    .report-actions {
        margin-top: 2rem;
        padding-top: 2rem;
    }
}

/* iPhone: iOS standard spacing */
@media (max-width: 480px) {
    .report-actions {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }
}

.payroll-date-range-summary {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: var(--font-size-tertiary);
    line-height: 1.35;
}

.payroll-date-range-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.payroll-date-picker-single {
    display: block;
    width: 100%;
}

/* Preset open lift is on .payroll-date-calendar-block:has(...) below */
.payroll-date-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    margin-bottom: 8px;
    width: 100%;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.payroll-date-toolbar-top {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
}

.payroll-preset-filter {
    position: relative;
    z-index: 2;
    max-width: none;
    width: max-content;
    flex: 0 0 auto;
    margin-left: auto;
}

.payroll-preset-filter.is-open {
    z-index: 10050;
}

.payroll-preset-filter .filter-dropdown-btn {
    border-radius: 2px;
    white-space: nowrap;
    min-height: 32px;
    padding: 6px 10px;
    font-size: var(--font-size-tertiary);
    width: max-content;
    max-width: none;
    gap: 0.35rem;
}

.payroll-preset-filter .filter-dropdown-btn #payrollPresetFilterLabel {
    overflow: visible;
    text-overflow: clip;
}

.payroll-preset-filter-menu {
    left: auto;
    right: 0;
    width: max-content;
    min-width: max-content;
    max-width: min(90vw, 320px);
    max-height: min(280px, 50vh);
    border-radius: 2px;
    z-index: 10051;
    display: none;
    flex-direction: column;
    align-items: stretch;
}

.payroll-preset-filter-menu.active {
    display: flex;
}

.payroll-preset-filter-menu .filter-dropdown-item {
    font-size: var(--font-size-tertiary);
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    justify-content: flex-start;
}

.payroll-date-month-nav {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex: 0 1 auto;
    min-width: 0;
    white-space: nowrap;
    height: 32px;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
}

.payroll-date-month-nav .history-calendar-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 6px 10px;
    box-sizing: border-box;
    border-radius: 2px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
}

.payroll-date-month-nav .history-calendar-nav-btn i {
    font-size: var(--font-size-secondaryallest);
    width: 1em;
    height: 1em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.payroll-date-month-nav #payrollMonthLabel {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    line-height: 1.2;
}

@media (hover: hover) and (pointer: fine) {
    .payroll-date-month-nav .history-calendar-nav-btn:hover {
        background: transparent;
        border-color: var(--border-color);
        color: var(--text-primary);
    }
}

.payroll-date-selected-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    margin: 0;
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    white-space: nowrap;
    text-align: center;
}

.payroll-date-selected-row span {
    flex: 0 0 auto;
    white-space: nowrap;
}

.payroll-date-calendar-block {
    background: transparent;
    border: none;
    border-radius: 12px;
    padding: 10px;
    position: relative;
    z-index: 1;
    margin-bottom: 1.25rem;
}

/* Preset menu extends below calendar — lift above earnings / By employee filter */
.payroll-date-calendar-block:has(.payroll-preset-filter.is-open) {
    z-index: 40;
}

.payroll-period-earnings {
    margin: 0 10px 6px;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.payroll-period-earnings:has(.payroll-scope-filter.is-open) {
    z-index: 40;
}

.payroll-period-earnings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

.payroll-period-select-all {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: none;
    background: transparent;
    padding: 0.15rem 0.1rem;
    margin: 0;
    cursor: pointer;
    color: var(--text-muted);
    font: inherit;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    min-height: 32px;
    -webkit-tap-highlight-color: transparent;
}

.payroll-period-select-all.is-disabled {
    opacity: 0.45;
    cursor: default;
}

.payroll-period-select-all .payroll-period-select-checkbox,
.payroll-period-group-checkbox {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin-right: 0;
    border-radius: 4px;
}

.payroll-period-select-all .payroll-period-select-checkbox .checkmark,
.payroll-period-group-checkbox .checkmark {
    width: 11px;
    height: 9px;
}

.payroll-period-select-checkbox.is-indeterminate {
    border-width: 0;
    background: var(--accent-green, #4ade6e);
}

.payroll-period-select-checkbox.is-indeterminate::after {
    content: '';
    width: 8px;
    height: 2px;
    border-radius: 1px;
    background: #fff;
}

.payroll-period-select-checkbox.is-indeterminate .checkmark {
    display: none;
}

.payroll-period-select-all-label {
    white-space: nowrap;
}

.payroll-period-group-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    min-width: 0;
}

.payroll-period-group-wrap > .payroll-period-group-checkbox {
    flex-shrink: 0;
    margin-top: 14px; /* center against ~46px header row */
}

.payroll-period-group-wrap > .payroll-period-project-group {
    flex: 1 1 auto;
    min-width: 0;
}

.payroll-scope-filter {
    position: relative;
    z-index: 2;
    max-width: none;
    width: max-content;
}

.payroll-scope-filter.is-open {
    z-index: 10050;
}

.payroll-scope-filter .filter-dropdown-btn {
    border-radius: 2px;
    white-space: nowrap;
    min-height: 32px;
    padding: 6px 10px;
    font-size: var(--font-size-tertiary);
    width: max-content;
    max-width: none;
    gap: 0.35rem;
}

.payroll-scope-filter .filter-dropdown-btn #payrollScopeFilterLabel {
    overflow: visible;
    text-overflow: clip;
}

.payroll-scope-filter-menu {
    left: auto;
    right: 0;
    width: max-content;
    min-width: max-content;
    max-width: min(90vw, 320px);
    max-height: min(320px, 50vh);
    border-radius: 2px;
    z-index: 10051;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    align-items: stretch;
}

.payroll-scope-filter-menu.active {
    display: flex;
}

.payroll-scope-filter-menu .filter-dropdown-item {
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    text-align: left;
    font-size: var(--font-size-tertiary);
    justify-content: flex-start;
}

.payroll-scope-filter-group {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

#payrollPeriodEarningsTotal {
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    font-size: var(--font-size-secondary);
}

.payroll-period-earnings-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-top: 0.35rem;
    margin-bottom: 0;
    padding: 0.35rem 0.75rem;
    border-top: none;
}

.payroll-period-earnings-total-label {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
}

.payroll-period-earnings-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: none;
    overflow: visible;
}

.payroll-period-project-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0;
}

.payroll-period-earnings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 46px;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: var(--bg-card);
    min-width: 0;
    box-sizing: border-box;
}

.payroll-period-earnings-row--project {
    cursor: pointer;
    user-select: none;
    font-weight: var(--font-weight-semibold);
}

@media (hover: hover) and (pointer: fine) {
    .payroll-period-earnings-row--project:hover {
        background: var(--bg-tertiary);
    }
}

.payroll-period-project-header-right {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.payroll-period-project-chevron {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.payroll-period-project-group.is-collapsed .payroll-period-project-chevron {
    transform: rotate(-90deg);
}

.payroll-period-project-group.is-collapsed > .payroll-period-project-employees {
    display: none;
}

.payroll-period-project-employees {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0;
    margin: 0;
}

.payroll-period-earnings-row--employee,
.payroll-period-earnings-row--child {
    margin-left: 0.5rem;
    min-height: 42px;
    padding: 0.5rem 0.7rem;
    border: none;
    background: transparent;
}

.payroll-period-earnings-name {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    line-height: 1.35;
}

.payroll-period-earnings-row--project .payroll-period-earnings-name {
    font-weight: var(--font-weight-semibold);
}

.payroll-period-earnings-meta {
    flex: 0 0 auto;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    white-space: nowrap;
}

.payroll-period-earnings-empty {
    padding: 0.85rem 0.75rem;
    text-align: center;
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
}

.payroll-date-calendar-title {
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: var(--font-size-tertiary);
    line-height: 1.35;
}

.payroll-date-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
    width: 100%;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.payroll-date-calendar.is-dragging-range {
    cursor: grabbing;
}

/* Wide screens: same split as the Tasks calendar row (960px), so the grid uses the panel without growing into giant squares. */
@media (min-width: 960px) {
    #laborPayrollPanel .payroll-date-picker-single {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 1rem;
        align-items: start;
        width: 100%;
        max-width: min(1360px, 100%);
        margin-inline: auto;
    }
}

.payroll-date-cell {
    aspect-ratio: 1;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    padding: 0.25rem;
    min-width: 0;
    min-height: 0;
    text-align: center;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
    background: var(--calendar-day-bg);
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    position: relative;
    touch-action: none;
    transition: background 0.12s ease-out, border-color 0.12s ease-out;
}

body.light-theme .payroll-date-cell {
    border: 1px solid rgba(203, 213, 224, 0.4);
}

.payroll-date-cell.payroll-weekday-header {
    aspect-ratio: auto;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    opacity: 1;
    cursor: default;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    min-height: 0;
    padding: 0.5rem 0;
    touch-action: auto;
}

body.light-theme .payroll-date-cell.payroll-weekday-header {
    border: none;
    background: transparent;
}

.payroll-date-cell.blank {
    cursor: default;
    touch-action: auto;
}

.payroll-date-cell.outside-month {
    opacity: 0.3;
}

@media (hover: hover) and (pointer: fine) {
    .payroll-date-cell.payroll-date-day:not(.selected):not(.in-range):hover {
        background: rgba(104, 211, 145, 0.15);
        border-color: var(--accent-primary);
    }

    body.light-theme .payroll-date-cell.payroll-date-day:not(.selected):not(.in-range):hover {
        background: rgba(72, 187, 120, 0.1);
        border-color: var(--accent-primary);
    }
}

.payroll-date-cell.has-unpaid-labor .payroll-unpaid-dot {
    --calendar-task-dot-size: 8px;
    --calendar-task-dot-radius: 25%;
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: var(--calendar-task-dot-size);
    height: var(--calendar-task-dot-size);
    margin-left: calc(var(--calendar-task-dot-size) / -2);
    border-radius: var(--calendar-task-dot-radius);
    background: var(--accent-yellow);
    pointer-events: none;
    box-sizing: border-box;
}

.payroll-date-legend {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.85rem 1.1rem;
    margin-top: 0.7rem;
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
}

.payroll-date-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.payroll-legend-swatch--period {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    box-sizing: border-box;
    background: rgba(104, 211, 145, 0.28);
    border: 1px solid var(--accent-primary);
}

.payroll-unpaid-dot.payroll-legend-dot {
    --calendar-task-dot-size: 8px;
    --calendar-task-dot-radius: 25%;
    position: static;
    display: inline-block;
    width: var(--calendar-task-dot-size);
    height: var(--calendar-task-dot-size);
    margin: 0;
    border-radius: var(--calendar-task-dot-radius);
    background: var(--accent-yellow);
    flex: 0 0 auto;
}

.payroll-date-cell.selected {
    outline: none;
    background: rgba(104, 211, 145, 0.28);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

body.light-theme .payroll-date-cell.selected {
    background: rgba(72, 187, 120, 0.22);
}

.payroll-date-cell.in-range:not(.selected) {
    background: rgba(104, 211, 145, 0.16);
    border-color: color-mix(in srgb, var(--accent-primary) 55%, transparent);
    color: var(--text-primary);
}

body.light-theme .payroll-date-cell.in-range:not(.selected) {
    background: rgba(72, 187, 120, 0.14);
}

.payroll-date-cell.today:not(.selected):not(.in-range) {
    background: rgba(104, 211, 145, 0.1);
}

.payroll-date-cell.today {
    border-color: var(--accent-primary);
    box-shadow: none;
}

.payroll-date-cell.range-start {
    border-top-left-radius: 2px;
    border-bottom-left-radius: 2px;
}

.payroll-date-cell.range-end {
    border-top-right-radius: 2px;
    border-bottom-right-radius: 2px;
}

.payroll-range-handle {
    --calendar-task-dot-size: 8px;
    --calendar-task-dot-radius: 25%;
    position: absolute;
    width: var(--calendar-task-dot-size);
    height: var(--calendar-task-dot-size);
    border-radius: var(--calendar-task-dot-radius);
    background: var(--accent-green);
    border: none;
    box-shadow: none;
    z-index: 3;
    pointer-events: auto;
    touch-action: none;
    cursor: grab;
    margin: 0;
    box-sizing: border-box;
}

.payroll-range-handle::before {
    content: '';
    position: absolute;
    inset: -16px;
}

.payroll-range-handle--start {
    left: calc(var(--calendar-task-dot-size) / -2);
    bottom: calc(var(--calendar-task-dot-size) / -2);
}

.payroll-range-handle--end {
    right: calc(var(--calendar-task-dot-size) / -2);
    bottom: calc(var(--calendar-task-dot-size) / -2);
}

.payroll-date-calendar.is-dragging-range .payroll-range-handle {
    cursor: grabbing;
    pointer-events: none; /* hit-test cells by geometry while dragging */
}

.payroll-date-range-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.65rem;
}

#laborPayrollPanel .payroll-inline-footer .btn,
#laborPayrollPanel .payroll-modal-footer .btn {
    font-size: var(--font-size-tertiary) !important;
    flex: 0 0 auto !important;
    width: auto !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: var(--card-radius) !important;
}

#laborPayrollPanel {
    width: 100%;
    padding: 0;
}

#laborPayrollPanel .payroll-date-picker-single {
    width: 100%;
}

#laborPayrollPanel,
#laborPayrollPanel .payroll-date-range-summary,
#laborPayrollPanel .filter-dropdown-btn,
#laborPayrollPanel .filter-dropdown-item,
#laborPayrollPanel .history-calendar-nav-btn,
#laborPayrollPanel .payroll-inline-footer .btn {
    font-family: "DM Sans", -apple-system, "system-ui", "Segoe UI", Roboto, sans-serif;
}

#laborPayrollPanel #payrollMonthLabel,
#laborPayrollPanel #payrollSelectedStartLabel,
#laborPayrollPanel #payrollSelectedEndLabel {
    font-family: inherit;
    font-size: var(--font-size-tertiary);
}

#laborPayrollPanel .payroll-date-cell,
#laborPayrollPanel .payroll-date-cell.payroll-weekday-header {
    font-family: inherit;
}

#laborPayrollPanel .modal-footer,
#laborPayrollPanel .payroll-modal-footer,
#laborPayrollPanel .payroll-inline-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: none;
}

#laborPayrollPanel .payroll-modal-footer-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

#laborPayrollPanel .payroll-history-btn {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
    padding: 0.35rem 0;
    min-height: 0;
    margin-top: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    box-shadow: none;
    transform: none;
}

#laborPayrollPanel .payroll-history-btn i {
    display: none;
}

#laborPayrollPanel .payroll-history-btn .btn-label {
    white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
    #laborPayrollPanel .payroll-history-btn:hover {
        background: transparent;
        border: none;
        color: var(--text-primary);
        transform: none;
    }
}

#laborPayrollPanel .payroll-history-btn:active {
    transform: none;
    opacity: 0.75;
}

/* Phone: keep month + filter on one row; Start/End stay centered below, no wrap */
@media (max-width: 480px) {
    .payroll-date-toolbar {
        gap: 0.4rem;
    }

    .payroll-date-toolbar-top {
        gap: 0.35rem;
    }

    .payroll-date-month-nav {
        gap: 4px;
        flex: 0 1 auto;
        height: 28px;
    }

    .payroll-date-month-nav .history-calendar-nav-btn,
    .history-calendar-nav-btn {
        min-width: 28px;
        height: 28px;
        min-height: 28px;
        padding: 4px 8px;
    }

    .calendar-nav .nav-btn {
        width: 28px;
        height: 28px;
        min-height: 28px;
    }

    .payroll-date-selected-row {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: center;
        gap: 0.65rem;
        white-space: nowrap;
    }

    .payroll-preset-filter {
        max-width: none;
        margin-left: auto;
        flex: 0 0 auto;
    }

    .payroll-preset-filter .filter-dropdown-btn {
        min-height: 28px;
        padding: 4px 8px;
    }
}

.report-ready {
    text-align: center;
    color: var(--accent-primary);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    font-size: 1rem;
    line-height: 1.4;
    letter-spacing: -0.2px;
}

/* iPad: Larger text */
@media (min-width: 768px) {
    .report-ready {
        font-size: 1.0625rem;
        margin-bottom: 1.25rem;
    }
}

.report-ready i {
    font-size: 1.375rem;
    min-width: 24px;
    text-align: center;
    line-height: 1;
}

/* iPad: Larger icon */
@media (min-width: 768px) {
    .report-ready i {
        font-size: var(--font-size-special);
        min-width: 26px;
    }
}

.report-buttons {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0.5rem;
}
.report-buttons .btn-report-action,
.report-buttons .btn-archived-reports {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    width: auto !important;
    margin-top: 0 !important;
    padding: 0.625rem 0.5rem !important;
    min-height: 52px !important;
    height: auto !important;
    align-self: stretch !important;
    box-sizing: border-box;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.25rem !important;
    font-size: var(--font-size-tertiary) !important;
    line-height: 1.2 !important;
    white-space: normal;
    text-align: center;
    border-radius: 12px !important;
}
.report-buttons .btn-report-action i,
.report-buttons .btn-archived-reports i {
    font-size: 1rem !important;
    min-width: unset !important;
    flex-shrink: 0;
}
.report-buttons .btn-report-action .btn-label,
.report-buttons .btn-archived-reports .btn-label {
    font-size: var(--font-size-tertiary) !important;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
}
.report-buttons .btn-archived-reports .archive-count {
    font-size: var(--font-size-tertiary) !important;
    color: inherit;
    opacity: 0.7;
}

/* ================================
   SECONDARY BUTTONS - Download PDF, Save to Archive, etc.
   ================================ */

/* Base Style for ALL Secondary Labor Buttons - Apple iOS Standard */
.btn-labor-secondary,
.btn-report-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 1rem 1.75rem;
    min-height: 52px;
    border-radius: 14px;
    font-weight: var(--font-weight-semibold);
    font-size: 17px !important;
    line-height: 1.3;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
}

/* Mobile: Slightly adjust padding only */
@media (max-width: 480px) {
    .btn-labor-secondary,
    .btn-report-action {
        padding: 0.875rem 1.5rem;
    }
}

/* Hover state - secondary buttons */
@media (hover: hover) and (pointer: fine) {
.btn-labor-secondary:hover,
.btn-report-action:hover {
    transform: translateY(-2px);
    background: var(--bg-tertiary);
    border-color: var(--text-secondary);
}
}


/* Active state - secondary buttons */
.btn-labor-secondary:active,
.btn-report-action:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* Color variants for secondary buttons */
.btn-labor-secondary.blue,
.btn-report-action.blue {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.btn-labor-secondary.red,
.btn-report-action.red {
    background: var(--accent-red);
    color: white;
    border-color: var(--accent-red);
}

.btn-labor-secondary.purple,
.btn-report-action.purple {
    background: var(--accent-purple);
    color: white;
    border-color: var(--accent-purple);
}

/* Icon color for colored variants */
.btn-labor-secondary.blue i,
.btn-labor-secondary.red i,
.btn-labor-secondary.purple i,
.btn-report-action.blue i,
.btn-report-action.red i,
.btn-report-action.purple i {
    color: white;
}

/* Archived Reports Button - Apple iOS Standard */
.btn-archived-reports {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.625rem;
    padding: 1rem 1.75rem;
    min-height: 52px;
    border-radius: 14px;
    margin-top: 1rem;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-tertiary);
    line-height: 1.3;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
}

/* Mobile: Slightly adjust padding only */
@media (max-width: 480px) {
    .btn-archived-reports {
        padding: 0.875rem 1.5rem;
    }
}

body:not(.light-theme) .btn-archived-reports {
    background: var(--bg-tertiary);
}

@media (hover: hover) and (pointer: fine) {
.btn-archived-reports:hover {
    transform: translateY(-2px);
    background: var(--bg-tertiary);
    border-color: var(--text-secondary);
}
}


.btn-archived-reports:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.archive-count {
    color: var(--text-muted);
    font-weight: var(--font-weight-semibold);
}

/* Archived Reports List */
.archived-reports-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.archived-reports-list::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

#archivedReportsModal .modal-body {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#archivedReportsModal .modal-body::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.archived-report-item {
    background: transparent;
    border-radius: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.archived-report-item .payroll-history-run {
    margin-bottom: 0.35rem;
}

.archived-report-item .payroll-history-lines {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.65rem;
    width: 100%;
    align-self: stretch;
}

.archived-report-item .payroll-history-run-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    width: 100%;
    align-self: stretch;
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    padding-bottom: 0.15rem;
    border-top: 1px solid var(--border-color);
}

#archivedReportsModal .payroll-history-run-actions.report-actions {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    padding-bottom: 0.15rem;
}

.archived-report-item .shift-project--muted {
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
}

.payroll-history-emp-label {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    padding: 0.35rem 0.15rem 0.15rem;
}

/* Match employee-card history stretch inside Payroll History modal */
#archivedReportsModal .history-entry.collapsible-section,
#employeeCardModal .history-entry.collapsible-section {
    padding: 0;
    margin-bottom: 0.25rem;
    border-radius: 2px;
    background: var(--bg-card);
    gap: 0;
    width: 100%;
    align-self: stretch;
    box-sizing: border-box;
}

#archivedReportsModal .collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
    color: var(--text-primary);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
}

#archivedReportsModal .history-entry .collapsible-header,
#employeeCardModal .history-entry .collapsible-header {
    width: 100%;
    box-sizing: border-box;
    min-height: 46px;
    padding: 0.55rem 0.75rem;
    gap: 0.5rem;
    align-items: center;
}

#archivedReportsModal .history-entry .collapsible-content,
#employeeCardModal .history-entry .collapsible-content {
    padding: 0.35rem 0.75rem 0.55rem;
    width: 100%;
    box-sizing: border-box;
}

/* Collapsible history content must not flex-grow — that fights the height:0 expand pin. */
#archivedReportsModal .history-entry.collapsible-section > .collapsible-content.history-shift,
#employeeCardModal .history-entry.collapsible-section > .collapsible-content.history-shift {
    flex: 0 0 auto;
    min-height: 0;
}

#archivedReportsModal .history-entry .history-shift,
#archivedReportsModal .payroll-history-run > .history-shift {
    width: 100%;
    align-self: stretch;
    align-items: stretch;
}

#archivedReportsModal .history-entry .shift-events-list {
    width: 100%;
}

#archivedReportsModal .history-entry-header-main {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
}

#archivedReportsModal .history-entry .history-entry-header-left {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.4rem;
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
}

#employeeCardModal .history-entry .history-entry-header-left {
    gap: 0.15rem;
    flex: 1 1 auto;
    min-width: 0;
}

#archivedReportsModal .history-entry .shift-hours,
#archivedReportsModal .history-entry .shift-pay,
#employeeCardModal .history-entry .shift-hours,
#employeeCardModal .history-entry .shift-pay {
    font-size: var(--font-size-tertiary);
    line-height: 1.2;
    white-space: nowrap;
    flex: 0 0 auto;
}

#archivedReportsModal .history-entry .shift-summary {
    flex: 0 0 auto;
    width: auto;
    align-self: center;
    justify-content: flex-end;
    gap: 0.4rem;
    min-width: 0;
}

#employeeCardModal .history-entry .shift-summary {
    flex: 0 0 auto;
    align-self: center;
    gap: 0.45rem;
}

#archivedReportsModal .history-entry .shift-date-line {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: 0.3rem;
}

#employeeCardModal .history-entry .shift-date-line {
    justify-content: flex-start;
    align-items: center;
    gap: 0.35rem;
    width: auto;
    max-width: 100%;
}

#archivedReportsModal .history-entry .shift-date-line > span:first-child,
#employeeCardModal .history-entry .shift-date-line > span:first-child {
    flex: 0 0 auto;
    white-space: nowrap;
}

#archivedReportsModal .history-entry .shift-paid-badge,
#archivedReportsModal .history-entry .shift-open-badge {
    flex: 0 0 auto;
    font-size: 10px;
    line-height: 1;
    padding: 0.2rem 0.35rem;
    height: auto;
    min-height: 0;
}

#employeeCardModal .history-entry .shift-paid-badge,
#employeeCardModal .history-entry .shift-open-badge {
    flex: 0 0 auto;
    font-size: 10px;
    line-height: 1;
    padding: 0.2rem 0.35rem;
    height: auto;
    min-height: 0;
}

#archivedReportsModal .history-entry .shift-project {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    max-width: none;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#employeeCardModal .history-entry .shift-project {
    line-height: 1.25;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#archivedReportsModal .collapse-icon {
    margin-top: 0;
    flex-shrink: 0;
}

#archivedReportsModal .shift-events-list {
    padding: 6px 2px;
    gap: 4px;
}

#archivedReportsModal .shift-event-row {
    gap: 8px;
}


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

.report-title {
    font-weight: var(--font-weight-semibold);
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.report-title i {
    color: var(--accent-primary);
    margin-right: 8px;
}

.archived-report-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.02em;
    border-radius: 4px;
    vertical-align: middle;
}

.archived-report-badge--paid {
    background: color-mix(in srgb, var(--accent-primary) 16%, transparent);
    color: var(--accent-primary);
}

.report-meta {
    display: flex;
    gap: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.report-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.report-meta i {
    opacity: 0.7;
}

.report-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-report-download {
    padding: 0.35rem 0.15rem;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    transition: none;
    white-space: nowrap;
    box-shadow: none;
    transform: none;
}

.btn-report-download:hover,
.btn-report-download:active {
    background: transparent;
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

.btn-report-delete {
    padding: 0.35rem 0.15rem;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: none;
    white-space: nowrap;
    box-shadow: none;
    transform: none;
}

.btn-report-delete:hover,
.btn-report-delete:active {
    background: transparent;
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

@media (max-width: 768px) {
    .archived-report-item {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .report-actions {
        width: 100%;
    }

    .btn-report-download,
    .btn-report-delete {
        flex: 1;
        justify-content: center;
    }

    #archivedReportsModal .modal-body {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
        overflow-x: hidden;
    }

    #archivedReportsModal .archived-reports-list,
    #archivedReportsModal .payroll-history-lines,
    #archivedReportsModal .history-entry.collapsible-section,
    #archivedReportsModal .history-entry .collapsible-content,
    #archivedReportsModal .history-entry .history-shift,
    #archivedReportsModal .payroll-history-run > .history-shift {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    #archivedReportsModal .history-entry .collapsible-header {
        gap: 0.35rem;
        min-height: 0;
        padding: 0.45rem 0.5rem;
    }

    #archivedReportsModal .history-entry .collapsible-content {
        padding: 0.25rem 0.5rem 0.45rem;
    }

    #archivedReportsModal .payroll-history-lines .history-entry .collapsible-header {
        padding: 0.4rem 0.45rem;
    }

    #archivedReportsModal .history-entry .shift-paid-badge,
    #archivedReportsModal .history-entry .shift-open-badge {
        font-size: 9px;
        padding: 0.12rem 0.28rem;
    }

    #archivedReportsModal .payroll-history-run-actions {
        flex-wrap: nowrap;
        justify-content: stretch;
        gap: 0.4rem;
        margin-top: 0.25rem;
        padding-top: 0.25rem;
        padding-bottom: 0.1rem;
    }

    #archivedReportsModal .shift-events-list {
        padding: 4px 2px;
        gap: 2px;
    }

    #archivedReportsModal .shift-event-row {
        gap: 6px;
    }
}

/* Employee card history rows mirror Payroll History rows on phones */
@media (max-width: 768px) {
    #employeeCardModal .history-entry .collapsible-header {
        gap: 0.35rem;
        min-height: 0;
        padding: 0.4rem 0.45rem;
    }

    #employeeCardModal .history-entry .collapsible-content {
        padding: 0.25rem 0.5rem 0.45rem;
    }

    #employeeCardModal .history-entry-header-main {
        flex-wrap: nowrap;
        gap: 0.5rem;
        min-width: 0;
    }

    #employeeCardModal .history-entry .history-entry-header-left {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.4rem;
        flex: 1 1 auto;
        min-width: 0;
    }

    #employeeCardModal .history-entry .shift-date-line {
        flex: 0 0 auto;
        flex-wrap: nowrap;
        gap: 0.3rem;
        max-width: none;
    }

    #employeeCardModal .history-entry .shift-project {
        flex: 1 1 auto;
        min-width: 0;
        line-height: 1.2;
    }

    #employeeCardModal .history-entry .shift-summary {
        width: auto;
        flex: 0 0 auto;
        justify-content: flex-end;
        gap: 0.4rem;
    }

    #employeeCardModal .history-entry .shift-paid-badge,
    #employeeCardModal .history-entry .shift-open-badge {
        font-size: 9px;
        padding: 0.12rem 0.28rem;
    }
}

@media (max-width: 480px) {
    #employeeCardModal .history-entry .collapsible-header {
        padding: 0.4rem 0.4rem;
        gap: 0.3rem;
    }

    #employeeCardModal .history-entry .collapsible-content {
        padding: 0.2rem 0.4rem 0.4rem;
    }

    #employeeCardModal .history-entry-header-main {
        gap: 0.3rem;
    }

    #employeeCardModal .history-entry .history-entry-header-left,
    #employeeCardModal .history-entry .shift-summary {
        gap: 0.28rem;
    }
}

@media (max-width: 480px) {
    #archivedReportsModal .modal-body {
        padding-left: 0.65rem;
        padding-right: 0.65rem;
    }

    #archivedReportsModal .history-entry .collapsible-header {
        padding: 0.4rem 0.4rem;
        gap: 0.3rem;
    }

    #archivedReportsModal .history-entry .collapsible-content {
        padding: 0.2rem 0.4rem 0.4rem;
    }

    #archivedReportsModal .history-entry-header-main {
        gap: 0.3rem;
    }

    #archivedReportsModal .history-entry .history-entry-header-left {
        gap: 0.28rem;
    }

    #archivedReportsModal .history-entry .shift-summary {
        gap: 0.28rem;
    }

    #archivedReportsModal .history-entry .shift-date-line > span:first-child {
        font-size: var(--font-size-tertiary);
    }
}

/* Input with Prefix (for hourly rate) */
/* Input with Prefix - iOS Style */
.input-with-prefix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    font-weight: var(--font-weight-semibold);
    font-size: 0.9375rem;
    pointer-events: none;
    z-index: 1;
}

/* iPad: Better prefix positioning */
@media (min-width: 768px) {
    .input-prefix {
        left: 1.125rem;
        font-size: 1rem;
    }
}

.input-with-prefix input {
    padding-left: 2rem !important;
}

/* iPad: Enhanced padding */
@media (min-width: 768px) {
    .input-with-prefix input {
        padding-left: 2.25rem !important;
    }
}

/* Employee History Modal */
.history-summary {
    display: flex;
    justify-content: space-between;
    background: var(--bg-primary);
    padding: 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    gap: 20px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.summary-label {
    font-size: var(--font-size-base);
    color: var(--text-muted);
    font-weight: var(--font-weight-semibold);
    text-align: center;
}

.summary-value {
    font-size: var(--font-size-default);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    text-align: center;
}

.history-section h4 {
    font-size: var(--font-size-default);
    color: var(--text-primary);
    margin-bottom: 15px;
    font-weight: var(--font-weight-semibold);
}

.history-list {
    padding-right: 8px;
}

.history-calendar-section {
    margin: 10px 0 12px;
    padding: 10px;
    border: none;
    border-radius: 12px;
    background: transparent;
}

.history-calendar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.history-calendar-mode {
    display: inline-flex;
    background: var(--bg-tertiary);
    border-radius: 2px;
    padding: 2px;
    gap: 2px;
}

.history-calendar-mode-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    padding: 4px 8px;
    border-radius: 2px;
    cursor: pointer;
}

.history-calendar-mode-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
}

.history-calendar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-tertiary);
    color: var(--text-primary);
    font-weight: var(--font-weight-medium);
}

.history-calendar-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 6px 10px;
    box-sizing: border-box;
    border-radius: 2px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
}

.history-calendar-nav-btn i {
    font-size: var(--font-size-secondaryallest);
    width: 1em;
    height: 1em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.history-calendar-nav #historyCalendarLabel,
.history-calendar-nav #payrollMonthLabel {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    line-height: 1.2;
}

@media (hover: hover) and (pointer: fine) {
    .history-calendar-nav-btn:hover {
        background: transparent;
        border-color: var(--border-color);
        color: var(--text-primary);
    }
}

.history-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.history-calendar-cell {
    text-align: center;
}

.history-calendar-header {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    font-weight: var(--font-weight-semibold);
    padding: 2px 0;
}

.history-calendar-day {
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: var(--bg-card);
    color: var(--text-primary);
    min-height: 30px;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.history-calendar-day.active-day:not(.has-unpaid-labor) {
    background: color-mix(in srgb, var(--text-muted) 12%, var(--bg-card) 88%);
    border-color: color-mix(in srgb, var(--text-muted) 25%, var(--border-color) 75%);
}

.history-calendar-day.has-unpaid-labor {
    background: color-mix(in srgb, var(--accent-yellow) 20%, var(--bg-card) 80%);
    border-color: color-mix(in srgb, var(--accent-yellow) 35%, var(--border-color) 65%);
}

.history-calendar-day.selected-day {
    outline: 1px solid var(--accent-green);
    background: color-mix(in srgb, var(--accent-green) 28%, var(--bg-card) 72%);
    border-color: color-mix(in srgb, var(--accent-green) 45%, var(--border-color) 55%);
}

.history-calendar-day.today {
    box-shadow: inset 0 0 0 1px var(--accent-green);
}

.history-calendar-day.outside-month {
    opacity: 0.55;
}

.history-calendar-clear-btn {
    grid-column: 1 / -1;
    border: none;
    background: transparent;
    color: var(--accent-blue);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    padding-top: 4px;
    cursor: pointer;
}

.history-entry {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 4px;
    border: 1px solid var(--border-color);
    gap: 6px;
}

.history-entry-header-main {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: nowrap;
    min-width: 0;
    width: 100%;
}

.history-entry-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    flex: 1 1 auto;
}

.shift-project {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.shift-project--empty {
    font-style: italic;
    opacity: 0.75;
}

.shift-project-detail {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: var(--font-size-tertiary);
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.shift-project-detail i {
    color: var(--text-muted);
    width: 14px;
    text-align: center;
}

.history-date {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    min-width: 0;
    text-align: left;
}

.history-shift {
    flex: 1;
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
}

.shift-times {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

.shift-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.shift-reason {
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.shift-hours {
    color: var(--text-secondary);
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-medium);
}

.shift-pay {
    color: var(--accent-green);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
}

.shift-date-line {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
}

.shift-open-badge {
    font-size: var(--font-size-tertiary);
    color: var(--accent-green);
    font-weight: var(--font-weight-semibold);
}

.shift-paid-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    color: var(--text-muted);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    padding: 0.2rem 0.35rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    background: var(--bg-tertiary, var(--bg-card));
}

.history-entry.is-paid .shift-pay {
    color: var(--text-muted);
}

.shift-multiday-badge {
    font-size: var(--font-size-tertiary);
    color: var(--status-upcoming, #63b3ed);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
}

.shift-events-list {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shift-event-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.shift-event-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.shift-event-left i {
    font-size: 0.9rem;
    color: var(--text-muted);
    width: 14px;
    text-align: center;
}

.shift-event-label {
    font-size: var(--font-size-tertiary);
    color: var(--text-primary);
    font-weight: var(--font-weight-medium);
}

.shift-event-time {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    white-space: nowrap;
}

.event-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.event-action {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.event-time {
    font-size: var(--font-size-base);
    color: var(--text-muted);
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
}

.history-empty i {
    color: var(--text-muted);
}

/* Mobile responsiveness for history modal */
@media (max-width: 768px) {
    .history-summary {
        flex-direction: column;
        gap: 12px;
    }
    
    .summary-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .history-entry {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .history-date {
        min-width: auto;
        text-align: left;
        font-size: var(--font-size-base);
    }
    
    .history-shift {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .shift-summary {
        width: 100%;
        justify-content: flex-start;
    }
    
}

/* Desktop enhancements for labor tracker */
@media (min-width: 768px) {
    #laborView .content-panel {
        padding: 25px;
        margin: 0 auto;
    }
    
    #laborView .view-title {
        margin-bottom: 25px;
    }
    
    /* Tablet: Slightly larger buttons and text */
    .btn-clock-main i {
        font-size: var(--font-size-special);
    }
    
    .btn-clock-main span {
        font-size: var(--font-size-tertiary);
    }
    
    /* Removed - handled by main styles */
    
    .report-buttons {
        flex-direction: row;
    }
    
    .btn-report-action {
        flex: 1;
    }
}

/* Extra small mobile (iPhone SE, etc) */
@media (max-width: 375px) {
    .labor-tab {
        padding: 12px 8px;
        font-size: var(--font-size-tertiary);
        min-height: 65px;
    }
    
    .labor-tab i {
        font-size: var(--font-size-default);
    }
    
    /* Small mobile optimizations */
    .employee-name {
        font-size: var(--font-size-tertiary);
    }
    
    .employee-details {
        font-size: var(--font-size-tertiary);
    }
    
    .employee-stats {
        gap: 6px;
    }
    
    .employee-hours,
    .employee-earnings {
        font-size: var(--font-size-tertiary);
    }
    
    .employee-main-actions {
        min-width: 80px;
        padding: 0;
    }
    
    .btn-clock-main {
        min-width: 80px;
        min-height: 72px;
        font-size: var(--font-size-tertiary);
    }
    
    .btn-clock-main i {
        font-size: 1.2rem;
    }
    
    .btn-clock-main span {
        font-size: var(--font-size-tertiary);
    }
    
    .btn-menu-toggle {
        width: 40px;
        height: 40px;
        font-size: var(--font-size-base);
    }
    
    .employee-dropdown-menu {
        top: 44px;
        min-width: 160px;
    }
    
    .employee-dropdown-menu .menu-item {
        padding: 14px 18px;
        font-size: var(--font-size-secondary);
    }
    
    /* Removed - handled by main styles */
}

/* ========================================
   FLOATING BOTTOM MENU (NEW)
   ======================================== */

/* Floating Bottom Menu Container */
.floating-bottom-menu {
    position: fixed;
    bottom: calc(6px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: min(600px, calc(100vw - 40px));
    max-width: 600px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    height: 56px;
    background: rgb(148 163 184 / 14%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    z-index: 1000;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

body.light-theme .floating-bottom-menu {
    background: rgb(148 163 184 / 14%);
    border: 1px solid rgba(15, 23, 42, 0.1);
}

/* Morphing Background Shape - Performance Optimized */
.menu-background-shape {
    position: absolute;
    height: 44px;
    background: var(--accent-green);
    border-radius: 22px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* Optimized transitions - only animate essential properties */
    transition: 
        left 0.25s ease-out,
        width 0.25s ease-out;
    /* Enable hardware acceleration */
    will-change: left, width;
    /* Force GPU layer */
    transform: translateY(-50%) translateZ(0);
}

/* Sausage stretch state during transition - Performance Optimized */
.menu-background-shape.stretching {
    transition: 
        left 0.15s ease-out,
        width 0.15s ease-out;
    will-change: left, width;
}

body.light-theme .menu-background-shape {
    background: var(--accent-green);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Removed expensive hover effects for better performance */

/* Menu Buttons */
.floating-bottom-menu .menu-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s cubic-bezier(0.4, 0.0, 0.6, 1);
    position: relative;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    z-index: 1;
    opacity: 0.9;
}

.floating-bottom-menu .menu-btn i {
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-bottom-menu .menu-btn:active {
    transform: none;
    transition: all 0.1s ease-out;
}

.floating-bottom-menu .menu-btn.active {
    color: #86efac;
    font-size: 18px;  /* Keep same size as inactive */
    transform: none;   /* Remove scale effect */
    opacity: 1;
    transition: color 0.2s ease, opacity 0.2s ease;
}

body.light-theme .floating-bottom-menu .menu-btn {
    color: #000000;
    opacity: 0.85;
}

body.light-theme .floating-bottom-menu .menu-btn.active {
    color: #059669;
    opacity: 1;
}

/* Center button (Dashboard/Plus) - smooth icon crossfade */
.floating-bottom-menu .menu-btn.center-btn {
    font-size: var(--font-size-special);
}

.floating-bottom-menu .center-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
}

.floating-bottom-menu .center-icon-wrap i {
    position: absolute;
    transition: opacity 0.25s ease;
}

.floating-bottom-menu .center-btn.plus-mode .center-icon-plus {
    opacity: 1;
}
.floating-bottom-menu .center-btn.plus-mode .center-icon-home {
    opacity: 0;
    pointer-events: none;
}
.floating-bottom-menu .center-btn:not(.plus-mode) .center-icon-plus {
    opacity: 0;
    pointer-events: none;
}
.floating-bottom-menu .center-btn:not(.plus-mode) .center-icon-home {
    opacity: 1;
}

/* Home icon - stays same size when active */
.floating-bottom-menu .menu-btn.center-btn.active .center-icon-home {
    font-size: var(--font-size-special);
}

/* Plus icon - gets smaller when active */
.floating-bottom-menu .menu-btn.center-btn.active .center-icon-plus {
    font-size: 18px;
}

.floating-bottom-menu .menu-btn.center-btn:active {
    transform: none;
    transition: all 0.1s ease-out;
}

.floating-bottom-menu .menu-btn.center-btn.active:active {
    transform: none;
    transition: all 0.1s ease-out;
}

.floating-bottom-menu .center-btn .center-icon-wrap i {
    transition: opacity 0.25s ease;
}

/* Notification badge */
.floating-bottom-menu .notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ef4444;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: none;
    pointer-events: none;
    transition: all 0.15s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.floating-bottom-menu .menu-btn.active .notification-badge {
    top: 2px;
    right: 2px;
    transform: none;  /* Remove scale effect */
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.6, 1);
}

/* User flow "New" badge on floating bottom menu */
.floating-bottom-menu .user-flow-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    margin-left: 0;
    padding: 0.15rem 0.35rem;
    font-size: 0.5625rem;
    border-radius: 4px;
}
.floating-bottom-menu .menu-btn.active .user-flow-badge.visible {
    background: rgba(255,255,255,0.35);
    color: #fff;
}

/* Remove scale effects for labor button only */
.floating-bottom-menu .menu-btn.labor-btn:active {
    transform: none;
    transition: all 0.1s ease-out;
}

.floating-bottom-menu .menu-btn.labor-btn.active {
    color: #86efac;
    font-size: 18px;  /* Same as inactive on mobile */
    transform: none;  /* Remove scale(1.1) */
    opacity: 1;
    transition: color 0.2s ease, opacity 0.2s ease;
}

/* Light theme - remove scale effects for labor button */
body.light-theme .floating-bottom-menu .menu-btn.labor-btn:active {
    transform: none;
}

body.light-theme .floating-bottom-menu .menu-btn.labor-btn.active {
    color: #059669;
    font-size: 18px;  /* Same as inactive on mobile */
    transform: none;  /* Remove scale(1.1) */
    opacity: 1;
}

/* Hide old floating button if it still exists */
.floating-add-btn {
    display: none !important;
}

/* iPad and larger screens - Make floating menu bigger */
@media (min-width: 769px) {
    .floating-bottom-menu .menu-btn {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
    
    .floating-bottom-menu .menu-btn.center-btn {
        font-size: 28px;
    }
    
    .floating-bottom-menu .menu-btn.center-btn.active .center-icon-home {
        font-size: 28px;
    }
    
    .floating-bottom-menu .menu-btn.center-btn.active .center-icon-plus {
        font-size: 22px;
    }
    
    .floating-bottom-menu .menu-btn.active {
        font-size: 22px;
    }
    
    /* Labor button specific for iPad */
    .floating-bottom-menu .menu-btn.labor-btn {
        font-size: 22px;
    }
    
    .floating-bottom-menu .menu-btn.labor-btn.active {
        font-size: 22px;
    }
    
    body.light-theme .floating-bottom-menu .menu-btn.labor-btn.active {
        font-size: 22px;
    }
    
    .floating-bottom-menu {
        height: 64px;
        padding: 0 12px;
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Floating Bottom Menu - Reduce bottom distance on mobile */
    .floating-bottom-menu {
        bottom: 0px;
        margin-bottom: env(safe-area-inset-bottom);
    }
    
    /* Settings Cards Mobile */
    .settings-card-header {
        padding: 1rem;
        gap: 0.75rem;
        /* Keep flex-direction: row to keep toggles side-by-side */
    }
    
    .settings-card-info {
        flex: 1;
        min-width: 0; /* Allow text to wrap */
    }
    
    .settings-card-text h4,
    .settings-card-text p {
        font-size: var(--font-size-tertiary);
    }
    
    .setting-btn {
        padding: 0.5rem 0.85rem;
        font-size: var(--font-size-tertiary);
    }
    
    .toggle-switch {
        flex-shrink: 0;
    }
    
    .settings-category-title {
        font-size: var(--font-size-tertiary);
    }
    
    #settingsView .settings-category-title > span > i:first-child,
    #settingsView .settings-card-info > i,
    .settings-card-info i {
        font-size: var(--font-size-default);
    }
}

@media (max-width: 480px) {
    .settings-card-header {
        padding: 1rem;
    }
    
    .settings-card-info {
        gap: 0.75rem;
    }
}

/* Light theme - white text & icons on colored job site items */
body.light-theme .job-site-item.in-progress,
body.light-theme .job-site-item.upcoming,
body.light-theme .job-site-item.on-hold,
body.light-theme .job-site-item.completed {
    color: #ffffff !important;
}

body.light-theme .job-site-item.in-progress .job-site-name,
body.light-theme .job-site-item.in-progress .job-site-client,
body.light-theme .job-site-item.in-progress .job-site-address,
body.light-theme .job-site-item.in-progress .job-site-description,
body.light-theme .job-site-item.in-progress .status-badge,
body.light-theme .job-site-item.in-progress i,
body.light-theme .job-site-item.upcoming .job-site-name,
body.light-theme .job-site-item.upcoming .job-site-client,
body.light-theme .job-site-item.upcoming .job-site-address,
body.light-theme .job-site-item.upcoming .job-site-description,
body.light-theme .job-site-item.upcoming .status-badge,
body.light-theme .job-site-item.upcoming i,
body.light-theme .job-site-item.on-hold .job-site-name,
body.light-theme .job-site-item.on-hold .job-site-client,
body.light-theme .job-site-item.on-hold .job-site-address,
body.light-theme .job-site-item.on-hold .job-site-description,
body.light-theme .job-site-item.on-hold .status-badge,
body.light-theme .job-site-item.on-hold i,
body.light-theme .job-site-item.completed .job-site-name,
body.light-theme .job-site-item.completed .job-site-client,
body.light-theme .job-site-item.completed .job-site-address,
body.light-theme .job-site-item.completed .job-site-description,
body.light-theme .job-site-item.completed .status-badge,
body.light-theme .job-site-item.completed i {
    color: #ffffff !important;
}

/* Status cards white text (both themes) */
.status-card.upcoming,
.status-card.on-hold,
.status-card.completed {
    color: #ffffff !important;
}

.status-card.upcoming .status-count,
.status-card.upcoming .status-label,
.status-card.on-hold .status-count,
.status-card.on-hold .status-label,
.status-card.completed .status-count,
.status-card.completed .status-label {
    color: #ffffff !important;
}


/* ============================================
   SPLASH SCREEN
   ============================================ */

.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* Always white so launch matches native splash and looks same in light/dark theme */
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20000 !important; /* Higher than auth modal */
    opacity: 1;
    transition: opacity 0.5s ease-out;
    
    /* Make completely non-interactive */
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.splash-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Language Switching Overlay */
.language-switching-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.94);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.language-switching-overlay.active {
    display: flex;
    opacity: 1;
}

.language-switch-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem;
    animation: scaleIn 0.3s ease-out;
}

.language-switch-icon {
    font-size: 4.5rem;
    color: #4ade80;
    animation: pulse 1.5s ease-in-out infinite;
}

.language-switch-text h3 {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    text-align: center;
    letter-spacing: 0.5px;
}

/* Loading circles for language switch - override default styles */
.language-switching-overlay .loading-circles {
    opacity: 1;
    animation: none;
    transform: translateY(0);
    margin-top: 0.5rem;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.splash-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 20px;
    
    /* Make non-interactive */
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    transform: translateY(30px);
    animation: slideInUp 1s ease-out 0.5s forwards;
}

@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.splash-icon {
    width: 80px;
    height: 80px;
    border-radius: 18px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    
    /* Make non-interactive */
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.splash-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    flex: 1;
}

.splash-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 18px;
}

.app-title {
    font-family: var(--font-family-sans);
    font-size: 2.2rem;
    font-weight: var(--font-weight-semibold);
    margin: 0;
    color: #4a5568;
    letter-spacing: -0.5px;
    text-align: left;
    line-height: 1.2;
    
    /* Make non-interactive */
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.rotating-subtitle {
    font-family: var(--font-family-sans);
    font-size: 0.95rem;
    font-weight: var(--font-weight-regular);
    color: #718096;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    height: 1.5rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    margin-top: 4px;
    
    /* Make non-interactive */
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.subtitle-word {
    position: absolute;
    left: 0;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.subtitle-word.active {
    opacity: 1;
    transform: translateY(0);
}

.loading-circles {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 0;
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
    animation: slideInUp 0.8s ease-out 1.2s forwards;
    
    /* Make non-interactive */
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.loading-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite both;
    
    /* Make non-interactive */
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.circle-1 {
    background: #4ade80; /* Mint green */
    animation-delay: 0s;
}

.circle-2 {
    background: #f87171; /* Coral pink */
    animation-delay: 0.3s;
}

.circle-3 {
    background: #fb923c; /* Warm orange */
    animation-delay: 0.6s;
}

/* Shared skeleton primitives (financial overview cards still use these) */
.skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.skeleton-line {
    height: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.skeleton-line.title {
    width: 60%;
    height: 1.3rem;
}

.skeleton-line.address {
    width: 70%;
    height: 0.9rem;
}

@keyframes skeletonShimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

@keyframes skeletonPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Job Card Skeleton Loader (financial view) */
.skeleton-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    min-height: 100px;
    position: relative;
    overflow: hidden;
}

.skeleton-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: transparent;
    animation: skeletonShimmer 1.5s infinite;
}

.skeleton-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.625rem;
    gap: 0.75rem;
}

.skeleton-card-header .skeleton-line.title {
    width: 55%;
    height: 1.1rem;
    margin-bottom: 0.5rem;
}

.skeleton-card-header .skeleton-line.address {
    width: 75%;
    height: 0.85rem;
}

.skeleton-card-amount {
    width: 70px;
    height: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.skeleton-card-progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.skeleton-card-stats {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.skeleton-card-stat {
    flex: 1;
    height: 2.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

@media (min-width: 768px) {
    .skeleton-card {
        padding: 1.25rem;
        border-radius: 16px;
        margin-bottom: 0;
    }
}

@media (max-width: 480px) {
    .skeleton-card {
        padding: 0.875rem;
        border-radius: 12px;
    }
}

/* Light theme: skeleton placeholders visible on light background */
body.light-theme .skeleton-line {
    background: rgba(0, 0, 0, 0.08);
}

body.light-theme .skeleton-card {
    background: var(--bg-card);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .skeleton-card::before {
    background: transparent;
}

body.light-theme .skeleton-card-amount,
body.light-theme .skeleton-card-progress,
body.light-theme .skeleton-card-stat {
    background: rgba(0, 0, 0, 0.08);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .splash-icon {
        width: 70px;
        height: 70px;
    }
    
    .app-title {
        font-size: var(--font-size-special);
    }
    
    .rotating-subtitle {
        font-size: var(--font-size-tertiary);
    }
}

/* Save Photo Options Modal - Must be above canvas (z-index 20001) */
.save-photo-modal {
    z-index: 25000 !important;
    justify-content: center !important;
    align-items: center !important;
    background: rgba(0, 0, 0, 0.85) !important;
}

.save-photo-modal .modal-content {
    max-width: 480px;
    width: 90%;
    border-radius: 20px;
    height: fit-content;
    align-self: center;
    max-height: 85vh;
    background-color: var(--glass-bg-dark);
    border: none;
}

body.light-theme .save-photo-modal .modal-content {
    background-color: #ffffff;
}

.save-photo-modal .modal-body {
    padding: 1.5rem;
}

.save-photo-modal .modal-body p {
    font-size: var(--font-size-tertiary);
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.save-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.save-option {
    display: block;
    cursor: pointer;
    position: relative;
}

.save-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
.save-option:hover .option-content {
    transform: translateY(-3px);
    border-color: var(--accent-primary);
}
}


.save-option input[type="radio"]:checked + .option-content {
    background: var(--accent-green);
    border-color: var(--accent-primary);
}

.option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: var(--bg-secondary);
    border-radius: 12px;
    font-size: var(--font-size-default);
    color: var(--text-icons);
    transition: all 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
.save-option:hover .option-icon {
    transform: scale(1.1);
}
}


.save-option input[type="radio"]:checked + .option-content .option-icon {
    background: #1a202c;
    color: var(--accent-primary);
}

.option-text {
    flex: 1;
}

.option-title {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-tertiary);
    color: var(--text-primary);
    margin-bottom: 6px;
}

.save-option input[type="radio"]:checked + .option-content .option-title {
    color: #1a202c;
}

.option-description {
    font-size: var(--font-size-tertiary);
    color: var(--text-secondary);
}

.save-option input[type="radio"]:checked + .option-content .option-description {
    color: #2d3748;
}

.option-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 10px;
    background: var(--accent-success);
    color: #1a202c;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.option-check {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--border-color);
    transition: all 0.3s ease;
}

.save-option input[type="radio"]:checked + .option-content .option-check {
    color: #1a202c;
    transform: scale(1.2);
}

.save-photo-modal .modal-footer {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.5rem;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
    border-top: 1px solid var(--border-color);
}

.save-photo-modal .modal-footer .btn {
    flex: 1;
    padding: 1rem 1.5rem;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .save-photo-modal .modal-content {
        width: 95%;
        max-width: none;
    }
    
    .option-content {
        padding: 1.25rem;
        gap: 0.875rem;
    }
    
    .option-icon {
        width: 42px;
        height: 42px;
        min-width: 42px;
        font-size: 1.2rem;
    }
    
    .option-title {
        font-size: var(--font-size-base);
    }
    
    .option-description {
        font-size: var(--font-size-secondary);
    }
    
    .save-photo-modal .modal-footer .btn {
        padding: 0.875rem 1rem;
    }
}



/* Quick Actions Menu - CSS transitions */
.quick-actions-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 100000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    visibility: hidden;
    -webkit-transition: visibility 0s 0.35s;
    transition: visibility 0s 0.35s;
}

.quick-actions-overlay.active,
.quick-actions-overlay.quick-actions-closing {
    visibility: visible;
}

.quick-actions-overlay.active {
    background: rgba(0, 0, 0, 0.5);
    -webkit-transition: background 0.3s ease;
    transition: background 0.3s ease;
}

.quick-actions-overlay.quick-actions-closing {
    background: rgba(0, 0, 0, 0);
    -webkit-transition: background 0.3s ease, visibility 0s 0.35s;
    transition: background 0.3s ease, visibility 0s 0.35s;
}

.quick-actions-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Explicit sans stack: overlay was historically outside <body> on some builds */
.quick-actions-overlay {
    font-family: var(--font-family-sans);
}

.quick-actions-sheet {
    width: 100%;
    max-width: 500px;
    background: var(--bg-card);
    border-radius: var(--card-radius) var(--card-radius) 0 0;
    padding: 0;
    -webkit-transform: translateY(100%);
    transform: translateY(100%);
    -webkit-transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80vh;
    overflow-y: auto;
    z-index: 100001;
}

.quick-actions-overlay.active .quick-actions-sheet {
    -webkit-transform: translateY(0);
    transform: translateY(0);
}

.quick-actions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    height: 38px;
    min-height: 38px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
}

.quick-actions-header h3 {
    margin: 0;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    line-height: 1.25;
}

.quick-actions-header button {
    width: 28px;
    height: 28px;
    border-radius: 2px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: var(--font-size-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.15s ease;
    min-width: 28px;
    min-height: 28px;
}

@media (hover: hover) and (pointer: fine) {
.quick-actions-header button:hover {
    background: var(--finance-track, var(--bg-tertiary));
    color: var(--text-primary);
}
}


.quick-actions-body {
    padding: 0.75rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

/* Quick Actions Trigger Button - reference layout (detail modal) */
#quickActionsBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.quick-action-btn {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.625rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    color: var(--text-muted);
    font-family: var(--font-family-sans);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: background-color 0.2s ease;
    min-height: 64px;
    text-align: center;
    box-sizing: border-box;
}

@media (hover: hover) and (pointer: fine) {
.quick-action-btn:hover,
.quick-action-btn:active {
    background: var(--finance-track, var(--bg-tertiary));
    color: var(--text-primary);
}
}


.quick-action-btn i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-default);
    width: auto;
    flex-shrink: 0;
    color: var(--accent-green);
    line-height: 1;
}

.quick-action-btn span {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
    word-break: break-word;
    display: block;
    color: inherit;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .quick-actions-header {
        padding: 0.625rem 0.75rem;
        height: 38px;
        min-height: 38px;
    }
    
    .quick-actions-header h3 {
        font-size: var(--font-size-tertiary);
    }
    
    .quick-actions-header button {
        width: 28px;
        height: 28px;
        font-size: var(--font-size-tertiary);
        min-width: 28px;
        min-height: 28px;
        border-radius: 2px;
    }
    
    .quick-actions-body {
        padding: 0.75rem;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .quick-action-btn {
        padding: 0.625rem 0.375rem;
        min-height: 64px;
        gap: 0.35rem;
        border-radius: 2px;
    }
    
    .quick-action-btn i {
        display: inline-flex;
        font-size: var(--font-size-base);
    }
    
    .quick-action-btn span {
        font-size: var(--font-size-tertiary);
        line-height: 1.15;
    }
}

/* ================================================
   ANNOUNCEMENTS / NEWS & UPDATES VIEW
   ================================================ */

.announcements-container {
    padding: 0.5rem 0;
}

.announcements-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    color: var(--text-secondary);
    gap: 1rem;
}

.announcements-loading i {
    font-size: 1.5rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

.announcements-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    text-align: center;
}

.announcements-empty i {
    font-size: 2.5rem;
    color: var(--text-secondary);
    opacity: 0.4;
    margin-bottom: 1rem;
}

.announcements-empty h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-default);
}

.announcements-empty p {
    color: var(--text-secondary);
    max-width: 260px;
    font-size: var(--font-size-secondary);
    opacity: 0.8;
}

.announcements-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Individual Announcement Card - Clean minimal style */
.announcement-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    border: none;
    transition: background 0.15s ease;
    position: relative;
}

.announcement-card:active {
    background: var(--bg-tertiary);
}

/* Type indicator - subtle left accent */
.announcement-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    border-radius: 0 3px 3px 0;
    opacity: 0.8;
}

.announcement-card.type-news::before {
    background: #3b82f6;
}

.announcement-card.type-update::before {
    background: #8b5cf6;
}

.announcement-card.type-alert::before {
    background: #f59e0b;
}

.announcement-card.type-maintenance::before {
    background: #6b7280;
}

.announcement-card.type-feature::before {
    background: #10b981;
}

.announcement-card-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 0.5rem;
}

/* Icon - smaller and cleaner */
.announcement-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.announcement-card.type-news .announcement-icon {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}

.announcement-card.type-update .announcement-icon {
    background: rgba(139, 92, 246, 0.12);
    color: #8b5cf6;
}

.announcement-card.type-alert .announcement-icon {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.announcement-card.type-maintenance .announcement-icon {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
}

.announcement-card.type-feature .announcement-icon {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.announcement-card-title {
    flex: 1;
    min-width: 0;
}

.announcement-card-title h4 {
    font-size: var(--font-size-secondary);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.announcement-card-title .announcement-date {
    font-size: var(--font-size-tertiary);
    color: var(--text-secondary);
    opacity: 0.7;
}

.announcement-card-body {
    padding-left: calc(36px + 0.875rem);
}

.announcement-card-body p {
    color: var(--text-secondary);
    font-size: var(--font-size-tertiary);
    line-height: 1.5;
    margin: 0 0 0.875rem 0;
}

.announcement-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.announcement-card-actions .btn-primary {
    padding: 0.5rem 0.875rem;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: opacity 0.15s ease;
}

.announcement-card-actions .btn-primary:active {
    opacity: 0.8;
}

.announcement-card-actions .btn-dismiss {
    padding: 0.5rem 0.875rem;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: color 0.15s ease;
}

.announcement-card-actions .btn-dismiss:active {
    color: var(--text-primary);
}

/* Priority - subtle indicators */
.announcement-card.priority-high::before {
    height: 32px;
}

.announcement-card.priority-urgent::before {
    height: 100%;
    top: 0;
    transform: none;
    border-radius: 0;
    background: #ef4444;
}

/* Announcements Actions Footer */
.announcements-actions {
    display: flex;
    justify-content: center;
    padding: 1.5rem 1rem;
    margin-top: 0.5rem;
}

.announcements-actions .btn-secondary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-medium);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.announcements-actions .btn-secondary:active {
    background: var(--bg-tertiary);
}

/* Light theme */
body.light-theme .announcement-card {
    background: rgba(0, 0, 0, 0.03);
}

body.light-theme .announcement-card:active {
    background: rgba(0, 0, 0, 0.06);
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .announcement-card {
        padding: 0.875rem 1rem;
    }
    
    .announcement-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 0.875rem;
    }
    
    .announcement-card-body {
        padding-left: calc(32px + 0.875rem);
    }
}

/* ============================================
   iOS GPU Performance Optimizations
   ============================================ */
@supports (-webkit-touch-callout: none) {
    /* Side menu: solid panel so slide runs at 60fps */
    .side-menu {
        background-color: rgba(31, 41, 55, 0.97) !important;
    }
    body.light-theme .side-menu {
        background-color: #ffffff !important;
    }
    
    /* Disable continuous animations on iOS */
    .pulse,
    [class*="pulse"] {
        animation: none !important;
    }
    /* Exception: task summary donut pulse is one-shot, not continuous */
    .task-summary-chart.donut-pulse {
        -webkit-animation: donut-pulse 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
        animation: donut-pulse 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    }
    
    /* Reduce will-change usage (iOS handles these poorly) */
    * {
        will-change: auto !important;
    }
    
    /* Limit "transition: all" - only allow specific properties (exclude donut arcs, checklist checkbox + particles). */
    *:not(.modal):not(.modal-content):not(.side-menu):not(.donut-segment):not(.checklist-checkbox):not(.subtask-particle) {
        transition-property: opacity, transform, background-color !important;
        transition-duration: 0.15s !important;
    }
    /* Exception: side menu - GPU layer + full -webkit- prefix (Capacitor iOS guide).
       Do not apply when desktop rail is active: that mode keeps the menu visible without .active,
       and these !important rules would otherwise pin the panel off-screen on iPad Safari. */
    body:not(.desktop-side-menu-mode) .side-menu {
        -webkit-transform: translateX(-100%) translateZ(0) !important;
        transform: translateX(-100%) translateZ(0) !important;
        -webkit-transition: -webkit-transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        will-change: transform !important;
        -webkit-backface-visibility: hidden !important;
        backface-visibility: hidden !important;
    }
    body:not(.desktop-side-menu-mode) .side-menu.active {
        -webkit-transform: translateX(0) translateZ(0) !important;
        transform: translateX(0) translateZ(0) !important;
    }
    /* Exception: task summary donut segments animate arc length/position */
    .donut-segment {
        transition-property: stroke-dasharray, stroke-dashoffset !important;
        transition-duration: 0.6s !important;
        transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    /* Task checkbox (list): keep border/background transitions under clamp */
    .task-checkbox,
    .task-checkbox::after {
        transition-property: opacity, transform, background-color, border-color !important;
        transition-duration: 0.2s !important;
        transition-timing-function: ease !important;
    }
    /* Checklist checkbox: border fill + checkmark stroke-dash + keyframe spring/particles (must beat * clamp on path) */
    .checklist-checkbox {
        -webkit-transition-property: border-color, background, background-color, border-width, box-shadow, opacity, transform !important;
        transition-property: border-color, background, background-color, border-width, box-shadow, opacity, transform !important;
        -webkit-transition-duration: 0.25s !important;
        transition-duration: 0.25s !important;
        -webkit-transition-timing-function: ease !important;
        transition-timing-function: ease !important;
    }
    .checklist-checkbox .checkmark path {
        -webkit-transition-property: stroke-dashoffset !important;
        transition-property: stroke-dashoffset !important;
        -webkit-transition-duration: 0.28s !important;
        transition-duration: 0.28s !important;
        -webkit-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;
        transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;
        -webkit-transition-delay: 0s !important;
        transition-delay: 0s !important;
    }
    .checklist-checkbox.checked .checkmark path {
        -webkit-transition-delay: 0.08s !important;
        transition-delay: 0.08s !important;
    }
    .checklist-checkbox.checked.animating {
        will-change: transform !important;
        -webkit-animation: subtask-springBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
        animation: subtask-springBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    }
    .checklist-checkbox.checked.animating .subtask-particle {
        will-change: transform, opacity !important;
        -webkit-animation: subtask-particleBurst 0.55s cubic-bezier(0.22, 0.68, 0, 1) forwards !important;
        animation: subtask-particleBurst 0.55s cubic-bezier(0.22, 0.68, 0, 1) forwards !important;
    }
    /* Exception: task-details expand/collapse animated via JS in toggleTaskDetails */
    .task-details-panel.active .task-list {
        -webkit-transition: none !important;
        transition: none !important;
    }
    .task-details-header {
        -webkit-transition: background-color 0.2s ease !important;
        transition: background-color 0.2s ease !important;
    }
    /* Exception: list-group expand/collapse animated via JS in toggleListGroup */
    .list-task-items {
        -webkit-transition: none !important;
        transition: none !important;
    }
    .list-group-header {
        -webkit-transition: background-color 0.2s ease !important;
        transition: background-color 0.2s ease !important;
    }
    /* Exception: photo viewer open/close fade + scale animation */
    .photo-viewer {
        -webkit-transition: opacity 0.3s ease, visibility 0s linear 0.3s, -webkit-transform 0.3s ease !important;
        transition: opacity 0.3s ease, visibility 0s linear 0.3s, transform 0.3s ease !important;
    }
    .photo-viewer.active {
        -webkit-transition: opacity 0.3s ease, visibility 0s linear 0s, -webkit-transform 0.3s ease !important;
        transition: opacity 0.3s ease, visibility 0s linear 0s, transform 0.3s ease !important;
    }
    /* Modal ::before disabled — single backdrop via JS backgroundColor (see _animateModalBackdrop). */
    body.platform-ios .modal::before,
    body:not(.platform-ios) .modal::before,
    #jobSiteDetailModal::before {
        opacity: 0 !important;
        -webkit-transition: none !important;
        transition: none !important;
        will-change: auto !important;
    }
    body:not(.platform-ios) .modal-content,
    body:not(.platform-ios) .modal-content.large {
        will-change: transform !important;
        -webkit-backface-visibility: hidden !important;
        backface-visibility: hidden !important;
    }
    body.platform-ios .modal-content,
    body.platform-ios .modal-content.large {
        will-change: transform !important;
        -webkit-backface-visibility: hidden !important;
        backface-visibility: hidden !important;
    }
    body:not(.platform-ios) .modal.slide-in .modal-content,
    body:not(.platform-ios) .modal.slide-in-top .modal-content {
        -webkit-animation-duration: 0.32s !important;
        animation-duration: 0.32s !important;
        -webkit-animation-timing-function: cubic-bezier(0.32, 0.72, 0, 1) !important;
        animation-timing-function: cubic-bezier(0.32, 0.72, 0, 1) !important;
    }
    body:not(.platform-ios) .modal.slide-out .modal-content,
    body:not(.platform-ios) .modal.slide-out-top .modal-content {
        -webkit-animation-duration: 0.28s !important;
        animation-duration: 0.28s !important;
        -webkit-animation-timing-function: cubic-bezier(0.32, 0, 0.67, 0) !important;
        animation-timing-function: cubic-bezier(0.32, 0, 0.67, 0) !important;
    }
}

/* Task Summary Modal */
.task-summary-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    padding: var(--content-padding);
    width: 100%;
    position: relative;
}

/* Donut uses transform (rotate + pulse) — explicit layers so legend rows, checkboxes, and particles stay above the chart */
.task-summary-chart {
    position: relative;
    z-index: 0;
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
    isolation: isolate;
}

@-webkit-keyframes donut-pulse {
    0%, 100% {
        -webkit-transform: scale(1);
        transform: scale(1);
        opacity: 1;
    }
    50% {
        -webkit-transform: scale(1.08);
        transform: scale(1.08);
        opacity: 0.92;
    }
}
@keyframes donut-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.92;
    }
}

.task-summary-chart.donut-pulse {
    -webkit-animation: donut-pulse 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: donut-pulse 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.donut-chart {
    position: relative;
    z-index: 0;
    width: 100%;
    height: auto;
    transform: rotate(-90deg);
}

.donut-segment {
    stroke-dasharray: 502.65;
    stroke-dashoffset: 502.65;
    transition: stroke-dasharray 0.6s cubic-bezier(0.4, 0, 0.2, 1), stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.donut-bg {
    stroke: var(--bg-tertiary);
    stroke-dashoffset: 0;
}

.donut-overdue {
    stroke: #fc8181;
}

.donut-due-soon {
    stroke: #f6ad55;
}

.donut-upcoming {
    stroke: var(--accent-green);
}

.donut-completed {
    stroke: #38a169;
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.total-tasks-count {
    font-size: 44px;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
}

.total-tasks-label {
    font-size: var(--font-size-tertiary);
    color: var(--text-secondary);
    margin-top: 2px;
}

.task-summary-legend {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.legend-section {
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Expanded accordion paints above sections below (donut scale / compositing overlap on small screens) */
.legend-section:has(.legend-task-list.active) {
    z-index: 2;
}

/* Donut legend rows — flat sheet rows (matches Labor / ov-stat) */
.task-summary-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    box-shadow: inset 0.1875rem 0 0 var(--legend-item-accent, transparent);
}

.task-summary-legend .legend-section:nth-child(1) .legend-item {
    --legend-item-accent: var(--overdue-color, #fc8181);
}

.task-summary-legend .legend-section:nth-child(2) .legend-item {
    --legend-item-accent: var(--due-soon-color, #f6ad55);
}

.task-summary-legend .legend-section:nth-child(3) .legend-item {
    --legend-item-accent: var(--accent-green);
}

.task-summary-legend .legend-section:nth-child(4) .legend-item {
    --legend-item-accent: var(--completed-color, #38a169);
}

@media (hover: hover) and (pointer: fine) {
    .task-summary-legend .legend-item:hover {
        background: var(--finance-track, var(--bg-tertiary));
        transform: none;
    }
}

.task-summary-legend .legend-item:active {
    opacity: 0.92;
}

.task-summary-legend .legend-color {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 2px;
    flex-shrink: 0;
}

.overdue-color {
    background: var(--overdue-color, #fc8181);
}

.due-soon-color {
    background: var(--due-soon-color, #f6ad55);
}

.upcoming-color {
    background: var(--accent-green);
}

.completed-color {
    background: var(--completed-color, #38a169);
}

.task-summary-legend .legend-details {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex: 1;
    min-width: 0;
    gap: 0.5rem;
}

.task-summary-legend .legend-label {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    font-weight: var(--font-weight-semibold);
    flex: 1;
    min-width: 0;
    line-height: 1.25;
}

.task-summary-legend .legend-count {
    font-size: var(--font-size-tertiary);
    font-weight: var(--font-weight-semibold);
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    background: transparent;
    padding: 0;
    border-radius: 0;
    min-width: 0;
    text-align: right;
    line-height: 1.25;
}

.task-summary-legend .legend-chevron {
    font-size: var(--font-size-tertiary);
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

@media (hover: hover) and (pointer: fine) {
    .task-summary-legend .legend-item:hover .legend-label,
    .task-summary-legend .legend-item:hover .legend-count {
        color: var(--text-primary);
    }
}

.task-summary-legend .legend-section:has(.legend-task-list.active) .legend-label,
.task-summary-legend .legend-section:has(.legend-task-list.active) .legend-count {
    color: var(--text-primary);
}

.legend-section:has(.legend-task-list.active) .legend-chevron {
    transform: rotate(180deg);
}

.task-summary-legend .legend-section:has(.legend-task-list.active) .legend-item {
    background: var(--finance-track, var(--bg-tertiary));
}

.legend-task-list {
    height: 0;
    overflow: hidden;
    opacity: 0;
}

.legend-task-list.active {
    position: relative;
    z-index: 1;
    height: auto;
    overflow: visible;
    opacity: 1;
    padding-top: var(--spacing-xs);
}

/* Checklist hit target + particle burst above row chrome */
.donut-view-container .legend-task-list .checklist-checkbox {
    position: relative;
    z-index: 1;
}

/* Light theme - Task Summary */
body.light-theme .task-summary-legend .legend-item {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.light-theme .task-summary-legend .legend-label,
body.light-theme .task-summary-legend .legend-count {
    color: var(--text-muted);
    background: transparent;
}

body.light-theme .task-summary-legend .legend-section:has(.legend-task-list.active) .legend-label,
body.light-theme .task-summary-legend .legend-section:has(.legend-task-list.active) .legend-count {
    color: var(--text-primary);
}

@media (hover: hover) and (pointer: fine) {
    body.light-theme .task-summary-legend .legend-item:hover {
        background: var(--bg-tertiary);
    }
}

body.light-theme .task-summary-legend .legend-section:has(.legend-task-list.active) .legend-item {
    background: var(--bg-tertiary);
}

/* Calendar task status legend chips (`.legend .legend-item`) */
body.light-theme .legend .legend-item {
    color: var(--text-tertiary);
    background: var(--transparent-bg-light);
}

body.light-theme .legend .legend-item.active {
    color: var(--accent-primary);
}

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

body.light-theme .donut-bg {
    stroke: var(--border-color);
}

/* Reduced motion preference - disable all animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    /* Checklist enter uses opacity:0 + scale until animation ends; crushed duration leaves rows invisible on iOS. */
    .checklist-row.checklist-row-enter {
        opacity: 1 !important;
        transform: none !important;
        -webkit-transform: none !important;
        animation: none !important;
        -webkit-animation: none !important;
    }
}

/* Donut legend lists only: hide job chip on small widths to save space (calendar/list keep job). */
@media (max-width: 768px) {
    .legend-task-list .list-task-job {
        display: none !important;
    }
}

#measurementsSection {
    display: none !important;
}

/* Mouse hover: avoid transform lift on clickable rows/cards — moving the element under the
   cursor toggles :hover and causes pointer/grab ↔ arrow flicker on web. */
@media (hover: hover) and (pointer: fine) {
    .job-site-item:not(.dragging):hover,
    .status-card:hover,
    .action-btn:hover {
        transform: none;
    }

    .job-site-item:not(.dragging) {
        cursor: pointer;
    }
}

/* Weak / offline network warning popup (cloud users) */
.forma-network-warning {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.forma-network-warning.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.forma-network-warning-card {
    width: min(92vw, 22rem);
    background: var(--bg-secondary, #1e1e1e);
    border: 1px solid color-mix(in srgb, var(--text-muted, #888) 35%, transparent);
    border-radius: 16px;
    padding: 1.5rem 1.25rem 1.25rem;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.forma-network-warning-icon {
    font-size: 2rem;
    color: var(--accent-warning, #f0ad4e);
    margin-bottom: 0.75rem;
}

.forma-network-warning-title {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary, #fff);
}

.forma-network-warning-body {
    margin: 0 0 1.25rem;
    font-size: 0.9375rem;
    line-height: 1.45;
    color: var(--text-muted, #aaa);
}

.forma-network-warning-dismiss {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 12px;
    background: var(--accent-primary, #4a9eff);
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

/* Persistent offline banner (cloud users) */
.forma-offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2147482500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    padding-top: calc(0.625rem + env(safe-area-inset-top, 0px));
    background: color-mix(in srgb, var(--accent-danger, #e74c3c) 92%, #000);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.28s ease, opacity 0.28s ease;
}

.forma-offline-banner.is-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.forma-offline-banner-icon {
    flex-shrink: 0;
    font-size: 0.9375rem;
    opacity: 0.95;
}

.forma-offline-banner-text {
    max-width: min(92vw, 36rem);
}

body.forma-offline-banner-visible {
    padding-top: calc(2.75rem + env(safe-area-inset-top, 0px));
}

body.forma-offline-banner-visible .header {
    top: calc(2.75rem + env(safe-area-inset-top, 0px));
}
