/* SECTION K — public/assets/css/theme.css
   Apparence commune KKNMLC. Aucune logique. Variables reglables plus tard via Options. */

:root {
    --couleur-fond: #f5f6f8;
    --couleur-texte: #1c1f26;
    --couleur-accent: #2d6cdf;
    --police-base: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --largeur-max-contenu: 900px;
    --hauteur-note: 120px;
    --cible-tactile-min: 44px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: var(--couleur-fond);
    color: var(--couleur-texte);
    font-family: var(--police-base);
    font-size: 16px; line-height: 1.5;
}

body.mode-ecran-fige { height: 100vh; height: 100dvh; overflow: hidden; }
body.mode-normal { min-height: 100vh; overflow-y: auto; }

.contenu-page {
    display: block; width: 100%;
    max-width: var(--largeur-max-contenu);
    margin: 0 auto; padding: 1rem; padding-top: 3.5rem;
}
body.mode-ecran-fige .contenu-page { height: 100dvh; overflow: hidden; }
.colonne-defilante { overflow-y: auto; -webkit-overflow-scrolling: touch; }

.bouton-menu {
    position: fixed; top: 0.5rem; left: 0.5rem;
    width: var(--cible-tactile-min); height: var(--cible-tactile-min);
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
    background: #fff; border: 1px solid #d2d6dd; border-radius: 8px;
    cursor: pointer; z-index: 30; padding: 0 10px;
}
.bouton-menu span { display: block; height: 2px; background: var(--couleur-texte); border-radius: 2px; }

.voile-menu { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 35; }
.voile-menu[hidden] { display: none; }

.menu-lateral {
    position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh;
    width: 78%; max-width: 320px; background: #fff;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    transform: translateX(-100%); transition: transform 0.2s ease;
    z-index: 40; padding-top: 3.5rem;
}
.menu-lateral.ouvert { transform: translateX(0); }
.menu-lateral ul { list-style: none; margin: 0; padding: 0; }
.menu-lateral li { border-bottom: 1px solid #eef0f4; }
.menu-lateral a {
    display: block; padding: 0.9rem 1.2rem; min-height: var(--cible-tactile-min);
    color: var(--couleur-texte); text-decoration: none;
}
.menu-lateral a[aria-current="page"] { background: var(--couleur-accent); color: #fff; font-weight: 600; }

.zone-note { max-width: var(--largeur-max-contenu); margin: 1rem auto; padding: 0 1rem; }
.note-label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.note-texte {
    width: 100%; height: var(--hauteur-note); resize: vertical;
    padding: 0.6rem; border: 1px solid #d2d6dd; border-radius: 8px;
    font-family: inherit; font-size: 1rem;
}
.note-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.note-actions button {
    min-height: var(--cible-tactile-min); padding: 0 1rem;
    border: 1px solid #d2d6dd; border-radius: 8px; background: #fff;
    cursor: pointer; font-size: 1rem;
}
.note-bouton-enregistrer { border-color: var(--couleur-accent); color: var(--couleur-accent); }
.note-statut { margin: 0.4rem 0 0; font-size: 0.9rem; color: #555; min-height: 1.2em; }

.note-popup {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center; z-index: 50;
}
.note-popup[hidden] { display: none; }
.note-popup-contenu { background: #fff; border-radius: 12px; padding: 1.5rem; max-width: 90%; width: 360px; }
.note-popup-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.note-popup-actions button {
    flex: 1; min-height: var(--cible-tactile-min);
    border: 1px solid #d2d6dd; border-radius: 8px; background: #fff;
    cursor: pointer; font-size: 1rem;
}

@media (max-width: 360px) {
    .note-popup-actions { flex-direction: column; }
}

button:focus-visible, a:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--couleur-accent); outline-offset: 2px;
}

.message-erreur { color: #b00020; font-weight: 600; }
.formulaire-connexion { display: flex; flex-direction: column; gap: 0.6rem; max-width: 360px; }
.formulaire-connexion label { font-weight: 600; }
.formulaire-connexion input {
    min-height: var(--cible-tactile-min); padding: 0 0.6rem;
    border: 1px solid #d2d6dd; border-radius: 8px; font-size: 1rem;
}
.formulaire-connexion button {
    min-height: var(--cible-tactile-min); border: 1px solid var(--couleur-accent);
    background: var(--couleur-accent); color: #fff; border-radius: 8px;
    font-size: 1rem; cursor: pointer;
}

/* U6 — page utilisateurs */
.message-statut { color: #0a7d29; font-weight: 600; margin: 0.5rem 0; }
.table-utilisateurs { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.table-utilisateurs th, .table-utilisateurs td { border: 1px solid #d2d6dd; padding: 0.5rem 0.7rem; text-align: left; }
.table-utilisateurs th { background: #eef0f4; }
.formulaire-utilisateur { display: flex; flex-direction: column; gap: 0.5rem; max-width: 360px; margin: 1rem 0 2rem; }
.formulaire-utilisateur label { font-weight: 600; }
.formulaire-utilisateur input, .formulaire-utilisateur select {
    min-height: var(--cible-tactile-min); padding: 0 0.6rem;
    border: 1px solid #d2d6dd; border-radius: 8px; font-size: 1rem;
}
.formulaire-utilisateur button {
    min-height: var(--cible-tactile-min); border: 1px solid var(--couleur-accent);
    background: var(--couleur-accent); color: #fff; border-radius: 8px; font-size: 1rem; cursor: pointer;
}

/* Contexte V1 */
.contexte-onglets { display: flex; gap: 0.4rem; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1rem 0; padding-bottom: 0.3rem; }
.contexte-onglet { flex: 0 0 auto; min-height: var(--cible-tactile-min); padding: 0 1rem; border: 1px solid #d2d6dd; border-radius: 8px; background: #fff; font-size: 1rem; cursor: pointer; white-space: nowrap; }
.contexte-onglet[aria-selected="true"] { background: var(--couleur-accent); color: #fff; border-color: var(--couleur-accent); font-weight: 600; }
.contexte-panneau { margin: 1rem 0; }
.contexte-panneau[hidden] { display: none; }
.contexte-note { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #eef0f4; }
.contexte-note textarea { width: 100%; height: var(--hauteur-note); resize: vertical; padding: 0.6rem; border: 1px solid #d2d6dd; border-radius: 8px; font-family: inherit; font-size: 1rem; }
.contexte-note-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.contexte-note-actions button { min-height: var(--cible-tactile-min); padding: 0 1rem; border: 1px solid #d2d6dd; border-radius: 8px; background: #fff; cursor: pointer; font-size: 1rem; }
.contexte-statut { margin: 0.4rem 0 0; font-size: 0.9rem; color: #555; min-height: 1.2em; }

/* Options V1 */
.options-onglets { display: flex; gap: 0.4rem; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1rem 0; padding-bottom: 0.3rem; }
.options-onglet { flex: 0 0 auto; min-height: var(--cible-tactile-min); padding: 0 1rem; border: 1px solid #d2d6dd; border-radius: 8px; background: #fff; font-size: 1rem; cursor: pointer; white-space: nowrap; }
.options-onglet[aria-selected="true"] { background: var(--couleur-accent); color: #fff; border-color: var(--couleur-accent); font-weight: 600; }
.options-panneau { margin: 1rem 0; }
.options-panneau[hidden] { display: none; }
.options-note { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #eef0f4; }
.options-note textarea { width: 100%; height: var(--hauteur-note); resize: vertical; padding: 0.6rem; border: 1px solid #d2d6dd; border-radius: 8px; font-family: inherit; font-size: 1rem; }
.options-note-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.options-note-actions button { min-height: var(--cible-tactile-min); padding: 0 1rem; border: 1px solid #d2d6dd; border-radius: 8px; background: #fff; cursor: pointer; font-size: 1rem; }
.options-statut { margin: 0.4rem 0 0; font-size: 0.9rem; color: #555; min-height: 1.2em; }

/* Extensions / Accroches V1 */
.extensions-onglets { display: flex; gap: 0.4rem; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1rem 0; padding-bottom: 0.3rem; }
.extensions-onglet { flex: 0 0 auto; min-height: var(--cible-tactile-min); padding: 0 1rem; border: 1px solid #d2d6dd; border-radius: 8px; background: #fff; font-size: 1rem; cursor: pointer; white-space: nowrap; }
.extensions-onglet[aria-selected="true"] { background: var(--couleur-accent); color: #fff; border-color: var(--couleur-accent); font-weight: 600; }
.extensions-panneau { margin: 1rem 0; }
.extensions-panneau[hidden] { display: none; }
.extensions-note { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #eef0f4; }
.extensions-note textarea { width: 100%; height: var(--hauteur-note); resize: vertical; padding: 0.6rem; border: 1px solid #d2d6dd; border-radius: 8px; font-family: inherit; font-size: 1rem; }
.extensions-note-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.extensions-note-actions button { min-height: var(--cible-tactile-min); padding: 0 1rem; border: 1px solid #d2d6dd; border-radius: 8px; background: #fff; cursor: pointer; font-size: 1rem; }
.extensions-statut { margin: 0.4rem 0 0; font-size: 0.9rem; color: #555; min-height: 1.2em; }

/* Sécurité / Filtres V1 */
.securite-onglets { display: flex; gap: 0.4rem; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1rem 0; padding-bottom: 0.3rem; }
.securite-onglet { flex: 0 0 auto; min-height: var(--cible-tactile-min); padding: 0 1rem; border: 1px solid #d2d6dd; border-radius: 8px; background: #fff; font-size: 1rem; cursor: pointer; white-space: nowrap; }
.securite-onglet[aria-selected="true"] { background: var(--couleur-accent); color: #fff; border-color: var(--couleur-accent); font-weight: 600; }
.securite-panneau { margin: 1rem 0; }
.securite-panneau[hidden] { display: none; }
.securite-note { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #eef0f4; }
.securite-note textarea { width: 100%; height: var(--hauteur-note); resize: vertical; padding: 0.6rem; border: 1px solid #d2d6dd; border-radius: 8px; font-family: inherit; font-size: 1rem; }
.securite-note-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.securite-note-actions button { min-height: var(--cible-tactile-min); padding: 0 1rem; border: 1px solid #d2d6dd; border-radius: 8px; background: #fff; cursor: pointer; font-size: 1rem; }
.securite-statut { margin: 0.4rem 0 0; font-size: 0.9rem; color: #555; min-height: 1.2em; }

/* Cartographie V1 */
.cartographie-onglets { display: flex; gap: 0.4rem; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1rem 0; padding-bottom: 0.3rem; }
.cartographie-onglet { flex: 0 0 auto; min-height: var(--cible-tactile-min); padding: 0 1rem; border: 1px solid #d2d6dd; border-radius: 8px; background: #fff; font-size: 1rem; cursor: pointer; white-space: nowrap; }
.cartographie-onglet[aria-selected="true"] { background: var(--couleur-accent); color: #fff; border-color: var(--couleur-accent); font-weight: 600; }
.cartographie-panneau { margin: 1rem 0; }
.cartographie-panneau[hidden] { display: none; }
.cartographie-note { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #eef0f4; }
.cartographie-note textarea { width: 100%; height: var(--hauteur-note); resize: vertical; padding: 0.6rem; border: 1px solid #d2d6dd; border-radius: 8px; font-family: inherit; font-size: 1rem; }
.cartographie-note-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.cartographie-note-actions button { min-height: var(--cible-tactile-min); padding: 0 1rem; border: 1px solid #d2d6dd; border-radius: 8px; background: #fff; cursor: pointer; font-size: 1rem; }
.cartographie-statut { margin: 0.4rem 0 0; font-size: 0.9rem; color: #555; min-height: 1.2em; }

/* Cockpit V1 */
body[data-page="cockpit"].mode-ecran-fige .contenu-page {
    max-width: none;
    width: 100%;
    height: 100dvh;
    padding: 3.5rem 0 0;
    overflow: hidden;
}
.cockpit-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}
.cockpit-bandeau {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: #eef0f4;
    border-bottom: 1px solid #d2d6dd;
    font-size: 0.85rem;
}
.cockpit-statut { color: #555; }
.cockpit-grille {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem;
}
.cockpit-colonne {
    flex: 0 0 85%;
    max-width: 85%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid #d2d6dd;
    border-radius: 8px;
    background: #fff;
}
.cockpit-colonne-entete {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem;
    border-bottom: 1px solid #eef0f4;
}
.cockpit-colonne-entete h2 { font-size: 1rem; margin: 0; flex: 1 1 100%; }
.cockpit-ia-label { font-size: 0.8rem; color: #555; }
.cockpit-ia-select { min-height: var(--cible-tactile-min); border: 1px solid #d2d6dd; border-radius: 6px; font-size: 0.9rem; }
.cockpit-etat { font-size: 0.8rem; color: #555; margin-left: auto; }
.cockpit-colonne-corps {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem;
}
.cockpit-message-placeholder { color: #888; font-size: 0.9rem; }
.cockpit-colonne-saisie {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.5rem;
    border-top: 1px solid #eef0f4;
}
.cockpit-saisie-texte { width: 100%; height: 60px; resize: vertical; padding: 0.5rem; border: 1px solid #d2d6dd; border-radius: 6px; font-family: inherit; font-size: 0.9rem; }
.cockpit-envoyer { min-height: var(--cible-tactile-min); border: 1px solid var(--couleur-accent); background: var(--couleur-accent); color: #fff; border-radius: 6px; font-size: 0.9rem; cursor: pointer; }
.cockpit-saisie-statut { margin: 0; font-size: 0.8rem; color: #555; min-height: 1em; }
@media (min-width: 900px) {
    .cockpit-colonne { flex: 1 1 0; max-width: none; }
    .cockpit-grille { overflow-x: hidden; }
}

/* Cockpit V1 — messages mémoire */
.cockpit-message { margin-bottom: 0.6rem; padding-bottom: 0.5rem; border-bottom: 1px solid #f0f2f5; }
.cockpit-message-meta { font-size: 0.75rem; color: #888; margin-bottom: 0.2rem; }
.cockpit-message-contenu { font-size: 0.95rem; white-space: pre-wrap; word-break: break-word; }

/* KK_STYLE_NOTES_V1 : harmonisation boutons de note (composant commun theme/note.php) */
.note-bouton-enregistrer {
    background-color: #1d4ed8;
    color: #ffffff;
    border: 1px solid #1d4ed8;
}
.note-bouton-enregistrer:hover {
    background-color: #1e40af;
    border-color: #1e40af;
}
.note-bouton-restaurer {
    background-color: #111827;
    color: #ffffff;
    border: 1px solid #111827;
}
.note-bouton-restaurer:hover {
    background-color: #000000;
    border-color: #000000;
}

/* KK_STYLE_NOTES_V2_SPECIFICITE : surclasse .note-actions button au repos (sans !important). */
.note-actions button.note-bouton-enregistrer { background-color: #1d4ed8; color: #ffffff; border: 1px solid #1d4ed8; }
.note-actions button.note-bouton-enregistrer:hover { background-color: #1e40af; border-color: #1e40af; }
.note-actions button.note-bouton-restaurer { background-color: #111827; color: #ffffff; border: 1px solid #111827; }
.note-actions button.note-bouton-restaurer:hover { background-color: #000000; border-color: #000000; }

/* KK_C1_DIRECTIVE_CSS : zone directive Cockpit, compacte, ne gonfle pas la hauteur de l ecran fige. */
.cockpit-directive { display: flex; gap: 0.5rem; align-items: center; padding: 0.4rem 0.6rem; flex: 0 0 auto; }
.cockpit-directive-texte { flex: 1 1 auto; min-height: 2.2rem; max-height: 3.5rem; resize: none; padding: 0.4rem; border: 1px solid #d2d6dd; border-radius: 8px; font: inherit; }
.cockpit-directive-envoyer { flex: 0 0 auto; min-height: 2.2rem; padding: 0 0.9rem; border: 1px solid #1d4ed8; background: #1d4ed8; color: #fff; border-radius: 8px; cursor: pointer; }
.cockpit-directive-statut { flex: 0 0 auto; font-size: 0.85rem; color: #555; }

/* KK_C1_DIRECTIVE_CSS_FIX : le statut passe SOUS la ligne champ+bouton (ne comprime plus la zone). */
.cockpit-directive { flex-wrap: wrap; }
.cockpit-directive-texte { flex: 1 1 60%; min-width: 0; }
.cockpit-directive-statut { flex: 1 1 100%; width: 100%; margin: 0.2rem 0 0; order: 9; }

/* KK_C1_UI_COMPACT : directive sur une ligne (champ + bouton + statut a droite), statut a ellipse. Surclasse KK_C1_DIRECTIVE_CSS(_FIX). */
.cockpit-directive { display: grid; grid-template-columns: 1fr auto minmax(0, 14rem); align-items: center; gap: 0.5rem; flex-wrap: nowrap; }
.cockpit-directive-texte { flex: none; min-width: 0; min-height: 2.2rem; max-height: 2.6rem; }
.cockpit-directive-envoyer { flex: none; white-space: nowrap; }
.cockpit-directive-statut { flex: none; width: auto; margin: 0; order: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 14rem; }
.cockpit-bandeau .cockpit-projet { white-space: nowrap; }
@media (max-width: 560px) {
  .cockpit-directive { grid-template-columns: 1fr auto; }
  .cockpit-directive-statut { grid-column: 1 / -1; max-width: 100%; }
}
