/* ==========================================================================
   SDC BTP — thème du panneau Filament
   Barre latérale verticale bleue, accent ambre « chantier », surfaces claires.
   Les styles Filament étant déclarés dans des @layer, ces règles (hors couche)
   les remplacent sans !important.
   ========================================================================== */

:root {
    --sdc-navy-950: #071d40;
    --sdc-navy-900: #0b2a5b;
    --sdc-navy-800: #0f3a7d;
    --sdc-navy-700: #1650a8;
    --sdc-amber: #f5a524;
    --sdc-sidebar-text: rgba(255, 255, 255, 0.86);
    --sdc-sidebar-muted: rgba(255, 255, 255, 0.52);
    --sdc-sidebar-hover: rgba(255, 255, 255, 0.08);
    --sdc-sidebar-active: rgba(255, 255, 255, 0.14);
    --sdc-page-bg: #f3f6fb;
    --sdc-card-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 2px 8px rgba(15, 23, 42, 0.05);
}

/* --------------------------------------------------------------------------
   1. Logo
   -------------------------------------------------------------------------- */
.sdc-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    height: 100%;
    color: var(--sdc-navy-900);
    white-space: nowrap;
}
.sdc-logo-mark {
    height: 100%;
    width: auto;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(7, 29, 64, 0.25));
}
.sdc-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}
.sdc-logo-name {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}
.sdc-logo-tagline {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    opacity: 0.7;
}
.dark .sdc-logo { color: #fff; }

/* --------------------------------------------------------------------------
   2. Barre latérale verticale bleue
   -------------------------------------------------------------------------- */
.fi-sidebar {
    background: linear-gradient(180deg, var(--sdc-navy-800) 0%, var(--sdc-navy-900) 55%, var(--sdc-navy-950) 100%);
    border-inline-end: none;
    box-shadow: 4px 0 24px rgba(7, 29, 64, 0.12);
}
.fi-sidebar .sdc-logo { color: #fff; }

.fi-sidebar-header-ctn,
.fi-sidebar-header {
    background: transparent;
    box-shadow: none;
    border: none;
}

/* Sur grand écran, la zone du logo (dans la barre supérieure) prolonge la barre bleue :
   une seule colonne bleue continue, de la largeur de la barre (dépliée ou repliée). */
@media (min-width: 64rem) {
    .fi-body { --sdc-bar: var(--sidebar-collapsed-width, 4.5rem); }
    .fi-body:has(.fi-main-sidebar.fi-sidebar-open) { --sdc-bar: var(--sidebar-width, 17rem); }

    .fi-topbar {
        background:
            linear-gradient(90deg, var(--sdc-navy-800) 0, var(--sdc-navy-800) var(--sdc-bar), transparent var(--sdc-bar)),
            rgba(255, 255, 255, 0.85);
    }
    .dark .fi-topbar {
        background:
            linear-gradient(90deg, var(--sdc-navy-950) 0, var(--sdc-navy-950) var(--sdc-bar), transparent var(--sdc-bar)),
            rgba(15, 23, 42, 0.85);
    }
    .fi-topbar-start .sdc-logo { color: #fff; }
    /* Barre repliée (étroite) : seul le bouton de dépliage reste visible */
    .fi-body:not(:has(.fi-main-sidebar.fi-sidebar-open)) .fi-topbar-start .sdc-logo { display: none; }
    .fi-topbar-start .fi-icon-btn { color: var(--sdc-sidebar-muted); }
    .fi-topbar-start .fi-icon-btn:hover { color: #fff; background-color: var(--sdc-sidebar-hover); }
}

.fi-sidebar-nav { scrollbar-color: rgba(255, 255, 255, 0.2) transparent; }

/* Titres de groupes */
.fi-sidebar-group-label {
    color: var(--sdc-sidebar-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.fi-sidebar-group-btn .fi-icon,
.fi-sidebar-group-collapse-btn { color: var(--sdc-sidebar-muted); }
.fi-sidebar-group-collapse-btn:hover { color: #fff; }

/* Éléments */
.fi-sidebar-item-btn {
    position: relative;
    border-radius: 0.6rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.fi-sidebar-item-label { color: var(--sdc-sidebar-text); font-weight: 500; }
.fi-sidebar-item-icon { color: var(--sdc-sidebar-muted); }

.fi-sidebar-item-btn:hover,
.fi-sidebar-item-btn:focus-visible { background-color: var(--sdc-sidebar-hover); }
.fi-sidebar-item-btn:hover .fi-sidebar-item-label,
.fi-sidebar-item-btn:hover .fi-sidebar-item-icon { color: #fff; }

/* Élément actif : fond translucide + liseré ambre */
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background-color: var(--sdc-sidebar-active);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn::before {
    content: "";
    position: absolute;
    inset-inline-start: -0.75rem;
    top: 0.45rem;
    bottom: 0.45rem;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--sdc-amber);
}
.fi-sidebar-item.fi-active .fi-sidebar-item-label { color: #fff; font-weight: 600; }
.fi-sidebar-item.fi-active .fi-sidebar-item-icon { color: var(--sdc-amber); }

/* Sous-éléments groupés (traits de liaison) */
.fi-sidebar-item-grouped-border-part,
.fi-sidebar-item-grouped-border-part-not-first,
.fi-sidebar-item-grouped-border-part-not-last { background-color: rgba(255, 255, 255, 0.18); }

/* Badges */
.fi-sidebar-item-badge-ctn .fi-badge {
    background-color: rgba(245, 165, 36, 0.18);
    color: #ffd38a;
    box-shadow: none;
}

/* Boutons repli / fermeture de la barre */
.fi-sidebar .fi-icon-btn { color: var(--sdc-sidebar-muted); }
.fi-sidebar .fi-icon-btn:hover { color: #fff; background-color: var(--sdc-sidebar-hover); }

/* Pied de barre (notifications, etc.) */
.fi-sidebar-footer { border-top: 1px solid rgba(255, 255, 255, 0.08); }

/* --------------------------------------------------------------------------
   3. Barre supérieure et fond de page
   -------------------------------------------------------------------------- */
.fi-body { background-color: var(--sdc-page-bg); }
.dark .fi-body { background-color: #0b1220; }

.fi-topbar {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(8px);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}
.dark .fi-topbar { background-color: rgba(15, 23, 42, 0.85); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06); }

.fi-header-heading { letter-spacing: -0.01em; }

/* --------------------------------------------------------------------------
   4. Cartes : sections, tableaux, widgets
   -------------------------------------------------------------------------- */
.fi-section,
.fi-ta-ctn,
.fi-wi-stats-overview-stat,
.fi-wi-chart .fi-section {
    border-radius: 0.9rem;
    box-shadow: var(--sdc-card-shadow);
}

/* Tuiles d'indicateurs : bandeau de couleur discret en haut */
.fi-wi-stats-overview-stat { position: relative; overflow: hidden; }
.fi-wi-stats-overview-stat::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--sdc-navy-700), #3b82f6);
    opacity: 0.85;
}
.fi-wi-stats-overview-stat-value { letter-spacing: -0.02em; }

/* En-têtes de tableaux */
.fi-ta-header-cell { background-color: #f8fafc; }
.dark .fi-ta-header-cell { background-color: rgba(255, 255, 255, 0.02); }
.fi-ta-header-cell-label { font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }

/* --------------------------------------------------------------------------
   5. Page de connexion
   -------------------------------------------------------------------------- */
.fi-simple-layout {
    background:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 32px 32px,
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 32px 32px,
        radial-gradient(1200px 600px at 15% 10%, #1d5fd1 0%, transparent 60%),
        linear-gradient(160deg, var(--sdc-navy-800) 0%, var(--sdc-navy-950) 100%);
    background-color: var(--sdc-navy-900);
}
.fi-simple-main {
    border-radius: 1.1rem;
    box-shadow: 0 24px 60px rgba(7, 29, 64, 0.45);
    border-top: 4px solid var(--sdc-amber);
}
.fi-simple-header .fi-logo { height: 3rem; margin-bottom: 0.5rem; }
.fi-simple-header-heading { color: var(--sdc-navy-900); }
.dark .fi-simple-header-heading { color: #fff; }

/* --------------------------------------------------------------------------
   6. Graphiques : hauteur minimale (Chart.js sans ratio fixe)
   -------------------------------------------------------------------------- */
.fi-wi-chart-canvas-ctn { min-height: 280px; }

/* --------------------------------------------------------------------------
   7. Assistant de démarrage
   -------------------------------------------------------------------------- */
.sdc-onboarding { display: grid; gap: 0.9rem; max-width: 64rem; }
.sdc-step {
    display: flex;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-radius: 0.9rem;
    background: #fff;
    box-shadow: var(--sdc-card-shadow);
    border: 1px solid rgba(15, 23, 42, 0.06);
}
.dark .sdc-step { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.08); }
.sdc-step-index {
    flex-shrink: 0;
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    font-weight: 700;
    color: var(--sdc-navy-800);
    background: #e8effb;
}
.sdc-step-done .sdc-step-index { background: #dcfce7; color: #15803d; }
.sdc-step-check { width: 1.2rem; height: 1.2rem; }
.sdc-step-body { flex: 1; min-width: 0; }
.sdc-step-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.sdc-step-head h3 { font-weight: 700; font-size: 1rem; }
.sdc-step-icon { width: 1.25rem; height: 1.25rem; color: #64748b; }
.sdc-step-body p { margin-top: 0.25rem; font-size: 0.875rem; color: #64748b; }
.dark .sdc-step-body p { color: #94a3b8; }
.sdc-step-actions { margin-top: 0.75rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.sdc-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.25rem;
    border-radius: 0.9rem;
    color: #fff;
    background: linear-gradient(120deg, var(--sdc-navy-800), var(--sdc-navy-700));
    box-shadow: var(--sdc-card-shadow);
    border-inline-start: 4px solid var(--sdc-amber);
}
.sdc-banner-icon { width: 2rem; height: 2rem; color: var(--sdc-amber); flex-shrink: 0; }
.sdc-banner-text { flex: 1; min-width: 14rem; display: flex; flex-direction: column; gap: 0.15rem; }
.sdc-banner-text span { font-size: 0.875rem; color: rgba(255, 255, 255, 0.8); }

/* --------------------------------------------------------------------------
   8. Tableaux simples (pages d'administration)
   -------------------------------------------------------------------------- */
.sdc-table-wrap { overflow-x: auto; }
.sdc-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.sdc-table th {
    text-align: start;
    padding: 0.6rem 1rem 0.6rem 0;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.sdc-table td { padding: 0.7rem 1rem 0.7rem 0; border-bottom: 1px solid rgba(15, 23, 42, 0.05); }
.dark .sdc-table th, .dark .sdc-table td { border-color: rgba(255, 255, 255, 0.08); }
.sdc-table tbody tr:last-child td { border-bottom: none; }
.sdc-table .sdc-num { text-align: end; font-variant-numeric: tabular-nums; }
.sdc-strong { font-weight: 600; }
.sdc-muted { color: #64748b; font-size: 0.875rem; }
.dark .sdc-muted, .dark .sdc-table th { color: #94a3b8; }

/* ---------------------------------------------------------------- 9. Devis (DQE + totaux) */
.sdc-dqe { overflow-x: auto; }
.sdc-dqe .sdc-table td { padding-inline-end: 0.75rem; vertical-align: top; }
.sdc-dqe .sdc-table td:first-child, .sdc-dqe .sdc-table th:first-child { padding-inline-start: 0.5rem; }
.sdc-dqe-lot td {
    background: rgba(37, 99, 235, 0.07);
    color: #1e3a8a;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-size: 0.8rem;
}
.dark .sdc-dqe-lot td { background: rgba(59, 130, 246, 0.14); color: #bfdbfe; }
.sdc-dqe-subtotal td { font-weight: 600; border-bottom: 2px solid rgba(15, 23, 42, 0.12) !important; }
.dark .sdc-dqe-subtotal td { border-color: rgba(255, 255, 255, 0.16) !important; }
.sdc-totals { min-width: 18rem; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.sdc-totals th { text-align: start; font-weight: 500; color: #475569; padding: 0.35rem 1.5rem 0.35rem 0; }
.sdc-totals td { text-align: end; padding: 0.35rem 0; white-space: nowrap; }
.sdc-totals .sdc-total th, .sdc-totals .sdc-total td {
    font-weight: 700;
    color: #0f172a;
    border-top: 1px solid rgba(15, 23, 42, 0.12);
    padding-top: 0.5rem;
}
.dark .sdc-totals th { color: #94a3b8; }
.dark .sdc-totals .sdc-total th, .dark .sdc-totals .sdc-total td { color: #f1f5f9; border-color: rgba(255, 255, 255, 0.16); }

/* ---------------------------------------------------------------- 10. Planning (Gantt) */
.sdc-gantt { --label: 15rem; font-size: 0.8rem; overflow-x: auto; }
.sdc-gantt-head, .sdc-gantt-row { display: flex; min-width: 46rem; }
.sdc-gantt-label { flex: 0 0 var(--label); padding: 0.4rem 0.75rem 0.4rem 0; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.sdc-gantt-label a, .sdc-gantt-label span { font-weight: 600; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sdc-gantt-label a:hover { color: var(--primary-600); }
.sdc-gantt-label small { color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sdc-gantt-track { position: relative; flex: 1 1 auto; }
.sdc-gantt-months, .sdc-gantt-weeks { display: flex; }
.sdc-gantt-months div { font-weight: 600; color: #334155; padding: 0.2rem 0.3rem; border-left: 1px solid rgba(15, 23, 42, 0.12); white-space: nowrap; overflow: hidden; }
.sdc-gantt-weeks div { color: #64748b; font-size: 0.7rem; padding: 0.15rem 0.3rem; border-left: 1px solid rgba(15, 23, 42, 0.06); white-space: nowrap; overflow: hidden; }
.sdc-gantt-head { border-bottom: 1px solid rgba(15, 23, 42, 0.1); }
.sdc-gantt-row { border-bottom: 1px solid rgba(15, 23, 42, 0.05); min-height: 2.6rem; }
.sdc-gantt-grid { position: absolute; top: 0; bottom: 0; border-left: 1px solid rgba(15, 23, 42, 0.05); }
.sdc-gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #d03b3b; opacity: 0.7; z-index: 2; }
.sdc-gantt-bar { position: absolute; top: 0.55rem; height: 1.5rem; border-radius: 4px; background: color-mix(in srgb, var(--bar) 28%, transparent); box-shadow: inset 0 0 0 1px var(--bar); overflow: hidden; z-index: 1; }
.sdc-gantt-fill { height: 100%; background: var(--bar); }
.sdc-gantt-bar span { position: absolute; inset: 0; display: flex; align-items: center; padding-left: 0.4rem; font-size: 0.7rem; font-weight: 600; color: #0f172a; white-space: nowrap; }
.sdc-gantt-milestone { position: absolute; top: 0.85rem; width: 14px; height: 14px; transform: rotate(45deg); border-radius: 2px; z-index: 1; }
.sdc-gantt-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; padding-top: 0.75rem; color: #475569; font-size: 0.75rem; }
.sdc-gantt-legend i { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 3px; margin-right: 0.35rem; vertical-align: -1px; }
.sdc-gantt-legend .sdc-gantt-legend-today { width: 2px; background: #d03b3b; }
.dark .sdc-gantt-months div { color: #e2e8f0; border-color: rgba(255, 255, 255, 0.14); }
.dark .sdc-gantt-weeks div, .dark .sdc-gantt-label small, .dark .sdc-gantt-legend { color: #94a3b8; }
.dark .sdc-gantt-head, .dark .sdc-gantt-row, .dark .sdc-gantt-grid, .dark .sdc-gantt-weeks div { border-color: rgba(255, 255, 255, 0.07); }
.dark .sdc-gantt-bar span { color: #f8fafc; }
@media (max-width: 640px) { .sdc-gantt { --label: 9rem; } }

/* 11. GED — aperçu des documents (PDF, photos, autres fichiers) */
.sdc-doc-preview iframe { display: block; width: 100%; height: min(75vh, 820px); border: 1px solid rgba(15, 23, 42, 0.1); border-radius: 0.5rem; background: #f1f5f9; }
.sdc-doc-preview img { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto; border-radius: 0.5rem; object-fit: contain; }
.sdc-doc-preview__hint, .sdc-doc-preview__empty { margin-top: 0.6rem; font-size: 0.8rem; color: #64748b; }
.sdc-doc-preview__hint a { color: var(--primary-600); text-decoration: underline; }
.sdc-doc-preview__file { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1.25rem; border: 1px dashed rgba(15, 23, 42, 0.2); border-radius: 0.75rem; }
.sdc-doc-preview__file > div { display: flex; flex-direction: column; flex: 1 1 12rem; min-width: 0; }
.sdc-doc-preview__file strong { overflow-wrap: anywhere; }
.sdc-doc-preview__file span { font-size: 0.8rem; color: #64748b; }
.sdc-doc-preview__icon { width: 2.5rem; height: 2.5rem; color: var(--primary-600); }
.dark .sdc-doc-preview iframe { border-color: rgba(255, 255, 255, 0.1); background: #0f172a; }
.dark .sdc-doc-preview__file { border-color: rgba(255, 255, 255, 0.2); }
.dark .sdc-doc-preview__hint, .dark .sdc-doc-preview__file span { color: #94a3b8; }
@media (max-width: 640px) { .sdc-doc-preview iframe { height: 60vh; } }
