/* ==========================================================================
   CAT EXTRANET — design system back-office (refonte 2026/10/28)
   Couche de refonte chargée en DERNIER, versionnée par mtime (page.php).
   Palette d'origine conservée : bleu #0d61be, ardoise #5c8dbd, corail
   #ff7551, orange #c77405, gris #c6cace.
   Rollback complet = retirer le lien modern.css + les fonctions page.php.
   ========================================================================== */

:root {
    --blue: #0d61be;
    --blue-dark: #0a4f9d;
    --slate: #5c8dbd;
    --coral: #ff7551;
    --orange: #c77405;
    --red: #cc1a1f;
    --bg: #e9edf1;
    --surface: #ffffff;
    --line: #dfe4e8;
    --line-soft: #eceff2;
    --text: #5c8dbd;
    --ink: #3f5670;
    --muted: #8aa0b5;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(16, 42, 67, 0.12), 0 4px 12px rgba(16, 42, 67, 0.06);
    --shadow-sm: 0 1px 3px rgba(16, 42, 67, 0.14);
    --panel: #f7fafc;
}

/* ---------- Base ---------- */
html {
    /* Fond peint aussi sur <html> : évite une bande blanche sous le footer
       quand le corps est plus court que le viewport. */
    background: var(--bg);
    color-scheme: light;
}

.app-body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
}

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

img {
    max-width: 100%;
    height: auto;
}

/* ---------- Barre supérieure ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 18px;
    padding: 13px 28px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.topbar__brand {
    font-size: 19px;
    font-weight: 700;
    color: var(--blue);
    letter-spacing: 0.01em;
    line-height: 1.15;
}

.topbar__sub {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
}

.topbar__user {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

/* ---------- Bannière ---------- */
.banner {
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.banner img {
    display: block;
    width: 100%;
    height: auto;
}

/* ---------- Conteneur (coquille PHP uniquement — les vues admin
   réutilisent la classe .container avec leur propre mise en page) ---------- */
.app > .container {
    flex: 1;
    width: 100%;
    /* Pleine largeur écran : les tableaux de résultats 1920 doivent
       exploiter tous les pixels (marge latérale bornée par clamp). */
    max-width: none;
    margin: 0 auto;
    padding: 26px clamp(20px, 2.5vw, 48px) 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    box-sizing: border-box;
}

/* ---------- Cartes ---------- */
.card {
    width: 100%;
    margin-inline: auto;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card__bar {
    padding: 13px 22px;
    background: var(--slate);
    color: #fff;
    font-weight: 700;
    font-size: 13.5px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.card__bar--coral {
    background: var(--coral);
}

.card__body {
    padding: 22px 24px;
    background: var(--surface);
    color: var(--text);
}

/* Anciens gabarits : tableauxwrappers v1 (VisuData, rapport…) neutralisés
   pour que les cartes remplissent le conteneur */
table[valign="top"],
table[valign="top"] > tbody,
table[valign="top"] > tbody > tr,
table[valign="top"] > tbody > tr > td {
    display: block;
    width: 100% !important;
    padding: 0;
    border: 0;
    box-sizing: border-box;
}

/* ---------- Boutons ---------- */
.btn-solid {
    display: inline-block;
    padding: 9px 18px;
    background: var(--blue);
    color: #fff;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.btn-solid:hover {
    background: var(--blue-dark);
    color: #fff;
}

.btn-ghost {
    display: inline-block;
    padding: 7px 14px;
    border: 1.5px solid var(--blue);
    border-radius: var(--radius-sm);
    color: var(--blue);
    font-weight: 600;
    font-size: 13.5px;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-ghost:hover {
    background: var(--blue);
    color: #fff;
}

/* Boutons d'action existants : couleurs de commun.css conservées
   (orange / darkorange), forme modernisée */
.btn-cat,
.btn-action {
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    /* en rangée flex : ne jamais rétrécir ni casser le libellé */
    flex: 0 0 auto;
    white-space: nowrap;
}

.btn-cat:hover,
.btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(16, 42, 67, 0.22);
}

/* ---------- Formulaires ---------- */
.newInput,
.newSelect,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="date"],
select {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    color: var(--ink);
    background: #fbfcfd;
    box-sizing: border-box;
    max-width: 100%;
}

textarea {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    color: var(--ink);
    background: #fbfcfd;
    box-sizing: border-box;
    max-width: 100%;
}

.newInput:focus,
.newSelect:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(13, 97, 190, 0.15);
    background: #fff;
}

label {
    font-weight: 600;
}

.divRowInput {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    flex-wrap: wrap;
}

/* ---------- Tableaux de données ---------- */
.card__body table,
.admin-body .table-scroll table {
    max-width: 100%;
}

.card__body th,
.admin-body .card th,
.admin-body .section th,
.admin-body table th {
    background: #f4f6f8;
    color: var(--slate);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 9px 12px;
    border-bottom: 2px solid var(--slate);
    text-align: left;
}

.card__body td,
.admin-body table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--line-soft);
}

.card__body tbody tr:hover,
.admin-body tbody tr:hover {
    background: #f6f9fc;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---------- Tables sans barre de défilement horizontale (1080p et +) ----------
   Cause : mots longs non coupables (emails, noms de bailleurs) et boutons
   d'actions nowrap qui gonflent la largeur minimale des tableaux. */
.card__body td,
.admin-body td {
    overflow-wrap: anywhere;
}

/* Les en-têtes ne se cassent jamais en milieu de mot (Ret « ACTI/f ») */
.card__body th,
.admin-body th {
    overflow-wrap: normal;
    word-break: keep-all;
}

.card__body td .btn-cat,
.card__body td .btn-action,
.admin-body td .btn-cat,
.admin-body td .btn-action,
.admin-body td button {
    white-space: normal;
    min-width: 0 !important;
    width: auto !important; /* neutralise les largeurs inline legacy (50%) qui tronquent */
    max-width: 100%;
}

/* Colonne Actions (td legacy display:flex) : libellés sur une ligne, jamais tronqués */
.admin-body td[style*="display: flex"] .btn-cat,
.admin-body td[style*="display: flex"] .btn-action {
    white-space: nowrap;
}

/* Tableau « Demande de compte » : colonne ACTION sur une ligne (astuce width:1%),
   bouton « Validé la création de l'accès » bleu (classe btn-cat ajoutée dans Admin.js) */
.admin-body #dataDemande td:last-child,
.admin-body #dataDemande th:last-child {
    width: 1%;
    white-space: nowrap;
}

.admin-body #dataDemande .btn-cat {
    white-space: nowrap;
}

/* Colonne EMAIL du tableau demandes : jamais de césure (68 caractères
   sur une ligne plutôt qu'une colonne de 4 caractères) */
.admin-body #dataDemande td:nth-child(8),
.admin-body #dataDemande th:nth-child(8) {
    white-space: nowrap;
}

.admin-body .tableContainer table,
.admin-body .tableDemandeContainer table,
.admin-body .tableMdpContainer table {
    width: 100%;
}

/* Logs : le scroll horizontal éventuel reste dans le conteneur, pas le document */
.admin-body .sectionLogs div[style*="overflow-y"],
.admin-body .sectionLogsConnexion div[style*="overflow-y"] {
    overflow-x: auto;
}

/* ---------- Messages ---------- */
.msg-error {
    color: #fff;
    text-align: center;
    background-color: var(--red);
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

/* Encadré message legacy (table cellspacing=5, VisuData) : pleine largeur
   de la carte, coins arrondis, plus de bordure noire */
table[cellspacing="5"] {
    width: 100% !important;
    border-spacing: 0;
}

table[cellspacing="5"] tr td {
    border-radius: 10px;
    background-color: var(--red);
    border: none !important;
    padding: 18px 20px;
    line-height: 1.6;
}

/* ---------- Rangées de boutons (legacy v1 : un bouton par td de table) ----------
   Le conteneur flex est le TR (display:flex sur un td détruit table-cell).
   table-layout:fixed sur la table interne pour que le nowrap ne l'étire pas. */
.card__body > table[width="100%"] > tbody > tr {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    justify-content: safe center;
    padding: 4px 0;
}

.card__body > table[width="100%"]:not([cellpadding]) {
    table-layout: fixed;
}

.card__body > table[width="100%"] > tbody > tr > td {
    flex: 0 0 auto;
    white-space: nowrap;
    border: none;
    padding: 2px;
}

/* Barres v2 (div flex inline, FormRequete) */
div[style*="flex-direction: row"],
div[style*="flex-direction:row"] {
    row-gap: 6px;
}

div[style*="flex-direction: row"] > button,
div[style*="flex-direction:row"] > button {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* ---------- Pagination ---------- */
.pagination-page,
.pagination-search {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-weight: 600;
}

/* ---------- jQuery UI (dialogues, datepicker) ---------- */
.ui-dialog {
    border: none !important;
    border-radius: var(--radius) !important;
    box-shadow: 0 12px 40px rgba(16, 42, 67, 0.3) !important;
    overflow: hidden;
    font-family: inherit;
}

.ui-dialog .ui-dialog-titlebar {
    background: var(--slate) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 12px 18px !important;
    font-size: 14px;
    letter-spacing: 0.05em;
}

.ui-dialog .ui-dialog-content {
    padding: 18px !important;
    color: var(--text);
}

.ui-datepicker {
    border: 1px solid var(--line) !important;
    border-radius: 10px !important;
    box-shadow: var(--shadow) !important;
    overflow: hidden;
}

/* ---------- Pied de page ---------- */
.app-footer {
    margin-top: auto;
    background: var(--surface);
    border-top: 3px solid var(--slate);
    padding: 18px 28px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 18px;
    color: var(--ink);
    font-size: 13.5px;
}

.app-footer__left strong {
    color: var(--blue);
}

.app-footer__right {
    color: var(--muted);
    font-style: italic;
}

.app-footer__doc {
    width: 100%;
    text-align: center;
    color: var(--blue);
    font-weight: 600;
    font-size: 13.5px;
    padding-top: 4px;
}

.app-footer__doc:hover {
    color: var(--blue-dark);
    text-decoration: underline;
}

/* ---------- Héritage : vues statites autonomes (view/admin/*.html) ---------- */
.main-page {
    border: none !important;
    box-shadow: var(--shadow);
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--surface);
}

.accueil {
    box-sizing: border-box;
}

/* ==========================================================================
   VUES ADMIN (view/admin/*.html — admin.html, data.html, addAccount.html)
   Le JS (Admin.js/data.js) pilote les display via .css() : on ne touche
   JAMAIS display ici, uniquement le style.
   ========================================================================== */
.admin-body .container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 22px;
    width: 100%;
    /* Pleine largeur écran (1920 et + ) : les tableaux 11 colonnes de
       l'administration ont besoin de tous les pixels disponibles. */
    max-width: none;
    height: auto;
    margin: 0 auto;
    padding: 26px clamp(20px, 2.5vw, 48px) 54px;
    box-sizing: border-box;
}

.admin-body .container > .card {
    flex: 1;
    min-width: 0;
}

/* Menu latéral : barre bleue pleine hauteur → carte collante */
.admin-body .navbar {
    position: sticky;
    top: 78px;
    flex: 0 0 230px;
    width: 230px;
    height: auto;
    justify-content: flex-start;
    gap: 6px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    box-sizing: border-box;
}

.admin-body #divButton {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin: 0 0 10px;
}

.admin-body .elementNav {
    height: auto;
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    justify-content: flex-start;
    gap: 8px;
}

.admin-body .elementNav:hover {
    background: #eef3f8;
    color: var(--blue);
}

/* Sections de contenu : cartes blanches (display piloté par Admin.js) */
.admin-body .section,
.admin-body .sectionSettings,
.admin-body .sectionLogs,
.admin-body .sectionLogsConnexion {
    flex: 1;
    min-width: 0;
    width: auto;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    gap: 22px;
    box-sizing: border-box;
}

.admin-body h1 {
    color: var(--blue);
    font-size: 21px;
    margin: 0;
}

.admin-body h2 {
    color: var(--slate);
    font-size: 16px;
    margin: 0;
}

.admin-body #searchBarUser {
    flex-wrap: wrap;
    row-gap: 10px;
}

.admin-body .accueil {
    width: 100% !important;
    margin-left: 0 !important;
    box-sizing: border-box;
}

/* « Les 10 dernières connexions » (45% inline) : centré sous le titre */
.admin-body #tableLastLog {
    margin-inline: auto;
}

/* Les grands tableaux (users, demandes, logs) ne débordent plus */
.admin-body .tableContainer,
.admin-body .tableDemandeContainer,
.admin-body .tableMdpContainer {
    max-width: 100%;
    overflow-x: auto;
    box-sizing: border-box;
    background-color: var(--surface);
}

/* data.css : table 80% margin auto → pleine largeur dans la carte */
.admin-body .table-scroll table {
    width: 100%;
    margin: 0;
}

/* Formulaire de refus (data.js le passe en display:block) */
.admin-body #formulaireRefus {
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin: 0 auto 18px;
    max-width: 760px;
    box-sizing: border-box;
}

/* Boutons d'action générés par data.js */
.admin-body .add-btn {
    background-color: #2e9e5b;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-weight: 600;
    width: auto;
}

.admin-body .delete-btn {
    background-color: var(--red);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-weight: 600;
    width: auto;
}

/* Section Paramètres : sous-blocs aérés */
.admin-body .variable,
.admin-body .listVariables {
    flex-wrap: wrap;
    gap: 18px;
    width: 100%;
}

.admin-body .environnement,
.admin-body .constante,
.admin-body .cron,
.admin-body .documentation {
    width: 100%;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    padding: 16px 18px;
    box-sizing: border-box;
    gap: 14px;
}

.admin-body .elementVariable {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 10px 14px;
    gap: 10px;
}

/* Popup "Sélection des dates" (Admin.js la révèle) */
.admin-body .displayGenerateStats {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    background: var(--surface);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* Tablettes */
@media screen and (max-width: 900px) {
    .topbar {
        padding: 12px 16px;
    }

    .app > .container {
        padding: 18px 12px 40px;
        gap: 16px;
    }

    /* Vues admin : menu latéral → bandeau horizontal */
    .admin-body .container {
        flex-direction: column;
        padding: 16px 12px 40px;
    }

    .admin-body .navbar {
        position: static;
        flex: none;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 10px;
    }

    .admin-body #divButton {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        margin: 0;
    }

    .admin-body .elementNav {
        width: auto;
        padding: 8px 12px;
    }

    .admin-body .section,
    .admin-body .sectionSettings,
    .admin-body .sectionLogs,
    .admin-body .sectionLogsConnexion {
        padding: 16px 14px;
        gap: 18px;
    }

    /* Barres v2 : rangée horizontale avec défilement (le wrap empilait
       les boutons à la verticale) */
    div[style*="flex-direction: row"],
    div[style*="flex-direction:row"] {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        justify-content: safe center !important;
        gap: 6px;
        padding: 6px;
        box-sizing: border-box;
    }

    #tableLastLog,
    #dataMdpUser {
        width: 100% !important;
    }

    /* div.accueil : width:100% + margin-left:5% inline = débordement */
    .accueil {
        margin-left: 0 !important;
    }
}

/* Mobiles */
@media screen and (max-width: 640px) {
    .topbar {
        padding: 10px 14px;
    }

    .topbar__brand {
        font-size: 16.5px;
    }

    .card__body {
        padding: 16px 14px;
    }

    .card__bar {
        padding: 11px 14px;
        font-size: 12.5px;
    }

    .newInput,
    .newSelect {
        width: 100% !important;
        max-width: 340px;
        margin-left: 0;
    }

    .divRowInput {
        flex-direction: column;
        align-items: stretch;
    }

    .divRowInput input {
        min-width: 0 !important;
        width: 100%;
    }

    /* libellés à largeur imposée (login 9rem, labelRitght 200px) */
    label[style*="min-width"] {
        min-width: 0 !important;
    }

    .labelRitght {
        min-width: 0;
        text-align: left;
    }

    .btn-action,
    .btn-cat {
        padding: 9px 14px;
        font-size: 13.5px;
    }

    textarea {
        width: 100% !important;
    }
}

/* ==========================================================================
   USERREQUEST (userRequest.php — configurations d'envois planifies)
   Portee : .ur-wrap. Specificite superieure a userRequest.css (charge apres).
   Les ids/classes consumes par userRequest.js sont conserves.
   ========================================================================== */
.ur-wrap {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
    font-size: 14px;
    color: var(--ink);
}

/* --- Bloc liste des configurations (pleine largeur, comme ACTIONS) --- */
.ur-wrap .listConfigRequest {
    width: 100%;
    flex: 0 0 auto;
    border-right: none;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 14px;
    box-sizing: border-box;
}

.ur-wrap #btn-display-add-config {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 6px 0;
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 700;
    color: #fff;
    background: var(--blue);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s ease;
}

.ur-wrap #btn-display-add-config:hover {
    background: var(--blue-dark);
}

.ur-wrap #btn-display-add-config img {
    width: 16px;
    margin: 0;
    filter: brightness(0) invert(1);
}

.ur-wrap .configRequest {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: auto;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ur-wrap .configRequest:hover {
    background: var(--surface);
    border-color: var(--blue);
    box-shadow: var(--shadow-sm);
}

.ur-wrap .configRequest.currentConfigRequest {
    background: #eaf2fb;
    border-color: var(--blue);
}

.ur-wrap .titleRequest {
    text-align: left;
    font-size: 14px;
    color: var(--ink);
    word-break: break-word;
}

.ur-wrap .configRequest .active {
    margin-left: 0;
    flex: 0 0 auto;
}

.ur-wrap #label-no-config {
    display: block;
    padding: 18px 6px;
    font-size: 14px;
    text-align: center;
    color: var(--muted);
}

/* --- Menu contextuel (clic droit / long press) --- */
.ur-wrap .context-menu,
.context-menu {
    display: none;
    position: absolute;
    z-index: 1000;
    min-width: 150px;
    padding: 6px 0;
    margin: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    list-style: none;
}

.context-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.context-menu li {
    padding: 8px 14px;
    font-size: 13.5px;
    color: var(--ink);
    cursor: pointer;
}

.context-menu li:hover {
    background: #eaf2fb;
    color: var(--blue);
}

/* --- Zone d'edition --- */
.ur-wrap .editionMode {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    font-size: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    box-sizing: border-box;
}

.ur-wrap #title-edition {
    font-size: 20px;
    color: var(--blue);
    margin: 0 0 4px 0;
}

.ur-wrap .editionMode h2 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--slate);
    border-bottom: 1px solid var(--line-soft);
    padding-bottom: 6px;
    margin: 22px 0 12px 0;
}

.ur-wrap .editionMode label {
    font-size: 13.5px;
    color: var(--ink);
}

/* Rangées legacy de l'édition (horaires, dates d'envoi) : wrap au lieu de déborder */
.ur-wrap .editionMode div[style*="display: flex"] {
    flex-wrap: wrap;
    row-gap: 8px;
}

/* --- Empilement des 3 blocs (Logement, Locataire, Gardien) --- */
.ur-wrap .ur-groups {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
}

/* --- Sections Logement / Locataire / Gardien : rangées horizontales --- */
.ur-wrap .ur-sec {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 22px;
    width: 100%;
}

.ur-wrap .ur-sec h2 {
    flex: 0 0 100%;
}

.ur-wrap .ur-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ur-wrap .ur-field .labelRitght {
    min-width: 0;
    text-align: right;
}

/* Rangees inline legacy : autoriser le retour a la ligne */
.ur-wrap [style*="flex-direction: row"],
.ur-wrap [style*="flex-direction:row"] {
    flex-wrap: wrap;
    gap: 10px 16px;
}

.ur-wrap .divNewDate {
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: 12px;
}

/* --- Boutons d'action de l'edition --- */
.ur-wrap .btn-submit-form,
.ur-wrap .btn-send,
.ur-wrap .btn-delete {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 700;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s ease, filter 0.2s ease;
}

.ur-wrap .btn-submit-form {
    background: var(--blue);
}

.ur-wrap .btn-send {
    background: var(--orange);
}

.ur-wrap .btn-delete {
    background: var(--red);
}

.ur-wrap .btn-submit-form:hover,
.ur-wrap .btn-send:hover,
.ur-wrap .btn-delete:hover {
    filter: brightness(0.92);
}

.ur-wrap .btn-submit-form img,
.ur-wrap .btn-send img,
.ur-wrap .btn-delete img {
    width: 16px;
    filter: brightness(0) invert(1);
}

.ur-wrap .btn-submit-form label,
.ur-wrap .btn-send label,
.ur-wrap .btn-delete label {
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
}

/* --- Mobile : empilement liste au-dessus de l'edition --- */
@media (max-width: 900px) {
    .ur-wrap {
        flex-direction: column;
        align-items: stretch;
    }

    .ur-wrap .listConfigRequest {
        width: 100%;
        flex: 0 0 auto;
    }

    .ur-wrap .editionMode {
        width: 100%;
        padding: 14px;
    }
}

/* ==========================================================================
   MODE SOMBRE (attribut data-theme="dark" posé sur <html> par theme.js)
   Bascule par le bouton ☾/☀ à côté de Déconnexion ; choix mémorisé.
   ========================================================================== */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #10151c;    --surface: #1a222d;
    --line: #2c3947;
    --line-soft: #232e3b;
    --blue: #4f8fd6;
    --blue-dark: #6ba3e4; /* en sombre, le survol éclaircit au lieu d'assombrir */
    --slate: #8fb3d8;
    --coral: #ff8f70;
    --orange: #d99a4a;
    --red: #e06a63;
    --text: #a9bed3;
    --ink: #d5e0ec;
    --muted: #8296ab;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --panel: #141c26;
}

/* Champs de saisie */
:root[data-theme="dark"] .newInput,
:root[data-theme="dark"] .newSelect,
:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="password"],
:root[data-theme="dark"] input[type="email"],
:root[data-theme="dark"] input[type="number"],
:root[data-theme="dark"] input[type="tel"],
:root[data-theme="dark"] input[type="date"],
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
    background: #222d3a;
    color: var(--ink);
}

:root[data-theme="dark"] .newInput:focus,
:root[data-theme="dark"] .newSelect:focus,
:root[data-theme="dark"] input:focus,
:root[data-theme="dark"] select:focus,
:root[data-theme="dark"] textarea:focus {
    background: #26323f;
    border-color: var(--blue);
}

/* En-têtes de tableaux et survol de lignes */
:root[data-theme="dark"] .card__body th,
:root[data-theme="dark"] .admin-body .card th,
:root[data-theme="dark"] .admin-body .section th,
:root[data-theme="dark"] .admin-body table th {
    background: #212c39;
}

:root[data-theme="dark"] .card__body tbody tr:hover,
:root[data-theme="dark"] .admin-body tbody tr:hover {
    background: #24303e;
}

/* Navigation latérale admin */
:root[data-theme="dark"] .admin-body .elementNav:hover {
    background: #243244;
    color: var(--blue);
}

/* Cases à cocher « Acti/f » (interrupteur legacy commun.css) */
:root[data-theme="dark"] .slider {
    background-color: #3a4857;
}

:root[data-theme="dark"] .slider:before {
    background-color: #dfe6ee;
}

/* Popups et blocs clairs en dur (legacy) */
:root[data-theme="dark"] .popup,
:root[data-theme="dark"] .admin-body #formulaireRefus {
    background-color: var(--surface);
    color: var(--ink);
}

:root[data-theme="dark"] .loader {
    background: rgba(10, 14, 19, 0.65);
}

:root[data-theme="dark"] .loader div {
    background: var(--surface);
    color: var(--ink);
}

:root[data-theme="dark"] .app-footer {
    color: var(--muted);
}

/* Image de bannière trop lumineuse en sombre : légèrement atténuée */
:root[data-theme="dark"] .banner img {
    filter: brightness(0.75);
}

/* Bouton du sélecteur de thème : petite pastille ronde */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1.5px solid var(--blue);
    border-radius: 50%;
    background: transparent;
    color: var(--blue);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
    background: var(--blue);
    color: #fff;
}

/* ---- passe 2 : règles legacy globales non couvertes ---- */
:root[data-theme="dark"] thead,
:root[data-theme="dark"] th {
    background: #212c39;
    color: var(--ink);
    border-color: var(--line);
}

:root[data-theme="dark"] tbody tr:hover {
    background: #24303e;
}

:root[data-theme="dark"] .context-menu {
    background: #222d3a;
    border-color: var(--line);
    color: var(--ink);
}

:root[data-theme="dark"] .context-menu li:hover {
    background: #2c3a4d;
}

/* Bandeau d'en-tête des cartes (connexion etc.), trop clair tel quel */
:root[data-theme="dark"] .card__bar {
    background: #26313e;
    color: #cfe0f2;
}

/* ---- passe 3 : lignes de statut en dur (bgcolor + couleurs inline) ---- */
:root[data-theme="dark"] tr[bgcolor] {
    background: #1e2836 !important;
}

:root[data-theme="dark"] [style*="#009900"] {
    color: #62c98a !important;
}

:root[data-theme="dark"] tr[style*="color: blue"],
:root[data-theme="dark"] .souligneBleu {
    color: #7fb2e5 !important;
}

/* ---- passe 4 : bandeau coral + filets de sécurité inline ---- */
:root[data-theme="dark"] .card__bar--coral {
    background: #4a3028;
    color: #ffb59e;
}

/* Filet de sécurité : tout fond blanc resté en dur dans une carte */
:root[data-theme="dark"] .card__body [style*="background-color: white"],
:root[data-theme="dark"] .card__body [style*="background-color:white"],
:root[data-theme="dark"] .card__body [style*="background: white"],
:root[data-theme="dark"] .card__body [style*="background:white"] {
    background-color: var(--surface) !important;
}

/* ---- passe 5 : section « Paramètres du serveur » ---- */
:root[data-theme="dark"] .admin-body .popupInformation {
    background: #222d3a;
    color: var(--ink);
    border-color: var(--line);
}
