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

/* Mobile touch optimizations */
html {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-touch-callout: none;
}

body {
    touch-action: pan-y pinch-zoom;
    -webkit-user-select: none;
    user-select: none;
}

input, textarea, button {
    -webkit-user-select: text;
    user-select: text;
}

:root {
    /* Refined Apple-inspired color palette */
    --primary: #007AFF;
    --primary-dark: #0051D5;
    --primary-light: #5AC8FA;
    --success: #34C759;
    --danger: #FF3B30;
    --warning: #FF9500;
    --bg: #FAFAFA;
    --surface: #FFFFFF;
    --text: #1D1D1F;
    --text-secondary: #86868B;
    --text-tertiary: #C7C7CC;
    --divider: #D2D2D7;
    --overlay: rgba(0, 0, 0, 0.4);
    --shadow-color: rgba(0, 0, 0, 0.04);
    
    /* Spacing system */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Border radius */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 50%;
    
    /* Refined shadows */
    --shadow-sm: 0 2px 8px var(--shadow-color);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: clamp(15px, 4vw, 17px);
}

body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

.screen { 
    min-height: 100vh; 
}

.hidden { 
    display: none !important; 
}

/* Login Screen */
.login-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: var(--spacing-2xl);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container h1 {
    margin-bottom: 64px;
    color: white;
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -1.5px;
}

.login-form {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    width: 100%;
    max-width: 380px;
    backdrop-filter: none;
}

.login-form input, .form-group input {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 12px;
    border: 1px solid var(--divider);
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--bg);
}

.login-form input:focus, .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
}

.remember-checkbox {
    display: flex;
    align-items: center;
    margin: 16px 0 24px 0;
    cursor: pointer;
    user-select: none;
}

.remember-checkbox input { 
    width: 18px;
    height: 18px;
    margin: 0 10px 0 0; 
    cursor: pointer;
    accent-color: var(--primary);
}

.remember-checkbox span { 
    font-size: 15px; 
    color: var(--text-secondary); 
}

.error-message { 
    color: var(--danger); 
    font-size: 13px; 
    margin-top: 12px; 
    min-height: 18px; 
}

/* Navigation */
.top-nav {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.6px;
}

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

.user-email { 
    font-size: 13px; 
    color: var(--text-secondary); 
    margin-right: 8px;
}

.icon-btn, .action-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius-full);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.icon-btn:hover, .action-btn:hover {
    background: rgba(0, 122, 255, 0.08);
    transform: scale(1.05);
}

.icon-btn:active, .action-btn:active {
    transform: scale(0.95);
}

.action-btn-delete:hover { 
    color: var(--danger); 
    background: rgba(255, 59, 48, 0.1); 
}

/* Main Container */
.app-container { 
    max-width: 640px; 
    margin: 0 auto; 
    padding: var(--spacing-lg); 
    padding-bottom: 120px; 
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    letter-spacing: -0.4px;
}

.btn:active { 
    transform: scale(0.97); 
}

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

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

.btn-primary:hover:not(:disabled) { 
    background: var(--primary-dark); 
}

.btn-danger { 
    background: var(--danger); 
    color: white; 
}

.btn-secondary { 
    background: var(--bg); 
    color: var(--primary); 
    border: 0.5px solid var(--divider);
}

.btn-secondary:hover { 
    background: var(--divider); 
}

.btn-small { 
    padding: 10px 20px; 
    font-size: 15px; 
    font-weight: 600;
}

.btn-full { 
    width: 100%; 
    margin-bottom: var(--spacing-md); 
}

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

.btn-action.disabled-grayed {
    background: var(--text-tertiary) !important;
    color: var(--text-secondary) !important;
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-action.disabled-grayed:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* Date Selector */
.date-selector-card {
    background: var(--surface);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--divider);
}

.date-nav-row {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 12px;
}

.nav-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 20px;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.2);
}

.nav-btn:hover { 
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.nav-btn:active { 
    transform: scale(0.96); 
}

.date-selector-card input[type="date"] {
    flex: 1;
    padding: 16px;
    border: 1px solid var(--divider);
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 500;
    font-family: inherit;
    background: var(--bg);
    min-width: 0;
    text-align: center;
    color: var(--text);
    transition: all 0.2s ease;
}

.date-selector-card input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.date-selector-card .btn-small {
    width: 100%;
    padding: 14px 20px;
    font-size: 17px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

/* Primary Actions Card */
.primary-actions-card {
    background: var(--surface);
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--divider);
}

.current-times {
    display: flex;
    justify-content: space-around;
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-xl) 0;
    background: var(--bg);
    border-radius: var(--radius-md);
}

.time-display-item { 
    text-align: center; 
    flex: 1; 
}

.time-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.time-group { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
}

.time-value {
    font-size: 40px;
    font-weight: 200;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -1.5px;
}

.edit-time-btn {
    background: var(--bg);
    color: var(--primary);
    border: none;
    padding: 8px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-time-btn:hover { 
    background: var(--divider);
    transform: scale(1.05);
}

.edit-time-btn:active { 
    transform: scale(0.92); 
}

/* Main Action Buttons */
.main-actions { 
    display: flex; 
    gap: 16px; 
    margin-bottom: var(--spacing-xl); 
}

.btn-action {
    flex: 1;
    padding: 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 100px;
    letter-spacing: -0.4px;
    box-shadow: var(--shadow-sm);
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-action:active { 
    transform: translateY(0);
}

.btn-action-primary { 
    background: var(--success); 
    color: white; 
}

.btn-action-danger { 
    background: var(--danger); 
    color: white; 
}

.btn-action svg {
    width: 32px;
    height: 32px;
}

/* Summary */
.today-summary-inline {
    display: flex;
    justify-content: space-around;
    padding: var(--spacing-lg) 0;
    background: var(--bg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
}

.summary-item { 
    text-align: center; 
    flex: 1; 
}

.summary-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: -1px;
}

.summary-item.earnings .summary-value { 
    color: var(--success); 
}

.summary-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.btn-secondary-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 14px 24px;
    background: var(--bg);
    color: var(--danger);
    border: 1px solid var(--divider);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    letter-spacing: -0.3px;
}

.btn-secondary-action:hover {
    background: rgba(255, 59, 48, 0.06);
    border-color: var(--danger);
    transform: translateY(-1px);
}

.btn-secondary-action:active { 
    transform: scale(0.98); 
}

.btn-secondary-action svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Pay Period Section */
.pay-period-section {
    background: var(--surface);
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--divider);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.section-header h2 {
    margin: 0;
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.6px;
}

.section-icon { 
    color: var(--primary); 
}

.btn-manage {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.3px;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.2);
}

.btn-manage:hover { 
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.btn-manage:active { 
    transform: scale(0.97); 
}

.current-period-display {
    background: var(--bg);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
}

.current-period-display .no-period {
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
    margin: 0;
    padding: var(--spacing-sm) 0;
}

.period-info { 
    background: transparent; 
    padding: 0; 
}

.period-info p {
    margin: 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    padding: 8px 0;
}

.period-info strong { 
    color: var(--text-secondary); 
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.period-info span { 
    color: var(--text); 
    font-weight: 600;
    font-size: 17px;
}

.period-quick-actions {
    display: flex;
    gap: 10px;
    margin-top: var(--spacing-md);
}

.btn-quick-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.3px;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.2);
}

.btn-quick-action:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.btn-quick-action:active {
    transform: scale(0.98);
}

.btn-quick-action svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay);
    backdrop-filter: blur(20px);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
    overflow-x: hidden;
    overflow-y: auto;
}

.modal.active { 
    display: flex; 
}

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

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

.modal-content {
    background: var(--surface);
    padding: var(--spacing-2xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--divider);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Mobile responsive modals */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-width: 95vw;
        max-height: 90vh;
        padding: 16px;
        border-radius: 16px;
        box-sizing: border-box;
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    .modal-large {
        max-width: 95vw;
        width: 95%;
    }
    
    .modal-pay-periods {
        max-width: 95vw;
        width: 95%;
    }
    
    .modal-period-form .modal-content {
        overflow-y: auto;
        overflow-x: hidden;
        max-height: 90vh;
    }
    
    .modal-calendar .modal-content {
        overflow-y: auto;
        overflow-x: hidden;
        max-height: 90vh;
    }
}

@media (max-width: 480px) {
    .modal {
        padding: 10px;
        align-items: center;
        box-sizing: border-box;
    }
    
    .modal-content {
        width: calc(100% - 20px);
        max-width: calc(100vw - 20px);
        max-height: calc(95vh - 20px);
        padding: 12px;
        border-radius: 12px;
        margin: 0;
        box-sizing: border-box;
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    .modal-large,
    .modal-pay-periods,
    .modal-period-form,
    .modal-calendar {
        max-width: calc(100vw - 20px);
        width: calc(100% - 20px);
    }
    
    .modal-period-form .modal-content,
    .modal-calendar .modal-content {
        max-height: calc(95vh - 20px);
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .modal-header-sticky {
        margin-bottom: 12px;
        padding-bottom: 8px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .modal-header-sticky h3 {
        font-size: 16px;
    }
    
    .btn-add-period {
        padding: 8px 12px;
        font-size: 13px;
        gap: 4px;
    }
    
    .modal-buttons {
        gap: 8px;
        margin-top: 12px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .periods-list-modern {
        max-height: 60vh;
        overflow-x: hidden;
    }
    
    .period-card {
        padding: 12px;
        margin-bottom: 12px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .period-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .period-dates {
        font-size: 15px;
    }
}
/* ...existing code... */

.notifications-list {
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 0; /* Changed from var(--spacing-xl) */
    padding: 2px;
    flex: 1;
    min-height: 0;
}

/* ...existing code... */

.modal-header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg); /* Changed from var(--spacing-xl) */
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--divider);
    flex-shrink: 0;
}

/* ...existing code... */

.modal-buttons { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 12px; 
    margin-top: var(--spacing-lg); /* Changed from var(--spacing-xl) */
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Pay Periods - Modern Design */
.modal-pay-periods {
    max-width: 700px;
}

.modal-header-sticky {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--divider);
}

.modal-header-sticky h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.btn-add-period {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
}

.periods-list-modern {
    max-height: 55vh;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: var(--spacing-lg);
    padding: 4px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    width: 100%;
}

/* Modern Period Card */
.period-card {
    background: var(--bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1.5px solid var(--divider);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.period-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.period-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.1);
    transform: translateY(-2px);
}

.period-card:hover::before {
    opacity: 1;
}

.period-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    width: 100%;
    box-sizing: border-box;
}

.period-dates {
    font-weight: 700;
    color: var(--text);
    font-size: 17px;
    letter-spacing: -0.4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.period-dates::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    display: inline-block;
}

.period-actions {
    display: flex;
    gap: 8px;
}

.period-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.period-stat {
    text-align: center;
    padding: 12px 8px;
    background: rgba(0, 122, 255, 0.03);
    border-radius: 8px;
    transition: background 0.2s ease;
}

.period-stat:hover {
    background: rgba(0, 122, 255, 0.06);
}

.period-stat strong {
    display: block;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.period-stat span {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

/* Period Form Modal */
.modal-period-form {
    max-width: 550px;
    max-height: 90vh;
}

.modal-period-form .modal-content {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 90vh;
}

.period-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.period-form-grid .form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
}

.period-form-grid .form-group label svg {
    color: var(--primary);
}

/* Modern Period Preview */
.period-preview-modern {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.05) 0%, rgba(0, 122, 255, 0.02) 100%);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    border: 1px solid rgba(0, 122, 255, 0.1);
    width: 100%;
    box-sizing: border-box;
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    color: var(--primary);
    font-weight: 600;
    font-size: 15px;
}

.preview-header svg {
    color: var(--success);
}

.preview-stats-grid {
    display: grid;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.preview-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--divider);
    box-sizing: border-box;
    width: 100%;
}

.preview-stat.highlight {
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.08) 0%, rgba(52, 199, 89, 0.03) 100%);
    border-color: rgba(52, 199, 89, 0.2);
}

.preview-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(0, 122, 255, 0.08);
    border-radius: 8px;
    flex-shrink: 0;
    color: var(--primary);
}

.preview-stat.highlight .preview-stat-icon {
    background: rgba(52, 199, 89, 0.15);
    color: var(--success);
}

.preview-stat-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.preview-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 2px;
}

.preview-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

/* Current Period Display - Enhanced */
.current-period-display {
    background: var(--bg);
    border-radius: 12px;
    padding: 24px;
    border: 1.5px solid var(--divider);
    transition: all 0.3s ease;
}

.no-period-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    text-align: center;
}

.no-period {
    margin: 0;
    color: var(--text-secondary);
    font-size: 15px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-link:hover {
    background: rgba(0, 122, 255, 0.08);
}

.period-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.btn-quick-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg);
    border: 1.5px solid var(--divider);
    border-radius: 10px;
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-quick-action:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.btn-quick-action span {
    font-weight: 600;
}

/* Period Info Grid (Current Period Display) */
.period-info-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.period-info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--divider);
}

.period-info-item svg {
    color: var(--primary);
    margin-top: 2px;
    flex-shrink: 0;
}

.period-info-item > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.info-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 15px;
    color: var(--text);
    font-weight: 600;
}

.period-stats-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: rgba(0, 122, 255, 0.04);
    border-radius: 8px;
    gap: 4px;
}

.stat-compact.highlight {
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.1) 0%, rgba(52, 199, 89, 0.05) 100%);
}

.stat-compact strong {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

.stat-compact.highlight strong {
    color: var(--success);
}

.stat-compact span {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Status Message */
.status-message {
    position: fixed;
    bottom: var(--spacing-xl);
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 28px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 15px;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    box-shadow: var(--shadow-lg);
    max-width: 90%;
    text-align: center;
}

.status-message.success { 
    background: var(--success); 
    color: white; 
    opacity: 1; 
}

.status-message.error { 
    background: var(--danger); 
    color: white; 
    opacity: 1; 
}

.empty-state { 
    text-align: center; 
    padding: 60px 20px; 
    color: var(--text-secondary); 
}

.empty-state-icon { 
    font-size: 56px; 
    margin-bottom: var(--spacing-md); 
    opacity: 0.5; 
}

.empty-state-text { 
    font-size: 15px; 
}

/* Inline icon helper */
.inline-icon {
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .app-title { 
        font-size: 20px;
        font-weight: 700;
    }
    
    .user-email { 
        display: none; 
    }
    
    .time-value { 
        font-size: 36px; 
    }
    
    .modal-content {
        padding: 20px; 
        max-height: 92vh;
        margin: 4vh 16px;
        border-radius: 16px;
        width: calc(100% - 32px);
        max-width: calc(100% - 32px);
        overflow-x: hidden;
    }
    
    .modal-large {
        max-width: calc(100% - 32px);
    }    .modal-buttons, .period-stats { 
        grid-template-columns: 1fr; 
    }
    
    .login-container h1 { 
        font-size: 40px; 
    }
    
    .date-selector-card {
        padding: 16px;
    }
    
    .nav-btn {
        min-width: 52px;
        height: 52px;
        font-size: 18px;
    }
    
    .app-container {
        padding: 16px;
    }
    
    .primary-actions-card {
        padding: var(--spacing-lg);
    }
    
    /* Pay Period Section Mobile */
    .pay-period-section {
        padding: var(--spacing-lg);
    }
    
    .section-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .section-header h2 {
        font-size: 20px;
        width: 100%;
    }
    
    .btn-manage {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        font-size: 16px;
    }
    
    /* Pay Period Mobile Optimizations */
    .modal-pay-periods {
        max-width: 100%;
    }
    
    .modal-header-sticky {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .modal-header-sticky h3 {
        justify-content: center;
    }
    
    .btn-add-period {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }
    
    .periods-list-modern {
        max-height: 50vh;
    }
    
    .period-card {
        padding: 16px;
        margin-bottom: 12px;
    }
    
    .period-card-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .period-dates {
        font-size: 15px;
        width: 100%;
    }
    
    .period-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .action-btn {
        flex: 0 0 auto;
        min-width: 44px;
        max-width: 44px;
        height: 44px;
        padding: 8px;
    }
    
    .action-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .period-stats {
        gap: 10px;
    }
    
    .period-stat span {
        font-size: 20px;
    }
    
    /* Period Form Mobile */
    .modal-period-form {
        max-width: 100%;
    }
    
    .period-form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .preview-stats-grid {
        gap: 10px;
    }
    
    .preview-stat {
        padding: 10px;
    }
    
    .preview-stat-value {
        font-size: 18px;
    }
    
    /* Current Period Mobile */
    .period-stats-compact {
        gap: 8px;
    }
    
    .stat-compact {
        padding: 10px 6px;
    }
    
    .stat-compact strong {
        font-size: 18px;
    }
    
    .stat-compact span {
        font-size: 10px;
    }
    
    .period-quick-actions {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .btn-quick-action {
        padding: 14px 16px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 16px;
    }
    
    .time-value { 
        font-size: 32px; 
    }
    
    .summary-value { 
        font-size: 28px; 
    }
    
    .btn-action { 
        padding: 20px 16px; 
        min-height: 90px; 
        font-size: 16px;
    }
    
    .btn-action svg {
        width: 28px;
        height: 28px;
    }
    
    .date-selector-card {
        padding: 14px;
    }
    
    .nav-btn {
        min-width: 48px;
        height: 48px;
        font-size: 16px;
    }
    
    .app-container {
        padding: 12px;
    }
    
    /* Pay Period Section - Small Mobile */
    .pay-period-section {
        padding: 16px;
    }
    
    .section-header h2 {
        font-size: 18px;
        gap: 8px;
    }
    
    .section-header h2 svg {
        width: 20px;
        height: 20px;
    }
    
    .btn-manage {
        padding: 12px 16px;
        font-size: 15px;
    }
    
    .btn-manage svg {
        width: 18px;
        height: 18px;
    }
    
    .modal-content {
        padding: 16px;
        margin: 2vh 12px;
    }
    
    /* Smaller mobile pay period adjustments */
    .period-card {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .period-dates {
        font-size: 14px;
    }
    
    .period-actions {
        gap: 6px;
        justify-content: center;
    }
    
    .period-stat strong {
        font-size: 10px;
    }
    
    .period-stat span {
        font-size: 18px;
    }
    
    .action-btn {
        min-width: 40px;
        max-width: 40px;
        height: 40px;
        padding: 6px;
    }
    
    .action-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .btn-add-period {
        font-size: 14px;
        padding: 10px 16px;
    }
    
    .preview-stat-value {
        font-size: 16px;
    }
    
    .stat-compact strong {
        font-size: 16px;
    }
    
    .no-period-state svg {
        width: 40px;
        height: 40px;
    }
    
    .no-period {
        font-size: 14px;
    }
    
    .btn-link {
        font-size: 14px;
        padding: 6px 12px;
    }
}

/* Safe area for notched devices */
@supports (padding: max(0px)) {
    .app-container {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(100px, env(safe-area-inset-bottom));
    }
    
    .status-message {
        bottom: max(24px, env(safe-area-inset-bottom));
    }
}

/* Google Sign-In Button */
.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    padding: 16px 28px;
    background: white;
    color: #3c4043;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    letter-spacing: -0.3px;
}

.google-signin-btn:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
    border-color: rgba(0, 0, 0, 0.12);
}

.google-signin-btn:active {
    transform: translateY(0);
}

/* Loading States */
.loading-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
    margin: 0;
    padding: var(--spacing-sm) 0;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Loading skeleton for time displays */
.time-value.loading {
    background: linear-gradient(90deg, var(--divider) 25%, var(--bg) 50%, var(--divider) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    color: transparent;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-screen h2 {
    color: white;
    font-size: 28px;
    font-weight: 700;
    margin-top: 28px;
    letter-spacing: -0.8px;
}

/* Top Loading Bar */
.top-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
    z-index: 10000;
    opacity: 0;
}

.top-loading-bar.active {
    opacity: 1;
    animation: loading-bar 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes loading-bar {
    0% { transform: scaleX(0); }
    50% { transform: scaleX(0.7); }
    100% { transform: scaleX(1); }
}

/* Syncing indicator - pulsing effect when items are queued */
.top-loading-bar.active[style*="opacity: 0.5"] {
    animation: loading-bar-pulse 2s ease-in-out infinite;
}

@keyframes loading-bar-pulse {
    0%, 100% { 
        transform: scaleX(0.3);
        opacity: 0.5;
    }
    50% { 
        transform: scaleX(0.6);
        opacity: 0.8;
    }
}

/* Prevent flash of content */
.screen {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.screen.visible {
    opacity: 1;
}

/* Notification Button */
.notification-btn {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--danger);
    color: white;
    border-radius: var(--radius-full);
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--surface);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Notification Modal */
.modal-header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg); /* Changed from var(--spacing-xl) */
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--divider);
    flex-shrink: 0;
}

.modal-header-with-action h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-text-action {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-text-action:hover {
    background: rgba(0, 122, 255, 0.08);
}

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

.notifications-list {
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 0; /* Changed from var(--spacing-xl) */
    padding: 2px;
    flex: 1;
    min-height: 0;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px;
    background: var(--bg);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    border: 1px solid var(--divider);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.notification-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.notification-item.unread {
    background: linear-gradient(to right, rgba(0, 122, 255, 0.05), var(--bg));
    border-color: rgba(0, 122, 255, 0.2);
}

.notification-item.unread::before {
    opacity: 1;
}

.notification-item:hover {
    border-color: var(--primary);
    transform: translateX(2px);
    box-shadow: var(--shadow-sm);
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.1), rgba(0, 122, 255, 0.05));
    border: 1px solid rgba(0, 122, 255, 0.15);
}

.notification-icon-svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.notification-item.unread .notification-icon {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-color: transparent;
}

.notification-item.unread .notification-icon-svg {
    color: white;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-message {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.2px;
    line-height: 1.4;
}

.notification-time {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Empty state for notifications */
.notifications-list .empty-state {
    padding: 80px 20px;
}

.notifications-list .empty-state-icon {
    font-size: 64px;
    margin-bottom: var(--spacing-lg);
}

.notifications-list .empty-state-text {
    font-size: 17px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Mobile optimizations for notifications */
@media (max-width: 768px) {
    .notification-item {
        padding: 16px;
        gap: 14px;
    }
    
    .notification-icon {
        width: 36px;
        height: 36px;
    }
    
    .notification-icon-svg {
        width: 18px;
        height: 18px;
    }
    
    .notifications-list {
        max-height: 60vh;
    }
}

/* Settings Modal Styles */
#settingsModal .modal-content {
    max-width: 400px;
}

#settingsModal h3 {
    margin: 0 0 var(--spacing-xl) 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--spacing-sm);
}

.form-group input {
    width: 100%;
    box-sizing: border-box;
}

/* Custom Time Picker Styles */
.modal-time-picker {
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--spacing-lg) var(--spacing-xl);
}

.modal-time-picker h3 {
    margin: 0 0 var(--spacing-lg) 0;
    flex-shrink: 0;
}

.custom-time-picker {
    margin: 0 0 var(--spacing-md) 0;
    flex-shrink: 0;
}

.time-picker-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 56px;
    font-weight: 200;
    letter-spacing: -2px;
    color: var(--text);
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md) 0;
    background: var(--bg);
    border-radius: var(--radius-md);
    font-variant-numeric: tabular-nums;
}

.time-separator {
    opacity: 0.5;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 49%, 100% { opacity: 0.5; }
    50%, 99% { opacity: 0.15; }
}

.time-picker-wheels {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: var(--spacing-md);
}

.time-wheel-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 140px;
}

.time-wheel-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.time-wheel {
    width: 100%;
    height: 200px;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 80px 0;
    mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        black 30%,
        black 70%,
        transparent 100%
    );
}

.time-wheel::-webkit-scrollbar {
    display: none;
}

.time-wheel-item {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    font-size: 20px;
    font-weight: 400;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    font-variant-numeric: tabular-nums;
}

.time-wheel-item:hover {
    color: var(--text);
}

.time-wheel-item.selected {
    color: var(--primary);
    font-weight: 600;
    font-size: 24px;
    transform: scale(1.1);
}

.time-wheel-separator {
    font-size: 36px;
    color: var(--text-secondary);
    opacity: 0.3;
    margin: 0 -6px;
    font-weight: 200;
    align-self: center;
    margin-top: 20px;
}

/* Touch feedback */
.time-wheel-item:active {
    transform: scale(0.95);
    color: var(--primary);
}

/* Make sure modal buttons are always visible */
.modal-time-picker .modal-buttons {
    margin-top: var(--spacing-md);
    flex-shrink: 0;
    position: relative;
}

/* Mobile optimizations for time picker */
@media (max-width: 768px) {
    .modal-time-picker {
        max-width: 95%;
        padding: var(--spacing-md) var(--spacing-lg);
        max-height: 92vh;
    }
    
    .time-picker-display {
        font-size: 48px;
        margin-bottom: var(--spacing-md);
        padding: var(--spacing-sm) 0;
    }
    
    .time-picker-wheels {
        gap: 12px;
        margin-bottom: var(--spacing-sm);
    }
    
    .time-wheel-container {
        max-width: 110px;
    }
    
    .time-wheel {
        height: 180px;
        padding: 70px 0;
    }
    
    .time-wheel-item {
        height: 36px;
        font-size: 18px;
    }
    
    .time-wheel-item.selected {
        font-size: 22px;
    }
    
    .time-wheel-separator {
        font-size: 32px;
        margin-top: 18px;
    }
    
    .modal-time-picker .modal-buttons {
        margin-top: var(--spacing-sm);
        gap: 10px;
    }
}

/* Smooth scrolling for time wheels */
.time-wheel {
    scroll-behavior: smooth;
}

/* Date Display Button */
.date-display-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--divider);
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 500;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
}

.date-display-btn:hover {
    background: var(--surface);
    border-color: var(--primary);
}

.date-display-btn:active {
    transform: scale(0.98);
    background: rgba(0, 122, 255, 0.1);
    border-color: var(--primary);
}

.date-display-btn svg {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.date-display-btn:hover svg {
    transform: scale(1.05);
}

/* Calendar Modal */
.modal-calendar {
    max-width: 420px;
    width: 95%;
}

.modal-calendar .modal-content {
    animation: slideUpBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 90vh;
    box-sizing: border-box;
}

@keyframes slideUpBounce {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--divider);
}

.calendar-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.calendar-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--bg);
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.calendar-nav-btn:hover {
    background: var(--primary);
    color: white;
}

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

.calendar-legend {
    display: flex;
    gap: 16px;
    margin-bottom: var(--spacing-lg);
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-color.worked {
    background: linear-gradient(135deg, #34c759, #30d158);
}

.legend-color.no-work {
    background: var(--bg);
    border: 2px solid var(--divider);
}

.legend-color.period-boundary {
    background: linear-gradient(135deg, #007AFF, #5AC8FA);
}

.legend-color.period-indicator {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.3), rgba(90, 200, 250, 0.3));
    border: 2px solid var(--primary);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
    width: 100%;
    box-sizing: border-box;
}

.calendar-weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 4px;
}

.calendar-weekday:first-child,
.calendar-weekday:last-child {
    color: var(--primary);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: var(--spacing-lg);
    width: 100%;
    box-sizing: border-box;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: var(--bg);
    border: 2px solid transparent;
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    min-height: 44px;
}

.calendar-day:hover:not(.empty):not(.disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.calendar-day:active:not(.empty):not(.disabled) {
    transform: scale(0.95);
}

.calendar-day.empty {
    visibility: hidden;
}

.calendar-day.today {
    border-color: var(--primary);
    font-weight: 700;
}

.calendar-day.weekend:not(.worked) {
    background: rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
    .calendar-day.weekend:not(.worked) {
        background: rgba(255, 255, 255, 0.03);
    }
}

.calendar-day.selected {
    background: var(--primary);
    color: white;
    font-weight: 700;
}

.calendar-day.worked {
    background: linear-gradient(135deg, #34c759, #30d158);
    color: white;
}

.calendar-day.no-work {
    background: var(--bg);
    border-color: var(--divider);
    color: var(--text-tertiary);
}

.calendar-day.period-start,
.calendar-day.period-end {
    border-color: var(--primary);
    border-width: 3px;
}

.calendar-day.period-start::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}

.calendar-day.period-end::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}

.calendar-day.in-period {
    background: linear-gradient(to bottom, rgba(0, 122, 255, 0.08), rgba(0, 122, 255, 0.12));
}

.calendar-day.in-period.worked {
    background: linear-gradient(135deg, #34c759, #30d158);
}

.calendar-day.worked::after {
    content: '✓';
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 10px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
}

.calendar-day.other-month {
    color: var(--text-tertiary);
    opacity: 0.4;
}

.calendar-day.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Mobile optimizations for calendar */
@media (max-width: 768px) {
    .modal-calendar {
        max-width: 100%;
        width: 100%;
        max-height: 90vh;
    }
    
    .modal-calendar .modal-content {
        padding: 16px;
        max-height: 90vh;
        overflow-y: auto;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .calendar-day {
        font-size: 12px;
        min-height: 38px;
        max-height: 50px;
        border-radius: 8px;
    }
    
    .calendar-weekday {
        font-size: 10px;
        padding: 4px 1px;
    }
    
    .calendar-legend {
        gap: 6px;
        padding: 8px;
        justify-content: center;
    }
    
    .legend-item {
        font-size: 11px;
    }
    
    .calendar-header {
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    
    .calendar-header h3 {
        font-size: 16px;
    }
    
    .calendar-nav-btn {
        width: 34px;
        height: 34px;
    }
    
    .calendar-grid {
        gap: 3px;
        margin-bottom: 12px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .calendar-weekdays {
        gap: 3px;
        width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    .modal-calendar .modal-content {
        padding: 12px;
        border-radius: 12px;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .calendar-day {
        font-size: 11px;
        min-height: unset;
        max-height: unset;
        border-radius: 6px;
        padding: 2px;
    }
    
    .calendar-weekday {
        font-size: 9px;
        padding: 3px 0;
    }
    
    .calendar-legend {
        gap: 4px;
        padding: 6px;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        font-size: 10px;
    }
    
    .legend-item {
        font-size: 10px;
        gap: 4px;
    }
    
    .legend-color {
        width: 10px;
        height: 10px;
    }
    
    .calendar-header {
        margin-bottom: 10px;
        padding-bottom: 6px;
    }
    
    .calendar-header h3 {
        font-size: 14px;
    }
    
    .calendar-nav-btn {
        width: 32px;
        height: 32px;
    }
    
    .calendar-grid {
        gap: 2px;
        margin-bottom: 10px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .calendar-weekdays {
        gap: 2px;
        margin-bottom: 6px;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Adjust calendar day hover effects for mobile */
    .calendar-day:hover:not(.empty):not(.disabled) {
        transform: scale(1.02);
    }
    
    /* Make calendar indicators smaller on mobile */
    .calendar-day.worked::after {
        font-size: 8px;
        bottom: 1px;
        right: 2px;
    }
    
    .calendar-day.period-start::before,
    .calendar-day.period-end::after {
        width: 4px;
        height: 4px;
        top: 1px;
        left: 1px;
    }
    
    .calendar-day.period-end::after {
        top: auto;
        left: auto;
        bottom: 1px;
        right: 1px;
    }
}

/* Period Date Selection Styles */
.period-date-selection {
    margin-bottom: var(--spacing-lg);
    width: 100%;
    box-sizing: border-box;
}

.selection-instruction {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(0, 122, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: var(--spacing-md);
    box-sizing: border-box;
    width: 100%;
}

.selection-instruction svg {
    flex-shrink: 0;
}

.selected-dates-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: var(--spacing-md);
    background: var(--bg);
    border-radius: var(--radius-md);
    box-sizing: border-box;
    width: 100%;
}

.date-badge {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: var(--surface);
    min-width: 0;
    border-radius: var(--radius-sm);
    border: 2px solid var(--divider);
    transition: all 0.2s ease;
}

.date-badge.active {
    border-color: var(--primary);
    background: rgba(0, 122, 255, 0.05);
}

.badge-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.badge-date {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.date-separator {
    font-size: 20px;
    color: var(--text-tertiary);
    font-weight: 300;
}

/* Period Calendar Container */
.period-calendar-container {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--divider);
    overflow: visible;
    box-sizing: border-box;
    width: 100%;
}

.period-calendar-container .calendar-header {
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--divider);
}

.period-calendar-container .calendar-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.period-calendar-container .calendar-grid,
.period-calendar-container .calendar-weekdays {
    width: 100%;
    box-sizing: border-box;
}

.period-calendar-container .btn {
    width: 100%;
    box-sizing: border-box;
}

/* Period Selection Calendar Specific Styles */
.period-selection-calendar .calendar-day {
    position: relative;
}

.period-selection-calendar .calendar-day.existing-period {
    cursor: not-allowed;
    font-weight: 600;
}

.period-selection-calendar .calendar-day.existing-period::before {
    content: '🔒';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 8px;
    opacity: 0.7;
}

.period-selection-calendar .calendar-day.period-selection-start {
    background: var(--primary) !important;
    color: white !important;
    font-weight: 700;
    border: 2px solid var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
}

.period-selection-calendar .calendar-day.period-selection-end {
    background: var(--primary) !important;
    color: white !important;
    font-weight: 700;
    border: 2px solid var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
}

.period-selection-calendar .calendar-day.in-selection-range {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.15), rgba(0, 122, 255, 0.25)) !important;
    color: var(--primary);
    font-weight: 600;
}

.period-selection-calendar .calendar-day.in-selection-range:hover {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.25), rgba(0, 122, 255, 0.35)) !important;
}

/* Hover effect for selectable days */
.period-selection-calendar .calendar-day:not(.existing-period):not(.disabled):not(.other-month):hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    z-index: 10;
}

/* Period Preview Adjustments */
.modal-period-form .period-preview-modern {
    margin-top: var(--spacing-md);
}

.modal-period-form .period-preview-modern .preview-stat-label {
    font-size: 11px;
}

.modal-period-form .period-preview-modern .preview-stat-value {
    font-size: 20px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .period-calendar-container {
        padding: 12px;
        margin-bottom: 16px;
        overflow: visible;
        width: 100%;
        box-sizing: border-box;
    }
    
    .period-calendar-container .calendar-grid,
    .period-calendar-container .calendar-weekdays {
        width: 100%;
        box-sizing: border-box;
    }
    
    .period-date-selection {
        width: 100%;
        box-sizing: border-box;
    }
    
    .selected-dates-display {
        flex-direction: row;
        gap: 8px;
        padding: 12px;
        flex-wrap: wrap;
        box-sizing: border-box;
        width: 100%;
    }
    
    .date-badge {
        font-size: 13px;
        padding: 8px 12px;
        min-width: 0;
        flex: 1 1 auto;
        box-sizing: border-box;
    }
    
    .modal-period-form {
        max-width: 100%;
        width: 100%;
    }
    
    .modal-period-form .modal-content {
        padding: 16px;
        max-height: 90vh;
        overflow-y: auto;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .period-preview-modern {
        padding: 12px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .period-preview-modern .preview-stat-value {
        font-size: 18px;
    }
    
    .period-preview-modern .preview-stat-label {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .period-calendar-container {
        padding: 10px;
        overflow: visible;
        width: 100%;
        box-sizing: border-box;
    }
    
    .period-calendar-container .calendar-grid {
        gap: 2px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .period-calendar-container .calendar-weekdays {
        gap: 2px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .period-date-selection {
        width: 100%;
        box-sizing: border-box;
    }
    
    .selected-dates-display {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
        box-sizing: border-box;
        width: 100%;
    }
    
    .date-separator {
        transform: rotate(90deg);
    }
    
    .date-badge {
        width: 100%;
        font-size: 12px;
        padding: 8px 10px;
        box-sizing: border-box;
    }
    
    .badge-label {
        font-size: 11px;
    }
    
    .badge-date {
        font-size: 14px;
    }
    
    .modal-period-form .modal-content {
        padding: 12px;
        overflow-y: auto;
        overflow-x: hidden;
        max-height: calc(95vh - 20px);
    }
    
    .period-date-selection {
        margin-bottom: 12px;
    }
    
    .selection-instruction {
        padding: 8px 12px;
        font-size: 12px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .period-calendar-container .calendar-header h4 {
        font-size: 14px;
    }
    
    .period-preview-modern {
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Make period selection calendar more touch-friendly */
    .period-selection-calendar .calendar-day:not(.existing-period):not(.disabled):not(.other-month):hover {
        transform: scale(1.05);
    }
    
    .period-selection-calendar .calendar-day.existing-period::before {
        font-size: 7px;
    }
}

/* Work History Calendar Specific Styles */
.work-history-calendar .calendar-day {
    position: relative;
}

.work-history-calendar .calendar-day.worked::after {
    content: '✓';
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 10px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
}

.work-history-calendar .calendar-day.no-work {
    position: relative;
}

.work-history-calendar .calendar-day.no-work::before {
    content: '!';
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 9px;
    font-weight: bold;
    color: var(--text-tertiary);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.work-history-calendar .calendar-day.in-period {
    box-shadow: inset 0 0 0 1px rgba(0, 122, 255, 0.2);
}

.work-history-calendar .calendar-day.period-start {
    border-left: 3px solid var(--primary);
}

.work-history-calendar .calendar-day.period-end {
    border-right: 3px solid var(--primary);
}

.work-history-calendar .calendar-day:hover:not(.empty):not(.disabled) {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.work-history-calendar .calendar-day.worked {
    background: linear-gradient(135deg, #34c759, #30d158);
    color: white;
    font-weight: 600;
}

.work-history-calendar .calendar-day.no-work {
    background: var(--bg);
    border: 2px dashed var(--divider);
    color: var(--text-tertiary);
}

/* Different styling for weekend */
.work-history-calendar .calendar-day.weekend:not(.worked):not(.in-period) {
    background: rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
    .work-history-calendar .calendar-day.weekend:not(.worked):not(.in-period) {
        background: rgba(255, 255, 255, 0.03);
    }
}

/* Mobile optimizations for work history calendar */
@media (max-width: 768px) {
    .work-history-calendar .calendar-day {
        font-size: 12px;
        min-height: 40px;
    }
    
    .work-history-calendar .calendar-day.worked::after {
        font-size: 9px;
        bottom: 1px;
        right: 3px;
    }
    
    .work-history-calendar .calendar-day.no-work::before {
        font-size: 8px;
        width: 12px;
        height: 12px;
    }
    
    .work-history-calendar .calendar-day:hover:not(.empty):not(.disabled) {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    }
}

@media (max-width: 480px) {
    .work-history-calendar .calendar-day {
        font-size: 11px;
        min-height: 36px;
    }
    
    .work-history-calendar .calendar-day.worked::after {
        font-size: 8px;
        bottom: 1px;
        right: 2px;
    }
    
    .work-history-calendar .calendar-day.no-work::before {
        font-size: 7px;
        width: 10px;
        height: 10px;
        top: 1px;
        right: 2px;
    }
    
    .work-history-calendar .calendar-day:hover:not(.empty):not(.disabled) {
        transform: scale(1.02);
    }
    
    .work-history-calendar .calendar-day.period-start,
    .work-history-calendar .calendar-day.period-end {
        border-width: 2px;
    }
}

