:root {
    /* Palette — ardoise froide + un seul accent teal (univers securite/technique) */
    --ink: #111A22;
    --ink-2: #18242E;
    --ink-line: #263743;
    --ink-text: #9FB0BA;
    --ink-text-hi: #FFFFFF;

    --bg: #F6F8F9;
    --surface: #FFFFFF;
    --border: #E4E9EC;
    --hairline: #EEF1F3;
    --text: #16232C;
    --muted: #5A6B74;
    --faint: #84949C;

    --accent: #0E7C86;
    --accent-hi: #0B929E;
    --accent-tint: #E4F1F2;

    --ok: #1F7A54;       --ok-bg: #E3F0E9;
    --grace: #9A6412;    --grace-bg: #FBF0D9;
    --expire: #B23A2B;   --expire-bg: #F7E4E0;
    --neutre: #6B7A82;   --neutre-bg: #EDF1F2;

    --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
    --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

    --r: 10px;
    --shadow: 0 1px 2px rgba(16,26,34,.04), 0 4px 16px rgba(16,26,34,.04);
    --shadow-hi: 0 2px 6px rgba(16,26,34,.06), 0 12px 32px rgba(16,26,34,.10);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: 'IBM Plex Sans', system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
body { background: #F4F6F8; }

/* En-têtes des écrans hérités (les écrans refondus utilisent les classes Bootstrap) */
.app-content h1:not(.h4):not(.h5) { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 1.3rem; color: #16232C; }

/* Signature : les cles / codes en jetons monospaces (teinte marque) */
code {
    font-family: var(--mono);
    font-size: 0.82em;
    letter-spacing: 0.02em;
    background: #EAF1FB;
    color: #00408F;
    padding: 0.16em 0.5em;
    border-radius: 6px;
    white-space: nowrap;
}
code.court { background: transparent; padding: 0; color: var(--muted); letter-spacing: 0; }


/* ---------------- Authentification ---------------- */
.ecran-auth { min-height: 100vh; }
.carte-auth {
    width: 100%;
    max-width: 384px;
    background: var(--surface);
    border-radius: 16px;
    padding: 2.25rem;
    box-shadow: 0 30px 70px rgba(0,0,0,.45);
}
.marque-auth { font-weight: 600; color: var(--muted); margin-bottom: 1.4rem; letter-spacing: -0.01em; }
.carte-auth h1 { margin-bottom: 0.2rem; }
.sous-titre { color: var(--muted); margin: 0 0 1.4rem; }
.marque-cle {
    font-family: var(--mono); font-weight: 700; letter-spacing: 0.08em; font-size: 0.82em;
    background: var(--accent); color: #fff; padding: 0.18em 0.5em; border-radius: 6px; margin-right: 0.45rem;
}

label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--muted); margin: 0.85rem 0 0.35rem; }

/* ---------------- Structure ---------------- */
.appli { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

.lateral {
    background: linear-gradient(180deg, var(--ink-2), var(--ink));
    color: var(--ink-text);
    display: flex; flex-direction: column;
    padding: 1.5rem 0.9rem;
    position: sticky; top: 0; height: 100vh;
}
.marque { display: flex; align-items: center; font-weight: 640; color: #fff; margin: 0.2rem 0.5rem 1.9rem; letter-spacing: -0.01em; }
.marque-nom { font-size: 1rem; }
.menu { display: flex; flex-direction: column; gap: 0.12rem; flex: 1; }
.lien {
    display: flex; align-items: center; gap: 0.65rem;
    color: var(--ink-text); text-decoration: none;
    padding: 0.6rem 0.7rem; border-radius: 9px;
    font-size: 0.92rem; font-weight: 500;
    transition: background .13s ease, color .13s ease;
}
.lien:hover { background: var(--ink-line); color: #fff; }
.lien.active { background: var(--accent); color: #fff; box-shadow: inset 3px 0 0 rgba(255,255,255,.65); }
.ico { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.lateral-pied { border-top: 1px solid var(--ink-line); padding-top: 1rem; margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.25rem; }
.utilisateur { font-size: 0.8rem; color: var(--faint); padding: 0.2rem 0.7rem 0.4rem; }
.lien-deco { display: block; background: none; border: none; text-align: left; cursor: pointer; color: var(--ink-text); padding: 0.5rem 0.7rem; font: inherit; font-size: 0.88rem; border-radius: 8px; text-decoration: none; }
.lien-deco:hover { color: #fff; background: var(--ink-line); }

.espace { padding: 2.25rem 2.5rem; max-width: 1180px; }

/* ---------------- Panneaux & cartes ---------------- */
.panneau { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1.5rem; margin-bottom: 1.4rem; box-shadow: var(--shadow); }
.deux-colonnes { display: grid; grid-template-columns: 350px 1fr; gap: 1.4rem; align-items: start; }
.entete-section { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.entete-section h2 { margin: 0; }

.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.9rem; }
.carte-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1.2rem 1.25rem; box-shadow: var(--shadow); }
.carte-stat .valeur { display: block; font-size: 2rem; font-weight: 680; letter-spacing: -0.03em; line-height: 1.1; }
.carte-stat .etiquette { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------------- Formulaires ---------------- */
input, select, textarea {
    width: 100%; font-family: inherit; font-size: 0.92rem; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.52rem 0.68rem;
    transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.ligne-champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.5rem 1rem; margin-bottom: 1.1rem; }
.zone-code { font-family: var(--mono); font-size: 0.8rem; min-height: 96px; resize: vertical; word-break: break-all; line-height: 1.5; }

/* ---------------- Boutons ---------------- */
.bouton { display: inline-block; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.95rem; font-size: 0.9rem; font-weight: 500; cursor: pointer; text-decoration: none; transition: border-color .12s, color .12s, background .12s; }
.bouton:hover { border-color: var(--accent); color: var(--accent); }
.bouton:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-tint); }
.bouton-primaire { background: var(--accent); color: #fff; border-color: var(--accent); margin-top: 1.1rem; }
.bouton-primaire:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: #fff; }
.bouton-primaire:disabled { opacity: .55; cursor: default; }
.mini { font-size: 0.8rem; padding: 0.32rem 0.6rem; border: 1px solid var(--border); background: var(--surface); border-radius: 7px; cursor: pointer; margin-left: 0.3rem; transition: border-color .12s, color .12s; }
.mini:hover { border-color: var(--accent); color: var(--accent); }
.mini.danger:hover { border-color: var(--expire); color: var(--expire); }

/* ---------------- Tables ---------------- */
.grille { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.grille th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.55rem 0.65rem; border-bottom: 1px solid var(--border); }
.grille td { padding: 0.7rem 0.65rem; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.grille tbody tr { transition: background .1s ease; }
.grille tbody tr:hover { background: #FAFCFC; }
.grille tr:last-child td { border-bottom: none; }
.actions { white-space: nowrap; text-align: right; }

/* ---------------- Pastilles de statut ---------------- */
.pastille { display: inline-block; font-size: 0.74rem; font-weight: 600; padding: 0.2em 0.65em; border-radius: 999px; letter-spacing: 0.01em; }
.pastille.ok { background: var(--ok-bg); color: var(--ok); }
.pastille.grace { background: var(--grace-bg); color: var(--grace); }
.pastille.expire { background: var(--expire-bg); color: var(--expire); }
.pastille.neutre { background: var(--neutre-bg); color: var(--neutre); }

/* ---------------- Messages & etats ---------------- */
.alerte { background: var(--expire-bg); color: var(--expire); border-radius: 8px; padding: 0.65rem 0.85rem; margin: 0.85rem 0; font-size: 0.9rem; }
.alerte-ok { background: var(--ok-bg); color: var(--ok); }
.vide { color: var(--muted); font-style: italic; padding: 0.5rem 0; }
.attente { color: var(--muted); }
.detail { color: var(--muted); font-size: 0.85rem; margin: 0.45rem 0 0; }

.banniere-alerte {
    display: block; background: var(--grace-bg); color: #7A5310;
    border: 1px solid #EAD6A8; border-left: 4px solid var(--grace);
    border-radius: 10px; padding: 0.85rem 1.1rem; margin-bottom: 1.6rem;
    text-decoration: none; font-size: 0.92rem; transition: box-shadow .12s;
}
.banniere-alerte:hover { box-shadow: var(--shadow); }
.banniere-alerte strong { color: var(--grace); }

.splash { min-height: 100vh; display: grid; place-items: center; color: var(--muted); font-size: 0.95rem; background: var(--bg); }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
    .appli { grid-template-columns: 1fr; }
    .lateral { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0.75rem 1rem; }
    .marque { margin: 0 1rem 0 0.5rem; }
    .menu { flex-direction: row; flex-wrap: wrap; flex: 1; }
    .lateral-pied { border-top: none; margin: 0 0 0 auto; padding-top: 0; flex-direction: row; align-items: center; }
    .utilisateur { display: none; }
    .deux-colonnes { grid-template-columns: 1fr; }
    .espace { padding: 1.25rem; }
}

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

/* =====================================================================
   Écran de connexion — charte EasyTech (bleu #00408F / orange #F26C16)
   IBM Plex Sans + Mono. Reproduit la maquette Claude Design.
   ===================================================================== */
.cx-login {
    display: flex;
    min-height: 100vh;
    background: #fff;
    color: #141B26;
    font-family: 'IBM Plex Sans', system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* --- Panneau de marque (gauche) --- */
.cx-brand {
    position: relative;
    width: 46%;
    max-width: 620px;
    background: #00408F;
    background-image: radial-gradient(1200px 620px at 18% -12%, rgba(255,255,255,.09), transparent 60%);
    overflow: hidden;
}
.cx-brand-motif { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.cx-brand-motif svg { position: absolute; right: -180px; bottom: -200px; opacity: .13; }
.cx-brand-inner { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100%; padding: 48px 52px; }
.cx-logo { align-self: flex-start; }
.cx-logo img { height: 104px; width: auto; display: block; filter: drop-shadow(0 8px 20px rgba(0,0,0,.28)); }
.cx-brand-mid { margin-top: auto; }
.cx-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 13px; border: 1px solid rgba(255,255,255,.34); border-radius: 999px;
    font-size: 12px; font-weight: 600; letter-spacing: .04em; color: rgba(255,255,255,.92);
}
.cx-dot { width: 7px; height: 7px; border-radius: 50%; background: #F26C16; }
.cx-h1 { margin: 18px 0 0; font-size: 38px; line-height: 1.12; font-weight: 700; color: #fff; letter-spacing: -0.025em; max-width: 14ch; }
.cx-tagline { margin: 16px 0 0; font-size: 16px; line-height: 1.5; color: rgba(255,255,255,.82); max-width: 34ch; font-style: italic; }
.cx-copy { margin-top: auto; padding-top: 28px; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 11.5px; color: rgba(255,255,255,.6); letter-spacing: .02em; }

/* --- Panneau formulaire (droite) --- */
.cx-form { position: relative; flex: 1; display: grid; place-items: center; padding: 24px; }
.cx-lang {
    position: absolute; top: 24px; right: 28px;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 12px; border: 1px solid #E6EAEF; border-radius: 999px;
    font-size: 12.5px; font-weight: 600; color: #5B6675;
}
.cx-card { width: 100%; max-width: 384px; animation: cxUp .45s ease both; }
.cx-title { margin: 0; font-size: 26px; font-weight: 700; color: #141B26; letter-spacing: -0.025em; }
.cx-sub { margin: 8px 0 0; font-size: 14.5px; color: #788393; }

.cx-error { margin-top: 22px; display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: #FCEBEA; border: 1px solid #F6D3CF; border-radius: 10px; color: #9F1B12; font-size: 13px; animation: cxUp .2s ease both; }
.cx-error svg { flex: none; }
.cx-info { margin-top: 18px; padding: 11px 14px; background: #EAF1FB; border: 1px solid #CFE0F5; border-radius: 10px; color: #1F4E86; font-size: 13px; }

.cx-label { display: block; font-size: 13px; font-weight: 600; color: #37414F; margin: 18px 0 7px; }
.cx-field { position: relative; }
.cx-ico-l { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #9098A5; display: grid; }
.cx-input {
    width: 100%; height: 46px; padding: 0 14px 0 40px;
    border: 1px solid #E6EAEF; border-radius: 10px;
    font-size: 14.5px; font-family: inherit; color: #141B26; background: #fff;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.cx-input::placeholder { color: #A2AAB5; }
.cx-input:focus { outline: none; border-color: #F26C16; box-shadow: 0 0 0 3px rgba(242,108,22,.15); }
.cx-input-pass { padding-right: 44px; }
.cx-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 30px; height: 30px; border: none; background: none; border-radius: 7px; cursor: pointer; color: #8A93A0; }
.cx-eye:hover { background: #EEF1F5; color: #1A2230; }

.cx-row { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 22px; }
.cx-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: #4B5563; cursor: pointer; margin: 0; }
.cx-check input { width: auto; height: auto; accent-color: #00408F; }
.cx-forgot { font-size: 13px; font-weight: 600; color: #F26C16; text-decoration: none; }
.cx-forgot:hover { text-decoration: underline; }

.cx-cta {
    width: 100%; height: 48px;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    background: #F26C16; color: #fff; border: none; border-radius: 10px;
    font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer;
    transition: background .13s ease, transform .05s ease;
}
.cx-cta:hover { background: #D95F0E; }
.cx-cta:active { transform: translateY(1px); }
.cx-cta:disabled { opacity: .7; cursor: default; }

.cx-help { margin-top: 26px; padding-top: 18px; border-top: 1px solid #EEF1F5; text-align: center; font-size: 12.5px; color: #9AA3AF; }
.cx-help a { color: #F26C16; text-decoration: none; font-weight: 600; }

.cx-success { text-align: center; animation: cxPop .3s ease both; }
.cx-check-circle { width: 66px; height: 66px; border-radius: 50%; background: #E7F4EC; display: grid; place-items: center; margin: 0 auto 20px; }
.cx-spin-big { margin: 22px auto 0; width: 26px; height: 26px; border: 3px solid #E6EAEF; border-top-color: #F26C16; border-radius: 50%; animation: cxSpin .8s linear infinite; }
.cx-spin { width: 17px; height: 17px; border: 2.5px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: cxSpin .7s linear infinite; display: inline-block; }

@keyframes cxUp  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes cxPop { from { opacity: 0; transform: scale(.94); }        to { opacity: 1; transform: none; } }
@keyframes cxSpin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
    .cx-brand { display: none; }
    .cx-form { flex: 1; }
}

/* =====================================================================
   Structure du shell (façon AdminLTE) — le thème gère les couleurs.
   ===================================================================== */
.app-wrapper { min-height: 100vh; }
.app-sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: 250px; height: 100vh; overflow-y: auto;
    z-index: 1040; transition: transform .2s ease;
}
.app-header {
    position: sticky; top: 0; z-index: 1030;
    margin-left: 250px; transition: margin-left .2s ease;
    min-height: 56px;
}
.app-main {
    margin-left: 250px; min-height: 100vh;
    display: flex; flex-direction: column;
    transition: margin-left .2s ease;
}
.app-content { flex: 1; padding: 14px 0 28px; }
.app-footer { padding: 12px 16px; }

.sidebar-collapse .app-sidebar { transform: translateX(-100%); }
.sidebar-collapse .app-header,
.sidebar-collapse .app-main { margin-left: 0; }

.sidebar-brand { padding: 14px 16px; }
.sidebar-menu .nav-link { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; }
.sidebar-menu .nav-link .nav-icon { width: 1.15rem; text-align: center; flex: none; }
.sidebar-menu .nav-link p { margin: 0; }

@media (max-width: 992px) {
    .app-header, .app-main { margin-left: 0; }
    .app-sidebar { transform: translateX(-100%); }
    .app-wrapper:not(.sidebar-collapse) .app-sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
}

/* Badge rouge (statuts de licence expirée / révoquée) — complète et-active/expired/none du thème */
.badge.et-danger { background: #FCEBEA; color: #9F1B12; font-weight: 600; }
.badge.et-danger .bi { margin-left: -.35rem; }

/* =====================================================================
   Certificat « Droits de Licence produit » (écran + impression PDF)
   ===================================================================== */
.cert-zone { background: #E9ECF1; padding: 24px 0; }
.cert {
    background: #fff; width: 210mm; max-width: 100%; min-height: 297mm;
    margin: 0 auto; padding: 22mm 20mm; box-shadow: 0 4px 24px rgba(0,0,0,.12);
    color: #1A2230; display: flex; flex-direction: column;
}
.cert-date { text-align: right; font-size: 12px; color: #333; font-weight: 700; }
.cert-logo { display: flex; justify-content: center; margin: 6px 0 4px; }
.cert-logo img { height: 84px; width: auto; }
.cert-titre { text-align: center; font-size: 24px; font-weight: 800; text-decoration: underline; margin: 6px 0 26px; }
.cert-soustitre { text-align: center; font-size: 17px; font-weight: 700; margin: 22px 0 14px; }
.cert-table { width: 78%; margin: 0 auto; border-collapse: separate; border-spacing: 0 8px; }
.cert-table td { border: 1px solid #B9C1CC; padding: 9px 16px; font-size: 13.5px; background: #fff; }
.cert-table td.lbl { font-weight: 700; width: 45%; }
.cert-table td.val { text-align: center; }
.cert-table td.val.strong { font-weight: 700; }
.cert-spacer { flex: 1; }
.cert-footer { border-top: 1px solid #D5DBE2; margin-top: 20px; padding-top: 10px; font-size: 8.5px; color: #444; display: flex; gap: 24px; }
.cert-footer .col { flex: 1; }
.cert-footer .marque { font-weight: 800; }
.cert-footer .marque .b { color: #00408F; } .cert-footer .marque .o { color: #F26C16; }
.cert-web { text-align: center; font-size: 9px; color: #00408F; margin-top: 6px; }

/* Impression : n'imprimer que le certificat, sans le shell */
@media print {
    .app-header, .app-sidebar, .app-footer, .no-print { display: none !important; }
    .app-main { margin: 0 !important; }
    .app-content, .app-content .container-fluid { padding: 0 !important; }
    body, .cert-zone { background: #fff !important; }
    .cert { box-shadow: none; width: auto; padding: 0; margin: 0; }
    @page { size: A4; margin: 12mm; }
}

/* Certificat d'authenticité (nouveau design) — impression */
.cert2-desk { display:flex; align-items:flex-start; justify-content:center; padding:28px 12px; background:#E9ECEF; }
@media print {
    .cert2-desk { background:#fff !important; padding:0 !important; min-height:0 !important; display:block !important; }
    .cert2-page { box-shadow:none !important; }
    @page { size: A4; margin: 0; }
}
