/* =========================================================================
   Module Statistiques & études + tableau de bord d'accueil RH (v2)
   Sans défilement de page dès 768 px : les grilles occupent la hauteur disponible, seuls tableaux et listes défilent.
   Charte : noir, blanc, gris, touche de vert (variables du socle uniquement).
   ========================================================================= */

/* ---------------------------------------------------------- Page des statistiques */
.st-page { --st-gap: .8rem; }
.st-share-notice { padding: .55rem .8rem; }
.st-filterbar { display: flex; align-items: center; gap: .5rem; padding: .4rem .5rem .4rem .6rem; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-panel, 14px); min-width: 0; }
.st-fb-main { display: flex; align-items: center; gap: .45rem; min-width: 0; flex: 1 1 auto; }
.st-fb-field { display: inline-flex; align-items: center; gap: .3rem; flex-shrink: 0; position: relative; }
.st-fb-field > .ph { position: absolute; left: .6rem; color: var(--text-3); pointer-events: none; font-size: 1rem; }
.st-fb-field .select { padding-left: 1.95rem; min-height: 2.2rem; height: 2.2rem; font-size: .86rem; width: auto; max-width: 15rem; font-weight: 600; }
.st-fb-chips { display: flex; align-items: center; gap: .35rem; min-width: 0; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; }
.st-fb-chips::-webkit-scrollbar { display: none; }
.st-fb-chips .chip, .st-period { flex-shrink: 0; font-size: .78rem; white-space: nowrap; }
.st-period { background: transparent; border-style: dashed; }
.st-fb-actions { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; }
.st-fb-actions .count { margin-left: .15rem; }
.st-fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .55rem; }
.st-fieldset legend { font-size: .72rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: .2rem; padding: 0; }
.st-filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: .6rem; align-items: end; }
.st-filter-grid .label { font-size: .78rem; color: var(--text-2); }

.st-tabs > .tabs { flex-shrink: 0; }
.st-section { display: flex; flex-direction: column; gap: var(--st-gap); min-width: 0; min-height: 0; }
.st-section > .stat-row { flex-shrink: 0; }
.st-empty { display: grid; place-items: center; }
.st-module { min-width: 0; }
.st-module-head { margin-bottom: .6rem; }
.st-module-head .h5 { margin: 0; display: flex; align-items: center; gap: .45rem; }

/* Grille d'éléments d'un sous-onglet : elle remplit la hauteur (rangées égales), défile seulement si l'écran est trop bas */
.st-grid { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); grid-template-rows: repeat(var(--rows, 1), minmax(var(--st-row-min, 270px), 1fr)); gap: var(--st-gap); min-height: 0; padding: 1px 2px 2px 1px; align-content: stretch; }
.st-grid > * { min-width: 0; min-height: 0; }
@media (min-width: 768px) and (max-width: 1199px) {
  .st-grid[style*="--cols: 3"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; grid-auto-rows: minmax(300px, 1fr); }
}
@media (min-width: 768px) and (max-width: 979px) {
  .st-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-rows: minmax(320px, 1fr); }
}
@media (max-width: 767px) {
  .st-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-rows: auto; overflow: visible; }
  .st-filterbar { flex-wrap: wrap; padding: .45rem; gap: .45rem; }
  .st-fb-main { flex: 1 1 0; flex-wrap: wrap; gap: .45rem; }
  .st-fb-compare, .st-period { display: none !important; }
  .st-fb-chips { flex-basis: 100%; order: 2; }
  .st-fb-field { flex: 1 1 auto; min-width: 0; }
  .st-fb-field .select { width: 100%; max-width: none; min-height: var(--tap, 44px); height: var(--tap, 44px); font-size: 16px; }
  .st-fb-actions .btn { min-height: var(--tap, 44px); }
  .st-fb-actions .btn .hide-compact { display: none; }
  .st-filterbar:has(.st-fb-actions .dropdown) .st-fb-main { flex-basis: 100%; }
  .st-filterbar:has(.st-fb-actions .dropdown) .st-fb-actions { width: 100%; justify-content: flex-end; }
  .st-pub-titles p { white-space: normal; }
}
@media (max-width: 680px) {
  .dash .stat-row .stat-icon, .st-section .stat-row .stat-icon { display: none; }
  .dash-today-label > span, .dash-today-label { font-size: 0; gap: 0; }
  .dash-today-label .ph { font-size: 1.25rem; }
}

/* Panneaux d'une grille (tableaux, qualité, formules, vues des modules) */
.st-panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.st-panel > .panel-header { flex-shrink: 0; }
.st-panel-body { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: .8rem; scrollbar-width: thin; }
.st-table { min-height: 0; }
.st-table .panel-title { min-width: 0; }
.st-search { min-width: 0; width: 13rem; }
.st-table-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; scrollbar-width: thin; }
.st-table-scroll .table thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-sunken); cursor: pointer; user-select: none; white-space: nowrap; }
.st-table-scroll .table td { white-space: nowrap; }
.st-table-scroll .table td.num, .st-table-scroll .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.st-table-scroll .table th .ph { font-size: .85rem; margin-left: .2rem; }
.st-table-scroll .table tr.is-first-of-group td { border-top: 2px solid var(--line-strong); }
.st-notes { max-width: min(380px, 92vw); white-space: normal; }
.st-notes p { margin: .25rem .7rem .55rem; font-size: .82rem; color: var(--text-2); line-height: 1.45; }
@media (max-width: 767px) {
  .st-panel { max-height: 70vh; }
  .st-table .panel-header { flex-wrap: wrap; }
  .st-search { width: 100%; }
}

.stats-note { display: flex; align-items: flex-start; gap: .5rem; font-size: .8rem; color: var(--text-3); margin: 0; }
.stats-note .ph { margin-top: .12rem; flex-shrink: 0; }
.stats-formulas { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: .6rem; }
.stats-formula { padding: .7rem .85rem; border-radius: var(--r-sm); background: var(--bg-sunken); border: 1px solid var(--line); font-size: .84rem; }
.stats-formula b { display: block; font-size: .8rem; color: var(--text); margin-bottom: .15rem; }
.stats-formula span { color: var(--text-2); }
.stats-quality { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: .5rem; }
.stats-quality > div { display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem; border-radius: var(--r-sm); border: 1px solid var(--line); font-size: .86rem; min-height: 44px; }
.stats-quality .q-dot { width: .6rem; height: .6rem; border-radius: 50%; flex-shrink: 0; background: var(--text-3); }
.stats-quality .q-dot.is-ok { background: var(--brand); }
.stats-quality .q-dot.is-warn { background: var(--warning); }
.stats-quality .q-dot.is-bad { background: var(--danger); }
.stats-quality b { margin-left: auto; }

.stats-cards-list { display: none; }
@media (max-width: 720px) {
  .st-table-scroll.has-cards .table { display: none; }
  .st-table-scroll.has-cards .stats-cards-list { display: flex; flex-direction: column; gap: .5rem; padding: .6rem; }
  .stats-row-card { border: 1px solid var(--line); border-radius: var(--r-sm); padding: .65rem .8rem; display: flex; flex-direction: column; gap: .2rem; font-size: .86rem; }
  .stats-row-card .rc-title { font-weight: 700; }
  .stats-row-card .rc-meta { display: flex; flex-wrap: wrap; gap: .25rem .8rem; color: var(--text-2); font-size: .8rem; }
}

/* ---------------------------------------------------------- Carte graphique */
.stat-chart { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; overflow: hidden; }
.sc-head { display: flex; align-items: flex-start; gap: .5rem; padding: .75rem .6rem .25rem 1rem; flex-shrink: 0; }
.sc-titles { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.sc-title { font-size: .95rem; font-weight: 750; margin: 0; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sc-sub { font-size: .76rem; color: var(--text-3); margin: 0; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-tools { display: flex; align-items: center; gap: .1rem; flex-shrink: 0; margin-left: auto; }
.sc-tools .btn-icon.is-on { background: var(--brand-soft); color: var(--brand-ink); }
.sc-type-btn { gap: .1rem; padding: 0 .4rem; }
.sc-type-btn .ph:first-child { font-size: 1.15rem; }
.sc-type-btn .sc-caret { font-size: .7rem; color: var(--text-3); }
.sc-type-menu { min-width: 300px; }
.sc-type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .2rem; padding: .1rem .3rem .35rem; }
.sc-type-opt { display: flex; align-items: center; gap: .5rem; padding: .5rem .55rem; border-radius: var(--r-xs, 6px); border: 1px solid transparent; background: transparent; color: var(--text); font: inherit; font-size: .84rem; text-align: left; cursor: pointer; min-height: 40px; }
.sc-type-opt .ph { font-size: 1.15rem; color: var(--text-2); flex-shrink: 0; }
.sc-type-opt:hover { background: var(--bg-hover); }
.sc-type-opt.is-active { border-color: var(--brand-line, var(--brand)); background: var(--brand-soft); }
.sc-type-opt.is-active .ph { color: var(--brand-ink); }
.sc-bar { display: flex; align-items: center; gap: .4rem; padding: 0 .8rem .15rem 1rem; flex-wrap: wrap; flex-shrink: 0; }
.sc-bar .select { min-height: 2rem; height: 2rem; padding-top: .2rem; padding-bottom: .2rem; font-size: .82rem; width: auto; max-width: 100%; }
.sc-bar .chip { font-size: .74rem; }
.sc-override { display: inline-flex; align-items: center; gap: .35rem; max-width: 100%; }
.sc-override .chip { cursor: pointer; max-width: 100%; }
.sc-body { position: relative; padding: .1rem .45rem .45rem; min-height: 160px; flex: 1 1 auto; display: flex; flex-direction: column; }
.sc-plot { min-height: 160px; flex: 1 1 auto; }
.stat-chart.is-fit .sc-body { min-height: 0; overflow: hidden; }
.stat-chart.is-fit .sc-plot { min-height: 0; }
.sc-plot .apexcharts-legend-text { font-family: inherit !important; }
.sc-plot .apexcharts-tooltip { box-shadow: var(--shadow-2); border: 1px solid var(--line) !important; border-radius: var(--r-sm) !important; }
.sc-table { flex: 1 1 auto; min-height: 0; max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); margin: .1rem .3rem .3rem; scrollbar-width: thin; }
.stat-chart.is-fit .sc-table { max-height: none; }
.sc-table .table thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-sunken); cursor: pointer; user-select: none; white-space: nowrap; }
.sc-table .table th .ph { font-size: .85rem; vertical-align: -0.1em; margin-left: .2rem; }
.sc-table .table td.num, .sc-table .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.sc-table tfoot td { font-weight: 750; background: var(--bg-sunken); position: sticky; bottom: 0; }
.sc-empty { position: absolute; inset: 0; display: grid; place-items: center; }
.sc-empty .empty { padding: 1rem; }

/* Plein écran */
.stat-chart.is-fs, .stat-chart:fullscreen { position: fixed; inset: 0; z-index: 300; border-radius: 0; border: 0; margin: 0; background: var(--bg-elev); padding: 1rem 1.5rem; }
.stat-chart:fullscreen::backdrop { background: var(--bg); }
.stat-chart.is-fs .sc-title { font-size: 1.4rem; -webkit-line-clamp: 3; }
.stat-chart.is-fs .sc-sub { font-size: .95rem; white-space: normal; }
.stat-chart.is-fs .sc-table { max-height: calc(100dvh - 160px); }

@media (max-width: 767px) {
  .stat-chart { overflow: visible; }
  .sc-head { padding: .7rem .4rem .25rem .85rem; }
  .sc-tools .btn-sm { min-height: 40px; min-width: 40px; }
  .sc-body { padding: .1rem .15rem .35rem; }
  .sc-type-menu { min-width: 0; }
  .sc-type-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------- Listes à choix multiples */
.stats-multi { position: relative; }
.stats-multi-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 2.6rem; padding: .4rem .7rem; border-radius: var(--r-control, 9px); border: 1px solid var(--line-strong); background: var(--bg-elev); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; text-align: left; }
.stats-multi-btn:hover { border-color: var(--text-3); }
.stats-multi-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-multi-btn.is-set { border-color: var(--brand); background: var(--brand-soft); }
.stats-multi-menu { position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: min(360px, 92vw); background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow-3, var(--shadow-2)); padding: .45rem; }
.stats-multi-list { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; margin-top: .35rem; }
.stats-multi-item { display: flex; align-items: center; gap: .55rem; padding: .45rem .55rem; border-radius: var(--r-xs, 6px); cursor: pointer; font-size: .88rem; min-height: 40px; }
.stats-multi-item:hover { background: var(--bg-hover); }
.stats-multi-item input { accent-color: var(--brand); width: 1rem; height: 1rem; margin: 0; flex-shrink: 0; }

/* ---------------------------------------------------------- Analyse IA */
.st-ai-body { max-height: calc(100dvh - 330px); overflow-y: auto; }
.stats-ai-answer { font-size: .92rem; line-height: 1.6; }
.stats-ai-answer h1, .stats-ai-answer h2, .stats-ai-answer h3, .stats-ai-answer h4 { font-size: 1rem; margin: 1rem 0 .4rem; }
.stats-ai-answer ul, .stats-ai-answer ol { padding-left: 1.2rem; margin: .3rem 0 .8rem; }
.stats-ai-answer p { margin: 0 0 .6rem; }
.stats-ai-answer strong { color: var(--text); }
.stats-ai-qa { border-top: 1px dashed var(--line); padding-top: .75rem; margin-top: .75rem; }
.stats-ai-q { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; font-size: .88rem; margin-bottom: .35rem; }
.stats-ai-privacy { display: flex; align-items: center; gap: .45rem; font-size: .76rem; color: var(--text-3); margin: 0; }
.st-ai .chip { max-width: 100%; }

/* ---------------------------------------------------------- Partage par lien */
.st-share-tabs { align-self: flex-start; }
.st-share-tabs button { gap: .4rem; }
.st-kind { --min: 240px; }
.st-kind .choice { align-items: flex-start; gap: .75rem; padding: .85rem .95rem; min-height: 44px; }
.st-kind .choice.is-active { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.st-kind .choice b { display: block; font-size: .92rem; }
.st-kind .choice small { display: block; font-weight: 500; color: var(--text-2); font-size: .8rem; line-height: 1.35; margin-top: .15rem; }
.st-kind-ico { width: 2.2rem; height: 2.2rem; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--bg-sunken); color: var(--text-2); font-size: 1.15rem; flex-shrink: 0; }
.st-kind .choice.is-active .st-kind-ico { background: var(--brand); color: var(--on-brand); }
.st-durations { flex-wrap: wrap; width: 100%; }
.st-durations button { flex: 1 0 auto; justify-content: center; gap: .3rem; min-height: 2.4rem; }
.st-switches { display: flex; flex-direction: column; gap: .65rem; }
.st-switches .switch { font-size: .9rem; min-height: 32px; }
.st-share-result { display: flex; flex-direction: column; gap: .35rem; padding: .75rem; border-radius: var(--r-sm); background: var(--brand-soft); border: 1px solid var(--brand-line, var(--brand)); }
.st-share-result .input { font-size: .82rem; background: var(--bg-elev); }
.st-share-list { display: flex; flex-direction: column; gap: .45rem; max-height: min(52vh, 460px); overflow-y: auto; scrollbar-width: thin; }
.st-share-item { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: .86rem; min-width: 0; }
.st-share-item.is-off { opacity: .66; }
.st-share-ico { width: 2.2rem; height: 2.2rem; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--bg-sunken); color: var(--text-2); font-size: 1.1rem; flex-shrink: 0; }
.st-share-body { min-width: 0; }
.st-share-line { align-items: center; min-width: 0; }
.st-share-line .badge .ph { font-size: .8rem; }
.st-share-meta { display: flex; flex-wrap: wrap; gap: .1rem .65rem; margin-top: .15rem; }
.st-share-actions { flex-shrink: 0; }
.st-journal { display: flex; flex-direction: column; gap: .3rem; max-height: min(52vh, 460px); overflow-y: auto; }
.st-journal-row { display: flex; align-items: center; gap: .6rem; padding: .45rem .55rem; border-bottom: 1px solid var(--line); min-width: 0; }
.st-journal-row .badge { flex-shrink: 0; }
@media (max-width: 767px) {
  .st-share-item { flex-wrap: wrap; }
  .st-share-actions { margin-left: auto; }
  .st-share-actions .btn-sm { min-height: var(--tap, 44px); min-width: var(--tap, 44px); }
}

/* ---------------------------------------------------------- Lien public (sans compte) */
.st-public { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.st-pub-top { display: flex; align-items: center; gap: 1rem; padding: .7rem clamp(.8rem, 2vw, 1.6rem); background: var(--bg-elev); border-bottom: 1px solid var(--line); flex-shrink: 0; position: sticky; top: 0; z-index: 30; }
.st-pub-brand { display: flex; align-items: center; gap: .75rem; min-width: 0; flex: 1 1 auto; }
.st-pub-titles { min-width: 0; }
.st-pub-titles h1 { margin: 0; font-size: 1.05rem; font-weight: 800; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-pub-titles p { margin: .1rem 0 0; font-size: .78rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-pub-tools { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; }
.st-pub-lang a { display: inline-flex; align-items: center; justify-content: center; min-width: 2.3rem; text-decoration: none; }
.st-pub-main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: .9rem clamp(.8rem, 2vw, 1.6rem); max-width: var(--content-max, 1680px); width: 100%; margin: 0 auto; }
.st-pub-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .45rem clamp(.8rem, 2vw, 1.6rem); font-size: .76rem; color: var(--text-3); border-top: 1px solid var(--line); flex-shrink: 0; }
.st-pub-foot span { display: inline-flex; align-items: center; gap: .35rem; }
@media (min-width: 768px) {
  .st-public { height: 100dvh; overflow: hidden; }
  .st-pub-main > .page-fill { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: var(--gap-page, .9rem); }
  .st-pub-main > .page-fill > * { flex-shrink: 0; }
  .st-pub-main > .page-fill > .tabset.fill { flex: 1 1 auto; min-height: 0; }
}
@media (min-width: 1920px) { .st-pub-main { max-width: 1880px; } }
@media (min-width: 2400px) { .st-pub-main { max-width: 2280px; } }
@media (max-width: 767px) {
  .st-pub-top { flex-wrap: wrap; padding-top: calc(.6rem + var(--safe-top, 0px)); }
  .st-pub-tools { width: 100%; justify-content: flex-end; }
  .st-pub-tools .btn, .st-pub-lang a { min-height: var(--tap, 44px); }
  .st-pub-foot { flex-direction: column; align-items: flex-start; padding-bottom: calc(.6rem + var(--safe-bottom, 0px)); }
}

/* Portes d'accès (code PIN, lien indisponible) */
.st-gate { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; background: var(--bg); }
.st-gate-card { width: min(440px, 100%); background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-panel, 14px); box-shadow: var(--shadow-2); padding: 2rem 1.8rem; display: flex; flex-direction: column; align-items: center; gap: .9rem; text-align: center; }
.st-gate-card h1 { font-size: 1.25rem; margin: 0; line-height: 1.3; }
.st-gate-card p { margin: 0; color: var(--text-2); font-size: .92rem; line-height: 1.5; }
.st-gate-card .field { width: 100%; text-align: left; }
.st-gate-card .notice { width: 100%; text-align: left; }
.st-gate-logo { display: grid; place-items: center; }
.st-gate-ico { width: 3.4rem; height: 3.4rem; border-radius: 50%; display: grid; place-items: center; background: var(--bg-sunken); color: var(--text); font-size: 1.6rem; }
.st-pin { text-align: center; font-size: 1.4rem; letter-spacing: .5em; font-variant-numeric: tabular-nums; min-height: 3rem; }
.st-gate-foot { display: inline-flex; align-items: center; gap: .35rem; margin: 0; }

/* ---------------------------------------------------------- Tableau de bord d'accueil */
.dash { --dash-gap: .85rem; }
.dash-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.dash-hello { flex: 1 1 auto; min-width: 0; }
.dash-hello .page-title { margin: 0; }
.dash-hello-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .9rem; font-size: .86rem; color: var(--text-2); margin-top: .25rem; }
.dash-hello-meta > span { display: inline-flex; align-items: center; gap: .35rem; }
.dash-toolbar { flex-shrink: 0; }

.dash-today { display: flex; align-items: center; gap: .45rem; overflow-x: auto; scrollbar-width: none; padding: 1px; min-height: 2.6rem; }
.dash-today::-webkit-scrollbar { display: none; }
@media (min-width: 768px) { .dash-today { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); padding-right: 36px; } }
.dash-today-label { display: inline-flex; align-items: center; gap: .4rem; font-size: .74rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); flex-shrink: 0; padding-right: .25rem; }
.dash-today-label .ph { font-size: 1.05rem; color: var(--brand-ink); }
.dash-chip { display: inline-flex; align-items: center; gap: .45rem; flex-shrink: 0; min-height: 2.4rem; padding: .3rem .8rem .3rem .65rem; border-radius: var(--r-pill, 999px); border: 1px solid var(--line); background: var(--bg-elev); color: var(--text); font-size: .85rem; text-decoration: none !important; white-space: nowrap; transition: background .12s, border-color .12s; }
.dash-chip:hover { border-color: var(--line-strong); background: var(--bg-hover); }
.dash-chip .ph { font-size: 1.05rem; color: var(--text-2); }
.dash-chip b { font-weight: 800; }
.dash-chip.tone-warning { border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); }
.dash-chip.tone-warning .ph { color: var(--warning); }
.dash-chip.is-done { color: var(--text-2); background: transparent; border-style: dashed; }
.dash-chip.is-done .ph { color: var(--brand-ink); }

.dash-editbar { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; padding: .55rem .7rem; border-radius: var(--r-sm); background: var(--brand-soft); border: 1px dashed var(--brand); }
.dash-editbar-title { display: inline-flex; align-items: center; gap: .45rem; font-size: .86rem; font-weight: 600; }
.dash-add-menu { max-height: 60vh; overflow-y: auto; min-width: 260px; }
.dash-tab-tools { display: flex; gap: .3rem; justify-content: flex-end; }

/* Grille de widgets : 4 colonnes, rangées d'une demi-hauteur (min. 220 px) ; un widget occupe 1 à 4 colonnes et 1 ou 2 rangées */
.dash-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: max(230px, calc((100% - var(--dash-gap)) / 2)); grid-auto-flow: dense; gap: var(--dash-gap); min-height: 0; padding: 1px 2px 2px 1px; }
.dw { grid-column: span var(--w, 1); grid-row: span var(--h, 1); min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; border-radius: var(--r-panel, 14px); }
.dw-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.dw-body > *, .dw-body > .widget-slot > * { flex: 1 1 auto; min-height: 0; height: 100%; }
.dw-body > .widget-slot { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.dw-body .panel { display: flex; flex-direction: column; overflow: hidden; margin: 0; }
.dw-body .panel > .panel-header, .dw-body .panel > .panel-footer { flex-shrink: 0; }
.dw-body .panel > :not(.panel-header):not(.panel-footer):not(.sc-head):not(.sc-bar) { flex: 1 1 auto; min-height: 0; overflow: auto; scrollbar-width: thin; }
.dw-body .stat-chart > .sc-body { overflow: hidden; }
.dw-body .stat-chart .sc-head { padding: .65rem .5rem .15rem .9rem; }
.dw-body .stat-chart .sc-title { font-size: .9rem; }
.dash-empty { grid-column: 1 / -1; grid-row: span 2; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: var(--r-panel, 14px); }
.dash.is-editing .dw { outline: 2px dashed var(--brand-line, var(--brand)); outline-offset: 2px; }
.dash.is-editing .dw-body { pointer-events: none; opacity: .72; }
.dash.is-editing .dw { container-type: inline-size; }
@container (max-width: 360px) { .dw-name > .truncate { display: none; } .dw-seg button { padding: 0 .35rem; } }
.dw-tools { display: flex; align-items: center; gap: .25rem; padding: .3rem .35rem; margin-bottom: .35rem; border-radius: var(--r-sm); background: var(--surface-inverse); color: var(--on-surface-inverse); flex-shrink: 0; min-width: 0; }
.dw-tools .btn { color: inherit; }
.dw-tools .btn:hover { background: color-mix(in srgb, var(--on-surface-inverse) 14%, transparent); }
.dw-handle { cursor: grab; display: grid; place-items: center; width: 1.8rem; height: 1.8rem; flex-shrink: 0; }
.dw-name { flex: 1 1 auto; min-width: 0; font-size: .8rem; font-weight: 650; display: flex; align-items: center; gap: .35rem; }
.dw-seg { padding: 1px; background: color-mix(in srgb, var(--on-surface-inverse) 12%, transparent); border: 0; }
.dw-seg button { min-height: 1.6rem; padding: 0 .45rem; font-size: .74rem; color: inherit; }
.dw-seg button.is-active { background: var(--brand); color: var(--on-brand); }
.dw.is-ghost { opacity: .4; }
@media (min-width: 768px) and (max-width: 1279px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dw { grid-column: span min(var(--w, 1), 2); }
}
@media (max-width: 767px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; }
  .dw { grid-column: 1 / -1; grid-row: auto; }
  .dw[data-kind="chart"] { height: 340px; }
  .dw[data-kind="chart"][style*="--h: 2"] { height: 440px; }
  .dw-body .panel > :not(.panel-header):not(.panel-footer):not(.sc-head):not(.sc-bar) { max-height: 420px; }
  .dash-toolbar .btn { min-height: var(--tap, 44px); }
  .dw-seg { display: none; }
}

/* Blocs intégrés */
.dash-list { display: flex; flex-direction: column; }
.dash-group { position: sticky; top: 0; z-index: 1; padding: .35rem 1rem; font-size: .7rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); background: var(--bg-sunken); border-bottom: 1px solid var(--line); }
.dash-item { display: flex; align-items: center; gap: .7rem; padding: .55rem 1rem; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none !important; min-height: 48px; min-width: 0; }
.dash-item:last-child { border-bottom: 0; }
a.dash-item:hover { background: var(--bg-hover); }
.dash-ico { width: 2.1rem; height: 2.1rem; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0; font-size: 1.1rem; background: var(--bg-sunken); color: var(--text-2); }
.dash-ico.tone-danger { background: var(--danger-soft); color: var(--danger); }
.dash-ico.tone-warning { background: var(--warning-soft); color: var(--warning); }
.dash-ico.tone-success { background: var(--brand-soft); color: var(--brand-ink); }
.dash-count { font-weight: 800; font-size: 1.05rem; min-width: 1.6rem; text-align: right; font-variant-numeric: tabular-nums; }
.dash-item-text { flex: 1 1 auto; min-width: 0; font-size: .87rem; line-height: 1.35; }
.dash-item-text small { display: block; color: var(--text-3); font-size: .76rem; }
.dash-chev { color: var(--text-3); flex-shrink: 0; }
.dash-when { flex-shrink: 0; font-size: .74rem; font-weight: 650; color: var(--text-3); white-space: nowrap; }
.dash-when.tone-danger { color: var(--danger); }
.dash-when.tone-warning { color: var(--warning); }
.dash-shortcuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .5rem; padding: .8rem; align-content: start; }
.dash-shortcut { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; padding: .7rem .4rem; min-height: 84px; border-radius: var(--r-sm); border: 1px solid var(--line); color: var(--text); text-decoration: none !important; font-size: .8rem; font-weight: 600; text-align: center; line-height: 1.25; }
.dash-shortcut:hover { background: var(--bg-hover); border-color: var(--line-strong); }
.dash-shortcut .dash-ico { width: 2.3rem; height: 2.3rem; background: var(--brand-soft); color: var(--brand-ink); font-size: 1.2rem; }
.dash-config-list { display: flex; flex-direction: column; gap: .4rem; }
.dash-config-item { display: flex; align-items: center; gap: .5rem; padding: .35rem .45rem .35rem .65rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-elev); min-height: 44px; }
.dash-config-item.is-hidden { opacity: .6; }
.dash-config-item .check { font-size: .88rem; font-weight: 600; align-items: center; }

/* ---------------------------------------------------------- Mode présentation (TV) */
.tv { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); padding: clamp(1rem, 2vw, 2.4rem); gap: clamp(.8rem, 1.4vw, 1.6rem); }
.tv-top { display: flex; align-items: center; gap: 1rem; }
.tv-brand { display: flex; align-items: center; gap: .9rem; }
.tv-brand b { font-size: clamp(1.1rem, 1.4vw, 1.8rem); font-stretch: 110%; }
.tv-brand small { display: block; color: var(--text-2); font-size: clamp(.85rem, 1vw, 1.15rem); }
.tv-clock { margin-left: auto; font-size: clamp(1.4rem, 2.4vw, 3rem); font-weight: 800; font-variant-numeric: tabular-nums; }
.tv-stage { flex: 1; position: relative; min-height: 0; display: flex; }
.tv-slide { position: absolute; inset: 0; display: flex; flex-direction: column; gap: clamp(.8rem, 1.2vw, 1.4rem); min-width: 0; }
.tv-title { font-size: clamp(1.6rem, 2.6vw, 3.4rem); font-weight: 800; font-stretch: 112%; letter-spacing: -.02em; margin: 0; line-height: 1.05; }
.tv-sub { color: var(--text-2); font-size: clamp(1rem, 1.3vw, 1.6rem); margin: 0; }
.tv-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(.8rem, 1.2vw, 1.5rem); flex: 1; align-content: center; }
.tv-kpi { min-width: 0; overflow: hidden; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-xl, 18px); padding: clamp(1rem, 1.8vw, 2.2rem); display: flex; flex-direction: column; gap: .5rem; justify-content: center; }
.tv-kpi-label { display: flex; align-items: center; gap: .6rem; font-size: clamp(1rem, 1.25vw, 1.6rem); color: var(--text-2); font-weight: 650; }
.tv-kpi-label .ph { font-size: 1.3em; color: var(--brand-ink); }
.tv-kpi-value { white-space: nowrap; font-size: clamp(2.2rem, 3.7vw, 5.4rem); font-weight: 800; font-stretch: 112%; letter-spacing: -.03em; line-height: 1; overflow: hidden; text-overflow: ellipsis; }
.tv-kpi-foot { font-size: clamp(.9rem, 1vw, 1.3rem); color: var(--text-3); }
.tv-charts { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(.8rem, 1.2vw, 1.5rem); }
.tv-charts.is-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tv-chart { min-height: 0; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-xl, 18px); padding: clamp(.8rem, 1.2vw, 1.6rem); display: flex; flex-direction: column; }
.tv-chart-title { font-size: clamp(1.05rem, 1.4vw, 1.8rem); font-weight: 750; color: var(--text-2); }
.tv-chart .stat-chart { border: 0; box-shadow: none; background: transparent; flex: 1; min-height: 0; }
.tv-chart .sc-head, .tv-chart .sc-bar { display: none !important; }
.tv-chart .sc-body { flex: 1; min-height: 0; padding: 0; }
.tv-body { overflow: hidden; }
@media (max-width: 900px) { .tv-charts.is-split { grid-template-columns: minmax(0, 1fr); } .tv-body { overflow: auto; } .tv-stage { min-height: 70vh; } .tv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tv-bottom { display: flex; align-items: center; gap: .8rem; }
.tv-progress { flex: 1; height: 6px; border-radius: 99px; background: var(--bg-sunken); overflow: hidden; }
.tv-progress > span { display: block; height: 100%; background: var(--brand); transition: width .1s linear; }
.tv-dots { display: flex; gap: .35rem; }
.tv-dots button { width: 12px; height: 12px; border-radius: 99px; border: 0; background: var(--line-strong); cursor: pointer; padding: 0; }
.tv-dots button.is-active { width: 34px; background: var(--brand); }
.tv-controls { display: flex; gap: .3rem; }
.tv-controls .btn { min-height: 2.6rem; }

/* ---------------------------------------------------------- Impression */
@media print {
  .sidebar, .topbar, .tabbar, .sidebar-overlay, .stats-no-print, .sc-tools, .sc-bar .select, .dw-tools, .dash-editbar, .toasts, .st-pub-tools { display: none !important; }
  .st-public, .st-pub-main { height: auto !important; overflow: visible !important; }
  .panel, .stat-chart, .stat-card { box-shadow: none !important; break-inside: avoid; }
  .st-grid, .dash-grid { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; grid-template-rows: none !important; grid-auto-rows: auto !important; overflow: visible !important; }
  .stat-chart { height: 340px; }
  .sc-table, .st-table-scroll, .st-panel-body { max-height: none !important; overflow: visible !important; }
  body { background: #fff !important; }
}

/* Administration › Statistiques (v2.0, 10C) */
.st-settings-form { gap: var(--gap-page, 1rem); }
.st-settings-form > .tabset.fill { flex: 1 1 auto; min-height: 0; }
.st-settings-foot { display: flex; justify-content: flex-end; flex-shrink: 0; }
@media (max-width: 767.98px) { .st-settings-foot .btn { width: 100%; justify-content: center; } }
