@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
    --bg: #EEF2F0;
    --surface: #FFFFFF;
    --surface-muted: #F4F7F5;
    --text: #16211D;
    --text-muted: #5B6B64;
    --border: #D8DED9;
    --accent: #1F6F63;
    --accent-hover: #17544B;
    --accent-soft: #E1F0EC;
    --positif: #2E7D4F;
    --positif-soft: #E5F3EA;
    --negatif: #B23A2E;
    --negatif-soft: #FBEAE8;
    --mauve: #7A4FA0;
    --mauve-soft: #F1E8F7;
    --neutre: #5B6B64;
    --radius: 10px;
    --radius-lg: 16px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

.chiffre {
    font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-variant-numeric: tabular-nums;
}

a { color: var(--accent); }

/* ---------- Connexion ---------- */
.page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}
.login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 40px 32px;
    width: 100%;
    max-width: 360px;
}
.login-title {
    margin: 0 0 24px;
    font-size: 22px;
    font-weight: 700;
}
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form label { font-size: 14px; color: var(--text-muted); }

/* ---------- Structure générale ---------- */
.app-shell {
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 16px 96px;
    min-height: 100vh;
}

.app-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 20px;
}
.app-header h1 {
    font-size: 19px;
    font-weight: 700;
    margin: 0;
}
.lien-deconnexion {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
}

/* Navigation basse, fixe — pensée pour le pouce sur téléphone */
.nav-basse {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 8px max(16px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-bottom));
    gap: 8px;
    z-index: 10;
}
.nav-basse a {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-muted);
}
.nav-basse a.actif {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

/* ---------- Carte de solde ---------- */
.carte-solde {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
}
.carte-solde .etiquette {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 6px;
}
.carte-solde .valeur {
    font-size: 40px;
    font-weight: 600;
    margin: 0;
    line-height: 1.1;
}
.solde-provisoire {
    font-size: 13px;
    color: var(--text-muted);
    margin: 6px 0 0;
    min-height: 16px;
}

/* ---------- Progression de la journée ---------- */
.carte-progression {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 20px;
}
.carte-progression.jour-conge { background: var(--negatif-soft); }
.carte-progression.jour-reprise { background: var(--mauve-soft); }
.carte-progression .etiquette-raison {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}
.carte-progression.jour-conge .etiquette-raison { color: var(--negatif); }
.carte-progression.jour-reprise .etiquette-raison { color: var(--mauve); }
.carte-progression .etiquette {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 8px;
}
.progression-texte {
    font-size: 15px;
    margin: 0 0 10px;
    color: var(--text);
}
.progression-texte #progression-pourcentage {
    font-weight: 700;
}
.barre-progression {
    height: 14px;
    background: var(--surface-muted);
    border-radius: 999px;
    overflow: hidden;
}
.barre-progression-remplissage {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease, background-color 0.3s ease;
}

/* ---------- Note du jour (page Pointer) ---------- */
.carte-note-jour {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-top: 16px;
}
.carte-note-jour .etiquette {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 8px;
}
.form-note-courante {
    display: flex;
    gap: 8px;
}
.form-note-courante input[type="text"] { flex: 1; }
.boutons-etat-jour {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.chiffre.positif, .valeur.positif, .badge.positif { color: var(--positif); }
.chiffre.negatif, .valeur.negatif, .badge.negatif { color: var(--negatif); }
.chiffre.neutre, .valeur.neutre, .badge.neutre { color: var(--text); }

/* ---------- Bouton de pointage ---------- */
.zone-pointage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 28px 0;
}
.bouton-pointage {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: none;
    font-family: inherit;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px;
    transition: transform 0.08s ease, background 0.15s ease;
    box-shadow: 0 8px 24px rgba(31, 111, 99, 0.25);
}
.bouton-pointage:active { transform: scale(0.96); }
.bouton-pointage.etat-depart {
    background: var(--negatif);
    box-shadow: 0 8px 24px rgba(178, 58, 46, 0.25);
}
.statut-pointage {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    min-height: 20px;
}
.statut-pointage .chiffre { color: var(--text); font-weight: 600; }

/* ---------- Liste des segments du jour ---------- */
.liste-segments {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.liste-segments h2 {
    font-size: 15px;
    margin: 0;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.segment-ligne {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.segment-ligne:last-child { border-bottom: none; }
.segment-ligne .duree { color: var(--text-muted); }
.vide { padding: 20px 16px; color: var(--text-muted); font-size: 14px; text-align: center; }

/* ---------- Cartes de résumé (gestion) ---------- */
.grille-resume {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.mini-carte {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}
.mini-carte .etiquette {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 4px;
}
.mini-carte .valeur {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

/* ---------- Filtres ---------- */
.bloc-filtres {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
}
.raccourcis-periode {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.raccourcis-periode a {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    background: var(--surface-muted);
}
.raccourcis-periode a.actif {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.form-filtre {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}
.form-filtre .ligne-dates { display: flex; gap: 8px; flex-wrap: wrap; }
.form-filtre .ligne-cases { display: flex; gap: 16px; flex-wrap: wrap; }
.form-filtre .champ { display: flex; flex-direction: column; gap: 4px; }
.form-filtre label { font-size: 12px; color: var(--text-muted); }
.form-filtre .case-filtre {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 400;
    color: var(--text);
}
.form-filtre .case-filtre input[type="checkbox"] { width: auto; }

/* ---------- Formulaires génériques ---------- */
input[type="text"], input[type="password"], input[type="number"], input[type="time"] {
    font-family: inherit;
    font-size: 15px;
    padding: 9px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    width: 100%;
}
input:focus, button:focus, a:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.bouton {
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.bouton-principal {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.bouton-principal:hover { background: var(--accent-hover); }
.bouton-discret {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
    padding: 6px 8px;
}
.bouton-danger { color: var(--negatif); }

.alerte-erreur {
    background: var(--negatif-soft);
    color: var(--negatif);
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 14px;
}
.alerte-succes {
    background: var(--positif-soft);
    color: var(--positif);
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
}

/* ---------- Tableau des journées (gestion) ---------- */
.journee {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    overflow: hidden;
    scroll-margin-top: 14px;
}
.journee.jour-conge, .journee.jour-conge .journee-entete { background: var(--negatif-soft); }
.journee.jour-reprise, .journee.jour-reprise .journee-entete { background: var(--mauve-soft); }
.note-texte {
    white-space: pre-line;
}
.journee-entete {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--surface-muted);
    border-bottom: 1px solid var(--border);
}
.journee-date {
    font-weight: 600;
    font-size: 14px;
}
.journee-date .weekend { color: var(--text-muted); font-weight: 400; }
.journee-date .badge-conge { color: var(--negatif); font-weight: 600; }
.journee-date .badge-reprise { color: var(--mauve); font-weight: 600; }
.badge-garde {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-hover);
    background: var(--accent-soft);
    padding: 1px 6px;
    border-radius: 999px;
    margin-left: 4px;
}

/* ---------- Page Aide ---------- */
.aide-sommaire {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    margin: 16px 0;
    font-size: 14px;
}
.aide-sommaire a { text-decoration: none; }
.aide-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.6;
    scroll-margin-top: 14px;
}
.aide-section h2 { font-size: 16px; margin: 0 0 8px; }
.aide-section ul { margin: 8px 0; padding-left: 20px; }
.aide-section li { margin-bottom: 4px; }
.aide-section details summary { font-weight: 600; }
.journee-ecart { font-size: 14px; font-weight: 600; }
.journee-corps { padding: 10px 16px 14px; }

.ligne-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 13px;
}
.ligne-item:last-of-type { border-bottom: none; }
.ligne-item .details { color: var(--text-muted); }

.actions-ligne { display: flex; gap: 4px; }
.actions-ligne button, .actions-ligne a {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 6px;
    text-decoration: underline;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 6px 0;
    padding: 10px;
    background: var(--surface-muted);
    border-radius: var(--radius);
}
.form-inline .champ-etroit { width: 110px; }
.form-inline .champ-heure { width: 125px; }

/* ---------- Bouton calendrier (champs AAAAMMJJ) ---------- */
.champ-date-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
}
.bouton-calendrier {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.bouton-calendrier:active { background: var(--surface-muted); }
.date-natif-cache {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.journee-ajout {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}
.journee-ajout button {
    font-size: 12px;
    background: none;
    border: none;
    color: var(--accent-hover);
    cursor: pointer;
    font-weight: 600;
    padding: 2px 0;
}

.masque { display: none; }

@media (max-width: 400px) {
    .bouton-pointage { width: 180px; height: 180px; font-size: 18px; }
    .carte-solde .valeur { font-size: 32px; }
}
