/* Luxgap HR — Design system pro, lisible, dense.
   Objectif : tableaux clairs (zebra + hover + sticky header), hiérarchie visuelle
   forte, cartes élégantes, palette cohérente. */

:root {
    /* Surfaces */
    --lx-bg: #f5f6f8;
    --lx-surface: #ffffff;
    --lx-surface-alt: #fafbfc;
    --lx-surface-stripe: #fafbfd;

    /* Bordures & ombres */
    --lx-border: #e4e7ec;
    --lx-border-strong: #d0d5dd;
    --lx-divider: #eceff3;
    --lx-shadow-xs: 0 1px 2px rgba(16,24,40,.04);
    --lx-shadow-sm: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.04);
    --lx-shadow-md: 0 4px 8px -2px rgba(16,24,40,.06), 0 2px 4px -2px rgba(16,24,40,.04);

    /* Texte */
    --lx-text: #101828;
    --lx-text-soft: #344054;
    --lx-text-muted: #667085;
    --lx-text-faint: #98a2b3;

    /* Couleurs de marque */
    --lx-primary: #2e3192;
    --lx-primary-soft: #eef0fb;
    --lx-primary-hover: #232669;
    --lx-accent: #fa6a39;
    --lx-accent-soft: #fff1ea;

    /* Sémantique */
    --lx-success: #12b76a;
    --lx-success-soft: #ecfdf3;
    --lx-success-text: #027a48;
    --lx-warning: #f79009;
    --lx-warning-soft: #fffaeb;
    --lx-warning-text: #b54708;
    --lx-danger: #f04438;
    --lx-danger-soft: #fef3f2;
    --lx-danger-text: #b42318;
    --lx-info: #0ba5ec;
    --lx-info-soft: #f0f9ff;
    --lx-info-text: #026aa2;

    /* Géométrie */
    --lx-radius-sm: 6px;
    --lx-radius: 10px;
    --lx-radius-lg: 14px;
}

/* === Base === */
html, body { height: 100%; }
body {
    background: var(--lx-bg);
    color: var(--lx-text);
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.92rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--lx-primary); text-decoration: none; }
a:hover { color: var(--lx-primary-hover); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 { color: var(--lx-text); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
.text-muted { color: var(--lx-text-muted) !important; }

/* === Navbar === */
.navbar.bg-dark { background: #14172b !important; box-shadow: 0 1px 0 rgba(255,255,255,.04); }
.navbar-brand { font-weight: 700; letter-spacing: -0.015em; font-size: 1.1rem; }
.navbar-dark .navbar-nav .nav-link {
    color: rgba(255,255,255,.78);
    font-weight: 500;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    margin: 0 1px;
}
.navbar-dark .navbar-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.dropdown-menu {
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius);
    box-shadow: var(--lx-shadow-md);
    padding: 0.4rem;
    font-size: 0.9rem;
}
.dropdown-item { border-radius: 6px; padding: 0.45rem 0.7rem; }
.dropdown-item:hover { background: var(--lx-primary-soft); color: var(--lx-primary); }
.dropdown-divider { border-color: var(--lx-divider); margin: 0.3rem 0; }

/* === Cards === */
.card {
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius);
    box-shadow: var(--lx-shadow-xs);
    background: var(--lx-surface);
}
.card:hover { box-shadow: var(--lx-shadow-sm); }
.card-body { padding: 1.1rem 1.25rem; }
.card-header {
    background: var(--lx-surface-alt);
    border-bottom: 1px solid var(--lx-border);
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
}
.card.border-danger { border-color: var(--lx-danger); border-width: 1px; box-shadow: 0 0 0 3px var(--lx-danger-soft); }
.card.border-warning { border-color: var(--lx-warning); }
.card.border-success { border-color: var(--lx-success); }

/* === Page header === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--lx-divider);
}
.page-header h1 { font-size: 1.5rem; margin: 0; font-weight: 700; }
.page-header .subtitle { color: var(--lx-text-muted); font-size: 0.88rem; margin-top: 0.2rem; }

/* === Boutons === */
.btn { border-radius: 8px; font-weight: 500; transition: all .15s ease; }
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(46,49,146,.2); }
.btn-primary { background: var(--lx-primary); border-color: var(--lx-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--lx-primary-hover); border-color: var(--lx-primary-hover); }
.btn-outline-primary { color: var(--lx-primary); border-color: var(--lx-primary); }
.btn-outline-primary:hover { background: var(--lx-primary); border-color: var(--lx-primary); color: #fff; }
.btn-outline-secondary { color: var(--lx-text-soft); border-color: var(--lx-border-strong); }
.btn-outline-secondary:hover { background: var(--lx-surface-alt); color: var(--lx-text); border-color: var(--lx-border-strong); }
.btn-outline-danger { color: var(--lx-danger-text); border-color: var(--lx-danger); }
.btn-outline-danger:hover { background: var(--lx-danger); border-color: var(--lx-danger); }
.btn-link { color: var(--lx-primary); }
.btn-link:hover { color: var(--lx-primary-hover); }
.btn-sm { padding: 0.32rem 0.7rem; font-size: 0.825rem; }

/* === Badges (soft, pas saturé) === */
.badge {
    font-weight: 600;
    padding: 0.32em 0.65em;
    border-radius: 999px;
    font-size: 0.72rem;
    letter-spacing: 0.01em;
}
.badge.bg-primary   { background: var(--lx-primary-soft) !important; color: var(--lx-primary) !important; }
.badge.bg-success   { background: var(--lx-success-soft) !important; color: var(--lx-success-text) !important; }
.badge.bg-warning   { background: var(--lx-warning-soft) !important; color: var(--lx-warning-text) !important; }
.badge.bg-danger    { background: var(--lx-danger-soft) !important; color: var(--lx-danger-text) !important; }
.badge.bg-info      { background: var(--lx-info-soft) !important; color: var(--lx-info-text) !important; }
.badge.bg-secondary { background: #f2f4f7 !important; color: #475467 !important; }
.badge.bg-dark      { background: #344054 !important; color: #fff !important; }
.badge-grade { background: var(--lx-primary); color: #fff; padding: 0.45em 0.7em; }

/* === Tableaux : LE point clé pour la lisibilité === */
.table {
    font-size: 0.875rem;
    margin-bottom: 0;
    color: var(--lx-text);
    --bs-table-bg: transparent;
}
.table > :not(caption) > * > * {
    padding: 0.7rem 0.85rem;
    vertical-align: middle;
    border-bottom-color: var(--lx-divider);
}
.table thead th {
    font-weight: 600;
    color: var(--lx-text-muted);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    background: var(--lx-surface-alt);
    border-bottom: 1px solid var(--lx-border);
    white-space: nowrap;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}
.table thead th:first-child { padding-left: 1rem; }
.table thead th:last-child { padding-right: 1rem; }

/* Zebra striping baseline (toutes les tables, pas besoin de .table-striped) */
.table > tbody > tr:nth-of-type(even) > * { background-color: var(--lx-surface-stripe); }
.table > tbody > tr:nth-of-type(odd)  > * { background-color: var(--lx-surface); }

/* Hover net mais subtil */
.table-hover > tbody > tr:hover > *,
.table > tbody > tr:hover > * {
    background-color: var(--lx-primary-soft) !important;
    color: var(--lx-text);
    transition: background-color .12s ease;
}

/* Lignes "totaux" / table-light en pied → fond plus marqué + bord supérieur */
.table tr.table-light > *,
.table tfoot > tr > *,
.table-light { background-color: #f2f4f7 !important; font-weight: 600; }
.table tfoot > tr > * { border-top: 2px solid var(--lx-border-strong); }

/* Lignes archivées / muted */
.table tr.text-muted > * { color: var(--lx-text-muted) !important; }

/* Cellules avec valeurs numériques alignées */
.table .text-end, .table th.text-end { font-variant-numeric: tabular-nums; }

/* Tableau scroll : sticky header pour les longues listes */
.table-responsive { border-radius: var(--lx-radius); }
.table-responsive .table thead th { position: sticky; top: 0; z-index: 2; }

/* Wrapper bg-white rounded → contour propre */
.table-responsive.bg-white,
.bg-white.rounded > .table {
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius);
    overflow: hidden;
}

/* Cellules d'édition inline (form-controls dans table) — moins agressif */
.table input.form-control,
.table select.form-select {
    font-size: 0.85rem;
}
.table input.form-control.border-0:focus,
.table select.form-select.border-0:focus {
    background: var(--lx-surface) !important;
    box-shadow: 0 0 0 2px rgba(46,49,146,.18);
}

/* === Forms === */
.form-control, .form-select {
    border-radius: 8px;
    border-color: var(--lx-border-strong);
    color: var(--lx-text);
    transition: border-color .12s ease, box-shadow .12s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--lx-primary);
    box-shadow: 0 0 0 3px rgba(46,49,146,.12);
}
.form-control-sm, .form-select-sm { padding: 0.32rem 0.6rem; font-size: 0.85rem; }
.form-label { font-weight: 500; color: var(--lx-text-soft); font-size: 0.85rem; }
.form-text { color: var(--lx-text-muted); }

/* === Alerts === */
.alert { border-radius: var(--lx-radius); border: 1px solid transparent; padding: 0.85rem 1rem; }
.alert-info     { background: var(--lx-info-soft);    color: var(--lx-info-text);    border-color: #b9e6fe; }
.alert-success  { background: var(--lx-success-soft); color: var(--lx-success-text); border-color: #abefc6; }
.alert-warning  { background: var(--lx-warning-soft); color: var(--lx-warning-text); border-color: #fedf89; }
.alert-danger   { background: var(--lx-danger-soft);  color: var(--lx-danger-text);  border-color: #fda29b; }

/* === Progress === */
.progress { background: #eaecf0; border-radius: 999px; height: 8px; }
.progress-bar { border-radius: 999px; background: var(--lx-primary); }

/* === KPI cards (grand chiffre) === */
.kpi-card { transition: box-shadow .15s ease, transform .15s ease; }
.kpi-card:hover { box-shadow: var(--lx-shadow-sm); transform: translateY(-1px); }
.kpi-card .card-body { padding: 1rem 1.15rem; }
.kpi-card .kpi-label {
    color: var(--lx-text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.kpi-card .kpi-value {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--lx-text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.kpi-card .kpi-sub { color: var(--lx-text-muted); font-size: 0.78rem; margin-top: 0.3rem; }
.kpi-card.border-warning { border-left: 3px solid var(--lx-warning); }
.kpi-card.border-danger  { border-left: 3px solid var(--lx-danger); }
.kpi-card.border-success { border-left: 3px solid var(--lx-success); }

/* === Tabs Harvest === */
.tabs-bar { border-bottom: 1px solid var(--lx-border); display: flex; gap: 0.25rem; margin-bottom: 1.25rem; }
.tabs-bar a {
    padding: 0.6rem 0.95rem;
    color: var(--lx-text-muted);
    border-bottom: 2px solid transparent;
    font-weight: 500;
    transition: color .12s ease, border-color .12s ease;
}
.tabs-bar a.active { color: var(--lx-text); border-bottom-color: var(--lx-accent); font-weight: 600; }
.tabs-bar a:hover { text-decoration: none; color: var(--lx-text); }

/* === Help panel === */
.help-panel {
    background: linear-gradient(180deg, #fafbfd 0%, #f5f6f8 100%);
    border: 1px solid var(--lx-border);
    border-radius: var(--lx-radius);
    padding: 1rem 1.15rem;
}
.help-panel h2 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.6rem; color: var(--lx-text); }
.help-panel ul { padding-left: 1.1rem; margin: 0; }
.help-panel ul li { margin-bottom: 0.4rem; line-height: 1.45; color: var(--lx-text-soft); }

/* === Avatars === */
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--lx-primary-soft);
    color: var(--lx-primary);
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

/* === Promo banner / hero === */
.promo-banner {
    background: linear-gradient(135deg, #2e3192 0%, #fa6a39 100%);
    color: #fff;
    padding: 1.1rem 1.4rem;
    border-radius: var(--lx-radius);
    box-shadow: var(--lx-shadow-md);
}

/* === Critères évaluation === */
.criterion-card {
    background: #fff;
    border: 1px solid var(--lx-border);
    box-shadow: var(--lx-shadow-xs);
    border-radius: var(--lx-radius);
    padding: 1rem 1.15rem;
    margin-bottom: 0.9rem;
    transition: box-shadow .15s ease;
}
.criterion-card:hover { box-shadow: var(--lx-shadow-sm); }
.criterion-card.negative-criterion { border-left: 4px solid var(--lx-danger); }

.ai-feedback {
    background: var(--lx-warning-soft);
    border-left: 3px solid var(--lx-warning);
    padding: 0.7rem 0.95rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--lx-warning-text);
}

/* === Donut === */
.donut-wrap { display: inline-block; position: relative; }
.donut-wrap text.donut-pct { font-weight: 700; font-size: 0.95rem; fill: var(--lx-text); }

/* === Texte sémantique === */
.text-success { color: var(--lx-success-text) !important; }
.text-warning { color: var(--lx-warning-text) !important; }
.text-danger  { color: var(--lx-danger-text) !important; }
.text-info    { color: var(--lx-info-text) !important; }

/* === Détails (déroulants) === */
details summary { cursor: pointer; color: var(--lx-text-soft); font-weight: 500; }
details[open] summary { color: var(--lx-text); margin-bottom: 0.5rem; }

/* === Validation states inline (édition tableau) === */
.is-valid { box-shadow: 0 0 0 2px rgba(18,183,106,.35) !important; transition: box-shadow .2s ease; }
.is-invalid { box-shadow: 0 0 0 2px rgba(240,68,56,.4) !important; transition: box-shadow .2s ease; }

/* === Scrollbars discrètes === */
.table-responsive::-webkit-scrollbar { height: 8px; width: 8px; }
.table-responsive::-webkit-scrollbar-thumb { background: #d0d5dd; border-radius: 999px; }
.table-responsive::-webkit-scrollbar-thumb:hover { background: #98a2b3; }

/* === Listes (small lists dans cards) === */
.list-unstyled.small li { padding: 0.25rem 0; border-bottom: 1px solid var(--lx-divider); }
.list-unstyled.small li:last-child { border-bottom: 0; }

/* === Liens dans tableau (icones d'actions) === */
.table .btn-link { color: var(--lx-text-muted); }
.table .btn-link:hover { color: var(--lx-primary); }
.table .btn-link.text-danger { color: var(--lx-danger-text); }
.table .btn-link.text-success { color: var(--lx-success-text); }

/* === Sections / titres dans pages === */
.section-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--lx-text-muted);
    font-weight: 600;
    margin: 1.5rem 0 0.6rem;
}

/* === Mode impersonation banner === */
.alert.rounded-0 {
    border-left: 0; border-right: 0;
    border-radius: 0;
    background: var(--lx-warning-soft);
    color: var(--lx-warning-text);
    border-color: #fedf89;
}

/* === Tickets : rendu HTML email reçu === */
.email-body {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--lx-text-soft);
    overflow-x: auto;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
}
.email-body p,
.email-body div {
    margin: 0 0 0.5rem 0;
    min-height: 1px; /* divs vides Outlook créent quand même un saut */
}
.email-body p:empty,
.email-body div:empty {
    height: 0.8rem; /* ligne vide visible */
    margin: 0;
}
.email-body br + br { display: block; content: ""; margin-top: 0.5rem; }
/* Signatures Outlook : <div class="elementToProof"> */
.email-body .elementToProof { display: block; margin: 0 0 0.35rem 0; }
.email-body .elementToProof:first-child { margin-top: 0.2rem; }
/* Quoted reply Outlook (les "De: ... Envoyé: ...") */
.email-body .OutlookMessageHeader,
.email-body [id^="x_"],
.email-body [id*="divRplyFwdMsg"] {
    border-top: 1px solid var(--lx-border);
    padding-top: 8px;
    margin-top: 12px;
    color: var(--lx-text-muted);
}
.email-body table {
    border-collapse: collapse;
    margin: 0.5rem 0;
    max-width: 100%;
}
.email-body table td, .email-body table th {
    padding: 4px 8px;
    border: 1px solid var(--lx-border);
}
.email-body blockquote {
    border-left: 3px solid var(--lx-border-strong);
    margin: 0.5rem 0;
    padding-left: 12px;
    color: var(--lx-text-muted);
}
.email-body pre {
    background: var(--lx-surface-alt);
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    white-space: pre-wrap;
}
/* Liens neutralisés : non cliquables, visuel d'avertissement */
.email-body .dead-link {
    color: #6b7280;
    text-decoration: underline dotted;
    cursor: not-allowed;
    background: #fff8e1;
    padding: 0 2px;
    border-radius: 2px;
}
.email-body .dead-link::before { content: "🔗 "; opacity: 0.5; }
.email-body .dead-link::after  { content: " ⚠️"; font-size: 0.75rem; opacity: 0.6; }
/* Images distantes bloquées (anti-tracking) : placeholder */
.email-body img.blocked-image,
.email-body img:not([src]) {
    display: inline-block;
    min-width: 80px;
    min-height: 24px;
    background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 6px, #e5e7eb 6px, #e5e7eb 12px);
    border: 1px dashed var(--lx-border-strong);
    border-radius: 3px;
    color: var(--lx-text-faint);
    font-size: 0.75rem;
    padding: 4px 8px;
    vertical-align: middle;
}
