  :root {
    /* Spacing & sizing */
    --gap-xs: 4px;
    --gap-sm: 8px;
    --gap-md: 14px;
    --gap-lg: 22px;
    --gap-xl: 36px;
    --radius: 10px;
    --radius-sm: 6px;
    /* Typography sizes */
    --fs-xxs: 10px;
    --fs-xs: 11px;
    --fs-sm: 12px;
    --fs-base: 13px;
    --fs-md: 15px;
    --fs-lg: 18px;
    --fs-xl: 22px;
    --fs-2xl: 28px;
    /* Colors */
    --bg: #0e0e10;
    --surface: #16161a;
    --surface2: #1e1e24;
    --border: #2a2a35;
    --border2: #3a3a48;
    --accent: #c8ff00;
    --accent2: #00d4ff;
    --accent3: #ff6b35;
    --text: #e8e8f0;
    --text2: #9090a8;
    --text3: #5a5a70;
    --green: #39d98a;
    --red: #ff4d6d;
    --yellow: #ffd166;
    --input-bg: #0c0c10;
    --r: 8px;
  }

  :root.light {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface2: #eef0f4;
    --border: #d8dce6;
    --border2: #c4c9d8;
    --accent: #5a8a00;
    --accent2: #006fa8;
    --accent3: #d44f15;
    --text: #1a1a2e;
    --text2: #4a4a6a;
    --text3: #8a8aaa;
    --green: #1a8a52;
    --red: #c0253e;
    --yellow: #a07000;
    --input-bg: #f9fafb;
  }

  /* Theme toggle button */
  .theme-btn {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--r);
    color: var(--text2);
    cursor: pointer;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    padding: 7px 10px;
    transition: all 0.15s;
    line-height: 1;
  }
  .theme-btn:hover { border-color: var(--accent); color: var(--accent); }

    * { box-sizing: border-box; margin: 0; padding: 0; }
  
  /* Inter pour le texte général + JetBrains Mono pour les nombres tabulaires */
  input[inputmode="numeric"],
  .computed-value,
  table tbody td,
  table tfoot td,
  .mini-value,
  .kpi-value,
  .dash-card-value,
  .dash-card-value-sm {
    font-family: 'JetBrains Mono', 'Menlo', monospace;
    font-feature-settings: 'tnum' 1, 'lnum' 1;
  }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    min-height: 100vh;
  }

  /* HEADER */
  .header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky; top: 0; z-index: 100;
  }
  .header-left { display: flex; align-items: center; gap: 16px; }
  .logo {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 18px;
    color: var(--accent);
    letter-spacing: -0.5px;
  }
  .logo span { color: var(--text2); font-weight: 400; }
  .project-badge {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 11px;
    color: var(--text2);
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
  }
  .header-right { display: flex; align-items: center; gap: 12px; }
  .btn {
    padding: 8px 16px;
    border-radius: var(--r);
    border: none;
    cursor: pointer;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s;
  }
  .btn-ghost {
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--text2);
  }
  .btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
  .btn-accent {
    background: var(--accent);
    color: #000;
    font-weight: 700;
  }
  .btn-accent:hover { background: #d9ff33; transform: translateY(-1px); }

  /* LAYOUT */
  .layout { display: flex; height: calc(100vh - 65px); overflow: hidden; position: relative; }
  
  /* SIDEBAR NAV */
  .sidebar {
    width: 200px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px 0;
    position: relative;
    z-index: 10;
    pointer-events: all;
    transition: width 0.2s ease, padding 0.2s ease;
  }
  /* État replié : largeur nulle, contenu masqué */
  .sidebar.collapsed {
    width: 0;
    padding: 0;
    overflow: hidden;
    border-right: none;
  }
  /* Boutons de bascule des panneaux latéraux */
  .panel-toggle {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 60;
    width: 22px;
    height: 54px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.15s;
    user-select: none;
    padding: 0;
  }
  .panel-toggle:hover { background: var(--surface2); color: var(--accent); }
  .panel-toggle.left  { left: 200px; border-radius: 0 6px 6px 0; border-left: none; transition: left 0.2s ease; }
  .panel-toggle.left.collapsed { left: 0; }
  .panel-toggle.right { right: 300px; border-radius: 6px 0 0 6px; border-right: none; transition: right 0.2s ease; }
  .panel-toggle.right.collapsed { right: 0; }
  .nav-section { padding: 0 12px 8px; }
  .nav-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 8px 8px;
  }
  .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.12s;
    color: var(--text2);
    font-size: 12px;
    user-select: none;
    pointer-events: all;
  }
  .nav-item:hover { background: var(--surface2); color: var(--text); }
  .nav-item.active { background: rgba(200,255,0,0.1); color: var(--accent); border: 1px solid rgba(200,255,0,0.2); }
  .nav-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--border2);
    flex-shrink: 0;
  }
  .nav-item.active .nav-dot { background: var(--accent); }
  .nav-divider { height: 1px; background: var(--border); margin: 8px 12px; }

  /* MAIN CONTENT */
  .main {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    scroll-behavior: smooth;
  }

  /* RESULTS PANEL */
  .results-panel {
    width: 300px;
    flex-shrink: 0;
    background: var(--surface);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 20px;
    transition: width 0.2s ease, padding 0.2s ease;
  }
  .results-panel.collapsed {
    width: 0;
    padding: 0;
    overflow: hidden;
    border-left: none;
  }

  /* SECTION */
  .section {
    margin-bottom: 40px;
    scroll-margin-top: 28px;
  }
  .section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }
  /* Sections repliables (J, K, L) */
  .section.collapsible > .section-header { cursor: pointer; user-select: none; }
  .section.collapsible.collapsed > .section-header { margin-bottom: 0; }
  .section.collapsible.collapsed > *:not(.section-header) { display: none !important; }
  .section-chevron { margin-left: auto; font-size: 13px; color: var(--text3); transition: transform 0.2s ease; }
  .section.collapsible:not(.collapsed) > .section-header .section-chevron { transform: rotate(90deg); }
  .section-tag {
    background: var(--accent);
    color: #000;
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
  }
  .section-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
  }

  /* GRID */
  .grid { display: grid; gap: 12px; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  /* Stabilise les colonnes grid : empêche les enfants (selects, inputs)
     d'étendre leur cellule selon le contenu intrinsèque */
  .grid > *, .grid-2 > *, .grid-3 > *, .grid-4 > * {
    min-width: 0;
  }

  /* FIELD */
  .field { display: flex; flex-direction: column; gap: 5px; }
  .field-label {
    font-size: 11px;
    color: var(--text2);
    font-weight: 500;
  }
  .field-sublabel { font-size: 10px; color: var(--text3); }
  
  .field-input {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--r);
    overflow: hidden;
    transition: border-color 0.15s;
  }
  .field-input:focus-within { border-color: var(--accent); }
  
  input[type="number"], input[type="text"], select {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 500;
    padding: 9px 12px;
    width: 100%;
    min-width: 0;          /* casse min-content default — empêche déformation grid */
    max-width: 100%;       /* contient dans le parent même si option longue */
    box-sizing: border-box;
  }
  /* SELECT: visibilité de la valeur courante + des options */
  select {
    color: var(--text) !important;
    background: var(--input-bg) !important;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%239090a8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    padding-right: 28px !important;
    text-overflow: ellipsis;  /* tronque les longues valeurs sans déborder */
    overflow: hidden;
    white-space: nowrap;
  }
  select:hover { color: var(--accent) !important; }
  select:focus { color: var(--accent) !important; }
  /* Options : fond clair-foncé homogène, texte clair */
  select option {
    background-color: #1a1a22 !important;
    color: #e8e8f0 !important;
    font-family: 'Inter', system-ui, sans-serif;
    padding: 8px;
  }
  select option:checked,
  select option:hover {
    background-color: #2a2a35 !important;
    color: #c8ff00 !important;
  }
  /* Tables H : selects bien visibles */
  #depTable select, #ventTable select {
    color: var(--text) !important;
    background-color: var(--input-bg) !important;
    width: 100%;
    min-width: 110px;
    font-size: 12px;
  }
  #depTable select:hover, #ventTable select:hover {
    color: var(--accent) !important;
  }
  input::placeholder { color: var(--text3); font-weight: 400; }
  
  .unit {
    padding: 0 10px;
    color: var(--text3);
    font-size: 11px;
    white-space: nowrap;
    border-left: 1px solid var(--border);
    background: var(--surface);
  }

  /* COMPUTED FIELD */
  .computed {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--r);
    padding: 9px 12px;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .computed-label { font-size: 11px; color: var(--text2); }
  .computed-value { font-weight: 500; color: var(--text); }
  .computed-value.highlight { color: var(--accent2); }

  /* CATEGORY BLOCK */
  .cat-block {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 16px;
    margin-bottom: 12px;
  }
  .cat-title {
    font-family: 'Syne', sans-serif;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .cat-badge {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 10px;
    color: var(--text3);
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 400;
  }

  /* RESULTS PANEL CONTENT */
  .results-title {
    font-family: 'Syne', sans-serif;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }
  .kpi-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 14px;
    margin-bottom: 10px;
  }
  .kpi-label { font-size: 10px; color: var(--text3); margin-bottom: 4px; }
  .kpi-value {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
  }
  .kpi-sub { font-size: 10px; color: var(--text3); margin-top: 2px; }
  .kpi-good { border-color: rgba(57,217,138,0.3); }
  .kpi-good .kpi-value { color: var(--green); }
  .kpi-warn { border-color: rgba(255,209,102,0.3); }
  .kpi-warn .kpi-value { color: var(--yellow); }
  .kpi-bad { border-color: rgba(255,77,109,0.3); }
  .kpi-bad .kpi-value { color: var(--red); }
  .kpi-neutral .kpi-value { color: var(--accent2); }

  .results-section-title {
    font-size: 10px;
    font-weight: 500;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 16px 0 8px;
  }

  .mini-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
  }
  .mini-row:last-child { border-bottom: none; }
  .mini-label { color: var(--text2); }
  .mini-value { color: var(--text); font-weight: 500; }
  .mini-value.pos { color: var(--green); }
  .mini-value.neg { color: var(--red); }

  /* TABS */
  .tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--surface2);
    border-radius: var(--r);
    padding: 4px;
    border: 1px solid var(--border);
  }
  .tab {
    flex: 1;
    text-align: center;
    padding: 7px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    color: var(--text2);
    transition: all 0.15s;
  }
  .tab.active {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border2);
  }

  /* TOOLTIP */
  .info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--border2);
    color: var(--text3);
    font-size: 9px;
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
  }

  /* PROGRESS BAR */
  .progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
  }
  .progress-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--accent);
    transition: width 0.4s ease;
  }
  .progress-fill.green { background: var(--green); }
  .progress-fill.red { background: var(--red); }
  .progress-fill.yellow { background: var(--yellow); }

  /* STATUS */
  .status-dot {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    margin-right: 6px;
  }
  .status-dot.green { background: var(--green); }
  .status-dot.red { background: var(--red); }
  .status-dot.yellow { background: var(--yellow); }

  /* SENSITIVITY */
  .sensitivity-grid {
    display: grid;
    grid-template-columns: auto repeat(5, 1fr);
    gap: 2px;
    font-size: 10px;
  }
  .sens-cell {
    padding: 5px 6px;
    text-align: center;
    border-radius: 3px;
    background: var(--surface2);
  }
  .sens-header { color: var(--text3); font-weight: 500; background: transparent; }
  .sens-label { color: var(--text2); text-align: left; padding-left: 0; background: transparent; }
  .sens-pos { background: rgba(57,217,138,0.15); color: var(--green); }
  .sens-neg { background: rgba(255,77,109,0.15); color: var(--red); }
  .sens-neutral { color: var(--text); }
  .sens-current { background: rgba(200,255,0,0.15); color: var(--accent); border: 1px solid rgba(200,255,0,0.3); }

  /* CASHFLOW CHART */
  #cashflow-chart { width: 100%; height: 220px; display: block; }

  .divider-label {
    font-size: 10px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 8px 0 4px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .divider-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
  }

  /* MODAL */
  .modal-overlay {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
  }
  .modal-box {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 14px;
    padding: 28px;
    width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
  }
  .modal-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .modal-close {
    background: transparent;
    border: none;
    color: var(--text3);
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    line-height: 1;
  }
  .modal-close:hover { color: var(--text); }
  .scenario-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--r);
    border: 1px solid var(--border);
    margin-bottom: 8px;
    background: var(--surface2);
    transition: border-color 0.15s;
  }
  .scenario-row:hover { border-color: var(--border2); }
  .scenario-name {
    flex: 1;
    font-size: 12px;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .scenario-meta {
    font-size: 10px;
    color: var(--text3);
    white-space: nowrap;
  }
  .scenario-btn {
    background: transparent;
    border: 1px solid var(--border2);
    border-radius: 5px;
    color: var(--text2);
    cursor: pointer;
    font-size: 10px;
    padding: 3px 8px;
    white-space: nowrap;
    font-family: 'Inter', system-ui, sans-serif;
  }
  .scenario-btn:hover { background: var(--surface); color: var(--text); }
  .scenario-btn.danger:hover { border-color: var(--red); color: var(--red); }
  .scenario-btn.load { border-color: rgba(200,255,0,0.3); color: var(--accent); }
  .scenario-btn.load:hover { background: rgba(200,255,0,0.08); }
  .save-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
  }
  .save-input {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--border2);
    border-radius: var(--r);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 12px;
    outline: none;
    padding: 8px 12px;
    transition: border-color 0.15s;
  }
  .save-input:focus { border-color: var(--accent); }
  .empty-state {
    text-align: center;
    color: var(--text3);
    font-size: 11px;
    padding: 24px 0;
  }


  /* PERIOD SELECTOR BUTTONS */
  .period-btn, .period-btn-cf {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    color: var(--text2);
    cursor: pointer;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: var(--fs-xs);
    padding: 7px 13px;
    transition: all 0.15s;
    letter-spacing: 0.4px;
  }
  .period-btn:hover, .period-btn-cf:hover {
    border-color: var(--accent);
    color: var(--accent);
  }
  .period-btn.active, .period-btn-cf.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.6px;
    box-shadow: 0 0 12px rgba(200,255,0,0.2);
  }

  /* DASHBOARD — section synthétique */
  .dash-group-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 0 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
  }
  .dash-grid-jalons {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  /* TIMELINE JALONS — vue visuelle des étapes clés */
  .timeline-jalons {
    position: relative;
    height: 130px;
    padding: 50px 30px 40px;
    background: linear-gradient(135deg, var(--surface2) 0%, rgba(200,255,0,0.02) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-top: 0;
  }
  .timeline-track-bg {
    position: absolute;
    left: 30px;
    right: 30px;
    top: 50%;
    height: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 3px;
    transform: translateY(-50%);
  }
  .timeline-track-fill {
    position: absolute;
    top: 50%;
    height: 6px;
    background: linear-gradient(90deg, var(--accent2) 0%, var(--accent) 100%);
    border-radius: 3px;
    transform: translateY(-50%);
    transition: all 0.3s;
  }
  .timeline-events {
    position: absolute;
    left: 30px;
    right: 30px;
    top: 0;
    bottom: 0;
  }
  .timeline-event {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
  }
  .timeline-event-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--bg);
    box-shadow: 0 0 0 1px var(--accent), 0 0 12px rgba(200,255,0,0.4);
    cursor: pointer;
    transition: transform 0.15s;
  }
  .timeline-event:hover .timeline-event-dot { transform: scale(1.3); }
  .timeline-event-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 10px;
    color: var(--text2);
    text-align: center;
    line-height: 1.3;
  }
  .timeline-event-label-top {
    bottom: calc(100% + 8px);
  }
  .timeline-event-label-top::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    width: 1px;
    height: 4px;
    background: var(--text3);
  }
  .timeline-event-label-bot {
    top: calc(100% + 8px);
  }
  .timeline-event-label-bot::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    width: 1px;
    height: 4px;
    background: var(--text3);
  }
  .timeline-event-name {
    color: var(--accent);
    font-weight: 700;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  .timeline-event-mois {
    color: var(--text);
    font-weight: 600;
  }
  .timeline-axis {
    position: absolute;
    left: 30px;
    right: 30px;
    bottom: 12px;
    display: flex;
    justify-content: space-between;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 9px;
    color: var(--text3);
  }
  .timeline-duree {
    position: absolute;
    top: 12px;
    right: 30px;
    background: var(--accent);
    color: var(--bg);
    font-family: 'Syne', sans-serif;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    letter-spacing: 0.4px;
  }
  .dash-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px 12px;
    transition: all 0.15s;
    position: relative;
    overflow: hidden;
  }
  .dash-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--border2);
    transition: background 0.2s;
  }
  .dash-card:hover {
    border-color: var(--border2);
    transform: translateY(-1px);
  }
  .dash-card-good::before { background: var(--green); }
  .dash-card-good { border-color: rgba(57,217,138,0.25); }
  .dash-card-good .dash-card-value { color: var(--green); }
  .dash-card-warn::before { background: var(--yellow); }
  .dash-card-warn { border-color: rgba(255,209,102,0.25); }
  .dash-card-warn .dash-card-value { color: var(--yellow); }
  .dash-card-neutral::before { background: var(--accent2); }
  .dash-card-neutral { border-color: rgba(0,212,255,0.25); }
  .dash-card-neutral .dash-card-value { color: var(--accent2); }
  .dash-card-bad::before { background: var(--red); }
  .dash-card-bad { border-color: rgba(255,77,109,0.25); }
  .dash-card-bad .dash-card-value { color: var(--red); }
  .dash-card-jalon::before { background: var(--accent); }
  .dash-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 8px;
  }
  .dash-card-label {
    color: var(--text2);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
    font-family: 'Inter', system-ui, sans-serif;
  }
  .dash-card-spark {
    flex-shrink: 0;
    line-height: 1;
  }
  .dash-card-spark canvas {
    display: block;
    width: 60px !important;
    height: 20px !important;
    max-width: 60px;
    max-height: 20px;
  }
  .dash-card-value {
    font-family: 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.3px;
    color: var(--text);
    word-break: break-word;
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' 1, 'lnum' 1;
  }
  .dash-card-value-sm {
    font-family: 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
  }
  .dash-card-value.pos { color: var(--green); }
  .dash-card-value.neg { color: var(--red); }
  .dash-card-sub {
    color: var(--text3);
    font-size: 11px;
    margin-top: 6px;
    letter-spacing: 0.2px;
    line-height: 1.35;
    font-family: 'Inter', system-ui, sans-serif;
  }

  /* TABLES — plus lisibles */
  table {
    font-variant-numeric: tabular-nums;
  }
  /* Inputs DANS les tables (H, FF, frais dev) — plus généreux */
  table input[type="number"], table input[type="text"] {
    padding: 7px 9px !important;
    font-size: 12px !important;
    min-width: 0;
    box-sizing: border-box;
  }
  table .field-input {
    border-radius: 5px;
  }
  table .field-input:focus-within {
    box-shadow: 0 0 0 2px rgba(200,255,0,0.15);
  }
  /* Numerics avec apostrophes — alignement à droite et un peu plus de souffle */
  input[inputmode="numeric"] {
    text-align: right;
    letter-spacing: 0.3px;
  }

  /* DUAL RANGE SLIDER pour début/fin */
  .range-dual {
    position: relative;
    width: 100%;
    height: 28px;
    margin: 0;
    padding: 0;
  }
  .range-dual .track {
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 4px;
    background: var(--surface2);
    border-radius: 4px;
    border: 1px solid var(--border);
  }
  .range-dual .track-fill {
    position: absolute;
    top: 0; bottom: 0;
    background: linear-gradient(90deg, var(--accent2) 0%, var(--accent) 100%);
    border-radius: 4px;
  }
  .range-dual input[type="range"] {
    position: absolute;
    left: 0; right: 0;
    top: 0;
    width: 100%;
    height: 28px;
    margin: 0;
    padding: 0;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
  }
  .range-dual input[type="range"]::-webkit-slider-runnable-track {
    background: transparent;
    height: 28px;
    border: none;
  }
  .range-dual input[type="range"]::-moz-range-track {
    background: transparent;
    height: 28px;
    border: none;
  }
  .range-dual input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
    box-shadow: 0 0 0 1px var(--accent), 0 2px 6px rgba(0,0,0,0.4);
    cursor: pointer;
    pointer-events: auto;
    margin-top: 0;
    transition: transform 0.1s;
  }
  .range-dual input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
  .range-dual input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.25); }
  .range-dual input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
    box-shadow: 0 0 0 1px var(--accent), 0 2px 6px rgba(0,0,0,0.4);
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.1s;
  }
  .range-dual input[type="range"]::-moz-range-thumb:hover { transform: scale(1.15); }
  .range-dual .range-min { z-index: 2; }
  .range-dual .range-max { z-index: 1; }
  /* Tooltips au survol */
  .range-dual .tooltip {
    position: absolute;
    top: -22px;
    transform: translateX(-50%);
    background: var(--surface2);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--accent);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 9px;
    padding: 2px 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    white-space: nowrap;
  }
  .range-dual:hover .tooltip { opacity: 1; }
  /* Graduations */
  .range-dual .ticks {
    position: absolute;
    left: 0; right: 0;
    bottom: -2px;
    height: 4px;
    pointer-events: none;
  }
  .range-dual .ticks span {
    position: absolute;
    top: 0;
    width: 1px;
    height: 4px;
    background: var(--text3);
    opacity: 0.4;
  }
  .range-dual-row td {
    padding-top: 0 !important;
    padding-bottom: 8px !important;
  }
  table thead tr {
    background: var(--surface2);
  }
  table thead th {
    font-family: 'Syne', sans-serif;
    font-size: var(--fs-xxs) !important;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    font-weight: 600 !important;
    padding: 10px 10px !important;
  }
  table tbody td {
    padding: 8px 10px !important;
    font-size: var(--fs-sm);
  }
  table tbody tr {
    transition: background 0.1s;
  }
  table tbody tr:hover {
    background: var(--surface2);
  }
  table tfoot tr td {
    padding: 10px !important;
    font-size: var(--fs-sm) !important;
  }

  /* PRINT — Export PDF mis en page */
  @page {
    size: A4 portrait;
    margin: 14mm 12mm 16mm 12mm;
  }
  @media print {
    /* Force light theme for print */
    :root, :root.light {
      --bg: #ffffff !important;
      --surface: #ffffff !important;
      --surface2: #f5f6fa !important;
      --border: #d0d4dc !important;
      --border2: #b0b4bf !important;
      --accent: #5a8000 !important;
      --accent2: #006fa8 !important;
      --accent3: #c0451c !important;
      --text: #1a1a2e !important;
      --text2: #4a4a6a !important;
      --text3: #7a7a96 !important;
      --green: #157040 !important;
      --red: #b0203a !important;
      --yellow: #806000 !important;
      --input-bg: #ffffff !important;
    }
    body {
      background: #ffffff !important;
      background-image: none !important;
      color: #1a1a2e !important;
      font-size: 10pt !important;
    }
    /* Hide UI chrome */
    header, .sidebar, .nav-sidebar, .results-panel, .toast, .modal-overlay,
    .theme-btn, .btn, .info-icon, .panel-toggle { display: none !important; }
    /* Full-width content */
    .main-layout, .layout { display: block !important; padding: 0 !important; }
    main { width: 100% !important; max-width: 100% !important; padding: 0 !important; margin: 0 !important; }
    /* Sections */
    .section {
      break-inside: avoid;
      page-break-inside: avoid;
      margin-bottom: 8mm !important;
      padding: 6mm !important;
      box-shadow: none !important;
      border: 1px solid #c4c8d2 !important;
      border-radius: 6px !important;
    }
    .section-tag {
      background: #5a8000 !important;
      color: #ffffff !important;
      box-shadow: none !important;
    }
    .section-title { font-size: 13pt !important; }
    .divider-label {
      color: #5a8000 !important;
      font-size: 9pt !important;
      border-bottom: 1px solid #c4c8d2 !important;
      page-break-after: avoid;
    }
    /* Inputs en lecture */
    input, select {
      border: none !important;
      background: transparent !important;
      color: #1a1a2e !important;
      font-weight: 500 !important;
      padding: 0 !important;
      box-shadow: none !important;
      -webkit-appearance: none !important;
      appearance: none !important;
    }
    select {
      background-image: none !important;
      padding-right: 0 !important;
    }
    .field-input { border: none !important; padding: 1px 0 !important; }
    /* Tables */
    table { break-inside: auto; page-break-inside: auto; font-size: 8.5pt !important; }
    tr    { break-inside: avoid; page-break-inside: avoid; }
    thead { display: table-header-group; }
    table thead tr { background: #f0f2f6 !important; }
    table tbody tr:hover { background: transparent !important; }
    /* Canvas: keep visible */
    canvas { max-width: 100% !important; height: auto !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    /* KPI / badges colorés */
    .kpi-card, .sens-cell, .cat-badge, .computed, .kpi-good, .kpi-warn, .kpi-bad, .kpi-neutral {
      print-color-adjust: exact;
      -webkit-print-color-adjust: exact;
    }
    .kpi-card { padding: 5mm !important; }
    .kpi-value { font-size: 14pt !important; }
    /* Saut de page entre groupes */
    .pdf-page-break { page-break-before: always; break-before: page; }
    /* Mode partiel: cache les sections non sélectionnées */
    body.pdf-paramAH .section:not(#secA):not(#secB):not(#secC):not(#secD):not(#secE):not(#secF):not(#secG):not(#secH) {
      display: none !important;
    }
    body.pdf-analyseIJ .section:not(#secI):not(#secJ) {
      display: none !important;
    }
    /* Footer page */
    .pdf-header-info {
      display: block !important;
      text-align: center;
      font-family: 'Syne', sans-serif;
      font-size: 11pt;
      font-weight: 700;
      color: #5a8000;
      margin-bottom: 4mm;
      padding-bottom: 2mm;
      border-bottom: 2px solid #5a8000;
    }
  }
  .pdf-header-info { display: none; }

  /* SCROLLBAR */
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

  /* TOAST */
  .toast {
    position: fixed;
    bottom: 20px; right: 20px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--r);
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text);
    z-index: 999;
    transform: translateY(60px);
    opacity: 0;
    transition: all 0.3s;
  }
  .toast.show { transform: translateY(0); opacity: 1; }
  .toast.success { border-color: rgba(57,217,138,0.4); color: var(--green); }

  /* RESPONSIVE */
  @media (max-width: 1200px) {
    .results-panel { width: 260px; }
  }
  @media (max-width: 900px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-4 { grid-template-columns: 1fr 1fr; }
    .results-panel { display: none; }
  }

  /* ─── Connexion et sélection de projet ──────────────────────────────────── */
  .pf-auth {
    position: fixed; inset: 0; z-index: 10000;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    padding: var(--gap-lg);
  }
  .pf-auth-card {
    width: 100%; max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--gap-xl) var(--gap-lg) var(--gap-lg);
  }
  .pf-auth-logo {
    font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -0.5px;
    color: var(--text); text-align: center;
  }
  .pf-auth-logo span { color: var(--accent); }
  .pf-auth-sub {
    font-size: var(--fs-xs); color: var(--text3);
    text-align: center; margin-bottom: var(--gap-xl);
  }
  .pf-auth-label {
    display: block; font-size: var(--fs-xs); color: var(--text2);
    margin-bottom: var(--gap-xs); margin-top: var(--gap-md);
  }
  .pf-auth-input {
    width: 100%; box-sizing: border-box;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border2); border-radius: var(--radius-sm);
    padding: 9px 11px; font-size: var(--fs-base); font-family: inherit;
  }
  .pf-auth-input:focus { outline: none; border-color: var(--accent); }
  .pf-auth-hint {
    font-size: var(--fs-xxs); color: var(--text3); margin-top: var(--gap-xs);
  }
  .pf-auth-btn {
    width: 100%; margin-top: var(--gap-lg);
    background: var(--accent); color: #101014;
    border: none; border-radius: var(--radius-sm);
    padding: 11px; font-size: var(--fs-base); font-weight: 700;
    font-family: inherit; cursor: pointer;
  }
  .pf-auth-btn:hover { filter: brightness(1.08); }
  .pf-auth-btn:disabled { opacity: 0.55; cursor: default; }
  .pf-auth-switch {
    margin-top: var(--gap-md); text-align: center;
    font-size: var(--fs-xs); color: var(--text3);
  }
  .pf-auth-switch a { color: var(--accent2); text-decoration: none; }
  .pf-auth-switch a:hover { text-decoration: underline; }
  .pf-auth-error {
    background: rgba(255, 77, 109, 0.1);
    border: 1px solid var(--red); border-radius: var(--radius-sm);
    color: var(--red); font-size: var(--fs-xs);
    padding: var(--gap-sm) var(--gap-md); margin-bottom: var(--gap-md);
  }

  .pf-project-select {
    background: var(--surface2); color: var(--text);
    border: 1px solid var(--border2); border-radius: var(--radius-sm);
    padding: 5px 9px; font-size: var(--fs-xs); font-family: inherit;
    max-width: 230px; margin-left: var(--gap-sm); cursor: pointer;
  }
  .pf-project-select:focus { outline: none; border-color: var(--accent); }
  .pf-project-new { padding: 5px 10px !important; }
  .pf-user-badge {
    font-size: var(--fs-xxs); color: var(--text3);
    margin-right: var(--gap-xs); white-space: nowrap;
    background: none; border: none; font-family: inherit; cursor: pointer;
    padding: 4px 6px; border-radius: var(--radius-sm);
  }
  .pf-user-badge:hover { color: var(--text); background: var(--surface2); }

  /* ─── Assistant de démarrage ───────────────────────────────────────────── */
  .pf-as {
    position: fixed; inset: 0; z-index: 9000;
    background: rgba(6, 6, 8, 0.78);
    display: flex; align-items: center; justify-content: center;
    padding: var(--gap-lg);
  }
  .pf-as-carte {
    position: relative;
    width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    padding: var(--gap-xl) var(--gap-xl) var(--gap-lg);
  }
  .pf-as-fermer {
    position: absolute; top: 12px; right: 14px;
    background: none; border: none; cursor: pointer;
    color: var(--text3); font-size: var(--fs-md); line-height: 1;
  }
  .pf-as-fermer:hover { color: var(--text); }
  .pf-as-etape {
    font-size: var(--fs-xxs); text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--accent);
  }
  .pf-as-titre {
    margin: var(--gap-xs) 0 var(--gap-sm);
    font-size: var(--fs-xl); font-weight: 700; color: var(--text);
  }
  .pf-as-intro {
    margin: 0 0 var(--gap-lg);
    font-size: var(--fs-sm); color: var(--text2); line-height: 1.55;
  }
  .pf-as-champs { display: flex; flex-direction: column; gap: var(--gap-md); }
  .pf-as-label {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: var(--fs-xs); color: var(--text2); margin-bottom: var(--gap-xs);
  }
  .pf-as-unite { font-size: var(--fs-xxs); color: var(--text3); }
  .pf-as-input {
    width: 100%; box-sizing: border-box;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border2); border-radius: var(--radius-sm);
    padding: 9px 11px; font-size: var(--fs-base); font-family: inherit;
  }
  .pf-as-input:focus { outline: none; border-color: var(--accent); }
  .pf-as-aide {
    margin-top: var(--gap-xs);
    font-size: var(--fs-xxs); color: var(--text3); line-height: 1.5;
  }
  .pf-as-apercu {
    margin-top: var(--gap-lg); padding: var(--gap-sm) var(--gap-md);
    background: var(--surface2); border-left: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm); color: var(--text2);
  }
  .pf-as-bilan {
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap-sm);
    margin-top: var(--gap-md);
  }
  .pf-as-kpi {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: var(--gap-sm) var(--gap-md);
    display: flex; flex-direction: column; gap: 2px;
  }
  .pf-as-kpi span { font-size: var(--fs-xxs); color: var(--text3); }
  .pf-as-kpi strong { font-size: var(--fs-md); color: var(--text); }
  .pf-as-kpi.accent { border-color: var(--accent); }
  .pf-as-kpi.accent strong { color: var(--accent); }
  .pf-as-pied {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: var(--gap-xl);
  }
  .pf-as-btn {
    background: var(--accent); color: #101014;
    border: none; border-radius: var(--radius-sm);
    padding: 10px 20px; font-size: var(--fs-sm); font-weight: 700;
    font-family: inherit; cursor: pointer;
  }
  .pf-as-btn:hover { filter: brightness(1.08); }
  .pf-as-btn.secondaire {
    background: none; color: var(--text2); border: 1px solid var(--border2);
    font-weight: 500;
  }
  .pf-as-btn.secondaire:hover { color: var(--text); border-color: var(--text3); }

  @media (max-width: 560px) {
    .pf-as-bilan { grid-template-columns: 1fr; }
  }
