/* =====================================================================
   ENERGY SOLUTIONS — CRM COMMERCIAL · Design system
   ---------------------------------------------------------------------
   Fichier unique et centralisé : tokens, base, layout (sidebar/header),
   composants (cartes, boutons, formulaires, badges, DataTables, modales,
   dropdowns, KPI, graphiques, workflow) et responsive.
   Typographie alignée sur energy-solutions.tn : Roboto (texte) + Poppins
   (titres, menus, boutons). Couleurs de marque : rouge #EE212E, marine #282F6A.
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
    --es-red: #ee212e;
    --es-red-600: #d01a26;
    --es-red-700: #ad141f;
    --es-red-50: #fff1f2;
    --es-red-100: #ffe0e2;

    --es-navy: #282f6a;
    --es-navy-950: #12153a;
    --es-navy-900: #181c47;
    --es-navy-800: #20255a;
    --es-navy-700: #2d3474;
    --es-navy-50: #eef0fb;

    --es-chart-1: #4552b0;
    --es-chart-2: #ee212e;
    --es-chart-track: #e9ecf5;

    --es-ink: #1b1f33;
    --es-text: #3a3f55;
    --es-muted: #6b7089;
    --es-subtle: #9aa0b4;

    --es-bg: #f4f6fa;
    --es-surface: #ffffff;
    --es-surface-2: #f8f9fc;
    --es-border: #e6e8f0;
    --es-border-strong: #d6dae6;

    --es-success: #11804a;
    --es-success-bg: #e7f6ee;
    --es-warning: #a86400;
    --es-warning-bg: #fff4dc;
    --es-danger: #c8102e;
    --es-danger-bg: #fdecee;
    --es-info: #2c5fd6;
    --es-info-bg: #eaf0ff;

    --es-font: "Roboto", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
    --es-font-display: "Poppins", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;

    --es-radius-sm: 6px;
    --es-radius: 10px;
    --es-radius-lg: 14px;
    --es-radius-xl: 18px;

    --es-shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
    --es-shadow-sm: 0 1px 3px rgba(23, 27, 63, 0.06), 0 1px 2px rgba(23, 27, 63, 0.04);
    --es-shadow-md: 0 6px 18px rgba(23, 27, 63, 0.07);
    --es-shadow-lg: 0 16px 40px rgba(23, 27, 63, 0.14);

    --es-sidebar-w: 268px;
    --es-sidebar-w-collapsed: 76px;
    --es-header-h: 64px;
    --es-ease: cubic-bezier(.2, .8, .2, 1);
    --es-focus: 0 0 0 3px rgba(238, 33, 46, 0.18);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--es-font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--es-text);
    background: var(--es-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5 { font-family: var(--es-font-display); color: var(--es-ink); margin: 0; line-height: 1.25; }

a { color: var(--es-navy-700); text-decoration: none; }
a:hover { color: var(--es-red); }

img { max-width: 100%; }

hr { border: 0; border-top: 1px solid var(--es-border); margin: 20px 0; }

::selection { background: var(--es-red-100); color: var(--es-ink); }

:focus-visible { outline: none; box-shadow: var(--es-focus); border-radius: 6px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

.text-muted, .cell-muted { color: var(--es-muted); }
.text-subtle { color: var(--es-subtle); }
.text-right { text-align: right; }
.text-nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.fw-600 { font-weight: 600; }

/* Barre de progression Turbo aux couleurs de la marque */
.turbo-progress-bar { height: 3px; background: var(--es-red); }

/* ---------- 3. Shell ---------- */
.app-shell { min-height: 100vh; }

.app-content {
    margin-left: var(--es-sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s var(--es-ease);
}

.app-main {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 28px 32px 40px;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 32px;
    border-top: 1px solid var(--es-border);
    color: var(--es-subtle);
    font-size: 12px;
    background: var(--es-surface);
}
.app-footer strong { color: var(--es-navy); font-weight: 500; }

html.sidebar-collapsed .app-content { margin-left: var(--es-sidebar-w-collapsed); }

/* ---------- 4. Sidebar ---------- */
.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: var(--es-sidebar-w);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--es-navy-900) 0%, var(--es-navy-950) 100%);
    color: #c9cdea;
    transition: width .25s var(--es-ease), transform .25s var(--es-ease);
}

.sidebar-header {
    height: var(--es-header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 14px 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.sidebar-brand { display: flex; align-items: center; min-width: 0; }
.sidebar-brand-logo { height: 46px; width: auto; display: block; }
.sidebar-brand-mark { height: 34px; width: 34px; display: none; }

.sidebar-toggle {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #c9cdea;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s ease, transform .25s var(--es-ease);
}
.sidebar-toggle:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.sidebar-tagline {
    padding: 14px 22px 4px;
    font-family: var(--es-font-display);
    font-size: 10.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(201, 205, 234, 0.55);
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 12px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.nav-section { margin-top: 14px; }
.nav-section-title {
    padding: 0 10px 6px;
    font-family: var(--es-font-display);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(201, 205, 234, 0.5);
    white-space: nowrap;
    overflow: hidden;
}

.nav-item { position: relative; }

.nav-link,
.nav-group-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    margin: 2px 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #c9cdea;
    font-family: var(--es-font-display);
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.nav-link:hover,
.nav-group-toggle:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.nav-icon {
    width: 22px;
    flex-shrink: 0;
    text-align: center;
    font-size: 17px;
    line-height: 1;
}
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-caret { font-size: 12px; transition: transform .25s var(--es-ease); opacity: .7; }
.nav-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--es-red);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}
.nav-pill {
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #c9cdea;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .03em;
}

.nav-link.active,
.nav-group.open > .nav-group-toggle.has-active,
.nav-group-toggle.has-active {
    color: #fff;
}
.nav-link.active { background: rgba(238, 33, 46, 0.14); }
.nav-link.active::before,
.nav-group-toggle.has-active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--es-red);
}
.nav-link.active .nav-icon,
.nav-group-toggle.has-active .nav-icon { color: var(--es-red); }

.nav-group.open > .nav-group-toggle .nav-caret { transform: rotate(180deg); }

.nav-submenu {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .28s var(--es-ease);
}
.nav-group.open > .nav-submenu { grid-template-rows: 1fr; }
.nav-submenu-inner { overflow: hidden; }
.nav-submenu .nav-link {
    min-height: 34px;
    padding: 6px 10px 6px 44px;
    font-family: var(--es-font);
    font-size: 13px;
    font-weight: 400;
    color: #aeb3d8;
}
.nav-submenu .nav-link::after {
    content: "";
    position: absolute;
    left: 21px;
    top: 50%;
    width: 6px;
    height: 6px;
    margin-top: -3px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    opacity: .6;
}
.nav-submenu .nav-link.active { background: transparent; color: #fff; font-weight: 500; }
.nav-submenu .nav-link.active::before { display: none; }
.nav-submenu .nav-link.active::after { background: var(--es-red); border-color: var(--es-red); opacity: 1; }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    color: #fff;
}
.sidebar-user:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar-user-text { display: block; min-width: 0; line-height: 1.3; }
.sidebar-user-name { display: block; font-family: var(--es-font-display); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { display: block; font-size: 11.5px; color: rgba(201, 205, 234, 0.7); white-space: nowrap; }

/* Sidebar réduite (desktop) */
html.sidebar-collapsed .app-sidebar { width: var(--es-sidebar-w-collapsed); }
html.sidebar-collapsed .sidebar-header { padding: 0; justify-content: center; flex-direction: column; gap: 0; }
html.sidebar-collapsed .sidebar-brand-logo { display: none; }
html.sidebar-collapsed .sidebar-brand-mark { display: block; }
html.sidebar-collapsed .sidebar-toggle { position: absolute; right: -14px; top: 18px; width: 28px; height: 28px; background: var(--es-surface); color: var(--es-navy); box-shadow: var(--es-shadow-md); border: 1px solid var(--es-border); transform: rotate(180deg); }
html.sidebar-collapsed .sidebar-tagline,
html.sidebar-collapsed .nav-section-title,
html.sidebar-collapsed .nav-label,
html.sidebar-collapsed .nav-caret,
html.sidebar-collapsed .nav-pill,
html.sidebar-collapsed .sidebar-user-text { display: none; }
html.sidebar-collapsed .sidebar-nav { overflow: visible; }
html.sidebar-collapsed .nav-section { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
html.sidebar-collapsed .nav-section:first-child { border-top: 0; }
html.sidebar-collapsed .nav-link,
html.sidebar-collapsed .nav-group-toggle { justify-content: center; padding: 8px 0; }
html.sidebar-collapsed .nav-badge { position: absolute; top: 2px; right: 6px; min-width: 16px; height: 16px; line-height: 16px; font-size: 10px; padding: 0 4px; }
html.sidebar-collapsed .sidebar-user { justify-content: center; }

/* Sous-menus en "flyout" quand la sidebar est réduite */
html.sidebar-collapsed .nav-group > .nav-submenu {
    position: absolute;
    left: calc(100% + 10px);
    top: 0;
    min-width: 220px;
    display: block;
    padding: 6px;
    border-radius: 12px;
    background: var(--es-navy-900);
    box-shadow: var(--es-shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-6px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
html.sidebar-collapsed .nav-group:hover > .nav-submenu,
html.sidebar-collapsed .nav-group:focus-within > .nav-submenu { opacity: 1; visibility: visible; transform: none; }
html.sidebar-collapsed .nav-group > .nav-submenu .nav-link { justify-content: flex-start; padding-left: 30px; }
html.sidebar-collapsed .nav-group > .nav-submenu .nav-link::after { left: 12px; }
html.sidebar-collapsed .nav-group > .nav-submenu .nav-flyout-title { display: block; }
.nav-flyout-title { display: none; padding: 6px 10px 4px; font-family: var(--es-font-display); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: rgba(201, 205, 234, 0.55); }

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(12, 14, 36, 0.48);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s;
}

/* ---------- 5. Header ---------- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--es-header-h);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px 0 28px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(160%) blur(8px);
    border-bottom: 1px solid var(--es-border);
}

.header-burger { display: none; }

.header-brand { display: none; align-items: center; }
.header-brand img { height: 32px; width: auto; }

.header-title { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.header-title-main { font-family: var(--es-font-display); font-size: 15px; font-weight: 600; color: var(--es-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-title-sub { font-size: 11.5px; color: var(--es-subtle); white-space: nowrap; }

.header-search {
    flex: 1;
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: 40px;
    border: 1px solid var(--es-border);
    border-radius: 10px;
    background: var(--es-surface-2);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.header-search:focus-within { border-color: var(--es-red); box-shadow: var(--es-focus); background: #fff; }
.header-search-scope {
    height: 100%;
    border: 0;
    border-right: 1px solid var(--es-border);
    background: transparent;
    padding: 0 26px 0 12px;
    font-family: var(--es-font-display);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--es-navy);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7089' d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    border-radius: 10px 0 0 10px;
}
.header-search-scope:focus { outline: none; }
.header-search-icon { padding: 0 4px 0 12px; color: var(--es-subtle); }
.header-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    background: transparent;
    padding: 0 10px 0 6px;
    font: inherit;
    color: var(--es-ink);
}
.header-search input:focus { outline: none; }
.header-search kbd {
    margin-right: 10px;
    padding: 2px 6px;
    border: 1px solid var(--es-border);
    border-radius: 5px;
    background: #fff;
    font-family: var(--es-font);
    font-size: 11px;
    color: var(--es-subtle);
}

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.header-search + .header-actions { margin-left: 0; }

.header-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--es-muted);
    font-size: 19px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.header-icon-btn:hover, .header-icon-btn[aria-expanded="true"] { background: var(--es-surface-2); color: var(--es-navy); }
.header-icon-btn .count-badge {
    position: absolute;
    top: 5px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: var(--es-red);
    color: #fff;
    font-family: var(--es-font);
    font-size: 10px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 4px 4px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font: inherit;
    transition: background .15s ease;
}
.header-user:hover, .header-user[aria-expanded="true"] { background: var(--es-surface-2); }
.header-user-text { line-height: 1.25; }
.header-user-name { font-family: var(--es-font-display); font-size: 13px; font-weight: 600; color: var(--es-ink); white-space: nowrap; }
.header-user-role { font-size: 11.5px; color: var(--es-muted); white-space: nowrap; }
.header-user .bi-chevron-down { color: var(--es-subtle); font-size: 12px; }

/* ---------- 6. Avatar ---------- */
.avatar {
    --av-size: 36px;
    width: var(--av-size);
    height: var(--av-size);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--es-red) 0%, #b5121d 100%);
    color: #fff;
    font-family: var(--es-font-display);
    font-size: calc(var(--av-size) * 0.38);
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.avatar-sm { --av-size: 30px; }
.avatar-lg { --av-size: 56px; }
.avatar-xl { --av-size: 88px; box-shadow: 0 0 0 4px #fff, var(--es-shadow-md); }
.avatar-navy { background: linear-gradient(135deg, var(--es-navy-700) 0%, var(--es-navy-900) 100%); }

/* ---------- 7. Dropdowns ---------- */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 70;
    min-width: 220px;
    padding: 6px;
    border: 1px solid var(--es-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--es-shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px) scale(.98);
    transform-origin: top right;
    transition: opacity .15s ease, transform .15s var(--es-ease), visibility .15s;
}
.dropdown-menu.dropdown-left { right: auto; left: 0; transform-origin: top left; }
.dropdown.open > .dropdown-menu { opacity: 1; visibility: visible; transform: none; }

.dropdown-header { padding: 10px 12px 8px; border-bottom: 1px solid var(--es-border); margin: -6px -6px 6px; }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--es-text);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}
.dropdown-item i { width: 18px; text-align: center; color: var(--es-muted); font-size: 15px; }
.dropdown-item:hover { background: var(--es-surface-2); color: var(--es-ink); }
.dropdown-item:hover i { color: var(--es-navy); }
.dropdown-item.danger { color: var(--es-danger); }
.dropdown-item.danger i { color: var(--es-danger); }
.dropdown-item.danger:hover { background: var(--es-danger-bg); }
.dropdown-divider { height: 1px; margin: 6px -6px; background: var(--es-border); }
.dropdown-menu form { margin: 0; }

.user-menu { width: 260px; }
.user-menu .dropdown-header { display: flex; align-items: center; gap: 12px; padding: 14px; }
.user-menu-name { font-family: var(--es-font-display); font-weight: 600; color: var(--es-ink); font-size: 14px; }
.user-menu-mail { font-size: 12px; color: var(--es-muted); max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.user-menu .profile-direction-role {
    height: auto;
    margin-top: 6px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--es-gold-600);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .12em;
    box-shadow: none;
}
.user-menu .profile-direction-role i {
    color: var(--es-gold-500);
    font-size: 11px;
}

/* Notifications */
.notif-menu { width: 380px; padding: 0; }
.notif-menu-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--es-border); }
.notif-menu-title { font-family: var(--es-font-display); font-weight: 600; font-size: 14px; color: var(--es-ink); }
.notif-list { max-height: 380px; overflow-y: auto; margin: 0; padding: 6px; list-style: none; }
.notif-menu-footer { padding: 8px; border-top: 1px solid var(--es-border); text-align: center; }
.notif-menu-footer a { display: block; padding: 8px; border-radius: 8px; font-family: var(--es-font-display); font-size: 13px; font-weight: 500; color: var(--es-navy); }
.notif-menu-footer a:hover { background: var(--es-surface-2); }

.notif-item {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 10px 12px 10px 14px;
    border-radius: 10px;
    color: var(--es-text);
    transition: background .15s ease;
}
.notif-item:hover { background: var(--es-surface-2); color: var(--es-text); }
.notif-item.is-unread { background: #fbfbfe; }
.notif-item.is-unread::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 18px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--es-red);
}
.notif-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 16px;
}
.notif-icon.tone-info { background: var(--es-info-bg); color: var(--es-info); }
.notif-icon.tone-warning { background: var(--es-warning-bg); color: var(--es-warning); }
.notif-icon.tone-danger { background: var(--es-danger-bg); color: var(--es-danger); }
.notif-icon.tone-success { background: var(--es-success-bg); color: var(--es-success); }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 500; color: var(--es-ink); line-height: 1.35; }
.notif-item.is-read .notif-title { font-weight: 400; color: var(--es-text); }
.notif-text { font-size: 12px; color: var(--es-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-time { font-size: 11px; color: var(--es-subtle); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.notif-mark {
    align-self: flex-start;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--es-subtle);
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s ease, background .15s ease;
}
.notif-item:hover .notif-mark, .notif-mark:focus-visible { opacity: 1; }
.notif-mark:hover { background: #fff; color: var(--es-success); }
.notif-item.is-read .notif-mark { display: none; }
.notif-empty { padding: 32px 16px; text-align: center; color: var(--es-muted); font-size: 13px; }
.notif-empty i { display: block; font-size: 28px; color: var(--es-border-strong); margin-bottom: 8px; }

/* ---------- 8. Page header & breadcrumb ---------- */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 10px;
    padding: 0;
    list-style: none;
    font-size: 12.5px;
    color: var(--es-subtle);
}
.breadcrumb a { color: var(--es-muted); }
.breadcrumb a:hover { color: var(--es-red); }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--es-border-strong); }
.breadcrumb-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--es-muted);
}
.breadcrumb-back:hover { color: var(--es-red); }

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 24px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.page-header-text { min-width: 0; flex: 1 1 320px; }
.page-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-family: var(--es-font-display);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--es-red);
}
.page-title { font-family: var(--es-font-display); font-size: 24px; font-weight: 600; color: var(--es-ink); letter-spacing: -.01em; margin: 0; }
.page-subtitle { margin-top: 4px; color: var(--es-muted); font-size: 14px; }
.page-subtitle a { font-weight: 500; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-actions form { margin: 0; }

.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row-actions form { margin: 0; display: inline-flex; }

/* ---------- 9. Cards ---------- */
.card {
    background: var(--es-surface);
    border: 1px solid var(--es-border);
    border-radius: var(--es-radius-lg);
    box-shadow: var(--es-shadow-xs);
    padding: 22px 24px;
    margin-bottom: 20px;
}
.card-flush { padding: 0; overflow: hidden; }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: -22px -24px 20px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--es-border);
}
.card-flush > .card-header { margin: 0; }
.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--es-font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--es-ink);
    margin: 0;
}
.card-title i { color: var(--es-red); font-size: 17px; }
.card-subtitle { font-size: 12.5px; color: var(--es-muted); margin-top: 2px; }
.card-body { padding: 20px 24px; }
.card-footer { padding: 14px 24px; border-top: 1px solid var(--es-border); background: var(--es-surface-2); }

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    font-family: var(--es-font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--es-ink);
}
.section-title i { color: var(--es-red); }
.section-title .text-muted { font-family: var(--es-font); font-weight: 400; font-size: 12.5px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid > .card { margin-bottom: 0; }
.grid-split { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
.grid-split-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; }
.grid-gap-bottom { margin-bottom: 20px; }
.stack > * + * { margin-top: 20px; }

.detail-columns { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.detail-side .card { position: relative; }

/* ---------- 10. Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    font-family: var(--es-font-display);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn i { font-size: 15px; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }

.btn-primary { background: var(--es-red); color: #fff; box-shadow: 0 1px 2px rgba(238, 33, 46, .25), inset 0 -1px 0 rgba(0, 0, 0, .08); }
.btn-primary:hover { background: var(--es-red-600); color: #fff; box-shadow: 0 6px 16px rgba(238, 33, 46, .25); }

.btn-navy { background: var(--es-navy); color: #fff; }
.btn-navy:hover { background: var(--es-navy-800); color: #fff; }

.btn-secondary { background: #fff; border-color: var(--es-border-strong); color: var(--es-text); box-shadow: var(--es-shadow-xs); }
.btn-secondary:hover { background: var(--es-surface-2); border-color: #c6cbdb; color: var(--es-ink); }

.btn-ghost { color: var(--es-muted); }
.btn-ghost:hover { background: var(--es-surface-2); color: var(--es-ink); }

.btn-success { background: var(--es-success); color: #fff; }
.btn-success:hover { background: #0c6a3c; color: #fff; }
.btn-danger { background: var(--es-danger); color: #fff; }
.btn-danger:hover { background: #a50d26; color: #fff; }
.btn-danger-outline { background: #fff; border-color: #f3c1c8; color: var(--es-danger); }
.btn-danger-outline:hover { background: var(--es-danger-bg); color: var(--es-danger); }

.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-sm i { font-size: 14px; }
.btn-lg { min-height: 46px; padding: 12px 22px; font-size: 14px; }
.btn-block { width: 100%; }

.btn-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--es-muted);
    font-size: 15px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-icon:hover { background: var(--es-surface-2); border-color: var(--es-border); color: var(--es-navy); }
.btn-icon.btn-danger { background: transparent; color: var(--es-muted); }
.btn-icon.btn-danger:hover { background: var(--es-danger-bg); border-color: #f3c1c8; color: var(--es-danger); }

/* ---------- 11. Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--es-surface-2);
    border: 1px solid var(--es-border);
    color: var(--es-text);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}
.badge-truncate { display: inline-block; max-width: 210px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-yes, .badge-success { background: var(--es-success-bg); border-color: #c4e8d3; color: var(--es-success); }
.badge-no, .badge-danger { background: var(--es-danger-bg); border-color: #f6c9cf; color: var(--es-danger); }
.badge-warning { background: var(--es-warning-bg); border-color: #f5dea6; color: var(--es-warning); }
.badge-info { background: var(--es-info-bg); border-color: #cddaff; color: var(--es-info); }
.badge-navy { background: var(--es-navy-50); border-color: #d7dbf3; color: var(--es-navy); }
.badge-red { background: var(--es-red-50); border-color: var(--es-red-100); color: var(--es-red-700); }
.badge-solid { background: var(--es-navy); border-color: var(--es-navy); color: #fff; }

/* ---------- 12. Formulaires ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-field.full, .form-grid > .full { grid-column: 1 / -1; }

.form-field label,
.form-label {
    font-family: var(--es-font-display);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--es-ink);
}
.form-field label.required::after { content: " *"; color: var(--es-red); }
.form-hint, .form-field .help-text { font-size: 12px; color: var(--es-subtle); }

.form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-field select,
.form-field textarea,
.form-control {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--es-border-strong);
    border-radius: 10px;
    background: #fff;
    color: var(--es-ink);
    font: inherit;
    font-size: 14px;
    box-shadow: var(--es-shadow-xs);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-field textarea, textarea.form-control { min-height: 90px; resize: vertical; line-height: 1.5; }
.form-field select, select.form-control {
    appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7089' d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.form-field input:hover, .form-field select:hover, .form-field textarea:hover, .form-control:hover { border-color: #c2c7d8; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus, .form-control:focus {
    outline: none;
    border-color: var(--es-red);
    box-shadow: var(--es-focus);
}
.form-field input::placeholder, .form-field textarea::placeholder, .form-control::placeholder { color: var(--es-subtle); }
.searchable-select { position: relative; width: 100%; min-width: 0; }
.searchable-select-native { display: none !important; }
.searchable-select-input {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 9px 34px 9px 12px;
    border: 1px solid var(--es-border-strong);
    border-radius: 10px;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7089' d='M8 11L3 6h10z'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Ccircle cx='6.5' cy='6.5' r='4.5' fill='none' stroke='%236b7089' stroke-width='1.5'/%3E%3Cpath d='m10 10 4 4' fill='none' stroke='%236b7089' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center, left 12px center;
    color: var(--es-ink);
    font: inherit;
    font-size: 14px;
    box-shadow: var(--es-shadow-xs);
}
.searchable-select-input:hover { border-color: #c2c7d8; }
.searchable-select-input:focus { outline: none; border-color: var(--es-red); box-shadow: var(--es-focus); }
.searchable-select-input:disabled { cursor: not-allowed; opacity: .65; }
.searchable-select-list {
    position: absolute;
    z-index: 1200;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    max-height: 250px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--es-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--es-shadow-md);
}
.searchable-select-list[hidden] { display: none; }
.searchable-select-option {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--es-text);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.searchable-select-option:hover, .searchable-select-option.is-active { background: var(--es-navy-50); color: var(--es-navy); }
.searchable-select-option[aria-selected="true"] { font-weight: 600; }
.searchable-select-option:disabled { opacity: .5; cursor: not-allowed; }
.searchable-select-empty { padding: 9px 10px; color: var(--es-subtle); font-size: 12.5px; }
.searchable-select--compact { flex: 0 0 auto; width: 118px; }
.searchable-select--compact .searchable-select-input { min-height: 38px; padding: 0 28px 0 10px; font-size: 13px; }
.searchable-select--compact .searchable-select-list { min-width: 160px; }
.table-filter .searchable-select--compact { width: 100%; }
.form-field:has(ul li) .searchable-select-input { border-color: #ef9aa5; }
.form-field input[type="file"] {
    padding: 10px;
    border: 1.5px dashed var(--es-border-strong);
    border-radius: 10px;
    background: var(--es-surface-2);
    font-size: 13px;
}
.form-field input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 7px 12px;
    border: 1px solid var(--es-border-strong);
    border-radius: 8px;
    background: #fff;
    font-family: var(--es-font-display);
    font-size: 12.5px;
    cursor: pointer;
}

.form-field ul { margin: 0; padding: 0; list-style: none; }
.form-field ul li,
.form-error { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--es-danger); }
.form-field ul li::before { content: "\F333"; font-family: "bootstrap-icons"; }
.form-field:has(ul li) input,
.form-field:has(ul li) select,
.form-field:has(ul li) textarea { border-color: #ef9aa5; }

.form-check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--es-text); }
.form-check input,
input[type="checkbox"] { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--es-red); cursor: pointer; flex-shrink: 0; }

.form-section {
    margin: 26px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--es-border);
    font-family: var(--es-font-display);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--es-navy);
}
.form-section:first-child { margin-top: 0; }

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--es-border);
}

.input-group { display: flex; align-items: stretch; }
.input-group > input, .input-group > .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group-text {
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid var(--es-border-strong);
    border-left: 0;
    border-radius: 0 10px 10px 0;
    background: var(--es-surface-2);
    color: var(--es-muted);
    font-size: 13px;
    white-space: nowrap;
}

/* ---------- 13. Alertes & flash ---------- */
.alert {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 16px;
    border: 1px solid var(--es-border);
    border-radius: 12px;
    background: var(--es-surface-2);
    font-size: 13.5px;
    margin-bottom: 16px;
}
.alert > i { font-size: 18px; line-height: 1.2; }
.alert-info { background: var(--es-info-bg); border-color: #cddaff; color: #1f468f; }
.alert-success { background: var(--es-success-bg); border-color: #c4e8d3; color: #0c5c35; }
.alert-warning { background: var(--es-warning-bg); border-color: #f5dea6; color: #7a4a00; }
.alert-danger { background: var(--es-danger-bg); border-color: #f6c9cf; color: #8d0b20; }

.flash-stack {
    position: fixed;
    top: calc(var(--es-header-h) + var(--dir-strip-h, 0px) + 12px);
    right: 20px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(400px, calc(100vw - 32px));
    pointer-events: none;
}
.flash-message {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 14px 14px 16px;
    border: 1px solid var(--es-border);
    border-left-width: 4px;
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--es-shadow-lg);
    font-size: 13.5px;
    color: var(--es-ink);
    animation: flash-in .3s var(--es-ease);
}
.flash-message.is-leaving { animation: flash-out .25s ease forwards; }
.flash-message > i { font-size: 18px; line-height: 1.2; }
.flash-message .flash-text { flex: 1; }
.flash-message .flash-close { border: 0; background: transparent; color: var(--es-subtle); cursor: pointer; font-size: 16px; padding: 0 2px; }
.flash-message .flash-close:hover { color: var(--es-ink); }
.flash-success { border-left-color: var(--es-success); }
.flash-success > i { color: var(--es-success); }
.flash-error, .flash-danger { border-left-color: var(--es-danger); }
.flash-error > i, .flash-danger > i { color: var(--es-danger); }
.flash-warning { border-left-color: #e79a00; }
.flash-warning > i { color: #e79a00; }
.flash-info, .flash-notice { border-left-color: var(--es-info); }
.flash-info > i, .flash-notice > i { color: var(--es-info); }

@keyframes flash-in { from { opacity: 0; transform: translate3d(16px, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes flash-out { to { opacity: 0; transform: translate3d(16px, 0, 0); } }

.status-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: 500;
}
.status-banner i { font-size: 18px; }
.status-won { background: var(--es-success-bg); color: var(--es-success); border: 1px solid #c4e8d3; }
.status-lost { background: var(--es-danger-bg); color: var(--es-danger); border: 1px solid #f6c9cf; }

/* ---------- 14. Modale ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(12, 14, 36, 0.5);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s;
}
.modal.open { opacity: 1; visibility: visible; }
.modal-dialog {
    width: min(460px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--es-shadow-lg);
    transform: translateY(10px) scale(.98);
    transition: transform .22s var(--es-ease);
}
.modal-lg .modal-dialog { width: min(720px, 100%); }
.modal.open .modal-dialog { transform: none; }
.modal-body { padding: 24px; display: flex; gap: 16px; }
.modal-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--es-danger-bg);
    color: var(--es-danger);
    font-size: 20px;
}
.modal-title { font-family: var(--es-font-display); font-size: 16px; font-weight: 600; color: var(--es-ink); margin: 0 0 6px; }
.modal-text { color: var(--es-muted); font-size: 13.5px; margin: 0; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--es-border); background: var(--es-surface-2); border-radius: 0 0 16px 16px; }

/* ---------- 15. DataTables ---------- */
.table-card {
    position: relative;
    background: var(--es-surface);
    border: 1px solid var(--es-border);
    border-radius: var(--es-radius-lg);
    box-shadow: var(--es-shadow-xs);
    margin-bottom: 20px;
    overflow: hidden;
}
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border-bottom: 1px solid var(--es-border);
}
.table-toolbar-left, .table-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-toolbar-left { flex: 1 1 280px; }

.table-search {
    position: relative;
    flex: 0 1 340px;
    min-width: 200px;
    margin: 0;
}
.table-search > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--es-subtle); pointer-events: none; }
.table-search input {
    width: 100%;
    height: 38px;
    padding: 0 34px 0 36px;
    border: 1px solid var(--es-border-strong);
    border-radius: 10px;
    background: var(--es-surface-2);
    font: inherit;
    font-size: 13.5px;
    color: var(--es-ink);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.table-search input:focus { outline: none; background: #fff; border-color: var(--es-red); box-shadow: var(--es-focus); }
.table-search .table-search-spinner {
    position: absolute;
    right: 12px;
    top: 50%;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border: 2px solid var(--es-border-strong);
    border-top-color: var(--es-red);
    border-radius: 50%;
    opacity: 0;
    animation: es-spin .7s linear infinite;
}
.table-card.is-loading .table-search-spinner { opacity: 1; }

.table-select {
    height: 38px;
    padding: 0 30px 0 10px;
    border: 1px solid var(--es-border-strong);
    border-radius: 10px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7089' d='M8 11L3 6h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none;
    font: inherit;
    font-size: 13px;
    color: var(--es-ink);
    cursor: pointer;
}
.table-select:focus { outline: none; border-color: var(--es-red); box-shadow: var(--es-focus); }

.table-length { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--es-muted); white-space: nowrap; }

.btn-filter-toggle.is-active { background: var(--es-navy-50); border-color: #cdd2f0; color: var(--es-navy); }
.btn-filter-toggle .count-dot { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--es-red); color: #fff; font-size: 10.5px; line-height: 18px; text-align: center; }

.table-filters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--es-border);
    background: var(--es-surface-2);
}
.table-filters[hidden] { display: none; }
.table-filter { display: flex; flex-direction: column; gap: 4px; }
.table-filter label { font-family: var(--es-font-display); font-size: 11.5px; font-weight: 500; color: var(--es-muted); }
.table-filter .table-select, .table-filter input { width: 100%; height: 36px; }
.table-filter input { padding: 0 10px; border: 1px solid var(--es-border-strong); border-radius: 9px; font: inherit; font-size: 13px; }
.table-filter input:focus { outline: none; border-color: var(--es-red); box-shadow: var(--es-focus); }
.table-filters-actions { display: flex; align-items: flex-end; }

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

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 11px 12px;
    background: var(--es-surface-2);
    border-bottom: 1px solid var(--es-border);
    font-family: var(--es-font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--es-muted);
    text-align: left;
    white-space: nowrap;
    user-select: none;
}
.data-table thead th.is-sortable { cursor: pointer; padding-right: 22px; position: sticky; }
.data-table thead th.is-sortable::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    width: 8px;
    height: 12px;
    margin-top: -6px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='12' viewBox='0 0 8 12'%3E%3Cpath fill='%23b9bfd0' d='M4 0l4 5H0zM4 12L0 7h8z'/%3E%3C/svg%3E") no-repeat center;
}
.data-table thead th.is-sortable:hover { color: var(--es-ink); }
.data-table thead th[aria-sort="ascending"] { color: var(--es-navy); }
.data-table thead th[aria-sort="ascending"]::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='12' viewBox='0 0 8 12'%3E%3Cpath fill='%23ee212e' d='M4 0l4 5H0z'/%3E%3Cpath fill='%23d6dae6' d='M4 12L0 7h8z'/%3E%3C/svg%3E"); }
.data-table thead th[aria-sort="descending"] { color: var(--es-navy); }
.data-table thead th[aria-sort="descending"]::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='12' viewBox='0 0 8 12'%3E%3Cpath fill='%23d6dae6' d='M4 0l4 5H0z'/%3E%3Cpath fill='%23ee212e' d='M4 12L0 7h8z'/%3E%3C/svg%3E"); }

.data-table tbody td {
    padding: 12px 12px;
    border-bottom: 1px solid #eff1f6;
    color: var(--es-text);
    vertical-align: middle;
}
.data-table tbody tr { transition: background .12s ease; }
.data-table tbody tr:hover td { background: #fafbfe; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td a strong, .data-table td strong { color: var(--es-ink); font-weight: 500; }
.data-table td a:hover strong { color: var(--es-red); }
.data-table thead th:first-child, .data-table tbody td:first-child { padding-left: 16px; }
.data-table .cell-email { overflow-wrap: anywhere; min-width: 140px; }
.data-table .cell-actions { width: 1%; white-space: nowrap; text-align: right; }
.data-table .cell-actions .row-actions { justify-content: flex-end; flex-wrap: nowrap; }
.data-table .cell-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table tfoot td { padding: 12px 16px; border-top: 1px solid var(--es-border); background: var(--es-surface-2); font-weight: 600; color: var(--es-ink); }
.data-table tr.dt-hidden { display: none; }

.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main-text { min-width: 0; }
.cell-sub { display: block; font-size: 12px; color: var(--es-subtle); margin-top: 1px; }
.cell-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--es-navy-50);
    color: var(--es-navy);
    font-family: var(--es-font-display);
    font-size: 13px;
    font-weight: 600;
}

.empty-state { padding: 44px 16px; text-align: center; color: var(--es-muted); }
.empty-state i { display: block; margin: 0 auto 10px; width: 56px; height: 56px; line-height: 56px; border-radius: 16px; background: var(--es-surface-2); color: var(--es-subtle); font-size: 24px; }
.empty-state strong { display: block; color: var(--es-ink); font-family: var(--es-font-display); font-weight: 500; margin-bottom: 2px; }

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-top: 1px solid var(--es-border);
    font-size: 13px;
    color: var(--es-muted);
}
.table-footer:empty { display: none; }

.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pagination a, .pagination span.page, .pagination button {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--es-text);
    font-family: var(--es-font-display);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
}
.pagination a:hover, .pagination button:hover:not([disabled]) { background: var(--es-surface-2); border-color: var(--es-border); color: var(--es-ink); }
.pagination .active, .pagination a.active, .pagination button.active { background: var(--es-navy); border-color: var(--es-navy); color: #fff; }
.pagination .disabled, .pagination button[disabled] { opacity: .4; pointer-events: none; }
.pagination .gap { min-width: 20px; justify-content: center; color: var(--es-subtle); display: inline-flex; }

/* Chargement */
.table-card .table-loader {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    overflow: hidden;
    opacity: 0;
    transition: opacity .15s ease;
}
.table-card .table-loader::before {
    content: "";
    position: absolute;
    left: -40%;
    width: 40%;
    height: 100%;
    background: var(--es-red);
    animation: es-loader 1s ease-in-out infinite;
}
.table-card.is-loading .table-loader { opacity: 1; }
.table-card.is-loading tbody { opacity: .55; transition: opacity .2s ease; }

@keyframes es-loader { to { left: 100%; } }
@keyframes es-spin { to { transform: rotate(360deg); } }

.skeleton { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #eef0f5 25%, #f6f7fb 50%, #eef0f5 75%); background-size: 200% 100%; animation: es-shimmer 1.2s infinite; }
@keyframes es-shimmer { to { background-position: -200% 0; } }

/* ---------- 16. KPI & dashboards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 20px;
    border: 1px solid var(--es-border);
    border-radius: var(--es-radius-lg);
    background: var(--es-surface);
    box-shadow: var(--es-shadow-xs);
    overflow: hidden;
    min-width: 0;
}
.kpi-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi-label { font-family: var(--es-font-display); font-size: 12.5px; font-weight: 500; color: var(--es-muted); line-height: 1.35; }
.kpi-code { font-family: var(--es-font); font-size: 10.5px; font-weight: 700; letter-spacing: .05em; color: var(--es-subtle); padding: 1px 6px; border: 1px solid var(--es-border); border-radius: 5px; margin-left: 4px; vertical-align: 1px; }
.kpi-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: var(--es-navy-50);
    color: var(--es-navy);
    font-size: 17px;
}
.kpi-icon.red { background: var(--es-red-50); color: var(--es-red); }
.kpi-icon.green { background: var(--es-success-bg); color: var(--es-success); }
.kpi-icon.amber { background: var(--es-warning-bg); color: var(--es-warning); }
.kpi-value { font-family: var(--es-font-display); font-size: 26px; font-weight: 600; color: var(--es-ink); line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-value small { font-family: var(--es-font); font-size: 13px; font-weight: 500; color: var(--es-muted); letter-spacing: 0; margin-left: 2px; }
.kpi-sub { font-size: 12px; color: var(--es-subtle); }
.kpi-formula { font-size: 11.5px; color: var(--es-subtle); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.kpi-meter { height: 6px; border-radius: 999px; background: var(--es-chart-track); overflow: hidden; margin-top: 6px; }
.kpi-meter > span { display: block; height: 100%; border-radius: 999px; background: var(--es-chart-1); }
.kpi-meter.red > span { background: var(--es-red); }
.kpi-won { border-top: 3px solid var(--es-success); }
.kpi-lost { border-top: 3px solid var(--es-danger); }

.kpi-hero {
    position: relative;
    padding: 24px 26px;
    border-radius: var(--es-radius-xl);
    background: radial-gradient(120% 140% at 100% 0%, rgba(238, 33, 46, .32) 0%, rgba(238, 33, 46, 0) 46%), linear-gradient(135deg, var(--es-navy-800) 0%, var(--es-navy-950) 100%);
    color: #fff;
    overflow: hidden;
    margin-bottom: 20px;
}
.kpi-hero::after {
    content: "";
    position: absolute;
    right: -40px;
    bottom: -60px;
    width: 260px;
    height: 260px;
    background: url("../images/brand/logo-energy-mark.png") no-repeat center / contain;
    opacity: .07;
}
.kpi-hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.kpi-hero-item { min-width: 0; }
.kpi-hero-label { font-family: var(--es-font-display); font-size: 12px; font-weight: 500; color: rgba(255, 255, 255, .7); }
.kpi-hero-value { font-family: var(--es-font-display); font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-hero-value small { font-size: 14px; font-weight: 500; color: rgba(255, 255, 255, .65); margin-left: 3px; }
.kpi-hero-sub { font-size: 12px; color: rgba(255, 255, 255, .6); margin-top: 2px; }

.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 16px;
    margin-bottom: 20px;
    border: 1px solid var(--es-border);
    border-radius: var(--es-radius-lg);
    background: var(--es-surface);
    box-shadow: var(--es-shadow-xs);
}
.filter-bar .form-field { flex: 0 1 190px; }
.filter-bar .form-field input, .filter-bar .form-field select { min-height: 38px; padding-top: 7px; padding-bottom: 7px; }
.filter-presets { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--es-border-strong);
    border-radius: 999px;
    background: #fff;
    color: var(--es-text);
    font-family: var(--es-font-display);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
}
.chip:hover { border-color: var(--es-navy); color: var(--es-navy); }
.chip.active { background: var(--es-navy); border-color: var(--es-navy); color: #fff; }

/* Tableau KPI (reproduction de l'onglet Dashboard Excel) */
.kpi-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.kpi-table th, .kpi-table td { padding: 11px 14px; border-bottom: 1px solid #eff1f6; text-align: left; vertical-align: middle; }
.kpi-table th { font-family: var(--es-font-display); font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--es-muted); background: var(--es-surface-2); }
.kpi-table td.kpi-table-value { text-align: right; font-family: var(--es-font-display); font-weight: 600; color: var(--es-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.kpi-table .kpi-table-code { width: 64px; }
.kpi-table .kpi-table-formula { white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--es-muted); }
.kpi-table tr.is-group td { background: #fbfbfd; font-family: var(--es-font-display); font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--es-navy); }
.kpi-table tr.is-highlight td { background: var(--es-red-50); }

/* Graphiques HTML/CSS (barres) */
.chart { position: relative; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; font-size: 12px; color: var(--es-muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.vbar-chart {
    --chart-h: 220px;
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 14px;
    height: calc(var(--chart-h) + 28px);
    padding: 0 4px 28px;
    background-image: linear-gradient(to top, #edf0f6 1px, transparent 1px);
    background-size: 100% calc(var(--chart-h) / 4);
    background-position: 0 calc(100% - 28px);
    background-repeat: repeat-y;
    border-bottom: 1px solid var(--es-border-strong);
}
.vbar {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    height: var(--chart-h);
    min-width: 0;
}
.vbar-fill {
    position: relative;
    width: min(56px, 72%);
    min-height: 2px;
    border-radius: 4px 4px 0 0;
    background: var(--es-chart-1);
    transition: height .6s var(--es-ease), filter .15s ease;
}
.vbar-fill.alt { background: var(--es-chart-2); }
.vbar-fill.muted { background: #b8c0e6; }
.vbar:hover .vbar-fill { filter: brightness(1.12); }
.vbar-value { margin-bottom: 6px; font-family: var(--es-font-display); font-size: 12px; font-weight: 600; color: var(--es-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.vbar-label { position: absolute; bottom: -24px; left: 0; right: 0; text-align: center; font-size: 11.5px; color: var(--es-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vbar-sep { width: 1px; align-self: stretch; margin-bottom: -28px; background: var(--es-border); flex: 0 0 1px; }

.hbar-chart { display: flex; flex-direction: column; gap: 16px; }
.hbar-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "label value" "track track";
    align-items: end;
    gap: 6px 12px;
}
.hbar-label { grid-area: label; font-size: 13px; color: var(--es-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { grid-area: track; position: relative; height: 22px; border-radius: 6px; background: var(--es-chart-track); }
.hbar-fill { position: absolute; left: 0; top: 0; bottom: 0; min-width: 2px; border-radius: 6px; background: var(--es-chart-1); transition: width .6s var(--es-ease); }
.hbar-fill.alt { background: var(--es-chart-2); }
.hbar-target { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; background: var(--es-ink); border-radius: 2px; box-shadow: 0 0 0 2px #fff; }
.hbar-value { grid-area: value; text-align: right; font-family: var(--es-font-display); font-size: 13px; font-weight: 600; color: var(--es-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-value small { font-family: var(--es-font); font-size: 11px; font-weight: 400; color: var(--es-subtle); margin-left: 6px; }

/* Petite liste de stats */
.stat-list { list-style: none; margin: 0; padding: 0; }
.stat-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eff1f6; font-size: 13.5px; }
.stat-list li:last-child { border-bottom: 0; }
.stat-list li strong { font-family: var(--es-font-display); font-weight: 600; color: var(--es-ink); font-variant-numeric: tabular-nums; }
.stat-list-inline { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.stat-list-inline li { padding: 12px 14px; border: 1px solid var(--es-border); border-radius: 12px; background: var(--es-surface-2); }
.stat-list-inline li:last-child { border-bottom: 1px solid var(--es-border); }
.stat-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--es-chart-track); overflow: hidden; margin: 0 4px; max-width: 160px; }
.stat-bar > span { display: block; height: 100%; background: var(--es-chart-1); border-radius: 999px; }

/* Funnel */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) 190px; align-items: center; gap: 14px; }
.funnel-label { font-size: 13px; color: var(--es-text); }
.funnel-label .badge { margin-left: 6px; }
.funnel-bar-wrap { height: 28px; border-radius: 7px; background: var(--es-chart-track); overflow: hidden; }
.funnel-bar { height: 100%; min-width: 2px; border-radius: 7px; background: var(--es-chart-1); transition: width .6s var(--es-ease); }
.funnel-count { text-align: right; font-size: 13px; color: var(--es-muted); font-variant-numeric: tabular-nums; }
.funnel-count strong { color: var(--es-ink); font-family: var(--es-font-display); font-weight: 600; margin-right: 4px; }

/* Taux */
.taux-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.taux-item { padding: 16px; border: 1px solid var(--es-border); border-radius: 12px; background: var(--es-surface-2); }
.taux-item-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; font-size: 13px; color: var(--es-muted); }
.taux-item-header strong { font-family: var(--es-font-display); font-size: 22px; font-weight: 600; color: var(--es-ink); }
.taux-bar-wrap { height: 8px; border-radius: 999px; background: var(--es-chart-track); overflow: hidden; }
.taux-bar { height: 100%; border-radius: 999px; background: var(--es-chart-1); }
.taux-item-sub { margin-top: 10px; font-size: 12px; color: var(--es-subtle); }

/* Mini bar chart (visites / mois) */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 200px; padding-bottom: 26px; border-bottom: 1px solid var(--es-border-strong); background-image: linear-gradient(to top, #edf0f6 1px, transparent 1px); background-size: 100% 25%; }
.bar-chart-col { position: relative; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.bar-chart-bar { width: min(28px, 80%); min-height: 2px; border-radius: 4px 4px 0 0; background: var(--es-chart-1); transition: filter .15s ease; }
.bar-chart-col:hover .bar-chart-bar { filter: brightness(1.15); }
.bar-chart-value { font-size: 11px; font-weight: 600; color: var(--es-ink); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.bar-chart-label { position: absolute; bottom: -22px; font-size: 10.5px; color: var(--es-subtle); white-space: nowrap; }

/* Tooltip léger (data-tip) */
[data-tip] { position: relative; }
[data-tip]:hover::before {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    padding: 6px 9px;
    border-radius: 7px;
    background: var(--es-ink);
    color: #fff;
    font-family: var(--es-font);
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: var(--es-shadow-md);
}

/* ---------- 17. Détails ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.detail-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-item { padding: 12px 16px 12px 0; border-bottom: 1px dashed var(--es-border); min-width: 0; }
.detail-item.full { grid-column: 1 / -1; }
.detail-label { font-family: var(--es-font-display); font-size: 11.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--es-subtle); margin-bottom: 4px; }
.detail-value { font-size: 14px; color: var(--es-ink); overflow-wrap: anywhere; white-space: pre-line; }
.detail-value a { font-weight: 500; }

.profile-cover {
    position: relative;
    height: 120px;
    margin: -22px -24px 0;
    border-radius: var(--es-radius-lg) var(--es-radius-lg) 0 0;
    background: radial-gradient(90% 160% at 100% 0%, rgba(238, 33, 46, .45) 0%, rgba(238, 33, 46, 0) 50%), linear-gradient(120deg, var(--es-navy-700), var(--es-navy-950));
    overflow: hidden;
}
.profile-cover::after { content: ""; position: absolute; right: 20px; top: 14px; width: 92px; height: 92px; background: url("../images/brand/logo-energy-mark.png") no-repeat center / contain; opacity: .18; }
.profile-identity { display: flex; align-items: flex-start; gap: 18px; margin-top: -44px; position: relative; flex-wrap: wrap; }
.profile-identity-text { padding-top: 52px; min-width: 0; }
.profile-name { font-family: var(--es-font-display); font-size: 20px; font-weight: 600; color: var(--es-ink); }
.profile-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; color: var(--es-muted); font-size: 13px; }
.profile-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--es-border); margin: 22px -24px 0; padding: 0 24px; overflow-x: auto; }
.profile-tab { display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 2px solid transparent; font-family: var(--es-font-display); font-size: 13.5px; font-weight: 500; color: var(--es-muted); white-space: nowrap; }
.profile-tab:hover { color: var(--es-ink); }
.profile-tab.active { color: var(--es-ink); border-bottom-color: var(--es-red); }
.password-meter { height: 6px; border-radius: 999px; background: var(--es-chart-track); overflow: hidden; }
.password-meter > span { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--es-danger); transition: width .25s ease, background .25s ease; }

/* ---------- 18. Workflow (pipeline, étapes, checklist, devis, timeline) ---------- */
.kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x proximity; }
.kanban-column {
    flex: 0 0 272px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 250px);
    min-height: 220px;
    border: 1px solid var(--es-border);
    border-radius: var(--es-radius-lg);
    background: #f1f3f8;
    scroll-snap-align: start;
}
.kanban-column-header { padding: 14px 14px 10px; border-bottom: 1px solid var(--es-border); }
.kanban-column-title { display: flex; align-items: center; gap: 8px; font-family: var(--es-font-display); font-size: 13.5px; font-weight: 600; color: var(--es-ink); margin-bottom: 6px; }
.kanban-column-title .stage-num { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; background: var(--es-navy); color: #fff; font-size: 11px; }
.kanban-column-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--es-muted); }
.kanban-column-total { font-family: var(--es-font-display); font-weight: 600; color: var(--es-ink); font-size: 12px; }
.kanban-column-body { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 10px; overflow-y: auto; }
.kanban-card {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--es-border);
    border-radius: 12px;
    background: #fff;
    color: inherit;
    box-shadow: var(--es-shadow-xs);
    transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.kanban-card:hover { color: inherit; border-color: #d3d8ea; box-shadow: var(--es-shadow-md); transform: translateY(-1px); }
.kanban-card-title { font-family: var(--es-font-display); font-size: 13.5px; font-weight: 500; color: var(--es-ink); margin-bottom: 6px; line-height: 1.35; }
.kanban-card-client { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--es-muted); margin-bottom: 10px; }
.kanban-card-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--es-border); font-size: 12px; }
.kanban-card-amount { font-family: var(--es-font-display); font-weight: 600; color: var(--es-ink); font-variant-numeric: tabular-nums; }
.kanban-card-gagnee { border-left: 3px solid var(--es-success); }
.kanban-card-perdue { border-left: 3px solid var(--es-danger); opacity: .75; }
.kanban-empty { padding: 22px 8px; text-align: center; color: var(--es-subtle); font-size: 12.5px; border: 1.5px dashed var(--es-border-strong); border-radius: 12px; }

.stage-progress { display: flex; align-items: flex-start; gap: 0; margin: 0 0 20px; padding: 18px 12px; border: 1px solid var(--es-border); border-radius: var(--es-radius-lg); background: #fff; overflow-x: auto; box-shadow: var(--es-shadow-xs); }
.stage-step { position: relative; flex: 1; min-width: 110px; text-align: center; }
.stage-step:not(:last-child)::after { content: ""; position: absolute; top: 15px; left: calc(50% + 20px); right: calc(-50% + 20px); height: 2px; border-radius: 2px; background: var(--es-border); }
.stage-step.done:not(:last-child)::after { background: var(--es-success); }
.stage-step-dot { position: relative; z-index: 1; width: 32px; height: 32px; margin: 0 auto 8px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--es-border-strong); border-radius: 50%; background: #fff; color: var(--es-subtle); font-family: var(--es-font-display); font-size: 12.5px; font-weight: 600; }
.stage-step.current .stage-step-dot { border-color: var(--es-red); background: var(--es-red); color: #fff; box-shadow: 0 0 0 5px var(--es-red-50); }
.stage-step.done .stage-step-dot { border-color: var(--es-success); background: var(--es-success); color: #fff; }
.stage-step.perdue.current .stage-step-dot { border-color: var(--es-danger); background: var(--es-danger); }
.stage-step-label { font-family: var(--es-font-display); font-size: 12px; font-weight: 500; color: var(--es-muted); padding: 0 6px; }
.stage-step.current .stage-step-label { color: var(--es-ink); font-weight: 600; }
.stage-step-proba { display: block; font-family: var(--es-font); font-size: 11px; color: var(--es-subtle); font-weight: 400; }

.checklist { display: flex; flex-direction: column; gap: 10px; }
.checklist-item { padding: 14px 16px; border: 1px solid var(--es-border); border-radius: 12px; background: #fff; transition: border-color .15s ease, background .15s ease; }
.checklist-item:has(input:checked) { border-color: #c4e8d3; background: #fbfefc; }
.checklist-item-blocking { border-left: 3px solid var(--es-danger); }
.checklist-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 500; color: var(--es-ink); cursor: pointer; }
.checklist-exigence { margin: 6px 0 10px 28px; font-size: 12.5px; color: var(--es-muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.checklist-item textarea { width: calc(100% - 28px); margin-left: 28px; min-height: 60px; padding: 8px 10px; border: 1px solid var(--es-border-strong); border-radius: 9px; font: inherit; font-size: 13px; resize: vertical; }
.checklist-item textarea:focus { outline: none; border-color: var(--es-red); box-shadow: var(--es-focus); }

.closure-actions { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.closure-actions form { margin: 0; }
.closure-lost summary { list-style: none; }
.closure-lost summary::-webkit-details-marker { display: none; }
.closure-lost-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; padding: 16px; border: 1px solid var(--es-border); border-radius: 12px; background: var(--es-surface-2); min-width: min(520px, 80vw); }
.closure-lost-form .full, .closure-lost-form button { grid-column: 1 / -1; justify-self: start; }

.devis-item { padding: 14px 16px; border: 1px solid var(--es-border); border-radius: 12px; margin-bottom: 10px; background: #fff; }
.devis-item-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 4px; }
.devis-item-header strong { font-family: var(--es-font-display); font-weight: 600; color: var(--es-ink); }
.devis-item-amount { font-family: var(--es-font-display); font-weight: 600; color: var(--es-navy); font-variant-numeric: tabular-nums; }
.devis-item-meta { font-size: 12.5px; color: var(--es-muted); display: flex; gap: 6px 14px; flex-wrap: wrap; }
.devis-item-comment { margin-top: 8px; font-size: 13px; color: var(--es-text); white-space: pre-line; }
.devis-item-files { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.devis-item-files a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--es-border); border-radius: 8px; background: var(--es-surface-2); font-size: 12.5px; color: var(--es-text); }
.devis-item-files a:hover { border-color: var(--es-navy); color: var(--es-navy); }
.new-devis-toggle summary, .collapsible summary { list-style: none; cursor: pointer; }
.new-devis-toggle summary::-webkit-details-marker, .collapsible summary::-webkit-details-marker { display: none; }
.new-devis-form { margin-top: 14px; padding: 18px; border: 1px solid var(--es-border); border-radius: 12px; background: var(--es-surface-2); }

/* Demande de devis (étape « Chiffrage / Devis ») */
.devis-item-mail { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; }
.devis-item-mail form { margin: 0; }
.devis-item-mail-to { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--es-muted); }
.devis-item-files a.devis-file-excel { border-color: #c4e8d3; background: var(--es-success-bg); color: var(--es-success); }
.devis-item-files a.devis-file-excel:hover { border-color: var(--es-success); color: var(--es-success); }
.devis-item-details { margin-top: 10px; border-top: 1px dashed var(--es-border); padding-top: 10px; }
.devis-item-details > summary { display: inline-flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; font-family: var(--es-font-display); font-size: 12.5px; font-weight: 500; color: var(--es-navy); }
.devis-item-details > summary::-webkit-details-marker { display: none; }
.devis-params { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.devis-params-section { padding: 12px 14px; border: 1px solid var(--es-border); border-radius: 10px; background: var(--es-surface-2); }
.devis-params-title { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; font-family: var(--es-font-display); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--es-navy); }
.devis-params-title i { color: var(--es-red); }
.devis-params dl { margin: 0; }
.devis-params dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid #eceef5; font-size: 12.5px; }
.devis-params dl > div:last-child { border-bottom: 0; }
.devis-params dt { color: var(--es-muted); }
.devis-params dd { margin: 0; font-weight: 500; color: var(--es-ink); text-align: right; overflow-wrap: anywhere; }
.devis-params dd span { font-weight: 400; color: var(--es-muted); }

.dd-step { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 0 0 14px; font-family: var(--es-font-display); font-size: 14px; font-weight: 600; color: var(--es-ink); }
.dd-step:not(:first-of-type) { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--es-border); }
.dd-step-num { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; background: var(--es-navy); color: #fff; font-size: 12px; }
.dd-step-hint { flex-basis: 100%; padding-left: 34px; font-family: var(--es-font); font-size: 12px; font-weight: 400; color: var(--es-subtle); }
.dd-section { margin-bottom: 10px; border: 1px solid var(--es-border); border-radius: 12px; background: #fff; }
.dd-section > summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; list-style: none; cursor: pointer; border-radius: 12px; }
.dd-section > summary::-webkit-details-marker { display: none; }
.dd-section > summary:hover { background: var(--es-surface-2); }
.dd-section > summary:focus-visible { outline: none; box-shadow: var(--es-focus); }
.dd-section-title { flex: 1; display: flex; align-items: center; gap: 8px; font-family: var(--es-font-display); font-size: 13.5px; font-weight: 600; color: var(--es-ink); }
.dd-section-title i { color: var(--es-red); }
.dd-chevron { color: var(--es-subtle); transition: transform .2s var(--es-ease); }
details[open] > summary .dd-chevron { transform: rotate(180deg); }
.dd-section[open] > summary { border-bottom: 1px solid var(--es-border); border-radius: 12px 12px 0 0; }
.dd-grid { padding: 16px 14px 18px; gap: 14px 18px; }
.dd-grid .form-hint { line-height: 1.4; }
.dd-grid .input-group-text { white-space: nowrap; font-size: 12px; }
.dd-envoi { margin: 18px 0 0; }
.dd-envoi code { font-size: 12px; }
.dd-form .form-actions { margin-top: 18px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { position: relative; padding: 0 0 18px 22px; }
.timeline-item::before { content: ""; position: absolute; left: 4px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--es-red); }
.timeline-item::after { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 2px; background: var(--es-border); }
.timeline-item:last-child::after { display: none; }
.timeline-date { font-size: 11.5px; color: var(--es-subtle); }
.timeline-transition { display: inline-flex; margin: 4px 0; padding: 2px 8px; border-radius: 6px; background: var(--es-navy-50); color: var(--es-navy); font-size: 12px; font-weight: 500; }
.timeline-comment { font-size: 13px; color: var(--es-text); white-space: pre-line; }
.historique-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.historique-form textarea { width: 100%; min-height: 70px; padding: 9px 11px; border: 1px solid var(--es-border-strong); border-radius: 10px; font: inherit; font-size: 13px; resize: vertical; }
.historique-form textarea:focus { outline: none; border-color: var(--es-red); box-shadow: var(--es-focus); }
.historique-form button { align-self: flex-end; }

.client-contacts { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.client-contact-list { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.client-contact-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 42px; gap: 12px; align-items: end; padding: 14px; border: 1px solid var(--es-border); border-radius: var(--es-radius); background: var(--es-surface-2); }
.client-contact-row .form-field { min-width: 0; gap: 5px; }
.client-contact-row .btn-icon { width: 40px; height: 40px; }

.client-history-card { margin-top: 20px; }
.client-history { list-style: none; margin: 0; padding: 18px 22px 4px; }
.client-history-item { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 0 12px; padding-bottom: 20px; }
.client-history-item::after { content: ""; position: absolute; top: 31px; bottom: 0; left: 15px; width: 2px; background: var(--es-border); }
.client-history-item:last-child { padding-bottom: 0; }
.client-history-item:last-child::after { display: none; }
.client-history-icon { position: relative; z-index: 1; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--es-border); border-radius: 10px; background: var(--es-surface); color: var(--es-navy); font-size: 14px; box-shadow: var(--es-shadow-xs); }
.client-history-item--visite .client-history-icon { border-color: #c9dce8; background: #f0f7fb; color: #356a86; }
.client-history-item--affaire .client-history-icon { border-color: #ead9ad; background: var(--es-gold-50); color: var(--es-gold-600); }
.client-history-item--activite .client-history-icon { border-color: #efd0cf; background: #fff5f4; color: var(--es-red); }
.client-history-item--devis .client-history-icon { border-color: #cfe2d7; background: #f1f8f3; color: #39744e; }
.client-history-content { min-width: 0; padding-top: 1px; }
.client-history-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 18px; }
.client-history-heading { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 10px; }
.client-history-title { color: var(--es-ink); font-size: 13px; font-weight: 600; text-decoration: none; }
.client-history-title:hover { color: var(--es-red); }
.client-history-title i { margin-left: 2px; color: var(--es-subtle); font-size: 10px; }
.client-history-actor { color: var(--es-subtle); font-size: 11.5px; white-space: nowrap; }
.client-history-date { flex: 0 0 auto; padding-top: 2px; color: var(--es-subtle); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.client-history-details { margin-top: 4px; color: var(--es-text); font-size: 12.5px; line-height: 1.5; }
.client-history-details p { margin: 2px 0 0; white-space: pre-line; }
.client-history-details p:first-child { margin-top: 0; }
.client-history-empty { margin: 0 18px 18px; }

/* Fiche qualification BE */
.fq-section { margin-bottom: 20px; }
.fq-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.fq-table th:nth-child(1) { width: 32%; }
.fq-table th:nth-child(2) { width: 28%; }
.fq-table th:nth-child(3) { width: 13%; }
.fq-table th { padding: 9px 12px; background: var(--es-surface-2); border-bottom: 1px solid var(--es-border); font-family: var(--es-font-display); font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--es-muted); text-align: left; }
.fq-table td { padding: 10px 12px; border-bottom: 1px solid #eff1f6; vertical-align: middle; font-size: 13.5px; }
.fq-table tr:last-child td { border-bottom: 0; }
.fq-param { width: 34%; font-weight: 500; color: var(--es-ink); }
.fq-unit { width: 110px; color: var(--es-muted); font-size: 12.5px; white-space: nowrap; }
.fq-hint { color: var(--es-subtle); font-size: 12px; }
.fq-table .form-control { min-height: 38px; padding: 7px 10px; font-size: 13.5px; }
.fq-progress { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--es-muted); }
.fq-progress .kpi-meter { width: 140px; margin: 0; }

/* ---------- 19. Login ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); background: #fff; }
.auth-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px 56px;
    color: #fff;
    background: radial-gradient(80% 90% at 100% 0%, rgba(238, 33, 46, .35) 0%, rgba(238, 33, 46, 0) 55%), linear-gradient(150deg, var(--es-navy-800) 0%, var(--es-navy-950) 100%);
    overflow: hidden;
}
.auth-hero::after { content: ""; position: absolute; right: -140px; bottom: -120px; width: 560px; height: 560px; background: url("../images/brand/logo-energy-mark.png") no-repeat center / contain; opacity: .08; }
.auth-hero-logo { position: relative; z-index: 1; height: 64px; width: auto; align-self: flex-start; }
.auth-hero-content { position: relative; z-index: 1; max-width: 560px; }
.auth-hero-eyebrow { font-family: var(--es-font-display); font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: #ff8a92; margin-bottom: 14px; }
.auth-hero-title { font-family: var(--es-font-display); font-size: 40px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; color: #fff; margin: 0 0 18px; }
.auth-hero-title span { color: var(--es-red); }
.auth-hero-text { font-size: 15.5px; font-weight: 300; line-height: 1.7; color: rgba(255, 255, 255, .78); margin: 0; }
.auth-hero-features { position: relative; z-index: 1; display: flex; gap: 22px; flex-wrap: wrap; font-family: var(--es-font-display); font-size: 12.5px; font-weight: 500; color: rgba(255, 255, 255, .75); }
.auth-hero-features span { display: inline-flex; align-items: center; gap: 8px; }
.auth-hero-features i { color: var(--es-red); }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.auth-form-wrap { width: 100%; max-width: 400px; }
.auth-form-logo { display: none; height: 46px; margin-bottom: 26px; }
.auth-title { font-family: var(--es-font-display); font-size: 26px; font-weight: 600; color: var(--es-ink); margin: 0 0 6px; }
.auth-subtitle { color: var(--es-muted); margin: 0 0 28px; font-size: 14.5px; }
.auth-form-wrap .form-field { margin-bottom: 16px; }
.auth-form-wrap .form-field label { font-family: "Roboto Condensed", var(--es-font); font-size: 13.5px; font-weight: 700; }
.auth-form-wrap .form-field input { min-height: 46px; }
.auth-password { position: relative; }
.auth-password button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.auth-copyright { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--es-border); font-size: 12px; color: var(--es-subtle); text-align: center; }

/* ---------- 20. Responsive ---------- */
@media (max-width: 1280px) {
    .kpi-hero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-columns { grid-template-columns: minmax(0, 1fr) 320px; }
    .header-user-text { display: none; }
}

@media (max-width: 1100px) {
    .kpi-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-split, .grid-split-even { grid-template-columns: minmax(0, 1fr); }
    .detail-columns { grid-template-columns: minmax(0, 1fr); }
    .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .funnel-row { grid-template-columns: 150px minmax(0, 1fr) 150px; }
}

/* Tablette & mobile : sidebar en drawer */
@media (max-width: 992px) {
    .app-content, html.sidebar-collapsed .app-content { margin-left: 0; }
    .app-sidebar, html.sidebar-collapsed .app-sidebar { width: 288px; transform: translateX(-100%); box-shadow: var(--es-shadow-lg); }
    html.sidebar-open .app-sidebar { transform: none; }
    html.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
    html.sidebar-open { overflow: hidden; }
    .sidebar-toggle .bi-chevron-left::before { content: "\F659"; } /* x-lg */
    html.sidebar-collapsed .sidebar-toggle { position: static; transform: none; background: rgba(255, 255, 255, .06); color: #c9cdea; box-shadow: none; border: 0; }
    /* En mode drawer, la sidebar réduite reprend sa forme complète */
    html.sidebar-collapsed .sidebar-header { padding: 0 14px 0 20px; flex-direction: row; justify-content: space-between; }
    html.sidebar-collapsed .sidebar-brand-logo { display: block; }
    html.sidebar-collapsed .sidebar-brand-mark { display: none; }
    html.sidebar-collapsed .sidebar-tagline, html.sidebar-collapsed .nav-section-title, html.sidebar-collapsed .nav-label, html.sidebar-collapsed .nav-caret, html.sidebar-collapsed .nav-pill, html.sidebar-collapsed .sidebar-user-text { display: initial; }
    html.sidebar-collapsed .nav-section-title, html.sidebar-collapsed .sidebar-tagline, html.sidebar-collapsed .sidebar-user-text { display: block; }
    html.sidebar-collapsed .nav-link, html.sidebar-collapsed .nav-group-toggle { justify-content: flex-start; padding: 8px 10px; }
    html.sidebar-collapsed .nav-submenu .nav-link { padding-left: 44px; }
    html.sidebar-collapsed .nav-section { border-top: 0; margin-top: 14px; padding-top: 0; }
    html.sidebar-collapsed .sidebar-nav { overflow-y: auto; overflow-x: hidden; }
    html.sidebar-collapsed .nav-group > .nav-submenu { position: static; display: grid; padding: 0; background: transparent; box-shadow: none; opacity: 1; visibility: visible; transform: none; min-width: 0; }
    html.sidebar-collapsed .nav-group > .nav-submenu .nav-flyout-title { display: none; }
    html.sidebar-collapsed .nav-badge { position: static; }
    html.sidebar-collapsed .sidebar-user { justify-content: flex-start; }

    .app-header { padding: 0 16px; gap: 10px; }
    .header-burger { display: inline-flex; }
    .header-title { display: none; }
    .header-brand { display: inline-flex; }
    .header-search { max-width: none; }
    .header-search kbd { display: none; }
    .app-main { padding: 22px 20px 32px; }
    .app-footer { padding: 14px 20px; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
    .auth-form-logo { display: block; }
}

@media (max-width: 768px) {
    body { font-size: 14px; }
    .header-search-scope { display: none; }
    .header-search { height: 38px; }
    .page-title { font-size: 20px; }
    .page-header { margin-bottom: 18px; }
    .page-actions { width: 100%; }
    .page-actions > .btn, .page-actions > form, .page-actions > .dropdown { flex: 1 1 auto; }
    .page-actions > form .btn, .page-actions > .dropdown > .btn { width: 100%; }
    .card { padding: 18px 16px; border-radius: 12px; }
    .card-header { margin: -18px -16px 16px; padding: 14px 16px; }
    .form-grid, .form-grid-3, .grid-2, .grid-3, .taux-grid, .closure-lost-form { grid-template-columns: minmax(0, 1fr); }
    .detail-grid { grid-template-columns: minmax(0, 1fr); }
    .kpi-grid, .kpi-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .kpi-card { padding: 14px; }
    .kpi-value { font-size: 21px; }
    .kpi-hero { padding: 20px; }
    .kpi-hero-value { font-size: 24px; }
    .funnel-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .funnel-count { text-align: left; }
    .vbar-chart { gap: 8px; }
    .profile-tabs { margin: 18px -16px 0; padding: 0 16px; }
    .profile-cover { margin: -18px -16px 0; }
    .flash-stack { right: 16px; left: 16px; width: auto; }
    .table-toolbar { padding: 12px; }
    .table-search { flex: 1 1 100%; }
    .filter-bar .form-field { flex: 1 1 140px; }
    .notif-menu { width: calc(100vw - 24px); right: -60px; }

    .kpi-table .kpi-table-formula { white-space: normal; }

    /* Fiche BE : une carte par paramètre */
    .fq-table thead { display: none; }
    .fq-table, .fq-table tbody, .fq-table tr, .fq-table td { display: block; width: 100%; }
    .fq-table tr { padding: 12px 14px; border-bottom: 1px solid var(--es-border); }
    .fq-table td { padding: 2px 0; border: 0; }
    .fq-table td.fq-param { width: 100%; margin-bottom: 6px; }
    .fq-table td.fq-unit, .fq-table td.fq-hint { display: inline; font-size: 12px; }
    .fq-table td.fq-unit:not(:empty)::after { content: " · "; }
    .devis-params { grid-template-columns: minmax(0, 1fr); }
    .dd-step-hint { padding-left: 0; }
    .dd-grid { padding: 14px 12px 16px; }
    .new-devis-form.dd-form { padding: 14px 12px; }
    .dd-form .form-actions { flex-direction: column-reverse; align-items: stretch; }
    .dd-form .form-actions .btn { width: 100%; justify-content: center; }

    /* DataTables → cartes */
    .data-table.dt-responsive thead { display: none; }
    .data-table.dt-responsive, .data-table.dt-responsive tbody, .data-table.dt-responsive tr, .data-table.dt-responsive td { display: block; width: 100%; }
    .data-table.dt-responsive tbody tr { padding: 12px 14px; border-bottom: 1px solid var(--es-border); }
    .data-table.dt-responsive tbody tr.dt-hidden { display: none; }
    .data-table.dt-responsive tbody tr:hover td { background: transparent; }
    .data-table.dt-responsive tbody td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; border: 0; text-align: right; }
    .data-table.dt-responsive tbody td::before { content: attr(data-label); flex-shrink: 0; font-family: var(--es-font-display); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--es-subtle); text-align: left; }
    .data-table.dt-responsive tbody td:first-child { padding-top: 0; }
    .data-table.dt-responsive tbody td:first-child::before { display: none; }
    .data-table.dt-responsive tbody td:first-child { justify-content: flex-start; text-align: left; font-size: 14.5px; }
    .data-table.dt-responsive tbody td.cell-actions { width: 100%; justify-content: flex-end; padding-top: 8px; margin-top: 4px; border-top: 1px dashed var(--es-border); }
    .data-table.dt-responsive tbody td.cell-actions::before { display: none; }
    .data-table.dt-responsive tbody td[colspan] { display: block; text-align: center; }
    .data-table.dt-responsive tbody td[colspan]::before { display: none; }
    .data-table.dt-responsive tfoot { display: block; }
    .table-footer { justify-content: center; }
}

@media (max-width: 480px) {
    .kpi-grid, .kpi-grid-4 { grid-template-columns: minmax(0, 1fr); }
    .kpi-hero-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .app-main { padding: 18px 14px 28px; }
    .header-actions { gap: 2px; }
    .header-user { padding: 2px; }
    .header-user .bi-chevron-down { display: none; }
    .stage-step { min-width: 86px; }
    .header-brand { display: none; }
    .auth-title { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 20 bis. Colonne « Commercial responsable » & filtres de listes ---------- */
.commercial-cell { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.commercial-cell .avatar { --av-size: 28px; flex-shrink: 0; font-size: 11px; }
.commercial-name { font-family: var(--es-font-display); font-size: 13px; font-weight: 500; color: var(--es-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.commercial-cell-empty { color: var(--es-subtle); font-size: 12.5px; gap: 6px; }
.commercial-cell-compact .avatar { --av-size: 22px; font-size: 9.5px; }
.commercial-cell-compact .commercial-name { font-size: 12px; font-weight: 500; color: var(--es-muted); }
.kanban-card-commercial { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--es-border); }
.data-table .col-commercial { min-width: 190px; }
.form-static { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px; border: 1px dashed var(--es-border-strong); border-radius: var(--es-radius); background: var(--es-surface-2); color: var(--es-ink); font-weight: 500; }
.form-static i { color: var(--es-navy); }
.filter-bar-list .form-field-commercial { flex: 1 1 230px; }
.filter-bar-list .form-field-commercial label i { color: var(--es-navy); margin-right: 2px; }
.filter-bar-list .form-field-date { flex: 0 1 150px; }
.kpi-card-link { text-decoration: none; transition: transform .15s var(--es-ease), box-shadow .15s ease, border-color .15s ease; }
.kpi-card-link:hover { transform: translateY(-2px); box-shadow: var(--es-shadow-md); border-color: var(--es-border-strong); color: inherit; }
.funnel-row-link { text-decoration: none; color: inherit; border-radius: 8px; transition: background .15s ease; }
.funnel-row-link:hover { background: var(--es-surface-2); color: inherit; }

/* ---------- 20 ter. ESPACE DIRECTION — identité visuelle ----------
   Accent « or champagne » associé au marine et au rouge de la marque :
   il n'apparaît que pour le rôle Direction (body.role-direction) et ne
   modifie ni la navigation, ni le menu latéral, ni les autres rôles. */
:root {
    --es-gold: #c9a24d;
    --es-gold-500: #b98f35;
    --es-gold-600: #9a7424;
    --es-gold-100: #f4e8c8;
    --es-gold-50: #fbf6e9;
    --dir-strip-h: 0px;
}
body.role-direction { --dir-strip-h: 34px; }

.direction-strip {
    position: sticky;
    top: 0;
    z-index: 45;
    height: var(--dir-strip-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px 0 28px;
    background: linear-gradient(90deg, var(--es-navy-950) 0%, var(--es-navy-900) 55%, var(--es-navy-800) 100%);
    border-bottom: 1px solid rgba(201, 162, 77, .55);
    color: #e9ddbd;
    font-family: var(--es-font-display);
}
.direction-strip-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.direction-strip-icon { color: var(--es-gold); font-size: 15px; }
.direction-strip-title { font-size: 11.5px; font-weight: 700; letter-spacing: .24em; color: var(--es-gold); white-space: nowrap; }
.direction-strip-sep { width: 1px; height: 14px; background: rgba(233, 221, 189, .3); }
.direction-strip-sub { font-size: 11.5px; font-weight: 400; letter-spacing: .02em; color: rgba(233, 221, 189, .75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge-direction {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 22px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--es-gold);
    background: linear-gradient(135deg, #e3c77d 0%, var(--es-gold) 55%, var(--es-gold-500) 100%);
    color: var(--es-navy-950);
    font-family: var(--es-font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 2px 6px rgba(154, 116, 36, .25);
}
.badge-direction i { font-size: 11px; }

.direction-strip .direction-strip-badge {
    height: auto;
    gap: 7px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: rgba(233, 221, 189, .88);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .16em;
    box-shadow: none;
}
.direction-strip .direction-strip-badge i {
    color: var(--es-gold);
    font-size: 12px;
}

body.role-direction .app-header { top: var(--dir-strip-h); box-shadow: 0 2px 0 var(--es-gold-100); }
body.role-direction .header-user-role { color: var(--es-gold-600); font-weight: 500; }
body.role-direction .header-user-role i { font-size: 10px; }
body.role-direction .header-title-sub { color: var(--es-gold-600); }
body.role-direction .app-header .avatar { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--es-gold); }

/* Sidebar : liseré et mention dorés, menu et navigation inchangés */
body.role-direction .app-sidebar { box-shadow: inset -2px 0 0 rgba(201, 162, 77, .45); }
.sidebar-tagline-direction {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 16px 2px;
    padding: 7px 10px;
    border: 1px solid rgba(201, 162, 77, .45);
    border-radius: 8px;
    background: rgba(201, 162, 77, .1);
    color: var(--es-gold);
    font-weight: 700;
    letter-spacing: .16em;
}
.sidebar-tagline-direction i { font-size: 14px; }
body.role-direction .nav-link.active { background: rgba(201, 162, 77, .14); }
body.role-direction .nav-link.active::before,
body.role-direction .nav-group-toggle.has-active::before { background: var(--es-gold); }
body.role-direction .nav-link.active .nav-icon,
body.role-direction .nav-group-toggle.has-active .nav-icon { color: var(--es-gold); }
body.role-direction .nav-submenu .nav-link.active::after { background: var(--es-gold); border-color: var(--es-gold); }
body.role-direction .sidebar-header { border-bottom-color: rgba(201, 162, 77, .28); }
html.sidebar-collapsed .sidebar-tagline-direction { display: flex; justify-content: center; margin: 12px 10px 2px; padding: 7px 0; }
html.sidebar-collapsed .sidebar-tagline-direction .nav-label { display: none; }

/* Pages : intitulés, cartes et tableaux avec filet doré */
body.role-direction .page-eyebrow { color: var(--es-gold-600); }
body.role-direction .page-title::after { content: ""; display: block; width: 44px; height: 3px; margin-top: 8px; border-radius: 3px; background: linear-gradient(90deg, var(--es-gold), var(--es-gold-100)); }
body.role-direction .kpi-card { border-top: 3px solid var(--es-gold); }
body.role-direction .table-card { border-top: 3px solid var(--es-gold); }
body.role-direction .card-direction { border-top: 3px solid var(--es-gold); }
body.role-direction .data-table thead th { background: var(--es-gold-50); color: var(--es-navy-900); border-bottom: 1px solid var(--es-gold-100); }
body.role-direction .data-table tbody tr:hover td { background: #fdfaf1; }
body.role-direction .filter-bar { border-left: 3px solid var(--es-gold); }
body.role-direction .filter-bar-list .form-field-commercial label { color: var(--es-gold-600); font-weight: 600; }
body.role-direction .filter-bar-list .form-field-commercial select { border-color: var(--es-gold); background-color: var(--es-gold-50); }
body.role-direction .commercial-cell .avatar { box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--es-gold-100); }
.funnel-bar-gold { background: linear-gradient(90deg, var(--es-navy-700), var(--es-navy)); }
body.role-direction .funnel-bar-gold { background: linear-gradient(90deg, var(--es-gold-500), var(--es-gold)); }
body.role-direction .chip.active { background: var(--es-navy); border-color: var(--es-navy); color: #fff; }

@media (max-width: 960px) {
    .direction-strip { padding: 0 14px; }
    .direction-strip-sub, .direction-strip-sep { display: none; }
}

/* ---------- 20 quater. Visites — machines relevées & heures de fonctionnement ---------- */
.machine-hours { display: flex; flex-direction: column; gap: 10px; }
.machine-hours-intro { margin: 0 0 4px; }
.machine-hours-head,
.machine-hours-row { display: grid; grid-template-columns: minmax(0, 1fr) 230px 42px; gap: 12px; align-items: start; }
.machine-hours-head { padding: 0 15px; font-family: var(--es-font-display); font-size: 11.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--es-subtle); }
.machine-hours-list { display: flex; flex-direction: column; gap: 8px; }
.machine-hours-row { padding: 12px 14px; border: 1px solid var(--es-border); border-radius: var(--es-radius); background: var(--es-surface-2); }
.machine-hours-row .form-field { gap: 4px; }
.machine-hours-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.machine-hours-row .input-group > input { flex: 1 1 auto; min-width: 0; text-align: right; font-variant-numeric: tabular-nums; }
.machine-hours-row input.is-invalid { border-color: #ef9aa5; background: var(--es-danger-bg); }
.machine-hours-actions { display: flex; align-items: center; justify-content: center; min-height: 42px; }
.machine-hours-row-errors { grid-column: 1 / -1; }
.machine-hours-row input.is-warning { border-color: #f0c36d; background: var(--es-warning-bg); }
.machine-hours-hint { font-size: 12px; color: var(--es-muted); }
.machine-hours-hint.is-warning { color: var(--es-warning); font-weight: 500; }
.machine-hours-hint[hidden] { display: none; }
.ecart-positif { color: var(--es-success); font-weight: 500; }
.ecart-nul { color: var(--es-subtle); }
.machine-hours-empty { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 1px dashed var(--es-border-strong); border-radius: var(--es-radius); color: var(--es-muted); font-size: 13px; }
.machine-hours-empty[hidden] { display: none; }
.machine-hours-empty i { color: var(--es-subtle); font-size: 18px; }
.machine-hours-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.machine-hours-summary { font-size: 13px; color: var(--es-muted); }
.machine-hours-summary strong { color: var(--es-ink); font-variant-numeric: tabular-nums; }
.machine-hours-sep { margin: 0 6px; color: var(--es-subtle); }
.kpi-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hours-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; font-size: 12.5px; color: var(--es-muted); }
.hours-note i { color: var(--es-navy); }
.card-footer.hours-note { margin-top: 0; border-radius: 0 0 var(--es-radius-lg) var(--es-radius-lg); }

@media (max-width: 768px) {
    .kpi-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .machine-hours-head { display: none; }
    .machine-hours-row { grid-template-columns: minmax(0, 1fr) 42px; }
    .machine-hours-machine, .machine-hours-value { grid-column: 1; }
    .machine-hours-actions { grid-column: 2; grid-row: 1; }
    .machine-hours-label { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; }
}

/* ---------- 20 quinquies. Toggle switch « Visite confirmée » ---------- */
.switch-form { display: inline-flex; margin: 0; }
.switch {
    --switch-w: 40px;
    --switch-h: 22px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--es-border);
    border-radius: 999px;
    background: var(--es-surface);
    color: var(--es-muted);
    font: inherit;
    font-family: var(--es-font-display);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    transition: border-color .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
}
.switch:hover { border-color: var(--es-border-strong); box-shadow: var(--es-shadow-xs); }
.switch:focus-visible { outline: none; box-shadow: var(--es-focus); }
.switch-track {
    position: relative;
    flex-shrink: 0;
    width: var(--switch-w);
    height: var(--switch-h);
    border-radius: 999px;
    background: #d6dae6;
    transition: background .2s var(--es-ease);
}
.switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(var(--switch-h) - 6px);
    height: calc(var(--switch-h) - 6px);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(23, 27, 63, .25);
    transition: transform .2s var(--es-ease);
}
.switch-text { min-width: 24px; text-align: left; }
.switch.is-on { border-color: #c4e8d3; background: var(--es-success-bg); color: var(--es-success); }
.switch.is-on .switch-track { background: var(--es-success); }
.switch.is-on .switch-thumb { transform: translateX(calc(var(--switch-w) - var(--switch-h))); }
.switch.is-busy { cursor: progress; opacity: .7; }
.switch.is-busy .switch-thumb { box-shadow: 0 0 0 3px rgba(17, 128, 74, .15), 0 1px 3px rgba(23, 27, 63, .25); }
.switch.is-readonly { cursor: default; opacity: .85; }
.switch.is-readonly:hover { border-color: var(--es-border); box-shadow: none; }
.switch.is-on.is-readonly:hover { border-color: #c4e8d3; }
.data-table td.col-confirmation { white-space: nowrap; }
.data-table th.col-confirmation { white-space: normal; min-width: 104px; line-height: 1.3; }
.data-table .switch { --switch-w: 36px; --switch-h: 20px; gap: 6px; padding: 3px 9px 3px 3px; }
@media (prefers-reduced-motion: reduce) {
    .switch, .switch-track, .switch-thumb { transition: none; }
}

/* ---------- 20 sexies. Validation Direction des passages d'étape (25 % → 50 %, 75 % → 100 %) ---------- */
.stage-step-gate { font-size: 10.5px; color: var(--es-subtle); vertical-align: 1px; }
.stage-step.pending .stage-step-dot { border-color: #e79a00; border-style: dashed; background: var(--es-warning-bg); color: var(--es-warning); }
.stage-step.pending .stage-step-label { color: var(--es-warning); }

.validation-panel {
    margin-bottom: 20px;
    padding: 16px 18px;
    border: 1px solid #f5dea6;
    border-left: 4px solid #e79a00;
    border-radius: 12px;
    background: var(--es-warning-bg);
    scroll-margin-top: calc(var(--es-header-h, 64px) + var(--dir-strip-h, 0px) + 16px);
}
.validation-panel-head { display: flex; gap: 14px; align-items: flex-start; }
.validation-panel-icon { flex: 0 0 auto; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: #fff; color: #e79a00; font-size: 17px; box-shadow: var(--es-shadow-xs); }
.validation-panel-text { flex: 1; min-width: 0; color: #7a4a00; font-size: 13.5px; }
.validation-panel-title { font-family: var(--es-font-display); font-size: 15px; font-weight: 600; color: var(--es-ink); margin-bottom: 6px; }
.validation-transition { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.validation-transition .bi-arrow-right { color: var(--es-muted); }
.validation-meta { line-height: 1.5; }
.validation-comment { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, .7); color: var(--es-text); white-space: pre-line; }
.validation-decision { margin-top: 14px; padding-top: 14px; border-top: 1px dashed #f0cf85; }
.validation-decision textarea { display: block; width: 100%; min-height: 64px; padding: 9px 11px; border: 1px solid #f0cf85; border-radius: 10px; background: #fff; font: inherit; font-size: 13px; color: var(--es-ink); resize: vertical; }
.validation-decision textarea:focus { outline: none; border-color: #e79a00; box-shadow: 0 0 0 3px rgba(231, 154, 0, .18); }
.validation-decision textarea::placeholder { color: var(--es-subtle); }
.validation-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

.validation-hint { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--es-navy-50); color: var(--es-navy); font-size: 13px; line-height: 1.45; }
.validation-hint i { font-size: 16px; line-height: 1.2; }

.validation-history { list-style: none; margin: 0; padding: 0; }
.validation-history-item { padding: 10px 0; border-bottom: 1px solid var(--es-border); }
.validation-history-item:first-child { padding-top: 0; }
.validation-history-item:last-child { border-bottom: 0; padding-bottom: 0; }
.validation-history-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.validation-history-transition { font-size: 12.5px; font-weight: 500; color: var(--es-ink); }
.validation-history-meta { font-size: 11.5px; color: var(--es-subtle); }
.validation-history-comment { margin-top: 4px; font-size: 12.5px; color: var(--es-text); white-space: pre-line; }

.kanban-card-validation { display: flex; align-items: center; gap: 6px; margin: -4px 0 10px; padding: 4px 8px; border-radius: 6px; background: var(--es-warning-bg); color: var(--es-warning); font-size: 11.5px; font-weight: 500; }

.direction-strip-right { display: flex; align-items: center; gap: 10px; }
.direction-strip-alert {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 28px;
    padding: 3px 9px 3px 5px;
    border: 1px solid rgba(201, 162, 77, .5);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(201, 162, 77, .18), rgba(255, 255, 255, .045));
    color: #f3ead4;
    font-family: var(--es-font-display);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .015em;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .16), 0 1px 0 rgba(255, 255, 255, .08) inset;
    transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.direction-strip-alert:hover {
    border-color: var(--es-gold);
    background: linear-gradient(135deg, rgba(201, 162, 77, .3), rgba(255, 255, 255, .08));
    color: #fff9eb;
    box-shadow: 0 3px 9px rgba(0, 0, 0, .22), 0 1px 0 rgba(255, 255, 255, .1) inset;
    transform: translateY(-1px);
}
.direction-strip-alert:focus-visible { outline: 2px solid #f1d58f; outline-offset: 2px; }
.direction-strip-alert-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: linear-gradient(145deg, #e6ca82, var(--es-gold-500));
    color: var(--es-navy-950);
    font-size: 11px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}
.direction-strip-alert-count {
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 1px solid rgba(233, 221, 189, .28);
    border-radius: 5px;
    background: rgba(7, 18, 35, .36);
    color: #f5d992;
    font-family: var(--es-font-ui);
    font-size: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.direction-strip-alert-label { color: rgba(243, 234, 212, .92); }
.direction-strip-alert-arrow { margin-left: 1px; color: rgba(233, 221, 189, .55); font-size: 10px; transition: color .16s ease, transform .16s ease; }
.direction-strip-alert:hover .direction-strip-alert-arrow { color: var(--es-gold); transform: translate(1px, -1px); }

/* Page « Validations Direction » */
.validation-table td { vertical-align: middle; }
.validation-table .badge { white-space: nowrap; }
.validation-table .cell-nowrap { white-space: nowrap; }
.validation-table .col-commercial { min-width: 140px; }
.validation-table .col-affaire { min-width: 220px; }
.validation-table .col-passage { white-space: nowrap; }
.validation-table .validation-step { display: flex; align-items: center; gap: 8px; }
.validation-table .validation-step + .validation-step { margin-top: 6px; }
.validation-table .validation-step-label { width: 62px; font-size: 11px; color: var(--es-subtle); text-transform: uppercase; letter-spacing: .04em; }
.validation-table .col-decision { width: 1%; min-width: 214px; }
.validation-table .validation-row-form { display: flex; flex-direction: column; gap: 6px; }
.validation-table .validation-row-form input[type="text"] { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--es-border-strong); border-radius: 8px; background: #fff; font: inherit; font-size: 12.5px; color: var(--es-ink); }
.validation-table .validation-row-form input[type="text"]:focus { outline: none; border-color: var(--es-red); box-shadow: var(--es-focus); }
.validation-table .validation-row-actions { display: flex; gap: 6px; }
.validation-table .validation-row-actions .btn { flex: 1; justify-content: center; white-space: nowrap; }
.validation-table .validation-cr { margin-top: 6px; max-width: 340px; font-size: 12.5px; color: var(--es-muted); white-space: pre-line; }
.validation-table .validation-cr i { color: var(--es-subtle); }
#historique-validations .validation-cr { margin-top: 0; }

@media (max-width: 720px) {
    .validation-panel-head { flex-direction: column; }
    .validation-actions .btn { flex: 1; justify-content: center; }
    .direction-strip-alert { gap: 6px; padding-right: 7px; }
}

@media (max-width: 768px) {
    .client-contact-row { grid-template-columns: minmax(0, 1fr) 42px; gap: 10px; }
    .client-contact-row .form-field { grid-column: 1; }
    .client-contact-row .btn-icon { grid-column: 2; grid-row: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .direction-strip-alert, .direction-strip-alert-arrow { transition: none; }
}

/* ---------- 21. Impression ---------- */
@media print {
    .app-sidebar, .app-header, .app-footer, .page-actions, .table-toolbar, .table-filters, .table-footer .pagination, .flash-stack, .cell-actions, .no-print { display: none !important; }
    .app-content { margin-left: 0 !important; }
    .app-main { padding: 0; max-width: none; }
    body { background: #fff; }
    .card, .table-card, .kpi-card { box-shadow: none; break-inside: avoid; }
    .print-only { display: block !important; }
}
.print-only { display: none; }

/* ==========================================================================
   Planification des visites (Direction) — tableau « Objectifs des commerciaux »
   Préfixe .obj-* : aucun impact sur la liste des visites.
   ========================================================================== */
.obj-card {
    background: var(--es-surface);
    border: 1px solid var(--es-border);
    border-radius: var(--es-radius-lg);
    box-shadow: var(--es-shadow-sm);
    margin-bottom: 22px;
    overflow: hidden;
    scroll-margin-top: 80px;
}
.obj-head { padding: 18px 20px 4px; }
.obj-title { display: flex; align-items: center; gap: 10px; margin: 0; font-family: var(--es-font-display); font-size: 17px; font-weight: 600; color: var(--es-ink); letter-spacing: -.01em; }
.obj-title i { color: var(--es-red); font-size: 18px; }
.obj-subtitle { margin: 4px 0 0; font-size: 13px; color: var(--es-muted); }
.obj-subtitle strong { color: var(--es-ink); font-weight: 600; }

.obj-filters { margin: 12px 20px 0; }
.obj-filters .form-field-mois { flex: 0 1 200px; }

/* Récapitulatif d'équipe */
.obj-recap {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr);
    gap: 16px 28px;
    margin: 16px 20px 0;
    padding: 16px 18px;
    background: var(--es-surface-2);
    border: 1px solid var(--es-border);
    border-radius: var(--es-radius);
}
.obj-recap-label { font-family: var(--es-font-display); font-size: 12.5px; font-weight: 500; color: var(--es-muted); }
.obj-recap-rate { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 10px; font-family: var(--es-font-display); font-size: 30px; font-weight: 600; color: var(--es-ink); line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.obj-recap-rate small { font-family: var(--es-font); font-size: 15px; font-weight: 500; color: var(--es-muted); margin-left: -6px; }
.obj-recap-rate-sub { font-family: var(--es-font); font-size: 13px; font-weight: 400; color: var(--es-muted); letter-spacing: 0; }
.obj-recap-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; align-self: center; }
.obj-stat { padding: 10px 12px; background: var(--es-surface); border: 1px solid var(--es-border); border-radius: var(--es-radius); }
.obj-stat dt { font-size: 11.5px; font-weight: 500; color: var(--es-muted); }
.obj-stat dd { margin: 2px 0 0; font-family: var(--es-font-display); font-size: 22px; font-weight: 600; color: var(--es-ink); font-variant-numeric: tabular-nums; }
.obj-recap-statuts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--es-muted); }
.obj-recap-statuts li { display: inline-flex; align-items: center; gap: 8px; }
.obj-recap-statuts strong { color: var(--es-ink); font-variant-numeric: tabular-nums; }

/* Barres de progression */
.obj-bar { flex: 1 1 auto; min-width: 70px; height: 8px; border-radius: 999px; background: var(--es-chart-track); overflow: hidden; }
.obj-bar-lg { height: 12px; }
.obj-bar-fill { display: block; height: 100%; min-width: 0; border-radius: 999px; background: var(--es-info); transition: width .4s ease; }
.obj-bar-fill-atteint { background: var(--es-success); }
.obj-bar-fill-en_cours { background: var(--es-info); }
.obj-bar-fill-en_retard { background: var(--es-danger); }
.obj-bar-fill-non_defini { background: var(--es-border); }

/* Tableau */
.obj-card .table-wrap { margin-top: 16px; overflow-x: auto; border-top: 1px solid var(--es-border); }
.obj-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.obj-table th { padding: 11px 16px; text-align: left; white-space: nowrap; font-family: var(--es-font-display); font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--es-muted); background: var(--es-surface-2); border-bottom: 1px solid var(--es-border); }
.obj-table td { padding: 12px 16px; vertical-align: middle; border-bottom: 1px solid var(--es-border); color: var(--es-ink); }
.obj-table tbody tr:last-child td { border-bottom: 0; }
.obj-table tbody tr:hover td { background: var(--es-surface-2); }
.obj-table .obj-num { text-align: right; font-variant-numeric: tabular-nums; }
.obj-table th.obj-num { text-align: right; }
.obj-edit { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.obj-input { width: 84px; min-height: 36px; padding: 6px 10px; text-align: center; font-variant-numeric: tabular-nums; }
.obj-save { min-height: 36px; padding: 6px 10px; }
.obj-rate { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.obj-rate-value { flex-shrink: 0; min-width: 42px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.obj-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 22px 0; color: var(--es-muted); }
.obj-note { margin: 0; padding: 12px 20px 16px; font-size: 12.5px; color: var(--es-subtle); border-top: 1px solid var(--es-border); }
.obj-note i { margin-right: 4px; }

@media (max-width: 960px) {
    .obj-recap { grid-template-columns: minmax(0, 1fr); }
}

/* Mobile : chaque commercial devient une carte */
@media (max-width: 768px) {
    .obj-head { padding: 16px 14px 2px; }
    .obj-filters { margin: 10px 14px 0; }
    .obj-recap { margin: 14px 14px 0; padding: 14px; }
    .obj-recap-rate { font-size: 26px; }
    .obj-recap-stats { gap: 8px; }
    .obj-stat { padding: 8px 10px; }
    .obj-stat dd { font-size: 19px; }
    .obj-note { padding: 12px 14px 14px; }

    .obj-table thead { display: none; }
    .obj-table, .obj-table tbody, .obj-table tr, .obj-table td { display: block; width: 100%; }
    .obj-table tbody tr { padding: 12px 14px; border-bottom: 1px solid var(--es-border); }
    .obj-table tbody tr:last-child { border-bottom: 0; }
    .obj-table tbody tr:hover td { background: transparent; }
    .obj-table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border: 0; text-align: right; flex-wrap: wrap; }
    .obj-table td::before { content: attr(data-label); flex-shrink: 0; font-family: var(--es-font-display); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--es-subtle); text-align: left; }
    .obj-table td:first-child { padding-top: 0; justify-content: flex-start; text-align: left; font-size: 14.5px; }
    .obj-table td:first-child::before { display: none; }
    .obj-table .obj-num, .obj-table th.obj-num { text-align: right; }
    .obj-table td .cell-sub { flex-basis: 100%; text-align: right; }
    .obj-rate { flex: 1 1 auto; min-width: 0; max-width: 220px; }
    .obj-table .obj-empty-row td::before { display: none; }
}
@media (max-width: 480px) {
    .obj-recap-stats { grid-template-columns: minmax(0, 1fr); }
    .obj-save-text { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .obj-bar-fill { transition: none; }
}
