/* ============================================================
   Qontinuity — Espace Client Conseil & Developpement
   Design system projet : Raleway (titres >= 40px) / Inter (reste).
   L'or est DECORATIF uniquement, jamais pour du texte (contraste WCAG).
   ============================================================ */

:root {
    --bg: #FFFFFF;
    --bg-warm: #F8F5F0;
    --bg-dark: #0D0D0D;
    --text: #111111;
    --text-secondary: #5A5A5A;
    --gold: #B8941F;
    --champagne: #C9A536;
    --border: #E5E0D8;
    --danger: #B3261E;
    --success: #1E6B3A;
    --warning: #8A5A00;
    --font-display: 'Raleway', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg-warm);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 12px; font-weight: 600; line-height: 1.25; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

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

.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--bg-dark); color: #fff; padding: 12px 20px; z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Connexion ---------- */

.auth-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%; max-width: 420px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px 32px;
}

.auth-logo { height: 34px; margin-bottom: 26px; }

.auth-card h1 { font-size: 21px; }

.auth-intro { color: var(--text-secondary); margin: 0 0 24px; font-size: 14px; }

/* ---------- Formulaires ---------- */

.champ { margin-bottom: 16px; }

.champ label {
    display: block; margin-bottom: 6px;
    font-size: 13px; font-weight: 500; color: var(--text-secondary);
}

input, select, textarea {
    width: 100%; padding: 10px 12px;
    font-family: var(--font-body); font-size: 15px; color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border); border-radius: 6px;
}

input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--text); box-shadow: 0 0 0 3px rgba(17, 17, 17, .07);
}

textarea { resize: vertical; min-height: 68px; }

.code-input {
    font-size: 26px; letter-spacing: 9px; text-align: center; font-weight: 600;
    padding: 12px;
}

button {
    font-family: var(--font-body); font-size: 15px; font-weight: 500;
    padding: 11px 20px; border-radius: 6px; border: 1px solid transparent;
    cursor: pointer; transition: opacity .15s ease;
}
button:hover { opacity: .85; }
button:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--bg-dark); color: #fff; width: 100%; }
.btn-secondary { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-lien {
    background: none; border: none; color: var(--text-secondary);
    text-decoration: underline; padding: 6px 0; font-size: 14px; width: auto;
}
.btn-danger-lien {
    background: none; border: none; color: var(--danger);
    text-decoration: underline; padding: 2px 0; font-size: 13px; width: auto;
}

/* ---------- Messages ---------- */

.message { padding: 11px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }
.message-erreur { background: #FDECEA; color: var(--danger); }
.message-succes { background: #E8F3EC; color: var(--success); }
.message-info { background: var(--bg-warm); color: var(--text-secondary); }
.message-alerte { background: #FDF3E2; color: var(--warning); }

/* ---------- Structure application ---------- */

.entete {
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    flex-wrap: wrap;
}
.entete-logo { height: 28px; }
.entete-identite { font-size: 13px; color: var(--text-secondary); }
.entete-identite strong { color: var(--text); font-weight: 600; }

.contenu { max-width: 1060px; margin: 0 auto; padding: 28px 24px 64px; }

.bandeau-onglets {
    display: flex; gap: 4px; margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.bandeau-onglets button {
    background: none; border: none; border-bottom: 2px solid transparent;
    border-radius: 0; padding: 9px 14px; color: var(--text-secondary); width: auto;
}
.bandeau-onglets button[aria-selected="true"] {
    color: var(--text); font-weight: 600; border-bottom-color: var(--gold);
}

.carte {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; margin-bottom: 22px;
}

/* ---------- Compteurs ---------- */

.compteurs {
    display: grid; gap: 14px; margin-bottom: 22px;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.compteur {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px;
}
.compteur-libelle {
    font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-secondary); margin-bottom: 8px;
}
.compteur-valeur { font-size: 30px; font-weight: 700; line-height: 1.1; }
.compteur-detail { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.compteur-negatif .compteur-valeur { color: var(--danger); }

.jauge {
    height: 6px; background: var(--bg-warm); border-radius: 3px;
    overflow: hidden; margin-top: 12px;
}
.jauge-remplissage { height: 100%; background: var(--champagne); border-radius: 3px; }
.jauge-remplissage.est-depasse { background: var(--danger); }

/* ---------- Tableaux ---------- */

.table-enveloppe { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th {
    text-align: left; font-size: 12px; text-transform: uppercase;
    letter-spacing: .05em; color: var(--text-secondary); font-weight: 600;
    padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}

td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }

.col-duree { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.col-date { white-space: nowrap; }
.col-horaires { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-secondary); }

/* Duree deduite des horaires — affichee avant l'envoi, recalculee par le serveur */
.duree-calculee {
    margin: -4px 0 16px;
    font-size: 14px; font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.duree-calculee.duree-invalide { color: var(--danger); font-weight: 500; }

.etiquette {
    display: inline-block; padding: 2px 9px; border-radius: 99px;
    font-size: 12px; background: var(--bg-warm); color: var(--text-secondary);
}

.vide { padding: 30px; text-align: center; color: var(--text-secondary); font-size: 14px; }

.grille-2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.grille-3 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr 1fr; }

.barre-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.barre-actions label { font-size: 13px; color: var(--text-secondary); }
.barre-actions select, .barre-actions input { width: auto; min-width: 180px; }

.discret { color: var(--text-secondary); font-size: 13px; }

@media (max-width: 720px) {
    .grille-2, .grille-3 { grid-template-columns: 1fr; }
    .contenu { padding: 20px 16px 48px; }
    .compteur-valeur { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
