/* Variables de présentation : le bleu reprend celui utilisé dans la signature.
   Le modèle copié dans Outlook possède ses propres styles, non modifiés ici. */
:root {
    --brand-blue: #005eb8;
    --brand-dark: #00498e;
    --ink: #172b3a;
    --muted: #536475;
    --line: #d9e3ed;
    --soft: #f3f7fb;
}
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--ink); background: #fff; }
h1 { font-size: clamp(28px, 2.5vw, 38px); letter-spacing: -.6px; }
h2 { font-size: 21px; line-height: 1.3; margin: 28px 0 16px; }
p { line-height: 1.55; }
a { color: var(--brand-blue); text-underline-offset: 3px; }
a:hover { color: var(--brand-dark); }
button { border: 1px solid var(--brand-blue); border-radius: 5px; background: var(--brand-blue); color: #fff; font: inherit; font-size: 14px; font-weight: 600; line-height: 1.35; padding: 11px 17px; cursor: pointer; }
button:hover { background: var(--brand-dark); }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible { outline: 3px solid #e4a600; outline-offset: 4px; }
.button-secondary { color: var(--brand-blue); background: #fff; }
.button-secondary:hover { color: #fff; }

/* CONNEXION : 50/50 strict. Flex centre le logo et le bloc de connexion dans
   chaque moitié, aussi bien à l’arrivée qu’après expiration de session. */
.login-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: 100vh; min-height: 100dvh; }
.brand-panel, .login-panel { display: flex; align-items: center; justify-content: center; padding: clamp(28px, 5vw, 80px); box-sizing: border-box; }
.brand-panel { background: #fff; }
.brand-logo { display: block; width: 100%; max-width: 520px; height: auto; }
.login-panel { background: var(--brand-blue); color: #fff; text-align: center; }
/* Le texte de connexion dispose de plus de largeur sur ordinateur.
   On conserve le retour à la ligne naturel quand la moitié d’écran est étroite. */
.login-content { width: 100%; max-width: 680px; }
.login-panel { padding-inline: clamp(24px, 3vw, 48px); }
.login-intro { font-size: 16px; }
@media (min-width: 1440px) {
    .login-intro { white-space: nowrap; }
}
.login-content h1 { margin: 0 0 24px; }
.login-content form { margin-top: 30px; }
.login-panel button { background: #fff; color: var(--brand-blue); border-color: #fff; padding: 14px 22px; }
.login-panel button:hover { background: #edf5ff; }
.login-notice { padding: 16px; border: 1px solid #8fbee8; border-radius: 5px; background: #004e99; }

/* GÉNÉRATEUR : pas de largeur fixe sur la grille. Chaque moitié occupe 50 %
   de l’espace disponible. Les contenus ont une largeur limitée pour la lecture. */
.layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: 100vh; }
.generator-panel, .help-panel { min-width: 0; padding: clamp(24px, 3vw, 56px); box-sizing: border-box; }
.generator-content { max-width: 760px; margin: 0 auto; }
.generator-title { text-align: center; margin: 0 0 28px; }
.help-panel { display: flex; justify-content: center; align-items: center; background: var(--soft); border-left: 1px solid var(--line); }
.guide { width: 100%; max-width: 560px; }
.guide h2 { margin-top: 0; font-size: 26px; }
.guide ol { padding-left: 24px; margin: 26px 0; }
.guide li { padding: 0 0 16px 8px; line-height: 1.6; }
.guide li::marker { font-weight: bold; color: var(--brand-blue); }
.guide details { border-top: 1px solid var(--line); padding-top: 20px; }
summary { cursor: pointer; font-weight: bold; }

/* Le tableau d’annuaire seul est visé : ne pas appliquer ces règles aux tables
   de signature, sous peine de modifier leur rendu et leur copie dans Outlook. */
.profile-table { width: 100%; border-collapse: collapse; margin: 22px 0; font-size: 14px; }
.profile-table caption { padding: 0 0 12px; color: var(--muted); }
.profile-table thead th { text-align: center; background: var(--soft); }
.profile-table th, .profile-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.profile-table tbody th, .profile-table tbody td { text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.profile-table tbody th { width: 34%; }
.phone-options { border: 1px solid var(--line); border-radius: 5px; padding: 16px 18px 18px; margin: 0; min-width: 0; }
.phone-options legend { padding: 0 6px; font-size: 13px; line-height: 1.5; max-width: 100%; }
.phone-options label { line-height: 1.6; }
.phone-options input { accent-color: var(--brand-blue); width: 16px; height: 16px; vertical-align: middle; margin-right: 6px; }
.actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.logout-actions { margin-top: 24px; }
.signature-preview { overflow-x: auto; padding: 24px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.muted { color: var(--muted); font-size: 13px; }
#copy-status { font-size: 14px; }

#copy-status.copy-status-success {
    margin: 12px 0;
    padding: 12px 16px;
    border: 1px solid #27823b;
    border-radius: 5px;
    background: #eaf7ed;
    color: #175c26;
    font-weight: 600;
    text-align: center;
}
.notice { padding: 18px 24px; border-bottom: 1px solid #b87810; background: #fff8e8; }

/* Sur tablette et téléphone, les deux moitiés deviennent deux blocs verticaux.
   La signature garde ses dimensions métier : son cadre défile horizontalement
   si nécessaire, sans provoquer de débordement de toute la page. */
@media (max-width: 900px) {
    .login-layout, .layout { grid-template-columns: minmax(0, 1fr); }
    .brand-panel { padding: 32px 24px; min-height: 28vh; }
    .brand-logo { max-width: 290px; }
    .login-panel { padding: 40px 24px; min-height: 60vh; }
    .generator-panel, .help-panel { padding: 28px 20px; }
    .help-panel { border-left: 0; border-top: 1px solid var(--line); }
    .guide h2 { font-size: 23px; }
    .profile-table th, .profile-table td { padding: 9px 8px; }
    .signature-preview { padding: 16px; }
}
/* Le masquage de sécurité reste prioritaire sur les règles grid et flex. */
[hidden] { display: none !important; }

/* Champ éditable limité à la fonction ; la largeur reste contenue sur mobile. */
.function-input { box-sizing: border-box; width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 5px; font: inherit; color: var(--ink); }
.field-notice { padding: 16px 18px; border: 1px solid #be303b; background: #fff0f1; border-radius: 5px; }
.field-notice h2 { margin-top: 0; font-size: 18px; }
.report-link { font-weight: bold; }

/* Commandes compactes : le texte reste lisible, la zone cliquable conserve
   une hauteur minimale pour le tactile. Elles ne concernent pas la signature. */
.profile-value { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-value > span { min-width: 0; overflow-wrap: anywhere; }
.button-small { font-size: 13px; padding: 4px 9px; min-height: 28px; flex-shrink: 0; }
.phone-toggle-actions { margin-top: 10px; }
.notice-icon { display: inline-block; width: 24px; height: 24px; object-fit: contain; vertical-align: middle; flex-shrink: 0; }
.blocking-notice { display: flex; gap: 10px; align-items: flex-start; }
.field-notice h2 { line-height: 1.5; }
@media (max-width: 480px) { .profile-value { flex-wrap: wrap; } }

/* Ce bouton ne doit pas agrandir la ligne Fonction du tableau. */
.edit-function-button { font-size: 12px; line-height: 1; padding: 1px 6px; border-radius: 3px; flex-shrink: 0; }
.report-button { display: inline-block; padding: 10px 17px; border: 1px solid var(--brand-blue); border-radius: 5px; background: var(--brand-blue); color: #fff; font-weight: 600; text-decoration: none; }
.report-button:hover { background: var(--brand-dark); color: #fff; }
