/* MyUnity Agent Portal v5 — Complete Redesign */
/* Mobile-first, Uber Driver / Alan Health inspired */

:root {
    --primary: #0033CC;
    --primary-light: #EBF0FF;
    --primary-dark: #0029A3;
    --primary-rgb: 0, 51, 204;
    --green: #059669;
    --green-light: #ECFDF5;
    --red: #DC2626;
    --red-light: #FEF2F2;
    --orange: #D97706;
    --orange-light: #FEF3C7;
    --dark: #111827;
    --dark-2: #1F2937;
    --bg: #F8F9FB;
    --g1: #F3F4F6;
    --g2: #E5E7EB;
    --g3: #6B7280;
    --g4: #9CA3AF;
    --g05: #FAFBFC;
    --white: #FFFFFF;
    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.07);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.09);
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--dark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

::-webkit-scrollbar { width: 0; height: 0; }

/* ===== LOGIN SCREEN ===== */
.login-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark);
    padding: 24px;
    position: relative;
    overflow: hidden;
}
.login-container::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -30%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0,51,204,0.15) 0%, transparent 60%);
    border-radius: 50%;
    pointer-events: none;
}
.login-container::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0,51,204,0.08) 0%, transparent 60%);
    border-radius: 50%;
    pointer-events: none;
}
.login-card {
    background: rgba(255,255,255,0.05);
    border-radius: 24px;
    padding: 40px 28px;
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
    position: relative;
    z-index: 1;
}
.login-logo {
    height: 32px;
    display: block;
    margin: 0 auto 8px;
    filter: brightness(0) invert(1);
}
.login-subtitle {
    text-align: center;
    color: rgba(255,255,255,0.35);
    font-size: 0.8rem;
    margin-bottom: 32px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
}
.login-card .field label { color: rgba(255,255,255,0.5); }
.login-card .field input {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.1);
    color: #fff;
}
.login-card .field input:focus {
    border-color: rgba(255,255,255,0.3);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.1);
}
.login-card .field input::placeholder { color: rgba(255,255,255,0.2); }
.login-card .btn-primary-full {
    background: #fff;
    color: var(--dark);
    box-shadow: 0 4px 16px rgba(255,255,255,0.08);
}
.login-card .btn-primary-full:hover {
    box-shadow: 0 8px 28px rgba(255,255,255,0.12);
}
.login-card .login-error { color: #EF4444; }
.login-card #biometricLoginDiv span { color: rgba(255,255,255,0.3); }
.login-card #biometricLoginDiv div[style*="background:rgba(0,51,204"] { background: rgba(255,255,255,0.06) !important; }
.login-card #biometricBtn {
    background: rgba(255,255,255,0.06) !important;
    border-color: rgba(255,255,255,0.1) !important;
    color: #fff !important;
}
.login-card #biometricBtn:hover { background: rgba(255,255,255,0.1) !important; }
.login-card #forgotLink a { color: rgba(255,255,255,0.5); }
.login-card #forgotLink a:hover { color: #fff; }
.login-card #forgotForm p,
.login-card #forgotForm a { color: rgba(255,255,255,0.4); }
.login-error {
    color: var(--red);
    font-size: 0.82rem;
    text-align: center;
    margin-top: 12px;
    min-height: 20px;
}

/* ===== FIELDS ===== */
.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--g3);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--g2);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.92rem;
    background: var(--white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    color: var(--dark);
    -webkit-appearance: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.08);
}
.field textarea { min-height: 80px; resize: vertical; }
.field-input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--g2);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.88rem;
    background: var(--white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    resize: vertical;
    color: var(--dark);
    -webkit-appearance: none;
}
.field-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.08);
}

/* ===== BUTTONS ===== */
.btn-primary-full {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 14px;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary-full:hover { background: var(--primary-dark); }
.btn-primary-full:active { transform: scale(0.98); }
.btn-primary-full:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    min-height: 48px;
}
.btn-action:active { transform: scale(0.97); }
.btn-blue { background: var(--primary); color: var(--white); }
.btn-blue:hover { background: var(--primary-dark); }
.btn-green { background: var(--green); color: var(--white); }
.btn-green:hover { background: #047857; }
.btn-red { background: var(--red); color: var(--white); }
.btn-red:hover { background: #B91C1C; }
.btn-orange { background: var(--orange); color: var(--white); }
.btn-orange:hover { background: #B45309; }
.btn-ghost {
    background: var(--white);
    color: var(--primary);
    border: 1.5px solid var(--g2);
}
.btn-ghost:hover { border-color: var(--primary); background: var(--primary-light); }
.btn-primary-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.2s var(--ease);
    min-height: 40px;
}
.btn-primary-sm:active { transform: scale(0.97); }

/* ===== HEADER ===== */
.app-header,
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    padding-top: var(--safe-top);
    height: calc(56px + var(--safe-top));
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-picto {
    width: 26px;
    height: 26px;
}
.header-title {
    font-weight: 800;
    font-size: 1rem;
    color: var(--dark);
    letter-spacing: -0.01em;
}
.header-right { display: flex; align-items: center; gap: 12px; }
.header-agent {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--g3);
}
.header-btn {
    background: var(--g1);
    border: none;
    cursor: pointer;
    color: var(--g3);
    padding: 8px;
    border-radius: 10px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.header-btn:hover { color: var(--red); background: var(--red-light); }

/* ===== MAIN CONTENT ===== */
.main-content,
#mainContent {
    padding-top: calc(56px + var(--safe-top));
    padding-bottom: calc(80px + var(--safe-bottom));
    min-height: 100vh;
    min-height: 100dvh;
}
.page-pad { padding: 20px 16px; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--white);
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    padding: 0 0 var(--safe-bottom);
    height: calc(72px + var(--safe-bottom));
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 0;
    color: var(--g4);
    font-family: var(--font);
    font-size: 0.62rem;
    font-weight: 600;
    transition: color 0.2s ease;
    flex: 1;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.nav-item svg {
    width: 22px;
    height: 22px;
    transition: all 0.25s var(--ease);
    stroke-width: 1.8;
}
.nav-item.active {
    color: var(--primary);
}
.nav-item.active svg {
    stroke-width: 2.4;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}

/* ===== CARDS ===== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.15s var(--ease);
    border: 1px solid rgba(0,0,0,0.04);
}
.card:active { transform: scale(0.985); }
.card-pad { padding: 16px; }
.card + .card { margin-top: 12px; }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--g1);
}
.card-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--dark);
}

/* ===== HERO SECTION (Dashboard) ===== */
.hero-card {
    background: linear-gradient(135deg, var(--primary) 0%, #0029A3 60%, #001A80 100%);
    border-radius: 20px;
    padding: 24px 20px;
    color: var(--white);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}
.hero-card::after {
    content: '';
    position: absolute;
    top: -30%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.hero-top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 4px;
}
.hero-avatar {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255,255,255,0.15);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.2);
}
.hero-avatar img { width: 100%; height: 100%; object-fit: cover; }
.hero-greeting {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.hero-date {
    font-size: 0.78rem;
    opacity: 0.65;
    margin-top: 2px;
    text-transform: capitalize;
}
.hero-matricule {
    display: inline-block;
    background: rgba(255,255,255,0.12);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 100px;
    letter-spacing: 0.5px;
    margin-top: 8px;
}

/* ===== MISSION CARD (Today) ===== */
.mission-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0,0,0,0.04);
    margin-bottom: 16px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}
.mission-card:active { transform: scale(0.985); }
.mission-card-active {
    border-left: 4px solid var(--green);
    background: linear-gradient(135deg, #ECFDF5 0%, var(--white) 100%);
}
.mission-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 10px;
}
.mission-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.mission-badge-live {
    background: var(--green-light);
    color: var(--green);
}
.mission-badge-type {
    background: var(--primary-light);
    color: var(--primary);
}
.mission-time {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}
.mission-site {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 3px;
}
.mission-client {
    font-size: 0.82rem;
    color: var(--g3);
}
.mission-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}
.mission-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    min-height: 48px;
    flex: 1;
}
.mission-btn:active { transform: scale(0.96); }
.mission-btn-primary {
    background: var(--primary);
    color: var(--white);
}
.mission-btn-green {
    background: var(--green);
    color: var(--white);
}
.mission-btn-outline {
    background: var(--white);
    color: var(--primary);
    border: 1.5px solid var(--g2);
}

/* ===== REST STATE ===== */
.rest-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.04);
    margin-bottom: 16px;
}
.rest-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: var(--green-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}
.rest-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--dark);
    margin-bottom: 4px;
}
.rest-sub {
    font-size: 0.82rem;
    color: var(--g4);
}

/* ===== STAT PILLS ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.stat-pill {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.04);
    transition: transform 0.15s var(--ease);
}
.stat-pill:active { transform: scale(0.97); }
.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
}
.stat-val {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
    line-height: 1;
}
.stat-label {
    font-size: 0.7rem;
    color: var(--g4);
    margin-top: 4px;
    font-weight: 600;
}

/* ===== QUALIFICATIONS ===== */
.dash-qualifs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 0 2px;
}
.qual-badge {
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 700;
}
.qual-green { background: var(--green-light); color: var(--green); }
.qual-orange { background: var(--orange-light); color: var(--orange); }
.qual-red { background: var(--red-light); color: var(--red); }

/* ===== NEXT SHIFT CARD ===== */
.next-shift-card {
    border-left: 4px solid var(--primary);
}
.ns-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.ns-site { font-size: 1.05rem; font-weight: 800; margin-bottom: 4px; }
.ns-details { font-size: 0.82rem; color: var(--g4); margin-bottom: 2px; }
.ns-type { font-size: 0.78rem; color: var(--g3); }

/* ===== SECTION TITLE ===== */
.section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--g3);
    padding: 16px 4px 10px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 36px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.empty-text {
    font-weight: 700;
    color: var(--g3);
    margin-top: 10px;
    font-size: 0.92rem;
}

/* ===== VACATION BANNER ===== */
.vacation-banner {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 16px rgba(5,150,105,0.2);
}
.vacation-banner.inactive {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 4px 16px rgba(var(--primary-rgb),0.2);
}
.vacation-site { font-size: 1.15rem; font-weight: 800; margin-bottom: 4px; }
.vacation-time { font-size: 0.82rem; opacity: 0.85; }
.vacation-actions { display: flex; gap: 8px; margin-top: 14px; }

.vb-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.vb-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.vb-since {
    font-size: 0.9rem;
    font-weight: 800;
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 8px;
}
.vb-site { font-size: 1.2rem; font-weight: 800; margin-bottom: 14px; }
.vb-actions { display: flex; gap: 10px; }
.vb-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    min-height: 48px;
}
.vb-btn:active { transform: scale(0.96); }
.vb-btn-main {
    background: rgba(255,255,255,0.2);
    color: #fff;
    flex: 1;
    justify-content: center;
}
.vb-btn-end {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

/* ===== SHIFT CARDS (Dashboard & Prestation) ===== */
.shift-card-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    margin-bottom: 10px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.04);
    border-left: 4px solid var(--primary);
}
.shift-card-main:active { transform: scale(0.985); }
.shift-card-main.shift-active {
    border-left-color: var(--green);
    background: linear-gradient(135deg, #ECFDF5 0%, #fff 100%);
}
.shift-card-left { flex: 1; }
.shift-hours,
.scm-hours {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}
.shift-site-name,
.scm-site {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 3px;
}
.shift-type-label,
.scm-type {
    font-size: 0.8rem;
    color: var(--g4);
}
.shift-status-active {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--green);
}
.scm-live {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--green);
    margin-bottom: 4px;
}

/* ===== PRESTATION ===== */
.presta-header {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(0,0,0,0.04);
}
.presta-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.presta-site {
    font-size: 1.08rem;
    font-weight: 800;
    color: var(--dark);
}
.presta-meta {
    font-size: 0.78rem;
    color: var(--g4);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

/* Prestation tabs */
.presta-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
    background: var(--g1);
    border-radius: 14px;
    padding: 4px;
}
.presta-tab {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--g3);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    min-height: 44px;
}
.presta-tab.active {
    background: var(--white);
    color: var(--primary);
    font-weight: 700;
    box-shadow: var(--shadow);
}
.presta-tab:hover:not(.active) { color: var(--dark); }

/* Type badges */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.type-incident { background: var(--red-light); color: var(--red); }
.type-ronde { background: #EFF6FF; color: #2563EB; }
.type-info { background: #EEF2FF; color: #4F46E5; }
.type-alerte { background: var(--orange-light); color: var(--orange); }
.type-intervention { background: var(--green-light); color: var(--green); }
.type-autre { background: var(--g1); color: var(--g3); }

/* Priority */
.prio-urgente { border-left: 3px solid var(--red); }
.prio-haute { border-left: 3px solid var(--orange); }

/* Entry item */
.entry-item {
    padding: 16px;
    border-bottom: 1px solid var(--g1);
    transition: background 0.15s ease;
}
.entry-item:last-child { border-bottom: none; }
.entry-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.entry-time { font-size: 0.75rem; color: var(--g3); font-weight: 600; }
.entry-msg { font-size: 0.88rem; line-height: 1.55; }
.entry-lieu { font-size: 0.78rem; color: var(--g4); margin-top: 4px; }

/* ===== QUICK ACTIONS (Prestation) ===== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 22px 10px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.04);
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.2s var(--ease);
    min-height: 80px;
}
.quick-btn:active { transform: scale(0.97); }
.quick-btn svg { color: var(--primary); }
.quick-btn span { font-size: 0.8rem; font-weight: 600; color: var(--dark); }

/* Photo grid */
.photo-grid { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.photo-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-xs);
    object-fit: cover;
    border: 1px solid var(--g2);
}

/* FAB */
.fab {
    position: fixed;
    bottom: calc(88px + var(--safe-bottom));
    right: 16px;
    z-index: 90;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    border: none;
    background: var(--primary);
    color: var(--white);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(var(--primary-rgb),0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease);
}
.fab:active { transform: scale(0.9); }

/* ===== PLANNING ===== */
.planning-recap {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.pr-item {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.04);
    padding: 16px;
    text-align: center;
}
.pr-val {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
}
.pr-label {
    font-size: 0.7rem;
    color: var(--g4);
    margin-top: 4px;
    font-weight: 600;
}

/* Planning week bar */
.planning-week {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 16px;
    margin-bottom: 4px;
    scrollbar-width: none;
}
.planning-week::-webkit-scrollbar { display: none; }
.planning-day {
    flex: 0 0 auto;
    min-width: 54px;
    padding: 10px 8px 12px;
    border-radius: 14px;
    text-align: center;
    cursor: pointer;
    background: transparent;
    border: none;
    font-family: var(--font);
    transition: all 0.2s var(--ease);
    -webkit-tap-highlight-color: transparent;
}
.planning-day-name {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--g4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.planning-day-num {
    font-size: 1rem;
    font-weight: 800;
    color: var(--dark);
    margin-top: 4px;
}
.planning-day-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary);
    margin: 6px auto 0;
    opacity: 0;
}
.planning-day.has-shift .planning-day-dot { opacity: 1; }
.planning-day.today {
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb),0.25);
}
.planning-day.today .planning-day-name,
.planning-day.today .planning-day-num { color: #fff; }
.planning-day.today .planning-day-dot { background: #fff; }
.planning-day.selected:not(.today) {
    background: var(--primary-light);
}
.planning-day.selected:not(.today) .planning-day-name,
.planning-day.selected:not(.today) .planning-day-num { color: var(--primary); }

.shift-card {
    padding: 16px;
    border-bottom: 1px solid var(--g1);
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.shift-card:last-child { border-bottom: none; }
.shift-card:active { background: var(--g05); }
.shift-time { text-align: center; min-width: 52px; }
.shift-time-h {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--primary);
}
.shift-time-d { font-size: 0.72rem; color: var(--g3); }
.shift-info { flex: 1; }
.shift-site { font-weight: 700; font-size: 0.9rem; }
.shift-type { font-size: 0.78rem; color: var(--g4); margin-top: 2px; }

/* ===== HISTORIQUE ===== */
.vac-item,
.hist-card { transition: all 0.15s ease; }
.vac-item:active,
.hist-card:active { transform: scale(0.985); }
.vac-status {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 100px;
    display: inline-block;
}

/* ===== PROFIL ===== */
.profil-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.04);
    padding: 24px 20px;
    margin-bottom: 12px;
}
.profil-top {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}
.profil-avatar-lg {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 800;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}
.profil-avatar-lg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px;
}
.profil-info { flex: 1; }
.profil-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.01em;
}
.profil-role {
    font-size: 0.82rem;
    color: var(--g4);
    margin-top: 2px;
}
.profil-badge {
    display: inline-block;
    background: var(--dark);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 100px;
    margin-top: 8px;
    letter-spacing: 0.5px;
}
.profil-qualifs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--g1);
}
.carte-pro-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 0;
    margin-top: 14px;
    border-top: 1px solid var(--g1);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: opacity 0.15s ease;
}
.carte-pro-link:active { opacity: 0.7; }

/* Profil tabs */
.profil-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
    background: var(--g1);
    border-radius: 14px;
    padding: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.profil-tabs::-webkit-scrollbar { display: none; }
.profil-tab {
    flex: 1;
    padding: 11px 6px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--g4);
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
    min-width: 0;
    min-height: 42px;
}
.profil-tab.active {
    background: var(--white);
    color: var(--primary);
    font-weight: 700;
    box-shadow: var(--shadow);
}
.profil-tab:hover:not(.active) { color: var(--dark); }

/* Profil rows */
.profil-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--primary);
    padding: 14px 16px 8px;
}
.profil-row {
    padding: 12px 16px;
    border-bottom: 1px solid var(--g1);
    display: flex;
    align-items: center;
}
.profil-row:last-child { border-bottom: none; }
.profil-row-label {
    font-size: 0.72rem;
    color: var(--g4);
    margin-bottom: 2px;
}
.profil-row-value {
    font-size: 0.88rem;
    font-weight: 600;
}

/* Document rows */
.doc-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--g1);
    cursor: pointer;
    transition: background 0.15s ease;
}
.doc-row:last-child { border-bottom: none; }
.doc-row:active { background: var(--g05); }
.doc-icon { flex-shrink: 0; }
.doc-info { flex: 1; min-width: 0; }
.doc-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.doc-meta {
    font-size: 0.72rem;
    color: var(--g4);
    margin-top: 2px;
}
.doc-status {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 100px;
    flex-shrink: 0;
}
.doc-valid { background: var(--green-light); color: var(--green); }
.doc-expired { background: var(--red-light); color: var(--red); }
.doc-pending { background: var(--orange-light); color: var(--orange); }

/* ===== RONDE PROGRESS ===== */
.ronde-progress {
    background: var(--g1);
    border-radius: 100px;
    height: 8px;
    overflow: hidden;
    margin: 10px 0;
}
.ronde-progress-bar {
    height: 100%;
    background: var(--green);
    border-radius: 100px;
    transition: width 0.4s var(--ease);
}
.pointeau-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--g1);
}
.pointeau-item.scanned { background: var(--green-light); }
.pointeau-check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--g2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.pointeau-item.scanned .pointeau-check {
    background: var(--green);
    border-color: transparent;
    color: var(--white);
}
.pointeau-name { font-weight: 600; font-size: 0.88rem; }
.pointeau-loc { font-size: 0.78rem; color: var(--g4); }

/* ===== STATUS DOT ===== */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.green { background: var(--green); }
.status-dot.orange { background: var(--orange); }
.status-dot.red { background: var(--red); }

/* Pulse dot */
.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    display: inline-block;
    animation: pulse 2s infinite;
}
.pulse-dot-sm {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    display: inline-block;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}

/* ===== MODAL / BOTTOM SHEET ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-sheet {
    background: var(--white);
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 24px 20px calc(24px + var(--safe-bottom));
    animation: slideUp 0.3s var(--ease);
}
.modal-handle {
    width: 40px;
    height: 4px;
    background: var(--g2);
    border-radius: 100px;
    margin: 0 auto 16px;
}
.modal-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--dark);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes slideDown { from { transform: translateY(0); } to { transform: translateY(100%); } }
@keyframes pulse-border { 0%,100% { box-shadow: 0 4px 12px rgba(220,38,38,0.12); } 50% { box-shadow: 0 4px 20px rgba(220,38,38,0.25); } }

/* Type selector in modal */
.type-selector { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.type-opt {
    padding: 10px 18px;
    border: 1.5px solid var(--g2);
    border-radius: 100px;
    background: var(--white);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    min-height: 40px;
}
.type-opt.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.type-opt:hover:not(.active) { border-color: var(--primary); }

/* MC priority buttons */
.mc-prio-btn {
    padding: 10px 18px;
    border: 1.5px solid var(--g2);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font);
    background: var(--white);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    min-height: 40px;
}
.mc-prio-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}
.mc-prio-btn[data-prio="haute"].active,
.mc-prio-btn[data-prio="urgente"].active {
    border-color: var(--red);
    background: var(--red-light);
    color: var(--red);
}

/* ===== BOTTOM SHEET (shift detail) ===== */
.bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.bottom-sheet {
    background: var(--white);
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 500px;
    padding: 24px 20px calc(28px + var(--safe-bottom));
    max-height: 88vh;
    overflow-y: auto;
    animation: slideUp 0.3s var(--ease);
}
.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--g2);
    border-radius: 4px;
    margin: 0 auto 20px;
}

/* Itinerary buttons */
.itinerary-grid {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.itinerary-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s var(--ease);
    min-height: 48px;
}
.itinerary-btn:active { transform: scale(0.97); }
.itinerary-btn-google {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    color: #1D4ED8;
}
.itinerary-btn-apple {
    background: var(--g1);
    border: 1px solid var(--g2);
    color: #374151;
}
.itinerary-btn-waze {
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    color: #065F46;
}

/* Live timer */
.live-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #ECFDF5 0%, #fff 100%);
    border: 1px solid #A7F3D0;
    border-radius: 14px;
    margin-bottom: 14px;
}
.live-timer-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s infinite;
    flex-shrink: 0;
}
.live-timer-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.live-timer-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.02em;
    margin-left: auto;
}

/* ===== PROFIL v2 (iOS Settings style) ===== */
.profil-page { padding-bottom: 40px; }

.pf-header {
    text-align: center;
    padding: 24px 16px 20px;
    margin-bottom: 8px;
}
.pf-avatar {
    width: 88px; height: 88px;
    border-radius: 50%;
    margin: 0 auto 14px;
    position: relative;
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.pf-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pf-initials { font-size: 1.6rem; font-weight: 800; color: #fff; }
.pf-avatar-edit {
    position: absolute; bottom: 0; right: 0;
    width: 28px; height: 28px;
    background: var(--primary); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
}
.pf-name { font-weight: 800; font-size: 1.2rem; margin-bottom: 2px; }
.pf-role { font-size: 0.82rem; color: var(--g3); margin-bottom: 4px; }
.pf-matricule {
    display: inline-block;
    font-size: 0.72rem; font-weight: 700;
    color: var(--primary); background: var(--primary-light);
    padding: 3px 12px; border-radius: 100px;
    margin-top: 6px;
}
.pf-qualifs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.pf-qual {
    padding: 4px 12px; border-radius: 100px;
    font-size: 0.7rem; font-weight: 700;
}
.pf-qual-green { background: #ECFDF5; color: #059669; }
.pf-qual-orange { background: #FEF3C7; color: #D97706; }
.pf-qual-red { background: #FEF2F2; color: #DC2626; }

.pf-section-label {
    font-size: 0.72rem; font-weight: 700;
    color: var(--g3); text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 16px 6px;
}
.pf-group {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    margin-bottom: 2px;
}
.pf-item {
    display: flex; align-items: center;
    gap: 12px; padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--g1);
}
.pf-item:last-child { border-bottom: none; }
.pf-item:active { background: var(--g05); }
.pf-item-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.pf-item-content { flex: 1; min-width: 0; }
.pf-item-title { font-weight: 600; font-size: 0.88rem; }
.pf-item-sub { font-size: 0.72rem; color: var(--g4); margin-top: 1px; }
.pf-item-alert { background: #FFFBEB; }
.pf-item-danger .pf-item-title { color: #DC2626; }
.pf-editable .pf-item-sub { font-size: 0.68rem; color: var(--g4); margin-bottom: 1px; }
.pf-count { font-size: 0.72rem; color: var(--g4); font-weight: 500; }

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: calc(90px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--dark);
    color: var(--white);
    padding: 14px 28px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s var(--ease);
    pointer-events: none;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== SKELETON ===== */
.skel {
    background: linear-gradient(90deg, var(--g1) 25%, #eaecf0 50%, var(--g1) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
    height: 20px;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== RAPPORT SERVICE ===== */
.rap-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--g3);
    display: block;
    margin-bottom: 4px;
}
.rap-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--g1);
}
.rap-section:last-of-type { border-bottom: none; }
.rap-section-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}
.rap-section-num {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.rap-section-title { font-size: 0.85rem; font-weight: 700; color: var(--dark); }
.rap-section-hint { font-size: 0.7rem; color: var(--g3); margin-top: 2px; }
.rap-photo-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.rap-photo-thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    border: 1px solid var(--g2);
}
.rap-photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rap-photo-del {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}
.rap-add-photo {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 18px;
    border: 2px dashed var(--g2);
    border-radius: var(--radius-xs);
    background: var(--g05);
    color: var(--g3);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    min-height: 48px;
}
.rap-add-photo:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}
.rap-add-photo:active { transform: scale(0.98); }

/* ===== RESPONSIVE TABLET ===== */
@media (min-width: 768px) {
    .main-content,
    #mainContent {
        max-width: 600px;
        margin: 0 auto;
    }
    .modal-overlay,
    .bottom-sheet-overlay {
        align-items: center;
    }
    .modal-sheet,
    .bottom-sheet {
        border-radius: 24px;
        max-height: 80vh;
    }
    .bottom-nav {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 20px 20px 0 0;
    }
    .app-header {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* ===== PRINT ===== */
@media print {
    .app-header, .bottom-nav, .fab { display: none !important; }
    .main-content, #mainContent { padding: 0; }
}
