.app-body { background: var(--bg-alt); }

.app-auth-gate {
  position: fixed; inset: 0; z-index: 300; background: var(--bg-alt);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.app-auth-gate-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 36px; max-width: 400px; width: 100%;
}

.payment-issue-banner {
  display: flex; align-items: center; gap: 10px; background: #FDF1DE; color: #B45309;
  border-bottom: 1px solid #F4D9AE; padding: 10px 20px; font-size: .84rem; font-weight: 600;
}
.payment-issue-banner svg { flex-shrink: 0; }
.payment-issue-banner span { flex: 1; }
.payment-issue-banner button {
  background: #B45309; color: #fff; border: none; padding: 6px 14px; border-radius: 8px;
  font-size: .8rem; font-weight: 700; cursor: pointer; flex-shrink: 0;
}
.payment-issue-banner button:hover { background: #92420A; }

.app-topbar {
  height: 64px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.app-topbar-right { display: flex; align-items: center; gap: 14px; }
.app-actions { display: flex; gap: 10px; }

.app-shell { display: flex; min-height: calc(100vh - 64px); }

.app-sidebar {
  width: 232px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 24px;
}
.tab-nav { display: flex; flex-direction: column; gap: 4px; }
.tab-nav-divider { height: 1px; background: var(--border); margin: 8px 4px 10px; }
.account-menu-wrap { position: relative; display: inline-flex; align-items: center; }
.account-avatar-btn {
  display: flex; align-items: center; gap: 6px; background: none; border: 1px solid transparent;
  cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 24px; transition: background .15s ease, border-color .15s ease;
}
.account-avatar-btn:hover { background: var(--bg-alt); border-color: var(--border); }
.account-avatar-btn[aria-expanded="true"] { background: var(--bg-alt); border-color: var(--border); }
.account-avatar-circle {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue), var(--navy)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .82rem; font-family: var(--font-display);
}
.account-chevron { width: 14px; height: 14px; color: var(--gray-400); transition: transform .15s ease; }
.account-avatar-btn[aria-expanded="true"] .account-chevron { transform: rotate(180deg); }

.account-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60;
  min-width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 6px; display: none; flex-direction: column;
}
.account-dropdown.open { display: flex; }
.account-dropdown .account-dropdown-header { padding: 12px 14px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.account-dropdown .account-email { display: block; font-weight: 700; font-size: .92rem; color: var(--text); word-break: break-all; }
.account-dropdown .account-cancel-notice {
  display: inline-block; margin-top: 8px; color: var(--amber, #B45309); background: var(--amber-light, #FDF1DE);
  padding: 4px 10px; border-radius: 20px; font-size: .74rem; font-weight: 600;
}
.account-dropdown .account-usage-notice {
  display: inline-block; margin-top: 8px; color: var(--text-muted); background: var(--bg-alt);
  padding: 4px 10px; border-radius: 20px; font-size: .74rem; font-weight: 600;
}
.account-dropdown .account-menu-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px;
  font-size: .86rem; font-weight: 600; color: var(--text); cursor: pointer; text-decoration: none;
  background: none; border: none; width: 100%; text-align: left; font-family: var(--font-body);
}
.account-dropdown .account-menu-item:hover { background: var(--bg-alt); }
.account-dropdown .account-menu-item.account-upgrade { color: var(--blue); }
.account-dropdown .account-menu-item.account-logout-item { color: var(--red); }
.account-dropdown .account-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.account-dropdown .account-login-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px;
  font-size: .86rem; font-weight: 600; color: var(--blue); text-decoration: none;
}
.account-dropdown .account-login-link:hover { background: var(--bg-alt); }

.commerce-clickable-row { cursor: pointer; }
.commerce-clickable-row:hover { background: var(--blue-light); }
.commerce-stock-empty { background: var(--red-light); color: var(--red); font-weight: 700; }
.sortable-th { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable-th:hover { color: var(--blue); }
.sortable-th .sort-indicator { color: var(--blue); font-size: .7rem; }

.tab-btn-home { background: var(--blue-light); color: var(--blue); font-weight: 700; }
.tab-btn-home:hover:not(:disabled) { background: var(--blue-light); color: var(--blue-hover); }
.tab-btn-home:disabled { background: transparent; color: var(--gray-400); }
.tab-home-badge {
  width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--blue), var(--navy));
}
.tab-home-badge svg { width: 12px; height: 12px; }
.sidebar-report-export { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.sidebar-report-export .btn svg { stroke: currentColor; }
.tab-btn {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: none; background: transparent; color: var(--text-muted); font-weight: 500; font-size: .9rem;
  cursor: pointer; text-align: left; width: 100%; font-family: var(--font-body);
}
.tab-btn svg { width: 17px; height: 17px; stroke: currentColor; flex-shrink: 0; }
.tab-btn:hover:not(:disabled) { background: var(--bg-alt); color: var(--text); }
.tab-btn.active { background: var(--blue-light); color: var(--blue); font-weight: 600; }
.tab-btn:disabled { opacity: .4; cursor: not-allowed; }

.sidebar-filters { border-top: 1px solid var(--border); padding-top: 16px; }
.sidebar-filters h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-400); margin-bottom: 10px; }
.filter-group { margin-bottom: 14px; }
.filter-group label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 6px; }
.filter-group select { width: 100%; }

.app-content { flex: 1; padding: 32px; max-width: 100%; overflow-x: hidden; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.stat-section-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; color: var(--text); margin: 0 0 16px; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 48px 24px; text-align: center;
  cursor: pointer; transition: border-color .15s ease, background .15s ease; background: var(--surface); width: 100%;
}
.dropzone svg { stroke: var(--gray-400); margin-bottom: 12px; flex-shrink: 0; }
.dropzone p { margin: 0; }
.dropzone:hover, .dropzone.drag-over { border-color: var(--blue); background: var(--blue-light); }
.link-like { color: var(--blue); font-weight: 600; text-decoration: underline; }
.import-error { color: var(--red); background: var(--red-light); padding: 10px 14px; border-radius: var(--radius-sm); margin-top: 14px; font-size: .88rem; }
.import-source-toggle { display: inline-flex; gap: 4px; background: var(--bg-alt); border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.import-source-btn { padding: 8px 18px; border: none; background: transparent; border-radius: 7px; font-family: var(--font-body); font-weight: 600; font-size: .85rem; color: var(--gray-600); cursor: pointer; }
.import-source-btn.active { background: var(--surface); color: var(--blue); box-shadow: var(--shadow-sm); }
.import-loading { display: flex; align-items: center; gap: 10px; color: var(--blue); background: var(--blue-light); padding: 10px 14px; border-radius: var(--radius-sm); margin-top: 14px; font-size: .88rem; font-weight: 600; }
.import-spinner { width: 16px; height: 16px; border: 2px solid var(--blue-light); border-top-color: var(--blue); border-radius: 50%; animation: mdr-spin .7s linear infinite; flex-shrink: 0; }
@keyframes mdr-spin { to { transform: rotate(360deg); } }

.table-wrap { overflow: auto; max-height: 520px; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
table.data-table { width: 100%; border-collapse: collapse; font-size: .87rem; }
table.data-table th, table.data-table td { padding: 11px 16px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.data-table thead th {
  position: sticky; top: 0; background: var(--navy); color: #fff; font-family: var(--font-mono);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; z-index: 2; border-bottom: none;
}
html.dark table.data-table thead th { background: #0B1220; }
table.data-table tbody tr:nth-child(even) td { background: var(--bg-alt); }
table.data-table tbody tr:hover td { background: var(--blue-light); }
table.data-table td.num, table.data-table th.num { font-family: var(--font-mono); text-align: right; }
table.data-table tbody tr.clickable-row { cursor: pointer; }
table.data-table tbody tr.clickable-row td:first-child { color: var(--blue); font-weight: 600; }
table.data-table tbody tr.clickable-row:hover td:first-child { text-decoration: underline; }
.col-type-badge { font-family: var(--font-mono); font-size: .65rem; padding: 1px 6px; border-radius: 8px; margin-left: 6px; }

/* Modal (détail de colonne) */
.mdr-modal-overlay {
  position: fixed; inset: 0; background: rgba(11,18,32,.55); display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 20px;
}
.mdr-modal {
  background: var(--surface); border-radius: var(--radius-lg); max-width: 760px; width: 100%;
  max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.mdr-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.mdr-modal-header h3 { margin: 0; }
.mdr-modal-close { background: none; border: none; font-size: 1.3rem; color: var(--text-muted); cursor: pointer; line-height: 1; padding: 4px; }
.mdr-modal-close:hover { color: var(--text); }
.mdr-modal-body { padding: 20px 24px; }
.detail-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.detail-stat { background: var(--bg-alt); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.detail-stat .v { font-family: var(--font-mono); font-weight: 600; font-size: 1.05rem; }
.detail-stat .l { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }

/* Filtre-builder professionnel (barre + popover, remplace l'ancienne sidebar) */
.filter-bar {
  display: flex; align-items: flex-start; gap: 14px; margin-bottom: 24px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.filter-bar-label {
  display: flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 700; color: var(--gray-600);
  text-transform: uppercase; letter-spacing: .03em; padding: 8px 4px; flex-shrink: 0;
}
.filter-bar-label svg { width: 15px; height: 15px; stroke: var(--blue); }
.filter-bar-divider { width: 1px; align-self: stretch; background: var(--border); flex-shrink: 0; }
.filter-count-badge {
  background: var(--blue); color: #fff; font-size: .68rem; font-weight: 700; border-radius: 20px;
  padding: 1px 7px; margin-left: 4px;
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; min-width: 0; }
.filter-add-wrap { position: relative; }
.filter-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--blue-light); color: var(--blue); padding: 6px 8px 6px 12px; border-radius: 20px; font-size: .82rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; }
.filter-chip:hover { border-color: var(--blue); box-shadow: var(--shadow-sm); }
.filter-chip .filter-chip-icon { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; flex-shrink: 0; }
.filter-chip .filter-chip-icon svg { width: 100%; height: 100%; }
.filter-chip .filter-chip-icon.type-categorical { color: var(--amber, #B45309); }
.filter-chip .filter-chip-icon.type-numeric { color: var(--blue); }
.filter-chip .filter-chip-icon.type-date { color: var(--green); }
.filter-popover-col-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; }
.filter-popover-col-icon svg { width: 100%; height: 100%; }
.filter-popover-col-icon.type-categorical { color: var(--amber, #B45309); }
.filter-popover-col-icon.type-numeric { color: var(--blue); }
.filter-popover-col-icon.type-date { color: var(--green); }
.commerce-field-label { display: flex; align-items: center; gap: 7px; }
.commerce-field-icon { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; flex-shrink: 0; color: var(--blue); }
.commerce-field-icon svg { width: 100%; height: 100%; }
.commerce-mapping-select.commerce-mapping-missing { border-color: var(--red); color: var(--red); background: var(--red-light); }
.commerce-mapping-select.commerce-mapping-missing:focus { outline: none; box-shadow: 0 0 0 3px rgba(192,54,44,.15); }
.filter-chip button { background: rgba(47,93,227,.15); border: none; color: var(--blue); cursor: pointer; font-weight: 700; line-height: 1; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }
.filter-chip button:hover { background: var(--blue); color: #fff; }

.filter-popover {
  position: fixed; z-index: 200; width: 300px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 16px;
}
.filter-popover h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-600); margin: 0 0 10px; }
.filter-popover select, .filter-popover input { width: 100%; margin-bottom: 10px; }
.filter-popover .filter-checklist { max-height: 180px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 10px; }
.filter-popover .filter-checklist label { display: flex; align-items: center; gap: 7px; font-size: .82rem; padding: 3px 0; cursor: pointer; }
.filter-popover .checklist-toggle { display: flex; gap: 10px; margin-bottom: 6px; }
.filter-popover .checklist-toggle button { background: none; border: none; color: var(--blue); font-size: .74rem; font-weight: 600; cursor: pointer; padding: 0; }
.filter-popover .range-row { display: flex; gap: 8px; }
.filter-popover .popover-actions { display: flex; gap: 8px; margin-top: 4px; }
.filter-popover .popover-actions .btn { flex: 1; padding: 9px; font-size: .85rem; }

/* Tableau descriptif sous les graphiques + boutons d'export */
.chart-data-table-wrap { margin-top: 20px; }
.section-tools { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-tools h4 { margin: 0; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-600); }
.table-export-btn { background: none; border: 1px solid var(--border); color: var(--text-muted); font-size: .74rem; font-weight: 600; padding: 5px 10px; border-radius: 20px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.table-export-btn:hover { border-color: var(--blue); color: var(--blue); }
.table-export-btn svg { width: 13px; height: 13px; stroke: currentColor; }

.pivot-toggle-btn { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border: none; background: var(--blue-light); color: var(--blue); border-radius: 5px; cursor: pointer; margin-right: 8px; vertical-align: middle; flex-shrink: 0; padding: 0; }
.pivot-toggle-btn:hover { background: var(--blue); color: #fff; }
.pivot-toggle-icon { width: 12px; height: 12px; transition: transform .15s ease; }
.pivot-toggle-btn[aria-expanded="true"] .pivot-toggle-icon { transform: rotate(90deg); }
.pivot-toggle-spacer { display: inline-block; width: 28px; }
.pivot-child-row { animation: mdr-fade-in .12s ease; }
@keyframes mdr-fade-in { from { opacity: 0; } to { opacity: 1; } }

.chart-toolbar { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 14px; flex-wrap: wrap; }
.chart-toolbar .btn { font-size: .82rem; padding: 8px 14px; }

/* Conteneur a hauteur fixe pour les graphiques compacts (Analyses avancees/predictives/prescriptives) */
.chart-box { position: relative; height: 260px; width: 100%; }
.chart-box.chart-box-sm { height: 220px; }
.chart-box.chart-box-lg { height: 320px; }

/* Conteneur defilable horizontalement pour les graphiques a nombreuses modalites */
.chart-scroll-outer { overflow-x: auto; padding-bottom: 6px; }
.chart-scroll-inner { min-width: 100%; height: 380px; }
.chart-scroll-outer::-webkit-scrollbar { height: 8px; }
.chart-scroll-outer::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 4px; }
.chart-scroll-outer::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
.chart-scroll-hint { font-size: .74rem; color: var(--gray-400); margin-top: 6px; display: none; align-items: center; gap: 5px; }
.chart-scroll-hint.visible { display: flex; }

.chart-gallery { margin-top: 28px; }
.chart-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 12px; }
.gallery-item { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.gallery-item img, .gallery-item .gallery-svg-thumb { width: 100%; height: 120px; object-fit: contain; background: var(--bg-alt); display: block; }
.gallery-item-footer { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; font-size: .78rem; }
.gallery-item-footer button { background: none; border: none; color: var(--gray-400); cursor: pointer; padding: 2px; }
.gallery-item-footer button:hover { color: var(--red); }
.gallery-item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }

/* Constructeur de graphiques enrichi */
.chart-controls fieldset { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.chart-controls legend { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-400); font-weight: 700; padding: 0; margin-bottom: 8px; }
.divider-line { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.palette-row { display: flex; gap: 6px; flex-wrap: wrap; }
.palette-row input[type="color"] { width: 30px; height: 30px; padding: 1px; border-radius: 6px; border: 1px solid var(--border); }
.chart-caption { margin-top: 10px; font-size: .85rem; color: var(--text-muted); font-style: italic; text-align: center; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-weight: 500 !important; flex-direction: row !important; }
.checkbox-row input { accent-color: var(--blue); }

/* Modal Exporter un rapport */
.report-format-options { display: flex; gap: 10px; margin-bottom: 18px; }
.report-format-option { flex: 1; border: 2px solid var(--border); border-radius: var(--radius-md); padding: 14px 10px; text-align: center; cursor: pointer; background: var(--surface); }
.report-format-option.active { border-color: var(--blue); background: var(--blue-light); }
.report-format-option svg { width: 24px; height: 24px; stroke: var(--blue); margin-bottom: 6px; }
.report-format-option div.label { font-size: .82rem; font-weight: 600; color: var(--text); }
.report-sections-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.report-section-check { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.report-section-check input { margin-top: 3px; accent-color: var(--blue); }
.report-section-check .rs-title { font-weight: 600; font-size: .9rem; }
.report-section-check .rs-desc { font-size: .78rem; color: var(--text-muted); }
.report-section-check.disabled { opacity: .5; cursor: not-allowed; }

/* Sous-navigation Analyses avancées */
.avance-subnav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.avance-subnav-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: .84rem;
  cursor: pointer; color: var(--text-muted); font-family: var(--font-body); transition: all .15s ease;
}
.avance-subnav-btn svg { width: 15px; height: 15px; stroke: currentColor; flex-shrink: 0; }
.avance-subnav-btn:hover { border-color: var(--blue); color: var(--blue); }
.avance-subnav-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.avance-section { display: none; }
.avance-section.active { display: block; }

/* Bouton Accueil (identité visuelle) */
.btn-home {
  display: inline-flex; align-items: center; gap: 9px; padding: 7px 16px 7px 7px; border-radius: 24px;
  border: 1px solid var(--border); background: var(--surface); font-family: var(--font-body); font-weight: 700;
  font-size: .88rem; color: var(--text); cursor: pointer; transition: all .15s ease; box-shadow: var(--shadow-sm);
}
.btn-home:hover:not(:disabled) { border-color: var(--blue); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-home:disabled { opacity: .45; cursor: not-allowed; }
.btn-home-badge {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--blue), var(--navy));
}

/* Analyse prescriptive — cartes de recommandation */
.reco-card { border: 1px solid var(--border); border-left: 4px solid var(--blue); border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 12px; background: var(--surface); }
.reco-card.reco-positive { border-left-color: var(--green); }
.reco-card.reco-negative { border-left-color: var(--red); }
.reco-card .reco-title { font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.reco-card .reco-condition { font-family: var(--font-mono); font-size: .85rem; color: var(--text-muted); background: var(--bg-alt); padding: 6px 10px; border-radius: 6px; display: inline-block; margin: 6px 0; }
.reco-card .reco-meta { font-size: .8rem; color: var(--text-muted); margin-top: 6px; }

/* Text Mining — nuage de mots-clés */
#tm-wordcloud { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 10px 16px; padding: 24px 12px; min-height: 160px; }
.tm-word { font-family: var(--font-display); font-weight: 700; line-height: 1; cursor: default; transition: transform .12s ease; white-space: nowrap; }
.tm-word:hover { transform: scale(1.08); }

/* Menu Accueil (sommaire de toutes les analyses) */
.home-menu-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.home-menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  font-family: var(--font-body); font-weight: 600; font-size: .88rem; color: var(--text); cursor: pointer;
}
.home-menu-item:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.home-menu-item-top { margin-top: 4px; }
.home-menu-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.home-menu-desc { font-weight: 400; font-size: .78rem; color: var(--text-muted); }
.home-menu-icon {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 8px;
  width: 28px; height: 28px; background: var(--blue-light); color: var(--blue);
}
.home-menu-icon svg { stroke: currentColor; }
.home-menu-icon-top { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--blue), var(--navy)); color: #fff; }
.home-menu-item:hover .home-menu-icon:not(.home-menu-icon-top) { background: #fff; }
.home-menu-group { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px; margin-top: 4px; }
.home-menu-group-title { display: flex; align-items: center; gap: 8px; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-400); font-weight: 700; margin: 4px 6px 8px; }
.home-menu-icon-group { width: 22px; height: 22px; border-radius: 6px; }
.home-menu-group .home-menu-item { border: none; padding: 8px 10px; margin-bottom: 2px; }
.home-menu-group .home-menu-item:hover { background: var(--blue-light); }
.boxplot-svg-wrap { width: 100%; overflow-x: auto; }
.boxplot-svg-wrap svg { font-family: var(--font-mono); }

/* Carte géographique */
#map-container { z-index: 0; }
.leaflet-popup-content { font-family: var(--font-body); font-size: .85rem; }

/* Croisements multi-variables (pivot + treemap) */
.pivot-controls { display: grid; grid-template-columns: repeat(5, 1fr) auto; gap: 14px; align-items: end; }
.pivot-controls label { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; font-weight: 600; }
@media (max-width: 1100px) { .pivot-controls { grid-template-columns: repeat(2, 1fr); } .pivot-controls button { grid-column: span 2; } }

table.data-table tr.pivot-level1-row td { font-weight: 700; background: var(--blue-light); }
table.data-table tr.pivot-level2-row td:first-child { padding-left: 32px; color: var(--text-muted); font-weight: 400; }
table.data-table tr.pivot-level3-row td:first-child { padding-left: 52px; color: var(--gray-400); font-weight: 400; font-size: .92em; }
table.data-table tr.pivot-total-row td { font-weight: 700; background: var(--navy); color: #fff; border-top: 2px solid var(--navy); }

.kpi-card { text-align: left; }
.kpi-card .kpi-value { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; }
.kpi-card .kpi-label { color: var(--text-muted); font-size: .82rem; margin-top: 2px; }

.select-input, input.select-input {
  padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-family: var(--font-body); font-size: .88rem;
}
.color-input { width: 100%; height: 38px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; background: var(--surface); }

.chart-builder { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: start; }
.chart-controls { display: flex; flex-direction: column; gap: 14px; }
.chart-controls label { display: flex; flex-direction: column; gap: 6px; font-size: .84rem; font-weight: 600; }
.chart-preview { min-height: 420px; }
@media (max-width: 880px) { .chart-builder { grid-template-columns: 1fr; } }

.heatmap-grid { display: grid; gap: 2px; }
.heatmap-cell { display: flex; align-items: center; justify-content: center; font-size: .7rem; font-family: var(--font-mono); border-radius: 4px; color: #fff; min-height: 34px; }
.heatmap-label { font-size: .7rem; font-family: var(--font-mono); color: var(--text-muted); display: flex; align-items: center; padding: 0 6px; }
.heatmap-scroll-outer { overflow: auto; max-height: 560px; padding-bottom: 6px; }
.heatmap-col-header { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.heatmap-row-header { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.heatmap-corner { position: sticky; top: 0; left: 0; z-index: 3; background: var(--surface); }

.corr-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.corr-row:last-child { border-bottom: none; }
.corr-bar-wrap { width: 100px; height: 6px; background: var(--gray-200); border-radius: 4px; overflow: hidden; }
.corr-bar { height: 100%; border-radius: 4px; }

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .app-sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
  .tab-nav { flex-direction: row; }
  .sidebar-filters { display: none !important; }
}
