:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --secondary: #10B981;
    --background: #F3F4F6;
    --surface: #FFFFFF;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    
    --grad-1-start: #3B82F6;
    --grad-1-end: #1D4ED8;
    --grad-2-start: #10B981;
    --grad-2-end: #047857;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #e2e8f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--text-main);
}

.app-container {
    width: 100%;
    max-width: 414px;
    height: 100vh;
    max-height: 896px;
    background-color: var(--background);
    position: relative;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

@media (min-width: 450px) {
    .app-container {
        height: 90vh;
        border-radius: 40px;
        border: 8px solid #111;
    }
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background);
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateX(20px);
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    transform: translateX(0);
}

.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}
.content-scroll.pb-nav { padding-bottom: 90px; }
.content-scroll.has-tabs { padding-top: 10px; }

/* Splash Screen */
#screen-login {
    background: linear-gradient(135deg, var(--grad-1-start), var(--grad-1-end));
    color: white;
    justify-content: center;
    padding: 30px;
}
.login-header { text-align: center; margin-bottom: 50px; }
.login-header .logo { 
    font-size: 4rem; 
    margin-bottom: 10px; 
    background: linear-gradient(135deg, #012169 33%, #FFFFFF 33%, #FFFFFF 66%, #C8102E 66%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}
.login-header h1 { font-size: 2rem; font-weight: 700; }
.login-header p { opacity: 0.8; }
.login-form { background: white; padding: 30px 20px; border-radius: 20px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); color: var(--text-main); }
.input-group { display: flex; align-items: center; background: var(--background); border-radius: 10px; padding: 12px 15px; margin-bottom: 15px; }
.input-group i { color: var(--text-muted); margin-right: 10px; }
.input-group input { border: none; background: none; outline: none; width: 100%; font-size: 1rem; }
.btn-primary { width: 100%; background: var(--primary); color: white; border: none; padding: 14px; border-radius: 10px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background 0.2s; margin-top: 10px; }
.btn-primary:active { background: var(--primary-dark); }
.forgot-password { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 0.9rem; cursor: pointer; }

/* Header */
.app-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 20px 10px; background: var(--background); }
.app-header.flat { background: var(--surface); padding: 20px; border-bottom: 1px solid var(--border); }
.user-info h2 { font-size: 1.2rem; font-weight: 700; }
.user-info p { font-size: 0.85rem; color: var(--text-muted); }
.icon-btn, .back-btn { background: var(--surface); border: 1px solid var(--border); width: 40px; height: 40px; border-radius: 50%; display: flex; justify-content: center; align-items: center; color: var(--text-main); cursor: pointer; position: relative; font-size: 1.1rem; }
.back-btn { border: none; background: none; width: 24px; justify-content: flex-start; }
.badge { position: absolute; top: -2px; right: -2px; background: #EF4444; color: white; font-size: 0.6rem; font-weight: bold; width: 16px; height: 16px; border-radius: 50%; display: flex; justify-content: center; align-items: center; }

/* Notifications Panel */
.notif-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 100; }
.notif-overlay.show { opacity: 1; pointer-events: all; }
.notifications-panel { position: absolute; bottom: -100%; left: 0; width: 100%; max-height: 80%; background: var(--surface); border-radius: 20px 20px 0 0; z-index: 101; transition: bottom 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); display: flex; flex-direction: column; box-shadow: 0 -10px 25px rgba(0,0,0,0.1); }
.notifications-panel.show { bottom: 0; }
.notif-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid var(--border); }
.close-btn { background: none; border: none; font-size: 1.2rem; color: var(--text-muted); cursor: pointer; }
.notif-content { overflow-y: auto; padding-bottom: 20px; }
.notif-item { display: flex; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.notif-item.unread { background: #EFF6FF; }
.notif-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--secondary); color: white; display: flex; justify-content: center; align-items: center; margin-right: 15px; font-size: 1.1rem; flex-shrink: 0; }
.notif-icon.bg-orange { background: #F59E0B; }
.notif-icon.bg-blue { background: var(--primary); }
.notif-text p { font-size: 0.9rem; margin-bottom: 4px; }
.notif-text span { font-size: 0.75rem; color: var(--text-muted); }

/* Stats & Actions */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 25px; }
.stat-card { padding: 20px 15px; border-radius: 16px; color: white; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
.gradient-1 { background: linear-gradient(135deg, var(--grad-1-start), var(--grad-1-end)); }
.gradient-2 { background: linear-gradient(135deg, var(--grad-2-start), var(--grad-2-end)); }
.stat-card h3 { font-size: 0.9rem; font-weight: 500; opacity: 0.9; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; margin-top: 5px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; margin-top: 10px; }
.section-header h3 { font-size: 1.1rem; font-weight: 600; }
.section-header a { color: var(--primary); text-decoration: none; font-size: 0.9rem; font-weight: 500; }
.actions-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 25px; }
.action-card { background: var(--surface); border-radius: 12px; padding: 15px 5px; display: flex; flex-direction: column; align-items: center; text-align: center; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.05); transition: transform 0.1s; }
.action-card:active { transform: scale(0.95); }
.action-icon { width: 40px; height: 40px; border-radius: 50%; background: #EFF6FF; color: var(--primary); display: flex; justify-content: center; align-items: center; font-size: 1.2rem; margin-bottom: 8px; }
.action-card span { font-size: 0.75rem; font-weight: 500; color: var(--text-main); }

/* Verify CSCS Screen */
.verify-result { background: var(--surface); border: 1px solid var(--secondary); border-radius: 12px; padding: 20px; text-align: center; margin-top: 25px; opacity: 0; transform: translateY(10px); transition: all 0.3s; }
.verify-result.show { opacity: 1; transform: translateY(0); }
.verify-icon { font-size: 3rem; color: var(--secondary); margin-bottom: 10px; }
.verify-result h3 { color: var(--secondary); margin-bottom: 15px; }
.verify-result p { margin-bottom: 8px; font-size: 0.95rem; text-align: left; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.hidden { display: none; }

/* Timesheets Screen */
.timesheet-card { background: var(--surface); border-radius: 12px; padding: 15px; margin-bottom: 15px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.ts-header { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 10px; }
.ts-header h4 { font-size: 0.95rem; }
.ts-date { font-size: 0.8rem; color: var(--text-muted); }
.ts-worker { display: flex; align-items: center; margin-bottom: 12px; }
.ts-worker:last-child { margin-bottom: 0; }
.ts-worker img { width: 40px; height: 40px; border-radius: 50%; margin-right: 12px; }
.ts-info flex { 1; }
.ts-info p { font-size: 0.85rem; }
.ts-info p:last-child { color: var(--text-muted); font-size: 0.75rem; }
.ts-hours { margin-left: auto; font-weight: 600; color: var(--primary); background: #EFF6FF; padding: 5px 10px; border-radius: 8px; font-size: 0.85rem; }

/* Reports Screen */
.report-card { background: var(--surface); border-radius: 12px; padding: 20px; margin-bottom: 15px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.report-card h3 { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 10px; }
.report-card h2 { font-size: 1.8rem; margin-bottom: 5px; }
.text-success { color: var(--secondary); font-size: 0.85rem; font-weight: 500; }
.chart-mock { display: flex; justify-content: space-between; align-items: flex-end; height: 120px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.bar-col { display: flex; flex-direction: column; align-items: center; width: 15%; height: 100%; justify-content: flex-end; }
.bar { width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; opacity: 0.8; transition: height 1s ease-out; }
.bar-col span { font-size: 0.7rem; color: var(--text-muted); margin-top: 5px; }
.trade-list { list-style: none; margin-top: 15px; }
.trade-list li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.trade-list li:last-child { border-bottom: none; }

/* Shared components */
.job-card { background: var(--surface); border-radius: 12px; padding: 15px; display: flex; align-items: center; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.job-icon { width: 50px; height: 50px; border-radius: 12px; display: flex; justify-content: center; align-items: center; font-size: 1.5rem; margin-right: 15px; color: white; }
.job-icon.brick { background: #F59E0B; }
.job-icon.plumb { background: #3B82F6; }
.job-icon.spark { background: #EAB308; }
.job-details { flex: 1; }
.job-details h4 { font-size: 1rem; margin-bottom: 4px; }
.job-details p { font-size: 0.8rem; color: var(--text-muted); }
.job-details p.rate { font-weight: 600; color: var(--text-main); margin-top: 4px; }
.job-status { font-size: 0.75rem; font-weight: 600; padding: 5px 10px; border-radius: 20px; margin-left: auto; text-align: right; }
.status-pending { background: #FEF3C7; color: #D97706; }
.status-active { background: #D1FAE5; color: #059669; }

/* Bottom Nav */
.bottom-nav { position: absolute; bottom: 0; left: 0; width: 100%; height: 70px; background: var(--surface); display: flex; justify-content: space-around; align-items: center; border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom, 10px); }
.nav-item { display: flex; flex-direction: column; align-items: center; color: var(--text-muted); cursor: pointer; font-size: 0.75rem; gap: 4px; }
.nav-item i { font-size: 1.25rem; margin-bottom: 2px; }
.nav-item.active { color: var(--primary); }

/* Tabs */
.tabs { display: flex; background: var(--surface); padding: 0 20px; border-bottom: 1px solid var(--border); }
.tab { padding: 15px 0; margin-right: 20px; font-size: 0.9rem; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Forms */
.form-container { background: var(--surface); border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; color: var(--text-main); }
.form-group select, .form-group input[type="text"], .form-group input[type="date"], .form-group input[type="password"], .form-group input[type="email"] { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; outline: none; background: var(--background); }
.number-stepper { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.number-stepper button { background: var(--background); color: var(--text-main); border: none; padding: 12px 20px; font-size: 1.2rem; cursor: pointer; min-width: 45px; display: flex; justify-content: center; align-items: center; }
.number-stepper input { flex: 1; text-align: center; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border); padding: 12px; font-size: 1rem; font-weight: 600; }
.checkbox-group label { display: flex; align-items: center; font-weight: normal; margin-bottom: 10px; }
.checkbox-group input { margin-right: 10px; width: 18px; height: 18px; accent-color: var(--primary); }
.btn-sm { background: var(--primary); color: white; border: none; padding: 8px 12px; border-radius: 8px; font-size: 0.85rem; cursor: pointer; }

/* Workers / Profiles */
.worker-card { background: var(--surface); border-radius: 12px; padding: 15px; display: flex; align-items: center; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.worker-avatar { position: relative; margin-right: 15px; }
.worker-avatar img { width: 50px; height: 50px; border-radius: 50%; }
.status-dot { position: absolute; bottom: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); }
.status-dot.green { background: #10B981; }
.status-dot.orange { background: #F59E0B; }
.worker-info flex { 1; }
.worker-info h4 { font-size: 1rem; margin-bottom: 2px; }
.worker-info p { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.tags { display: flex; gap: 8px; }
.tag { font-size: 0.65rem; padding: 3px 8px; background: var(--background); border-radius: 4px; color: var(--text-main); font-weight: 500; }

.profile-header { text-align: center; padding: 20px 0; }
.profile-header img { border-radius: 50%; margin-bottom: 10px; }
.profile-header h3 { font-size: 1.2rem; }
.profile-header p { font-size: 0.9rem; color: var(--text-muted); }
.menu-list { background: var(--surface); border-radius: 12px; overflow: hidden; margin-bottom: 20px; }
.menu-item { display: flex; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 0.95rem; }
.menu-item:last-child { border-bottom: none; }
.menu-item .icon-wrapper { width: 30px; color: var(--text-muted); }
.menu-item.text-danger { color: #EF4444; }
.menu-item.text-danger .icon-wrapper { color: #EF4444; }
.ml-auto { margin-left: auto; color: var(--text-muted); }

/* Registration Styles */
.register-section { margin-top: 30px; text-align: center; border-top: 1px solid var(--border); padding-top: 20px; }
.register-section p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 10px; }
.btn-outline { width: 100%; background: transparent; color: var(--primary); border: 2px solid var(--primary); padding: 12px; border-radius: 10px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-outline:active { background: #EFF6FF; }

.type-card { background: var(--surface); border-radius: 12px; padding: 20px; display: flex; align-items: center; cursor: pointer; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); border: 2px solid transparent; transition: all 0.2s; margin-bottom: 15px;}
.type-card:active { transform: scale(0.98); border-color: var(--primary); }
.type-icon { width: 50px; height: 50px; border-radius: 12px; background: #EFF6FF; color: var(--primary); display: flex; justify-content: center; align-items: center; font-size: 1.5rem; margin-right: 15px; }
.type-info { flex: 1; }
.type-info h3 { font-size: 1.1rem; margin-bottom: 4px; color: var(--text-main); }
.type-info p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }
.type-card .arrow { color: var(--text-muted); font-size: 1.2rem; }

/* Toast */
.toast { position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(100px); background: #10B981; color: white; padding: 12px 20px; border-radius: 30px; font-size: 0.9rem; font-weight: 500; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); opacity: 0; transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); z-index: 1000; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* Enhanced Profile Styles */
.avatar-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
}
.avatar-container img {
    border-radius: 50%;
    margin-bottom: 10px;
    border: 3px solid var(--surface);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.edit-avatar-badge {
    position: absolute;
    bottom: 15px;
    right: 0;
    background: var(--primary);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid var(--surface);
    font-size: 0.8rem;
}
.profile-stats {
    display: flex;
    justify-content: space-around;
    background: var(--surface);
    border-radius: 12px;
    padding: 15px;
    margin: 20px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.profile-stats div {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.profile-stats div strong {
    font-size: 1.2rem;
    color: var(--text-main);
    display: block;
    margin-bottom: 5px;
}

.edit-avatar-section {
    text-align: center;
    padding: 20px 0 30px;
}
.avatar-container.lg img {
    width: 120px;
    height: 120px;
}
.upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s;
    border: 3px solid transparent;
}
.avatar-container.lg:hover .upload-overlay {
    opacity: 1;
}
.upload-overlay i {
    font-size: 1.5rem;
    margin-bottom: 5px;
}
.upload-overlay span {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Ensure right-side elements in job cards are perfectly flush right */
.job-card .btn-sm { margin-left: auto; }
