/* ==========================================================================
   ERP-BTP.WebIA.mg — Design system
   Bootstrap 5.3 (CDN) + variables propres. Aucune étape de build.
   ========================================================================== */

/* ---------- Jetons de design (mode clair) ---------- */
:root {
    --erp-primary: #0F2A4A;
    --erp-primary-rgb: 15, 42, 74;
    --erp-primary-hover: #163a63;
    --erp-sidebar-bg: #0B1F38;
    --erp-sidebar-text: rgba(255, 255, 255, .72);
    --erp-sidebar-text-active: #ffffff;
    --erp-sidebar-hover: rgba(255, 255, 255, .06);
    --erp-sidebar-active: rgba(242, 140, 40, .16);
    --erp-accent: #F28C28;
    --erp-accent-rgb: 242, 140, 40;
    --erp-accent-hover: #d97817;
    --erp-gantt-late: #6f42c1;          /* tâches en retard (Gantt et légende) */
    --erp-success: #198754;
    --erp-warning: #FD7E14;
    --erp-danger: #DC3545;
    --erp-bg: #F4F6F9;
    --erp-muted: #6C757D;
    --erp-text: #212529;
    --erp-surface: #ffffff;
    --erp-border: #e3e7ed;

    --erp-font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --erp-font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

    --erp-sidebar-width: 260px;
    --erp-sidebar-collapsed-width: 72px;
    --erp-topbar-height: 60px;
    --erp-radius: .625rem;
    --erp-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);

    /* Surcharges Bootstrap */
    --bs-primary: var(--erp-primary);
    --bs-primary-rgb: var(--erp-primary-rgb);
    --bs-success: var(--erp-success);
    --bs-warning: var(--erp-warning);
    --bs-danger: var(--erp-danger);
    --bs-body-bg: var(--erp-bg);
    --bs-body-color: var(--erp-text);
    --bs-secondary-color: var(--erp-muted);
    --bs-body-font-family: var(--erp-font-sans);
    --bs-border-color: var(--erp-border);
    --bs-link-color: var(--erp-primary);
    --bs-link-color-rgb: var(--erp-primary-rgb);
    --bs-link-hover-color: var(--erp-accent);
    --bs-border-radius: var(--erp-radius);
}

/* ---------- Mode sombre (prêt, non activé) ---------- */
[data-bs-theme="dark"] {
    --erp-primary: #4d7fb8;
    --erp-primary-rgb: 77, 127, 184;
    --erp-sidebar-bg: #08172a;
    --erp-bg: #111827;
    --erp-surface: #1a2332;
    --erp-text: #e5e7eb;
    --erp-muted: #9ca3af;
    --erp-border: #2b3646;
}

/* ---------- Base ---------- */
body {
    background: var(--erp-bg);
    color: var(--erp-text);
    font-family: var(--erp-font-sans);
    font-size: .925rem;
}

.font-mono,
.money,
.qty,
.code {
    font-family: var(--erp-font-mono);
    font-variant-numeric: tabular-nums;
}

.money,
.qty,
td.num,
th.num {
    text-align: right;
    white-space: nowrap;
}

.money.is-negative { color: var(--erp-danger); }

h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5 { font-weight: 600; color: var(--erp-text); }

/* ---------- Boutons et couleurs ---------- */
.btn-primary {
    --bs-btn-bg: var(--erp-primary);
    --bs-btn-border-color: var(--erp-primary);
    --bs-btn-hover-bg: var(--erp-primary-hover);
    --bs-btn-hover-border-color: var(--erp-primary-hover);
    --bs-btn-active-bg: var(--erp-primary-hover);
    --bs-btn-active-border-color: var(--erp-primary-hover);
    --bs-btn-disabled-bg: var(--erp-primary);
    --bs-btn-disabled-border-color: var(--erp-primary);
}

.btn-outline-primary {
    --bs-btn-color: var(--erp-primary);
    --bs-btn-border-color: var(--erp-primary);
    --bs-btn-hover-bg: var(--erp-primary);
    --bs-btn-hover-border-color: var(--erp-primary);
    --bs-btn-active-bg: var(--erp-primary);
}

.btn-accent {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--erp-accent);
    --bs-btn-border-color: var(--erp-accent);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--erp-accent-hover);
    --bs-btn-hover-border-color: var(--erp-accent-hover);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--erp-accent-hover);
    --bs-btn-active-border-color: var(--erp-accent-hover);
}

.text-accent { color: var(--erp-accent) !important; }
.bg-accent { background-color: var(--erp-accent) !important; color: #fff; }
.text-bg-accent { background-color: var(--erp-accent) !important; color: #fff !important; }
.bg-accent-subtle { background-color: rgba(var(--erp-accent-rgb), .14) !important; }
.text-primary { color: var(--erp-primary) !important; }
.bg-primary { background-color: var(--erp-primary) !important; }

.form-control:focus,
.form-select:focus {
    border-color: rgba(var(--erp-accent-rgb), .6);
    box-shadow: 0 0 0 .2rem rgba(var(--erp-accent-rgb), .18);
}

.form-check-input:checked {
    background-color: var(--erp-primary);
    border-color: var(--erp-primary);
}

.form-label { font-weight: 500; margin-bottom: .3rem; }
.form-label .required-mark { color: var(--erp-danger); }

/* ---------- Logo ---------- */
.erp-logo {
    display: inline-flex;
    align-items: baseline;
    gap: .3rem;
    font-weight: 700;
    letter-spacing: -.02em;
    text-decoration: none;
    line-height: 1;
}
.erp-logo .erp-logo-main { color: inherit; font-size: 1.2em; }
.erp-logo .erp-logo-sub { color: var(--erp-accent); font-size: .85em; font-weight: 600; }
.erp-logo img { max-height: 36px; }

/* ==========================================================================
   Layout applicatif
   ========================================================================== */
.erp-layout { min-height: 100vh; }

/* ---------- Sidebar ---------- */
.erp-sidebar {
    background: var(--erp-sidebar-bg);
    color: var(--erp-sidebar-text);
    --bs-offcanvas-bg: var(--erp-sidebar-bg);
    --bs-offcanvas-color: var(--erp-sidebar-text);
    --bs-offcanvas-width: var(--erp-sidebar-width);
}

.erp-sidebar .erp-sidebar-brand {
    height: var(--erp-topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    flex-shrink: 0;
}

.erp-sidebar .erp-sidebar-brand .erp-logo { color: #fff; }

.erp-sidebar-nav {
    padding: .75rem .75rem 1.5rem;
    overflow-y: auto;
    flex: 1 1 auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .15) transparent;
}

.erp-nav-section {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255, 255, 255, .4);
    padding: 1rem .75rem .35rem;
    white-space: nowrap;
}

.erp-nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem .75rem;
    border-radius: .5rem;
    color: var(--erp-sidebar-text);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s, color .15s;
}
.erp-nav-link .bi { font-size: 1.1rem; width: 1.25rem; text-align: center; flex-shrink: 0; }
.erp-nav-link:hover { background: var(--erp-sidebar-hover); color: var(--erp-sidebar-text-active); }
.erp-nav-link.active {
    background: var(--erp-sidebar-active);
    color: var(--erp-sidebar-text-active);
    box-shadow: inset 3px 0 0 var(--erp-accent);
}
.erp-nav-link.active .bi { color: var(--erp-accent); }
.erp-nav-link.disabled { opacity: .45; cursor: default; pointer-events: none; }

.erp-sidebar-footer {
    padding: .75rem 1.25rem;
    font-size: .75rem;
    color: rgba(255, 255, 255, .35);
    border-top: 1px solid rgba(255, 255, 255, .06);
    white-space: nowrap;
    overflow: hidden;
}

/* Desktop : sidebar fixe, repliable */
@media (min-width: 992px) {
    .erp-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--erp-sidebar-width);
        display: flex;
        flex-direction: column;
        z-index: 1030;
        transition: width .2s ease;
    }
    .erp-sidebar .offcanvas-body { display: flex; flex-direction: column; padding: 0; min-height: 0; flex: 1 1 auto; }
    .erp-main {
        margin-left: var(--erp-sidebar-width);
        transition: margin-left .2s ease;
    }

    body.sidebar-collapsed .erp-sidebar { width: var(--erp-sidebar-collapsed-width); }
    body.sidebar-collapsed .erp-main { margin-left: var(--erp-sidebar-collapsed-width); }
    body.sidebar-collapsed .erp-sidebar .erp-sidebar-brand { padding: 0; justify-content: center; }
    body.sidebar-collapsed .erp-sidebar .erp-logo-sub,
    body.sidebar-collapsed .erp-sidebar .erp-nav-label,
    body.sidebar-collapsed .erp-sidebar .erp-sidebar-footer { display: none; }
    body.sidebar-collapsed .erp-sidebar .erp-nav-section { font-size: 0; padding: .5rem 0; border-top: 1px solid rgba(255, 255, 255, .06); margin: .5rem .5rem 0; }
    body.sidebar-collapsed .erp-sidebar .erp-nav-link { justify-content: center; padding: .6rem 0; }
}

/* Mobile / tablette : offcanvas Bootstrap (.offcanvas-lg) */
@media (max-width: 991.98px) {
    .erp-sidebar .offcanvas-body { display: flex; flex-direction: column; padding: 0; }
    .erp-sidebar .btn-close { filter: invert(1); }
}

/* ---------- Topbar ---------- */
.erp-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--erp-topbar-height);
    background: var(--erp-surface);
    border-bottom: 1px solid var(--erp-border);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 0 1rem;
}

.erp-topbar .erp-search { max-width: 420px; flex: 1 1 auto; }
.erp-topbar .erp-search .form-control { background: var(--erp-bg); border-color: transparent; }
.erp-topbar .erp-search .form-control:focus { background: var(--erp-surface); }
.erp-topbar .erp-icon-btn {
    position: relative;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--erp-muted);
    font-size: 1.2rem;
}
.erp-topbar .erp-icon-btn:hover { background: var(--erp-bg); color: var(--erp-text); }
.erp-topbar .erp-icon-btn .badge { position: absolute; top: 2px; right: 0; font-size: .6rem; }
.erp-topbar .erp-project-select { max-width: 240px; }
.erp-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--erp-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .85rem;
    flex-shrink: 0;
}
.erp-console-badge { background: var(--erp-accent); color: #fff; font-weight: 600; }

/* ---------- Contenu ---------- */
.erp-content { padding: 1.5rem; }
@media (max-width: 575.98px) { .erp-content { padding: 1rem; } }

.erp-footer { padding: 1rem 1.5rem; color: var(--erp-muted); font-size: .8rem; }

/* ---------- En-tête de page ---------- */
.erp-page-header { margin-bottom: 1.5rem; }
.erp-page-header .breadcrumb { font-size: .8rem; margin-bottom: .25rem; --bs-breadcrumb-divider-color: var(--erp-muted); }
.erp-page-header .breadcrumb a { color: var(--erp-muted); text-decoration: none; }
.erp-page-header .breadcrumb a:hover { color: var(--erp-accent); }
.erp-page-header h1 { font-size: 1.5rem; margin: 0; }
.erp-page-header .erp-page-subtitle { color: var(--erp-muted); margin: .25rem 0 0; }

/* ---------- Cartes ---------- */
.card {
    --bs-card-bg: var(--erp-surface);
    --bs-card-border-color: var(--erp-border);
    --bs-card-border-radius: var(--erp-radius);
    --bs-card-cap-bg: var(--erp-surface);
    box-shadow: var(--erp-shadow);
}
.card > .card-header { font-weight: 600; padding: .85rem 1.25rem; }
.card > .card-body { padding: 1.25rem; }

.erp-stat-card .erp-stat-icon {
    width: 46px;
    height: 46px;
    border-radius: .65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}
.erp-stat-card .erp-stat-label { color: var(--erp-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.erp-stat-card { container-type: inline-size; }
.erp-stat-card .erp-stat-value { font-size: clamp(.95rem, 6cqi, 1.45rem); font-weight: 700; font-family: var(--erp-font-mono); line-height: 1.2; }
.erp-stat-card .erp-stat-trend { font-size: .8rem; }

/* ---------- Tableaux ---------- */
/* Conteneur positionné : les éléments absolus (.visually-hidden) restent dans la zone de défilement
   au lieu d'élargir la page sur mobile */
.table-responsive { position: relative; }
.erp-table { margin-bottom: 0; --bs-table-bg: transparent; }
.erp-table thead th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--erp-muted);
    font-weight: 600;
    background: var(--erp-bg);
    border-bottom-width: 1px;
    white-space: nowrap;
    vertical-align: middle;
}
.erp-table td { vertical-align: middle; }
.erp-table .erp-sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .25rem; }
.erp-table .erp-sort:hover { color: var(--erp-text); }
.erp-table .erp-sort .bi { font-size: .7rem; opacity: .5; }
.erp-table .erp-sort.is-sorted { color: var(--erp-primary); }
.erp-table .erp-sort.is-sorted .bi { opacity: 1; }
.erp-table-toolbar { padding: .85rem 1.25rem; border-bottom: 1px solid var(--erp-border); }
.erp-table-footer { padding: .75rem 1.25rem; border-top: 1px solid var(--erp-border); font-size: .85rem; color: var(--erp-muted); }
.erp-table-footer .pagination { margin: 0; }
.pagination { --bs-pagination-active-bg: var(--erp-primary); --bs-pagination-active-border-color: var(--erp-primary); --bs-pagination-color: var(--erp-primary); }

/* ---------- État vide ---------- */
.erp-empty-state { text-align: center; padding: 3rem 1rem; color: var(--erp-muted); }
.erp-empty-state .erp-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--erp-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--erp-primary);
    margin-bottom: 1rem;
}
.erp-empty-state h5 { color: var(--erp-text); }

/* ---------- Badges ---------- */
.badge { font-weight: 500; }
.erp-badge-pending {
    background: rgba(var(--erp-accent-rgb), .12);
    color: #a85a0c;
    border: 1px dashed rgba(var(--erp-accent-rgb), .6);
}
.erp-ai-badge { border: 1px solid transparent; }
.erp-ai-badge.is-draft { background: rgba(var(--erp-accent-rgb), .14); color: #a85a0c; border-color: rgba(var(--erp-accent-rgb), .35); }

/* ---------- Toasts ---------- */
.erp-toast-container { z-index: 1090; }
.erp-toast { min-width: 280px; border: 0; box-shadow: 0 8px 24px rgba(16, 24, 40, .15); }
.erp-toast .toast-body { display: flex; gap: .65rem; align-items: flex-start; }
.erp-toast .toast-body .bi { font-size: 1.15rem; line-height: 1.3; }

/* ---------- Indicateur de chargement ---------- */
.erp-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: var(--erp-accent);
    z-index: 2000;
    opacity: 0;
    transition: width .4s ease, opacity .3s ease;
}
body.is-loading .erp-loading-bar { width: 80%; opacity: 1; transition: width 8s cubic-bezier(.1, .7, .2, 1), opacity .1s; }
.btn .erp-btn-spinner { display: none; }
.btn.is-loading .erp-btn-spinner { display: inline-block; }
.btn.is-loading { pointer-events: none; opacity: .8; }

/* ---------- Pages invité (connexion) ---------- */
.erp-guest {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    background:
        radial-gradient(circle at 15% 20%, rgba(var(--erp-accent-rgb), .12), transparent 40%),
        linear-gradient(160deg, var(--erp-sidebar-bg) 0%, var(--erp-primary) 100%);
}
.erp-guest-card { width: 100%; max-width: 440px; }
.erp-guest-card .card { box-shadow: 0 20px 50px rgba(0, 0, 0, .25); border: 0; }
.erp-guest-brand { color: #fff; text-align: center; margin-bottom: 1.5rem; }
.erp-guest-brand .erp-logo { color: #fff; font-size: 1.6rem; }
.erp-guest-brand p { color: rgba(255, 255, 255, .7); font-size: .9rem; margin: .5rem 0 0; }
.erp-guest-footer { color: rgba(255, 255, 255, .55); text-align: center; font-size: .8rem; margin: 1rem 0 0; }

/* ---------- UI kit ---------- */
.erp-swatch { height: 64px; border-radius: .5rem; border: 1px solid var(--erp-border); }
.erp-kit-section { scroll-margin-top: calc(var(--erp-topbar-height) + 1rem); }

[x-cloak] { display: none !important; }

/* Bootstrap force un fond transparent sur .offcanvas-lg en desktop */
.erp-sidebar.offcanvas-lg { background-color: var(--erp-sidebar-bg) !important; }

/* ---------- Listes et matrice des permissions ---------- */
.list-group {
    --bs-list-group-active-bg: var(--erp-primary);
    --bs-list-group-active-border-color: var(--erp-primary);
    --bs-list-group-action-hover-bg: var(--erp-bg);
}
.erp-matrix thead th { font-size: .68rem; letter-spacing: .02em; }
.erp-matrix th,
.erp-matrix td { padding-left: .3rem; padding-right: .3rem; }
.erp-matrix tbody th { padding-left: 1rem; }
.erp-matrix .form-check-input { cursor: pointer; }
.erp-matrix .form-check-input:disabled { cursor: not-allowed; }

/* Utilitaire absent de Bootstrap 5.3 : autorise un enfant flex à rétrécir (troncature du texte) */
.min-w-0 { min-width: 0 !important; }

/* ==========================================================================
   Site vitrine (domaine racine)
   ========================================================================== */
.erp-public { background: var(--erp-surface); }
.erp-public-nav { background: rgba(255, 255, 255, .95); backdrop-filter: blur(6px); border-bottom: 1px solid var(--erp-border); }
.erp-public-nav .erp-logo { color: var(--erp-primary); font-size: 1.15rem; }
.erp-public-nav .nav-link { color: var(--erp-text); font-weight: 500; }
.erp-public-nav .nav-link:hover { color: var(--erp-accent); }
.erp-hero {
    color: #fff;
    padding: 5rem 0 4rem;
    background:
        radial-gradient(circle at 85% 15%, rgba(var(--erp-accent-rgb), .25), transparent 40%),
        linear-gradient(160deg, var(--erp-sidebar-bg) 0%, var(--erp-primary) 100%);
}
.erp-hero h1 { color: #fff; font-size: clamp(1.9rem, 4vw, 3rem); font-weight: 700; line-height: 1.15; }
.erp-hero .erp-hero-kicker { color: var(--erp-accent); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; }
.erp-hero .lead { color: rgba(255, 255, 255, .8); }
.erp-section { padding: 4rem 0; }
.erp-section-alt { background: var(--erp-bg); }
.erp-section h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.erp-module-icon {
    width: 48px; height: 48px; border-radius: .75rem;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(var(--erp-accent-rgb), .12); color: var(--erp-accent); font-size: 1.4rem;
}
.erp-price-card.is-popular { border: 2px solid var(--erp-accent); }
.erp-price-card .erp-price { font-family: var(--erp-font-mono); font-size: 1.6rem; font-weight: 700; }
.erp-public-footer { background: var(--erp-sidebar-bg); color: rgba(255, 255, 255, .7); padding: 2.5rem 0; }
.erp-public-footer a { color: #fff; }
.erp-public-footer .erp-logo { color: #fff; }

/* Onglets « pilule » aux couleurs de la charte */
.nav-pills { --bs-nav-pills-link-active-bg: var(--erp-primary); --bs-nav-link-color: var(--erp-text); --bs-nav-link-hover-color: var(--erp-accent); }
.nav-tabs { --bs-nav-link-color: var(--erp-muted); --bs-nav-link-hover-color: var(--erp-accent); --bs-nav-tabs-link-active-color: var(--erp-primary); }

/* ------------------------------------------------------------------
   Grille BDQE (lignes flexibles, colonnes de largeur fixe, défilement horizontal)
   ------------------------------------------------------------------ */
.bdqe-scroll { overflow-x: auto; }
.bdqe-grid { min-width: max-content; font-size: .8125rem; }
.bdqe-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--erp-border); }
.bdqe-row > div { padding: .3rem .4rem; flex: 0 0 auto; min-width: 0; }
.bdqe-head { position: sticky; top: 0; z-index: 3; background: var(--erp-surface); font-weight: 600; color: var(--erp-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; }
.bdqe-head > div { padding-top: .55rem; padding-bottom: .55rem; }
.bdqe-lot { background: rgba(var(--erp-primary-rgb), .08); font-weight: 600; }
.bdqe-chapter { background: var(--erp-bg); font-weight: 600; }
.bdqe-total { background: rgba(var(--erp-accent-rgb), .06); font-weight: 600; }
.bdqe-line:hover { background: rgba(var(--erp-primary-rgb), .03); }
.bdqe-line.is-text { font-style: italic; color: var(--erp-muted); }
.bdqe-line.has-error { background: rgba(220, 53, 69, .07); box-shadow: inset 3px 0 0 var(--erp-danger); }
.bdqe-line.is-selected { box-shadow: inset 3px 0 0 var(--erp-accent); }
.bdqe-line .form-control, .bdqe-line .form-select, .bdqe-chapter .form-control, .bdqe-lot .form-control {
    font-size: .8125rem; padding: .15rem .35rem; min-height: 0; border-color: transparent; background-color: transparent;
}
.bdqe-line .form-control:hover, .bdqe-line .form-select:hover, .bdqe-chapter .form-control:hover, .bdqe-lot .form-control:hover { border-color: var(--erp-border); }
.bdqe-line .form-control:focus, .bdqe-line .form-select:focus, .bdqe-chapter .form-control:focus, .bdqe-lot .form-control:focus { border-color: var(--erp-accent); background-color: var(--erp-surface); }
.bdqe-line textarea.form-control { resize: none; overflow: hidden; line-height: 1.35; }
.bdqe-line .form-control:disabled, .bdqe-line .form-select:disabled, .bdqe-chapter .form-control:disabled, .bdqe-lot .form-control:disabled { background: transparent; opacity: 1; color: inherit; }
.bdqe-num { text-align: right; font-family: var(--erp-font-mono); white-space: nowrap; }
.bdqe-num .form-control { text-align: right; font-family: var(--erp-font-mono); }
.bdqe-handle { cursor: grab; color: var(--erp-muted); }
.bdqe-line.sortable-ghost { opacity: .4; background: rgba(var(--erp-accent-rgb), .12); }
.bdqe-c-handle { width: 26px; }
.bdqe-c-number { width: 58px; font-family: var(--erp-font-mono); }
.bdqe-c-designation { width: 360px; }
.bdqe-c-type { width: 120px; }
.bdqe-c-technical_parameter { width: 130px; }
.bdqe-c-element { width: 170px; }
.bdqe-c-specification { width: 170px; }
.bdqe-c-standard { width: 110px; }
.bdqe-c-unit { width: 78px; }
.bdqe-c-quantity, .bdqe-c-corrected_quantity { width: 110px; }
.bdqe-c-workforce, .bdqe-c-duration, .bdqe-c-waste_rate, .bdqe-c-margin_rate, .bdqe-c-price_basis { width: 78px; }
.bdqe-c-cost_unit_price, .bdqe-c-sale_unit_price { width: 120px; }
.bdqe-c-cost_amount, .bdqe-c-sale_amount { width: 150px; }
.bdqe-c-actions { width: 76px; text-align: right; }
.bdqe-totalbar {
    position: sticky; bottom: 0; z-index: 5; background: var(--erp-surface); border-top: 2px solid var(--erp-accent);
    box-shadow: 0 -4px 12px rgba(16, 24, 40, .08); padding: .6rem 1rem; font-size: .8125rem;
}
.bdqe-totalbar .bdqe-total-item { display: flex; flex-direction: column; }
.bdqe-totalbar .bdqe-total-item span:first-child { color: var(--erp-muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; }
.bdqe-totalbar .bdqe-total-item span:last-child { font-family: var(--erp-font-mono); font-weight: 600; white-space: nowrap; }

/* ---------- Planning Gantt (P20, Frappe Gantt 0.6.1) ---------- */
.erp-gantt-wrapper { overflow: auto; max-height: 70vh; border: 1px solid var(--bs-border-color); border-radius: .375rem; }
.erp-gantt-wrapper .gantt .bar { fill: #9fb3c8; }
.erp-gantt-wrapper .gantt .bar-progress { fill: var(--erp-primary, #0F2A4A); }
.erp-gantt-wrapper .gantt .erp-gantt-critical .bar { fill: #f1aeb5; }
.erp-gantt-wrapper .gantt .erp-gantt-critical .bar-progress { fill: var(--erp-danger, #DC3545); }
.erp-gantt-wrapper .gantt .erp-gantt-late .bar { fill: #c5b3e6; stroke: var(--erp-gantt-late); stroke-width: 1.5; }
.erp-gantt-wrapper .gantt .erp-gantt-done .bar { fill: #a3cfbb; }
.erp-gantt-wrapper .gantt .erp-gantt-milestone .bar,
.erp-gantt-wrapper .gantt .erp-gantt-milestone .bar-progress { fill: var(--erp-success, #198754); }
.erp-gantt-wrapper .gantt .erp-gantt-milestone .handle { display: none; }
.erp-gantt-wrapper .gantt .bar-label { font-family: var(--erp-font-sans); font-size: 11px; }
.erp-gantt-key-late { background: var(--erp-gantt-late); }
.erp-gantt-key { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }
.erp-calendar { table-layout: fixed; }
.erp-calendar td { height: 96px; vertical-align: top; }
.erp-calendar .erp-cal-item { display: block; font-size: .7rem; line-height: 1.25; padding: 1px 4px; margin-bottom: 2px; border-radius: 3px; background: #e7edf4;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.erp-calendar .erp-cal-item.is-critical { background: #f8d7da; }
.erp-calendar .erp-cal-item.is-milestone { background: #d1e7dd; font-weight: 600; }
