:root {
    --fond: #ECEEF1;
    --surface: #FFFFFF;
    --surface-douce: #F7F8FA;
    --entete: #E9ECF0;
    --bordure: #D9DDE3;
    --bordure-forte: #A9B1BB;
    --texte: #1F2933;
    --texte-doux: #555E68;
    --accent: #1F5FA8;
    --accent-fonce: #174A84;
    --accent-clair: #E3ECF7;
    --danger: #A3261C;
    --danger-clair: #FBEAE8;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--fond);
    color: var(--texte);
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

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

h1 {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 28px;
    font-weight: 600;
}

/* Barre de navigation */
.barre { background: var(--surface); border-bottom: 1px solid var(--bordure); }
.barre-contenu {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 32px;
}
.logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--texte);
    text-decoration: none;
}
.navigation { display: flex; gap: 4px; flex-grow: 1; }
.navigation a {
    padding: 8px 14px;
    border-radius: 6px;
    color: var(--texte);
    text-decoration: none;
}
.navigation a:hover { background: var(--entete); }
.navigation a.actif { background: var(--accent-clair); color: var(--accent); font-weight: 600; }

.page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 32px 48px;
}
.titre-page {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

/* Messages */
.message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 18px;
    border: 1px solid;
    border-radius: 6px;
    font-weight: 500;
}
.message span { flex-grow: 1; }
.message button {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.message-succes { background: #E2F1E6; border-color: #A9D3B5; color: #17512B; }
.message-erreur { background: var(--danger-clair); border-color: #E5B5B0; color: #8A1F16; }

/* Boutons */
button, input[type="submit"] { font-family: inherit; cursor: pointer; }
.btn, input[type="submit"] {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #C7CDD5;
    border-radius: 6px;
    background: var(--surface);
    color: var(--texte);
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover, input[type="submit"]:hover { background: var(--entete); color: var(--texte); }
.btn-primaire, input[type="submit"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #FFFFFF;
    font-weight: 600;
}
.btn-primaire:hover, input[type="submit"]:hover { background: var(--accent-fonce); color: #FFFFFF; }
.btn-grand { height: 40px; padding: 0 16px; font-size: 14px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #FFFFFF; font-weight: 600; }
.btn-danger:hover { background: #82190F; color: #FFFFFF; }
.btn-tirets { border-style: dashed; border-color: var(--bordure-forte); background: transparent; }
.btn-texte { border: 0; background: transparent; font-size: 14px; padding: 0 8px; }
.btn-icone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--danger);
    vertical-align: middle;
}
.btn-icone:hover { background: var(--danger-clair); }
.chevron { transition: transform .15s; }
[aria-expanded="true"] .chevron { transform: rotate(180deg); }

/* Formulaires */
input[type="text"], input[type="search"], input[type="password"], select, textarea {
    padding: 0 10px;
    height: 38px;
    border: 1px solid var(--bordure-forte);
    border-radius: 6px;
    background: var(--surface);
    color: var(--texte);
    font-family: inherit;
    font-size: 14px;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.champ { display: flex; flex-direction: column; gap: 5px; font-weight: 500; }
.carte {
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 18px;
}
.carte h2 { margin: 0 0 14px; font-size: 16px; font-weight: 600; }
.grille-champs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.groupe-boutons { display: flex; gap: 8px; margin-top: 14px; }

.recherche { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.recherche .champ-large { flex: 1 1 320px; }
.recherche .champ-etroit { flex: 0 1 220px; }
.recherche input, .recherche select { height: 40px; }

.resume { display: flex; gap: 12px; margin: 0 0 10px; color: var(--texte-doux); font-size: 13px; font-weight: 500; }

/* Tableaux */
table {
    width: 100%;
    margin: 0 0 24px;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: 8px;
    text-align: left;
}
caption {
    padding-bottom: 8px;
    text-align: left;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 600;
}
th {
    padding: 11px 16px;
    background: var(--entete);
    border-bottom: 1px solid var(--bordure);
    font-size: 13px;
    font-weight: 600;
}
td {
    padding: 10px 16px;
    border-bottom: 1px solid #E6E9ED;
    vertical-align: middle;
}
tr:last-child td { border-bottom: 0; }

.liste-tp tbody tr.ligne:hover td { background: var(--surface-douce); }
.nom-tp { font-weight: 600; }
.description-tp { color: var(--texte-doux); font-size: 13px; }
.etiquette {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--entete);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}
.date { color: var(--texte-doux); white-space: nowrap; }
.lien-pdf { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.actions { display: flex; align-items: center; gap: 6px; }
.en-ligne { display: inline; }
.aucun { padding: 32px; text-align: center; color: var(--texte-doux); }

.ligne-fichiers td { background: var(--surface-douce); }
.fichiers { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fichier {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 0 2px 0 10px;
    border: 1px solid var(--bordure);
    border-radius: 6px;
    background: var(--surface);
    font-size: 13px;
}
.fichier a { text-decoration: none; }
.fichier .btn-icone { width: 26px; height: 26px; }

/* Connexion et confirmation */
.carte-centree { max-width: 420px; margin: 80px auto 0; }
.carte-centree input[type="password"] { width: 100%; }
.carte-centree p { margin: 0 0 4px; font-size: 15px; }

/* Autocomplétion */
.ui-widget.ui-autocomplete {
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    border: 1px solid var(--bordure);
    border-radius: 6px;
}
