/* ==========================================================================
   Portail employé Samabadge — design system PWA mobile-first v3 (iOS-like)
   Palette indigo, typographie SF-like via Inter, safe-area, no-shift,
   composants reutilisables.
   ========================================================================== */

:root {
    /* Couleurs — indigo principal */
    --emp-primary:       #6366F1;
    --emp-primary-700:   #4F46E5;
    --emp-primary-50:    #EEF2FF;
    --emp-primary-100:   #E0E7FF;
    --emp-accent:        #8B5CF6;

    --emp-success:       #10B981;
    --emp-success-50:    #ECFDF5;
    --emp-warning:       #F59E0B;
    --emp-warning-50:    #FFFBEB;
    --emp-danger:        #EF4444;
    --emp-danger-50:     #FEF2F2;
    --emp-info:          #0EA5E9;
    --emp-info-50:       #F0F9FF;

    --emp-dark:          #0F172A;
    --emp-text:          #1E293B;
    --emp-text-soft:     #475569;
    --emp-gray:          #64748B;
    --emp-muted:         #94A3B8;

    --emp-bg:            #F4F5F9;
    --emp-bg-2:          #FAFAFC;
    --emp-card:          #FFFFFF;
    --emp-border:        #E2E8F0;
    --emp-border-soft:   #EEF1F5;
    --emp-overlay:       rgba(15, 23, 42, 0.55);

    /* Rayons */
    --emp-r-sm: 10px;
    --emp-r:    14px;
    --emp-r-lg: 18px;
    --emp-r-xl: 24px;

    /* Ombres iOS douces */
    --emp-shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
    --emp-shadow:    0 4px 14px rgba(15,23,42,0.06);
    --emp-shadow-lg: 0 18px 40px rgba(15,23,42,0.12);

    /* Mesures */
    --emp-topbar-h: 54px;
    --emp-bottom-nav: 60px;
    --emp-safe-top:    env(safe-area-inset-top, 0);
    --emp-safe-bottom: env(safe-area-inset-bottom, 0);

    /* Transitions */
    --t-fast: 0.15s cubic-bezier(.4,0,.2,1);
    --t-med:  0.25s cubic-bezier(.4,0,.2,1);
}

/* ============================ Reset / base ============================ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
html { background: var(--emp-bg); }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
    background: var(--emp-bg);
    color: var(--emp-text);
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    line-height: 1.5;
    /* Reserve l'espace pour la bottom-nav fixe */
    padding-bottom: calc(var(--emp-bottom-nav) + var(--emp-safe-bottom) + 12px);
    overflow-x: hidden;
}
@supports (-webkit-touch-callout: none) {
    body { touch-action: manipulation; }
}
button, input, select, textarea { font-family: inherit; }
button { background: none; border: 0; cursor: pointer; color: inherit; padding: 0; }
a { color: var(--emp-primary); text-decoration: none; }
img { max-width: 100%; display: block; }

/* Scroll fluide iOS */
.emp-scroll { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* Utility */
.emp-row { display: flex; }
.emp-col { display: flex; flex-direction: column; }
.emp-gap-2 { gap: 0.5rem; }
.emp-gap-3 { gap: 0.75rem; }
.emp-flex-1 { flex: 1; min-width: 0; }
.emp-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emp-mt-0 { margin-top: 0 !important; }
.emp-mt-1 { margin-top: 0.5rem !important; }
.emp-mt-2 { margin-top: 1rem !important; }
.emp-text-muted { color: var(--emp-muted); }
.emp-text-gray { color: var(--emp-gray); }
.emp-text-sm { font-size: 0.82rem; }
.emp-text-xs { font-size: 0.72rem; }

/* ============================ Top bar ============================ */
.emp-topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    height: calc(var(--emp-topbar-h) + var(--emp-safe-top));
    padding: var(--emp-safe-top) 16px 0;
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(255,255,255,0.82);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--emp-border-soft);
}
.emp-topbar-left { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.emp-topbar h1 {
    font-size: 17px; font-weight: 700; margin: 0;
    color: var(--emp-dark); letter-spacing: -0.01em;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.emp-topbar small { font-size: 11px; color: var(--emp-muted); margin-top: 1px; line-height: 1; }
.emp-topbar-right { display: flex; align-items: center; gap: 10px; }

.emp-topbar-btn {
    width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--emp-border-soft); color: var(--emp-text);
    text-decoration: none; font-size: 16px; position: relative;
    transition: background var(--t-fast), transform var(--t-fast);
}
.emp-topbar-btn:hover { background: var(--emp-border); }
.emp-topbar-btn:active { transform: scale(0.92); }
.emp-topbar-btn .badge-dot,
.emp-topbar-btn .badge-num {
    position: absolute; top: -2px; right: -2px;
    background: var(--emp-danger); color: white;
    border: 2px solid var(--emp-card);
    border-radius: 999px;
}
.emp-topbar-btn .badge-dot { width: 10px; height: 10px; }
.emp-topbar-btn .badge-num {
    min-width: 18px; height: 18px; padding: 0 4px;
    font-size: 10px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
}
.emp-topbar-back {
    background: transparent; color: var(--emp-primary);
    width: auto; padding: 0 4px 0 0; font-size: 22px;
}

.emp-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--emp-primary), var(--emp-accent));
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
    text-decoration: none;
    box-shadow: var(--emp-shadow-sm);
    flex-shrink: 0;
    transition: transform var(--t-fast);
}
.emp-avatar:active { transform: scale(0.95); }

/* ============================ Container ============================ */
.emp-container {
    padding: 14px 16px 0;
    max-width: 760px;
    margin: 0 auto;
}
.emp-container.is-flush { padding: 0; }

/* ============================ Cards ============================ */
.emp-card {
    background: var(--emp-card);
    border-radius: var(--emp-r);
    padding: 14px 16px;
    border: 1px solid var(--emp-border-soft);
    margin-bottom: 12px;
    box-shadow: var(--emp-shadow-sm);
}
.emp-card.is-flush { padding: 0; overflow: hidden; }
.emp-card.is-tight { padding: 10px 12px; }
.emp-card-hero {
    background: linear-gradient(135deg, var(--emp-primary) 0%, var(--emp-accent) 100%);
    color: white;
    border: none;
    padding: 18px 18px 20px;
    border-radius: var(--emp-r-lg);
    box-shadow: 0 14px 36px rgba(99,102,241,0.32);
    position: relative;
    overflow: hidden;
    margin-bottom: 16px;
}
.emp-card-hero::before, .emp-card-hero::after {
    content: ''; position: absolute; border-radius: 50%;
    background: rgba(255,255,255,0.10);
    pointer-events: none;
}
.emp-card-hero::before { width: 220px; height: 220px; top: -90px; right: -60px; }
.emp-card-hero::after  { width: 160px; height: 160px; bottom: -70px; left: -40px; background: rgba(251,191,36,0.18); }
.emp-card-hero h2 { font-size: 22px; margin: 0 0 4px; font-weight: 800; letter-spacing: -0.02em; position: relative; }
.emp-card-hero p  { margin: 0; opacity: 0.9; font-size: 14px; position: relative; }
.emp-card-hero .hero-time {
    margin-top: 12px; display: inline-flex; gap: 7px; align-items: center;
    background: rgba(255,255,255,0.18); padding: 5px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
    backdrop-filter: blur(8px); position: relative;
}

/* ============================ Section title ============================ */
.emp-section-title {
    font-size: 12px; font-weight: 700;
    color: var(--emp-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 18px 4px 8px;
    display: flex; align-items: center; justify-content: space-between;
}
.emp-section-title a {
    font-size: 12px; color: var(--emp-primary); font-weight: 600;
    text-transform: none; letter-spacing: 0;
}
.emp-section-title a:active { opacity: 0.6; }

/* ============================ KPI grid ============================ */
.emp-kpi-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
    margin-bottom: 12px;
}
.emp-kpi {
    background: var(--emp-card);
    border-radius: var(--emp-r);
    padding: 12px 14px;
    border: 1px solid var(--emp-border-soft);
    box-shadow: var(--emp-shadow-sm);
    position: relative;
    overflow: hidden;
}
.emp-kpi .label { font-size: 11px; color: var(--emp-gray); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.emp-kpi .value { font-size: 24px; font-weight: 800; color: var(--emp-dark); margin-top: 4px; line-height: 1.1; letter-spacing: -0.02em; }
.emp-kpi .icon  { position: absolute; right: 12px; top: 12px; font-size: 22px; opacity: 0.85; }
.emp-kpi .sub   { font-size: 11px; color: var(--emp-muted); margin-top: 4px; }
.emp-kpi.is-inline { padding: 10px 12px; }
.emp-kpi.is-inline .value { font-size: 18px; }

/* ============================ Quick actions ============================ */
.emp-actions {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
    margin-bottom: 14px;
}
.emp-action {
    text-decoration: none;
    color: var(--emp-text);
    background: var(--emp-card);
    border: 1px solid var(--emp-border-soft);
    border-radius: var(--emp-r);
    padding: 12px 6px 10px;
    text-align: center;
    transition: transform var(--t-fast), box-shadow var(--t-fast);
    box-shadow: var(--emp-shadow-sm);
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.emp-action:active { transform: scale(0.95); }
.emp-action .emp-action-ico {
    width: 38px; height: 38px;
    border-radius: 12px; display: flex; align-items: center; justify-content: center;
    background: var(--emp-primary-50); color: var(--emp-primary);
    font-size: 18px;
}
.emp-action span { font-size: 11px; font-weight: 600; line-height: 1.2; color: var(--emp-text-soft); }
.emp-action .emp-badge-count {
    position: absolute; top: 6px; right: 6px;
    background: var(--emp-danger); color: white;
    min-width: 18px; height: 18px; border-radius: 9px;
    font-size: 10px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 5px; border: 2px solid var(--emp-card);
}

/* ============================ List items / rows ============================ */
.emp-list { display: flex; flex-direction: column; gap: 8px; }
.emp-list-item {
    display: flex; align-items: center; gap: 12px;
    background: var(--emp-card);
    border: 1px solid var(--emp-border-soft);
    border-radius: var(--emp-r);
    padding: 12px 14px;
    text-decoration: none;
    color: inherit;
    transition: transform var(--t-fast), background var(--t-fast);
    box-shadow: var(--emp-shadow-sm);
}
.emp-list-item:active { transform: scale(0.985); background: var(--emp-bg-2); }
.emp-list-item .ico {
    width: 40px; height: 40px; border-radius: 12px;
    background: var(--emp-primary-50); color: var(--emp-primary);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 17px;
}
.emp-list-item .body { flex: 1; min-width: 0; }
.emp-list-item .body strong { display: block; font-size: 14px; font-weight: 600; color: var(--emp-dark); }
.emp-list-item .body small  { color: var(--emp-gray); font-size: 12px; display: block; margin-top: 2px; }
.emp-list-item .chev { color: var(--emp-muted); font-size: 18px; flex-shrink: 0; }

/* Inset list iOS-style (groupes dans une carte) */
.emp-inset {
    background: var(--emp-card);
    border-radius: var(--emp-r);
    overflow: hidden;
    border: 1px solid var(--emp-border-soft);
    box-shadow: var(--emp-shadow-sm);
    margin-bottom: 12px;
}
.emp-inset-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    text-decoration: none; color: inherit;
    border-bottom: 1px solid var(--emp-border-soft);
    background: var(--emp-card);
    transition: background var(--t-fast);
}
.emp-inset-row:last-child { border-bottom: 0; }
.emp-inset-row:active { background: var(--emp-bg-2); }
.emp-inset-row .ico {
    width: 32px; height: 32px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 15px;
}
.emp-inset-row .body { flex: 1; min-width: 0; }
.emp-inset-row .body strong { display: block; font-size: 14px; color: var(--emp-dark); font-weight: 500; }
.emp-inset-row .body small  { display: block; color: var(--emp-gray); font-size: 12px; margin-top: 2px; }
.emp-inset-row .chev { color: var(--emp-muted); font-size: 16px; flex-shrink: 0; }

/* ============================ Bottom nav iOS-like ============================ */
.emp-bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: rgba(255,255,255,0.86);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--emp-border-soft);
    display: flex;
    height: calc(var(--emp-bottom-nav) + var(--emp-safe-bottom));
    padding-bottom: var(--emp-safe-bottom);
    z-index: 100;
}
.emp-bottom-nav a {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--emp-muted);
    font-size: 10.5px;
    font-weight: 500;
    transition: color var(--t-fast), transform var(--t-fast);
    position: relative;
    padding-top: 4px;
}
.emp-bottom-nav a i { font-size: 22px; }
.emp-bottom-nav a:active { transform: scale(0.92); }
.emp-bottom-nav a.active { color: var(--emp-primary); }
.emp-bottom-nav a .nav-badge {
    position: absolute; top: 2px; right: calc(50% - 18px);
    background: var(--emp-danger); color: white;
    min-width: 16px; height: 16px; border-radius: 8px;
    font-size: 9px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 4px; border: 2px solid var(--emp-card);
}

/* ============================ Forms ============================ */
.emp-form-group { margin-bottom: 14px; }
.emp-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; display: block; color: var(--emp-text); }
.emp-input, .emp-select, .emp-textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--emp-border);
    border-radius: 12px;
    font-size: 16px; /* >=16px pour eviter le zoom iOS */
    font-family: inherit;
    background: var(--emp-card);
    color: var(--emp-dark);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
    -webkit-appearance: none;
    appearance: none;
}
.emp-textarea { resize: vertical; min-height: 90px; }
.emp-input:focus, .emp-select:focus, .emp-textarea:focus {
    outline: none;
    border-color: var(--emp-primary);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.12);
}
.emp-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748B' d='M3.2 5.4l4.8 4.8 4.8-4.8z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* Search */
.emp-search {
    position: relative;
}
.emp-search input {
    width: 100%; padding: 9px 14px 9px 36px;
    border: 0; border-radius: 12px;
    font-size: 15px;
    background: rgba(120,120,128,0.12);
    color: var(--emp-dark);
}
.emp-search input::placeholder { color: var(--emp-muted); }
.emp-search input:focus { outline: none; background: rgba(120,120,128,0.18); }
.emp-search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--emp-muted); font-size: 14px; }

/* Segmented control iOS */
.emp-segment {
    display: inline-flex;
    background: rgba(120,120,128,0.16);
    padding: 2px;
    border-radius: 10px;
    width: 100%;
}
.emp-segment a, .emp-segment button {
    flex: 1;
    text-align: center;
    padding: 7px 10px;
    border-radius: 8px;
    color: var(--emp-text);
    font-size: 13px; font-weight: 600;
    text-decoration: none;
    transition: background var(--t-fast), box-shadow var(--t-fast), color var(--t-fast);
    white-space: nowrap;
}
.emp-segment a.active, .emp-segment button.active {
    background: var(--emp-card);
    color: var(--emp-dark);
    box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}

/* ============================ Buttons ============================ */
.emp-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    border: none;
    transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
    text-decoration: none;
    line-height: 1;
}
.emp-btn:active { transform: scale(0.97); }
.emp-btn-primary { background: var(--emp-primary); color: white; box-shadow: 0 4px 14px rgba(99,102,241,0.32); }
.emp-btn-primary:hover { background: var(--emp-primary-700); }
.emp-btn-success { background: var(--emp-success); color: white; box-shadow: 0 4px 14px rgba(16,185,129,0.32); }
.emp-btn-danger  { background: var(--emp-danger);  color: white; box-shadow: 0 4px 14px rgba(239,68,68,0.32); }
.emp-btn-light   { background: rgba(120,120,128,0.16); color: var(--emp-text); }
.emp-btn-outline { background: transparent; border: 1.5px solid var(--emp-border); color: var(--emp-text); }
.emp-btn-block   { width: 100%; }
.emp-btn-sm      { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.emp-btn-lg      { padding: 14px 26px; font-size: 16px; border-radius: 14px; }

/* FAB */
.emp-fab {
    position: fixed;
    right: 18px;
    bottom: calc(var(--emp-bottom-nav) + var(--emp-safe-bottom) + 16px);
    width: 56px; height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--emp-primary), var(--emp-accent));
    color: white;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 12px 28px rgba(99,102,241,0.4);
    text-decoration: none;
    font-size: 22px;
    z-index: 90;
    transition: transform var(--t-fast);
}
.emp-fab:active { transform: scale(0.9); }

/* ============================ Status pills ============================ */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1.2; }
.pill i { font-size: 10px; }
.pill.success { background: var(--emp-success-50); color: #047857; }
.pill.warning { background: var(--emp-warning-50); color: #92400E; }
.pill.danger  { background: var(--emp-danger-50);  color: #B91C1C; }
.pill.info    { background: var(--emp-info-50);    color: #0369A1; }
.pill.neutral { background: var(--emp-border-soft); color: var(--emp-text-soft); }

/* ============================ Empty state ============================ */
.emp-empty { text-align: center; padding: 36px 20px; color: var(--emp-gray); }
.emp-empty i { font-size: 44px; opacity: 0.35; display: block; margin-bottom: 10px; color: var(--emp-muted); }
.emp-empty h4 { margin: 0 0 4px; font-size: 16px; color: var(--emp-text); font-weight: 600; }
.emp-empty p { margin: 0; font-size: 13px; color: var(--emp-gray); }

/* ============================ Login splash ============================ */
.emp-login-wrap {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(160deg, var(--emp-primary-50) 0%, #FAFAFC 70%);
    padding: 24px 18px calc(24px + var(--emp-safe-bottom));
}
.emp-login-card { width: 100%; max-width: 400px; }
.emp-login-card h1 { font-size: 22px; font-weight: 800; text-align: center; margin: 0 0 6px; letter-spacing: -0.02em; }
.emp-login-card p.lead { text-align: center; color: var(--emp-gray); font-size: 14px; margin: 0 0 22px; }
.emp-login-box { background: white; padding: 24px 22px; border-radius: var(--emp-r-lg); box-shadow: 0 14px 50px rgba(15,23,42,0.10); }

/* ============================ Alerts ============================ */
.emp-alert {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 12px;
    display: flex; gap: 10px; align-items: flex-start;
    border: 1px solid transparent;
}
.emp-alert i { font-size: 18px; flex-shrink: 0; }
.emp-alert.success { background: var(--emp-success-50); color: #065F46; border-color: rgba(16,185,129,0.25); }
.emp-alert.danger  { background: var(--emp-danger-50);  color: #991B1B; border-color: rgba(239,68,68,0.25); }
.emp-alert.info    { background: var(--emp-info-50);    color: #075985; border-color: rgba(14,165,233,0.25); }
.emp-alert.warning { background: var(--emp-warning-50); color: #92400E; border-color: rgba(245,158,11,0.25); }
.emp-alert .emp-alert-body { flex: 1; }
.emp-alert .emp-alert-actions { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.emp-alert .emp-alert-actions a { color: inherit; font-weight: 700; font-size: 13px; }

/* ============================ Sheets / modals ============================ */
.emp-sheet-backdrop {
    position: fixed; inset: 0; z-index: 200;
    background: var(--emp-overlay);
    display: none;
    align-items: flex-end; justify-content: center;
    animation: empFadeIn var(--t-med);
}
.emp-sheet-backdrop.is-open { display: flex; }
.emp-sheet {
    background: var(--emp-card);
    width: 100%;
    max-width: 520px;
    border-radius: var(--emp-r-xl) var(--emp-r-xl) 0 0;
    padding: 18px 18px calc(18px + var(--emp-safe-bottom));
    max-height: 90vh;
    overflow-y: auto;
    animation: empSlideUp var(--t-med);
    box-shadow: 0 -8px 32px rgba(15,23,42,0.18);
}
.emp-sheet-handle {
    width: 38px; height: 5px; border-radius: 3px;
    background: var(--emp-border);
    margin: -8px auto 14px;
}
.emp-sheet h4 { margin: 0 0 12px; font-size: 17px; font-weight: 700; color: var(--emp-dark); }

@keyframes empFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes empSlideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ============================ Tab bar (segmented horizontal scroll) ============================ */
.emp-tabbar {
    display: flex; gap: 8px;
    overflow-x: auto;
    padding: 6px 4px 10px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px 4px;
}
.emp-tabbar::-webkit-scrollbar { display: none; }
.emp-tab {
    flex-shrink: 0;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--emp-card);
    border: 1px solid var(--emp-border-soft);
    color: var(--emp-text-soft);
    font-size: 13px; font-weight: 600;
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.emp-tab:active { transform: scale(0.96); }
.emp-tab.active {
    background: var(--emp-primary);
    color: white;
    border-color: var(--emp-primary);
    box-shadow: 0 4px 12px rgba(99,102,241,0.32);
}
.emp-tab .badge {
    background: rgba(255,255,255,0.30);
    color: inherit;
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 10px; font-weight: 800;
    line-height: 1.4;
}
.emp-tab:not(.active) .badge { background: var(--emp-danger); color: white; }

/* ============================ Avatars / initials ============================ */
.emp-avatar-circle {
    width: 40px; height: 40px; border-radius: 50%;
    color: white; font-weight: 700; font-size: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.emp-avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.emp-avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.emp-avatar-lg { width: 56px; height: 56px; font-size: 19px; }

/* ============================ Timeline ============================ */
.emp-timeline { display: flex; flex-direction: column; gap: 12px; }
.emp-timeline-item { display: flex; gap: 10px; }
.emp-timeline-item .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--emp-primary); flex-shrink: 0; margin-top: 6px; }
.emp-timeline-item .body { flex: 1; min-width: 0; }

/* ============================ Feed (employe v3) ============================ */
.emp-feed-post {
    background: var(--emp-card);
    border: 1px solid var(--emp-border-soft);
    border-radius: var(--emp-r-lg);
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: var(--emp-shadow-sm);
    overflow: hidden;
}
.emp-feed-post.is-pinned { border-color: var(--emp-warning); background: linear-gradient(180deg, #FFFBEB 0%, #FFF 100%); }
.emp-feed-post.cat-urgent     { border-left: 4px solid var(--emp-danger); }
.emp-feed-post.cat-important  { border-left: 4px solid var(--emp-warning); }
.emp-feed-post.cat-annonce    { border-left: 4px solid var(--emp-primary); }
.emp-feed-post.cat-celebration{ border-left: 4px solid var(--emp-success); }
.emp-feed-author { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.emp-feed-author .av { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.emp-feed-author .name { font-weight: 700; font-size: 14px; color: var(--emp-dark); line-height: 1.2; }
.emp-feed-author .date { font-size: 11.5px; color: var(--emp-muted); margin-top: 1px; }
.emp-feed-cat { font-size: 10px; padding: 2px 8px; border-radius: 999px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.emp-feed-content { color: var(--emp-text); line-height: 1.55; white-space: pre-wrap; font-size: 14.5px; }
.emp-feed-content strong { color: var(--emp-dark); }
.emp-feed-media { margin-top: 12px; border-radius: var(--emp-r); overflow: hidden; display: grid; gap: 4px; }
.emp-feed-media img { width: 100%; max-height: 360px; object-fit: cover; display: block; cursor: zoom-in; }
.emp-feed-media.grid-2 { grid-template-columns: 1fr 1fr; }
.emp-feed-media.grid-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.emp-feed-media.grid-3 img:first-child { grid-row: span 2; max-height: none; height: 100%; }
.emp-feed-media.grid-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.emp-feed-media img { max-height: 240px; }
.emp-feed-stats { display: flex; gap: 12px; font-size: 12px; color: var(--emp-muted); margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--emp-border-soft); }
.emp-feed-actions { display: flex; gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--emp-border-soft); }
.emp-feed-action {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 8px; border-radius: 10px;
    color: var(--emp-text-soft); font-size: 13px; font-weight: 600;
    transition: background var(--t-fast); cursor: pointer; background: transparent; border: 0;
}
.emp-feed-action:active { background: var(--emp-bg-2); transform: scale(0.97); }
.emp-feed-action.is-active { color: var(--emp-primary); }

/* Composer feed */
.emp-feed-composer {
    background: var(--emp-card);
    border: 1px solid var(--emp-border-soft);
    border-radius: var(--emp-r-lg);
    padding: 12px 14px;
    margin-bottom: 14px;
    box-shadow: var(--emp-shadow-sm);
}

/* ============================ Chat (Messenger style) ============================ */
.emp-chat-page {
    height: calc(100vh - var(--emp-topbar-h) - var(--emp-bottom-nav) - var(--emp-safe-top) - var(--emp-safe-bottom));
    height: calc(100dvh - var(--emp-topbar-h) - var(--emp-bottom-nav) - var(--emp-safe-top) - var(--emp-safe-bottom));
    display: flex;
    background: var(--emp-bg);
    position: relative;
    overflow: hidden;
}
.emp-chat-conv-list { width: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 12px 12px; }
.emp-chat-conv {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 10px;
    border-radius: var(--emp-r);
    text-decoration: none; color: inherit;
    transition: background var(--t-fast);
    margin-bottom: 2px;
}
.emp-chat-conv:active { background: var(--emp-border-soft); }
.emp-chat-conv .av { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 17px; flex-shrink: 0; position: relative; }
.emp-chat-conv .av .online { position: absolute; bottom: 0; right: 0; width: 13px; height: 13px; border-radius: 50%; background: var(--emp-success); border: 2.5px solid var(--emp-card); }
.emp-chat-conv .body { flex: 1; min-width: 0; }
.emp-chat-conv .body .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.emp-chat-conv .body .top .name { font-weight: 600; color: var(--emp-dark); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emp-chat-conv .body .top .time { font-size: 11px; color: var(--emp-muted); flex-shrink: 0; }
.emp-chat-conv .body .preview { font-size: 13px; color: var(--emp-gray); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; display: flex; gap: 6px; align-items: center; }
.emp-chat-conv.is-unread .body .top .name { font-weight: 700; }
.emp-chat-conv.is-unread .body .preview { color: var(--emp-text); font-weight: 600; }
.emp-chat-conv .body .preview .unread {
    background: var(--emp-primary); color: white;
    min-width: 19px; height: 19px; border-radius: 999px;
    font-size: 11px; font-weight: 700;
    padding: 0 6px;
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: auto;
}

/* Conversation ouverte (vue chat) */
.emp-chat-room {
    display: flex; flex-direction: column;
    width: 100%;
    height: 100%;
    background: var(--emp-card);
}
.emp-chat-room-head {
    flex-shrink: 0;
    padding: 10px 14px;
    border-bottom: 1px solid var(--emp-border-soft);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    display: flex; align-items: center; gap: 10px;
}
.emp-chat-room-head .back { color: var(--emp-primary); font-size: 22px; padding: 4px 6px; }
.emp-chat-room-head .av { width: 38px; height: 38px; border-radius: 50%; color: white; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.emp-chat-room-head .info { flex: 1; min-width: 0; }
.emp-chat-room-head .info .name { font-weight: 700; color: var(--emp-dark); font-size: 15px; line-height: 1.1; }
.emp-chat-room-head .info .desc { font-size: 11.5px; color: var(--emp-muted); margin-top: 2px; }
.emp-chat-room-head .actions { display: flex; gap: 6px; }
.emp-chat-room-head .actions button { width: 36px; height: 36px; border-radius: 50%; color: var(--emp-primary); font-size: 17px; }

.emp-chat-msgs {
    flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 12px 12px 8px;
    background: linear-gradient(180deg, #FAFAFD 0%, #FFFFFF 100%);
    display: flex; flex-direction: column; gap: 4px;
}
.emp-chat-day-sep { text-align: center; font-size: 11px; color: var(--emp-muted); margin: 12px 0 6px; font-weight: 600; }

.emp-chat-msg-row { display: flex; gap: 8px; max-width: 80%; }
.emp-chat-msg-row.me { margin-left: auto; flex-direction: row-reverse; }
.emp-chat-msg-row .av { width: 28px; height: 28px; border-radius: 50%; color: white; font-weight: 700; font-size: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; align-self: flex-end; }
.emp-chat-msg-row.me .av { display: none; }
.emp-chat-msg-row.consec .av { visibility: hidden; }

.emp-chat-msg-row .col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.emp-chat-msg-row.me .col { align-items: flex-end; }
.emp-chat-msg-row .author { font-size: 11px; color: var(--emp-muted); padding: 0 6px; margin-bottom: 1px; font-weight: 600; }
.emp-chat-msg-row.me .author { display: none; }
.emp-chat-msg-row .bubble {
    background: var(--emp-card);
    border: 1px solid var(--emp-border-soft);
    border-radius: 18px;
    padding: 8px 13px;
    font-size: 14px;
    color: var(--emp-text);
    word-wrap: break-word;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
    max-width: 100%;
    position: relative;
}
.emp-chat-msg-row.me .bubble {
    background: linear-gradient(135deg, var(--emp-primary), var(--emp-accent));
    color: white;
    border: 0;
}
.emp-chat-msg-row.me .bubble a { color: #DDD6FE; }

/* Tail / coin coupé style messenger */
.emp-chat-msg-row .bubble.first      { border-top-left-radius: 18px; }
.emp-chat-msg-row .bubble.last       { border-bottom-left-radius: 6px; }
.emp-chat-msg-row.me .bubble.first   { border-top-right-radius: 18px; border-top-left-radius: 18px; }
.emp-chat-msg-row.me .bubble.last    { border-bottom-right-radius: 6px; border-bottom-left-radius: 18px; }

.emp-chat-msg-row .bubble img.att {
    max-width: 240px; max-height: 280px;
    border-radius: 12px; display: block;
    margin-top: 4px; cursor: zoom-in;
}
.emp-chat-msg-row .bubble a.att-file {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 10px; background: rgba(0,0,0,0.06);
    border-radius: 8px; font-size: 12px; text-decoration: none;
    margin-top: 4px; color: inherit;
}
.emp-chat-msg-row.me .bubble a.att-file { background: rgba(255,255,255,0.18); color: white; }
.emp-chat-msg-row .meta { font-size: 10.5px; color: var(--emp-muted); padding: 0 6px; display: flex; gap: 6px; align-items: center; }
.emp-chat-msg-row.me .meta { color: var(--emp-muted); }
.emp-chat-msg-row.deleted .bubble { font-style: italic; color: var(--emp-muted); background: var(--emp-border-soft); border: 0; }

.emp-chat-mention { background: rgba(99,102,241,0.14); color: var(--emp-primary); padding: 1px 5px; border-radius: 6px; font-weight: 600; }
.emp-chat-msg-row.me .emp-chat-mention { background: rgba(255,255,255,0.25); color: white; }

/* Composer input */
.emp-chat-composer {
    flex-shrink: 0;
    padding: 8px 10px;
    padding-bottom: calc(8px + var(--emp-safe-bottom));
    background: var(--emp-card);
    border-top: 1px solid var(--emp-border-soft);
    display: flex; gap: 6px; align-items: flex-end;
    position: relative;
}
.emp-chat-composer .icon-btn {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--emp-border-soft); color: var(--emp-text);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 17px; flex-shrink: 0; transition: background var(--t-fast);
}
.emp-chat-composer .icon-btn:active { transform: scale(0.92); }
.emp-chat-composer textarea {
    flex: 1;
    border: 0;
    border-radius: 20px;
    padding: 10px 14px;
    background: rgba(120,120,128,0.12);
    resize: none;
    font-family: inherit;
    font-size: 15px;
    min-height: 38px;
    max-height: 120px;
    outline: none;
    color: var(--emp-text);
    line-height: 1.35;
}
.emp-chat-composer textarea:focus { background: rgba(120,120,128,0.18); }
.emp-chat-composer .send-btn {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--emp-primary); color: white;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
    transition: transform var(--t-fast), opacity var(--t-fast);
}
.emp-chat-composer .send-btn:active { transform: scale(0.92); }
.emp-chat-composer .send-btn:disabled, .emp-chat-composer .send-btn.is-disabled { opacity: 0.45; }

.emp-chat-att-prev {
    position: absolute; bottom: 100%; left: 10px; right: 10px;
    margin-bottom: 8px;
    background: var(--emp-primary-50); border: 1px solid var(--emp-primary-100);
    color: var(--emp-primary-700);
    border-radius: 10px; padding: 6px 10px;
    font-size: 12px;
    display: none; align-items: center; gap: 8px;
}
.emp-chat-att-prev.is-on { display: flex; }
.emp-mention-popup {
    position: absolute; bottom: 100%; left: 12px; right: 12px;
    margin-bottom: 8px;
    background: var(--emp-card); border: 1px solid var(--emp-border);
    border-radius: var(--emp-r); box-shadow: var(--emp-shadow-lg);
    max-height: 200px; overflow-y: auto; z-index: 50; display: none;
}
.emp-mention-item { padding: 9px 14px; cursor: pointer; font-size: 14px; }
.emp-mention-item.active, .emp-mention-item:hover { background: var(--emp-border-soft); }

/* ============================ Tap effect ============================ */
.tap { transition: transform var(--t-fast); }
.tap:active { transform: scale(0.97); }

/* ============================ Helpers couleurs (présence) ============================ */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--emp-muted); }
.dot.success { background: var(--emp-success); }
.dot.warning { background: var(--emp-warning); }
.dot.danger  { background: var(--emp-danger); }
.dot.info    { background: var(--emp-info); }

/* ============================ Skeleton (éviter "blank flash") ============================ */
.emp-skel { background: linear-gradient(90deg, #EEF1F5 0%, #F8FAFC 50%, #EEF1F5 100%); background-size: 200% 100%; animation: skel 1.4s linear infinite; border-radius: 8px; }
@keyframes skel { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ============================ Desktop ============================ */
@media (min-width: 768px) {
    .emp-container { padding: 18px 24px 0; max-width: 800px; }
    .emp-bottom-nav { display: none; }
    body { padding-bottom: 24px; }
    .emp-kpi-grid { grid-template-columns: repeat(4, 1fr); }
    .emp-actions { grid-template-columns: repeat(6, 1fr); }
    .emp-fab { right: 24px; bottom: 24px; }
}

/* ============================ Transitions de page ============================
   Le fond de la WebView native est aligné sur le fond des pages (capacitor.config.json),
   donc la navigation ne flashe plus. On garde une entrée douce du contenu au chargement
   (fondu + léger glissé). Navigation instantanée au tap (pas d'interception JS).
   Les barres haut/bas restent fixes. */
@media (prefers-reduced-motion: no-preference) {
    .emp-container,
    .emp-login-wrap {
        animation: empPageIn 0.24s cubic-bezier(0.22, 0.61, 0.36, 1) both;
    }
}

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