:root {
    --bg-dark: #04060F;
    --bg-panel: rgba(12, 16, 38, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);

    --logo-green: #00F270;
    --logo-cyan: #00C8F0;
    --color-cp: var(--logo-green);
    --color-plus: var(--logo-cyan);
    --color-minus-full: #FF3060;
    --color-minus-partial: #FF9500;
    --color-minus: #FF3060;
    --color-mixed: #C040FF;

    --bg-entreprise: rgba(0, 90, 220, 0.07);
    --border-entreprise: rgba(0, 120, 255, 0.2);
    --text-entreprise: #7AA5FF;

    --text-main: #FFFFFF;
    --text-muted: #5a6380;
    --radius-card: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, .big-number, .mf-val { font-family: 'Space Grotesk', sans-serif; letter-spacing: -0.5px; }
body { background: var(--bg-dark); color: var(--text-main); height: 100vh; overflow: hidden; width: 100vw; position: relative; }
body::before { content: ''; position: fixed; top: -30vh; left: 50%; transform: translateX(-50%); width: 80vw; height: 60vh; background: radial-gradient(ellipse, rgba(0,200,240,0.05) 0%, transparent 70%); pointer-events: none; z-index: 0; }

.glass-panel { background: var(--bg-panel); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border: 1px solid var(--border-color); border-radius: var(--radius-card); }

.app-container { display: flex; flex-direction: column; height: 100vh; width: 100vw; padding-bottom: 90px; position: relative; z-index: 1; }

/* ── HEADER ─────────────────────────────────── */
.global-header { display: flex; justify-content: space-between; align-items: center; padding: 1.8vh 4vw; border-bottom: 1px solid var(--border-color); background: rgba(4, 6, 15, 0.8); z-index: 50; flex-shrink: 0; }
.brand-group { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 32px; height: 32px; object-fit: contain; border-radius: 8px; }
.brand-title { font-size: clamp(15px, 2.2vh, 20px); font-weight: 700; background: linear-gradient(90deg, #FFF 0%, #8090C0 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.contract-badge { font-size: 10px; padding: 5px 10px; border-radius: 20px; background: rgba(0,242,112,0.06); color: var(--logo-green); font-weight: 700; border: 1px solid rgba(0,242,112,0.2); letter-spacing: 0.3px; }

/* ── FLOATING NAV ────────────────────────────── */
.floating-nav { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); width: 88%; max-width: 380px; background: rgba(10, 14, 35, 0.9); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border: 1px solid rgba(255,255,255,0.09); border-radius: 28px; box-shadow: 0 12px 50px rgba(0,0,0,0.7); display: flex; justify-content: space-around; padding: 8px; z-index: 100; }
.nav-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative; z-index: 2; transition: 0.3s; }
.nav-btn .nav-icon { font-size: 18px; filter: grayscale(1); opacity: 0.5; transition: 0.3s; transform: translateY(0); }
.nav-btn span { font-size: 10px; font-weight: 700; font-family: 'Space Grotesk'; opacity: 0; transform: translateY(8px); transition: 0.3s; }
.nav-btn.active .nav-icon { filter: grayscale(0); opacity: 1; transform: translateY(-4px); }
.nav-btn.active span { opacity: 1; transform: translateY(-2px); color: #FFF; }

/* ── PAGES ──────────────────────────────────── */
.pages-wrapper { flex: 1 1 auto; position: relative; overflow: hidden; }
.page { display: none; height: 100%; flex-direction: column; padding: 2vh 4vw; overflow-y: auto; }
.page.active { display: flex; animation: fadeUp 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes fadeUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }

/* ── CALENDAR HEADER ────────────────────────── */
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2vh; flex-shrink: 0; }
.cal-header h2 { margin: 0; font-size: clamp(18px, 3.5vh, 24px); font-weight: 700; }
.slide-btn { background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); color: var(--logo-cyan); padding: 0.8vh 3.5vw; border-radius: 10px; font-size: 15px; cursor: pointer; transition: 0.15s; }
.slide-btn:active { background: rgba(0,200,240,0.12); transform: scale(0.88); }

/* ── LEGEND ─────────────────────────────────── */
.legend { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 8px; margin-bottom: 1.2vh; padding: 1vh 2.5vw; flex-shrink: 0; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); }
.box { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.box.entreprise { background: var(--bg-entreprise); border: 1px solid var(--border-entreprise); }
.box.cp { background: var(--logo-green); }
.box.anomaly-plus { background: var(--logo-cyan); }
.box.anomaly-minus-full { background: var(--color-minus-full); }
.box.anomaly-minus-partial { background: var(--color-minus-partial); }
.box.mixed { background: var(--color-mixed); }
.box.off { background: rgba(255,255,255,0.03); border: 1px dashed rgba(255,255,255,0.1); }

/* ── CALENDAR WRAPPER & SLIDER ───────────────── */
.calendar-wrapper { flex: 1; width: 100%; position: relative; display: flex; align-items: center; min-height: 0; mask-image: linear-gradient(to right, transparent 0%, black 28%, black 72%, transparent 100%); -webkit-mask-image: linear-gradient(to right, transparent 0%, black 28%, black 72%, transparent 100%); }
.calendar-slider { display: flex; width: 100vw; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; margin-left: -4vw; padding-left: 25vw; padding-right: 25vw; align-items: stretch; }
.calendar-slider::-webkit-scrollbar { display: none; }

.slide-item { flex: 0 0 52vw; scroll-snap-align: center; opacity: 0.1; transform: scale(0.68); transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1); height: 100%; display: flex; flex-direction: column; }
.slide-item.active { opacity: 1; transform: scale(1); }

@media (max-width: 600px) {
    .calendar-slider { padding-left: 7vw; padding-right: 7vw; }
    .slide-item { flex: 0 0 86vw; transform: scale(0.78); opacity: 0.08; }
    .slide-item.active { transform: scale(1); opacity: 1; }
}
@media (min-width: 800px) {
    .calendar-slider { padding-left: calc(50vw - 230px); padding-right: calc(50vw - 230px); }
    .slide-item { flex: 0 0 460px; margin: 0 8px; transform: scale(0.68); opacity: 0.08; }
    .slide-item.active { transform: scale(1); opacity: 1; }
}

/* ── DAY GRID ───────────────────────────────── */
.day-headers { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.5vw; margin-bottom: 4px; flex-shrink: 0; }
.day-header { text-align: center; font-size: clamp(8px, 1.2vh, 10px); color: var(--text-muted); font-weight: 700; text-transform: uppercase; }
.days-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; gap: 0.5vw; flex: 1; min-height: 0; }

/* ── DAY CELLS ──────────────────────────────── */
.day-cell {
    border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: clamp(13px, 1.9vh, 17px); font-weight: 700; cursor: pointer; position: relative;
    color: var(--text-muted); background: transparent; transition: all 0.18s ease;
}
.day-cell:active { transform: scale(0.9); }
.day-cell.empty { pointer-events: none; }

/* Ghost states */
.day-cell.off, .day-cell.ecole, .day-cell.ferie {
    background: rgba(255,255,255,0.015); opacity: 0.35; font-weight: 400;
    color: var(--text-muted); border: 1px solid transparent;
}

/* Today highlight */
.day-cell.today {
    outline: 2px solid rgba(255,255,255,0.9) !important;
    outline-offset: -2px;
    color: #FFF !important;
    background: rgba(255,255,255,0.08) !important;
}
.day-cell.today::before {
    content: '•'; position: absolute; top: 2px; right: 4px; font-size: 8px; color: #FFF;
}

/* Work day */
.day-cell.entreprise {
    background: var(--bg-entreprise); border: 1px solid var(--border-entreprise);
    color: var(--text-entreprise);
}

/* Anomalies */
.day-cell.cp { background: linear-gradient(145deg, #00F270, #009A45); color: #001A0A; box-shadow: 0 3px 12px rgba(0,242,112,0.2); }
.day-cell.anomaly-plus { background: linear-gradient(145deg, #00C8F0, #005EA8); color: #FFF; box-shadow: 0 3px 12px rgba(0,200,240,0.2); }
.day-cell.anomaly-minus-full { background: linear-gradient(145deg, #FF3060, #8B0020); color: #FFF; box-shadow: 0 3px 12px rgba(255,48,96,0.2); }
.day-cell.anomaly-minus-partial { background: linear-gradient(145deg, #FF9500, #885000); color: #FFF; box-shadow: 0 3px 12px rgba(255,149,0,0.2); }
.day-cell.anomaly-mixed { background: linear-gradient(145deg, #C040FF, #5800A0); color: #FFF; box-shadow: 0 3px 12px rgba(192,64,255,0.25); }

/* RH validated dot */
.day-cell .rh-dot { position: absolute; top: 3px; left: 3px; width: 5px; height: 5px; background: var(--logo-green); border-radius: 50%; box-shadow: 0 0 5px var(--logo-green); }

/* Cell info labels */
.cell-info { font-size: clamp(7px, 1vh, 9px); font-weight: 800; position: absolute; bottom: 2px; line-height: 1; }
.cell-info-l { left: 3px; right: auto; font-size: 6px; }
.cell-info-r { right: 3px; left: auto; font-size: 6px; }

/* ── MONTH FOOTER ───────────────────────────── */
.month-footer { display: flex; justify-content: space-around; padding: 1.2vh 2vw; margin-top: 1.2vh; margin-bottom: 0.8vh; flex-shrink: 0; }
.mf-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mf-val { font-size: clamp(16px, 2.5vh, 22px); font-weight: 700; line-height: 1; }
.mf-lbl { font-size: clamp(7px, 1vh, 9px); color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 0.4px; }
.mf-divider { width: 1px; background: var(--border-color); }

/* ── STATS PAGE ─────────────────────────────── */
.page-title-group { margin-bottom: 1.5vh; flex-shrink: 0; }
.page-title-group h2 { font-size: clamp(20px, 3.2vh, 24px); margin-bottom: 2px; }
.page-title-group .sub { color: var(--logo-cyan); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.8; }

.stats-grid { display: flex; flex-direction: column; gap: 1.5vh; max-width: 520px; margin: 0 auto; width: 100%; padding-bottom: 20px; }

/* Summary row */
.stats-summary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 2vw; }
.summary-chip { background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 16px; padding: 1.8vh 14px; display: flex; flex-direction: column; align-items: center; text-align: center; backdrop-filter: blur(20px); gap: 4px; }
.summary-chip .chip-value { font-family: 'Space Grotesk'; font-size: clamp(26px, 5.5vh, 42px); font-weight: 700; line-height: 1; }
.summary-chip .chip-unit { font-size: 13px; opacity: 0.45; font-weight: 600; margin-left: 2px; }
.summary-chip .chip-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); font-weight: 700; }

/* Detail card */
.stat-detail-card { background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: var(--radius-card); padding: 1.8vh 16px; backdrop-filter: blur(20px); }
.stat-detail-card h3 { font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-muted); font-weight: 700; margin-bottom: 1.2vh; font-family: 'Inter'; }
.stat-rows { display: flex; flex-direction: column; gap: 0.9vh; }
.stat-row { display: flex; justify-content: space-between; align-items: center; }
.stat-row-label { font-size: 13px; color: rgba(255,255,255,0.65); }
.stat-row-value { font-size: 15px; font-weight: 700; font-family: 'Space Grotesk'; }

/* Séparateur dans les cartes */
.stat-row-divider { height: 1px; background: var(--border-color); margin: 0.5vh 0; }

/* Progress */
.progress-bar-wrap { width: 100%; height: 4px; background: rgba(255,255,255,0.05); border-radius: 6px; overflow: hidden; margin-top: 1.2vh; }
.progress-fill { height: 100%; transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1); border-radius: 6px; }
.cp-fill { background: linear-gradient(90deg, #007A35, var(--logo-green)); }

/* Anticipation chip */
.anticipation-chip { background: rgba(0, 200, 240, 0.05); border: 1px solid rgba(0,200,240,0.12); border-radius: 10px; padding: 1vh 12px; font-size: 12px; color: rgba(255,255,255,0.55); margin-top: 1vh; }
.anticipation-chip strong { color: var(--logo-cyan); }

/* Utility */
.cyan-text { color: var(--color-plus); }
.red-text { color: var(--color-minus); }
.green-text { color: var(--logo-green); }
.purple-text { color: var(--color-mixed); }

/* ── JOURNAL ────────────────────────────────── */
.page-title-group-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2vh; flex-shrink: 0; }
.page-title-group-row h2 { font-size: clamp(18px, 3vh, 22px); }

.btn-new-entry { background: rgba(0,242,112,0.08); border: 1px solid rgba(0,242,112,0.22); color: #FFF; padding: 1vh 3vw; border-radius: 10px; cursor: pointer; font-family: 'Space Grotesk'; font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 6px; transition: 0.2s; }
.btn-new-entry:active { transform: scale(0.93); }

.journal-wrapper { padding-bottom: 20px; }
.journal-section-title { font-size: 10px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 1.5px; margin-bottom: 1.2vh; font-weight: 800; padding-left: 2px; }
.mt-4 { margin-top: 3vh; }

.journal-month-divider { display: flex; align-items: center; margin: 2vh 0 1vh; width: 100%; max-width: 600px; margin-left: auto; margin-right: auto; }
.journal-month-divider::before, .journal-month-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.05); }
.journal-month-divider span { padding: 0 12px; font-size: 9px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-muted); font-weight: 800; font-family: 'Space Grotesk'; }

.journal-list { display: flex; flex-direction: column; gap: 0.8vh; max-width: 600px; margin: 0 auto; width: 100%; }

.journal-item {
    display: flex; background: rgba(255,255,255,0.025); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px; padding: 1.1vh 14px; align-items: center; gap: 12px;
    cursor: pointer; transition: all 0.2s ease; position: relative; overflow: hidden;
}
.journal-item:hover { border-color: rgba(255,255,255,0.12); background: rgba(255,255,255,0.04); }
.journal-item.rh-valide { border-color: rgba(0,242,112,0.2); background: rgba(0,242,112,0.025); }
.journal-item.rh-valide::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--logo-green); border-radius: 14px 0 0 14px; }

.journal-date { font-weight: 700; font-size: 11px; color: var(--text-muted); width: 44px; text-align: center; flex-shrink: 0; }
.journal-date span { font-size: 20px; font-family: 'Space Grotesk'; display: block; color: #FFF; line-height: 1.2; }
.journal-content { flex: 1; min-width: 0; }
.journal-content h4 { font-size: 13px; margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.journal-content p { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tags-wrap { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex-shrink: 0; }
.journal-value { font-size: 11px; font-weight: 700; font-family: 'Space Grotesk'; padding: 3px 8px; border-radius: 6px; text-align: center; white-space: nowrap; }

.val-plus-tag { background: rgba(0,200,240,0.1); color: var(--color-plus); border: 1px solid rgba(0,200,240,0.2); }
.val-minus-tag { background: rgba(255,48,96,0.1); color: var(--color-minus); border: 1px solid rgba(255,48,96,0.2); }
.val-cp-tag { background: rgba(0,242,112,0.1); color: var(--logo-green); border: 1px solid rgba(0,242,112,0.2); }
.val-rh-tag { background: rgba(0,242,112,0.08); color: var(--logo-green); border: 1px solid rgba(0,242,112,0.15); font-size: 9px; letter-spacing: 0.3px; }

/* ── MODAL ──────────────────────────────────── */
.modal { display: none; position: fixed; inset: 0; background: rgba(2,4,12,0.92); z-index: 200; align-items: center; justify-content: center; padding: 4vw; backdrop-filter: blur(4px); }
.modal.active { display: flex; }
.bounce-in { animation: bounceIn 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.2); }
@keyframes bounceIn { 0% { transform:scale(0.88); opacity:0; } 100% { transform:scale(1); opacity:1; } }
.modal-content { width: 100%; max-width: 440px; border-radius: 22px; padding: 2.5vh 18px; position: relative; max-height: 92vh; overflow-y: auto; }
.close-btn { position: absolute; top: 14px; right: 14px; background: rgba(255,255,255,0.08); border: none; color: #FFF; font-size: 18px; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; }
.close-btn:active { transform: scale(0.8); }

.modal-header { margin-bottom: 1.2vh; }
.modal-header h2 { font-size: 18px; margin-bottom: 4px; }
.modal-picker { width: auto; background: rgba(0,0,0,0.5); color: #FFF; border: 1px solid var(--border-color); padding: 7px 10px; border-radius: 8px; font-size: 15px; margin-bottom: 10px; outline: none; }
.day-badge { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; background: rgba(255,255,255,0.08); margin-bottom: 1.5vh; }

/* RH checkbox row in modal */
.rh-checkbox-row { display: flex; align-items: center; gap: 10px; background: rgba(0,242,112,0.05); border: 1px solid rgba(0,242,112,0.15); border-radius: 10px; padding: 10px 14px; margin-bottom: 1.5vh; cursor: pointer; transition: background 0.2s; }
.rh-checkbox-row:hover { background: rgba(0,242,112,0.08); }
.rh-checkbox-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--logo-green); cursor: pointer; flex-shrink: 0; }
.rh-checkbox-row label { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.8); cursor: pointer; flex: 1; }
.rh-checkbox-row .rh-check-hint { font-size: 10px; color: var(--logo-green); font-weight: 700; }

.input-card { background: rgba(255,255,255,0.03); border-radius: 12px; padding: 1.3vh 14px; margin-bottom: 1.2vh; border-left: 3px solid var(--border-color); transition: background 0.2s; }
.input-card:focus-within { background: rgba(255,255,255,0.05); }
.plus-card { border-left-color: var(--color-plus); }
.minus-card { border-left-color: var(--color-minus-partial); }
.cp-card-input { border-left-color: var(--logo-green); }
.input-card h4 { font-size: 10px; margin-bottom: 0.8vh; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 800; }

.input-row { display: flex; align-items: center; gap: 8px; margin-bottom: 0.8vh; }
.input-row span { font-size: 12px; color: #BBB; }
.input-card input, .input-card select { background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.1); color: #FFF; font-size: 14px; padding: 10px; border-radius: 8px; width: 100%; outline: none; transition: border-color 0.2s; }
.input-card input:focus, .input-card select:focus { border-color: rgba(255,255,255,0.3); }
.input-row input { width: 75px; text-align: center; font-weight: 700; }
.tbd-row { display: flex; align-items: center; gap: 8px; margin: 4px 0 0.8vh; }
.tbd-row input { width: auto !important; }
.tbd-row label { font-size: 11px; color: var(--text-muted); font-weight: 600; cursor: pointer; }

.btn-primary { width: 100%; padding: 1.8vh; border: none; border-radius: 12px; background: linear-gradient(90deg, var(--logo-green), var(--logo-cyan)); color: #001A0A; font-family: 'Space Grotesk'; font-size: 15px; font-weight: 800; cursor: pointer; margin-top: 0.8vh; transition: 0.15s; box-shadow: 0 4px 18px rgba(0,242,112,0.2); }
.btn-primary:active { transform: scale(0.96); }

/* ── TOAST ──────────────────────────────────── */
.toast { position: fixed; top: -60px; left: 50%; transform: translateX(-50%); background: var(--logo-green); color: #001A0A; padding: 10px 22px; border-radius: 30px; font-weight: 800; font-family: 'Space Grotesk'; font-size: 13px; z-index: 1000; opacity: 0; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); white-space: nowrap; }
.toast.show { top: 28px; opacity: 1; }
