/* Toubana — composants applicatifs. Uniquement des tokens (tokens.css). */

.btn--ghost { background: transparent; color: var(--fg-2); }
.btn--ghost:hover { background: var(--bg-hover); }
.btn--sm { height: 28px; padding: 0 10px; font-size: var(--fs-xs); }
.btn[disabled], .btn.htmx-request { opacity: .55; pointer-events: none; }
.field { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; font-size: var(--fs-xs); color: var(--fg-2); }
.field input, .pop select, .pop input:not([type=checkbox]), .toolbar input[type=date], .toolbar select {
  height: 34px; padding: 0 10px; border: 1px solid var(--border-default); border-radius: 4px;
  background: var(--bg-surface); color: var(--fg-1); font: inherit; font-size: var(--fs-sm);
}
.field input:focus, .pop input:focus, .pop select:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--ring-focus); }
.field-error { color: var(--danger); font-size: var(--fs-xs); }
.muted { color: var(--fg-3); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums lining-nums; }

/* --- Barre d'outils de page : période, onglets ------------------------ */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.toolbar__spacer { flex: 1; }
.period { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.period__range { display: inline-flex; align-items: center; gap: 4px; }
.period__range input { width: 140px; }
.segments__opt { font-family: inherit; }
a.segments__opt { display: inline-flex; align-items: center; text-decoration: none; color: inherit; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-default); margin-bottom: 16px; overflow-x: auto; }
.tabs a {
  padding: 9px 14px; font-size: var(--fs-sm); color: var(--fg-2); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center;
}
.tabs a:hover { color: var(--fg-1); }
.tabs a.is-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: var(--fw-semibold); }
.tabs .chip { font-size: 10.5px; padding: 0 7px; }

/* --- KPI enrichis ----------------------------------------------------- */
.kpi__row { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.kpi__sub { font-size: var(--fs-xs); color: var(--fg-3); }
.kpi__gauge { height: 6px; border-radius: var(--radius-pill); background: var(--bg-sunken); overflow: hidden; }
.kpi__gauge span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

/* --- Panneaux de graphiques ------------------------------------------ */
.grid { display: grid; gap: 12px; margin-bottom: 12px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid--wide-r { grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); }
.scroll-x { overflow-x: auto; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.scroll-x > table.list th { white-space: nowrap; }
.panel {
  background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 6px;
  padding: 14px 16px; min-width: 0; margin-bottom: 12px;
}
.grid > .panel { margin-bottom: 0; }
.panel__head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.panel__head h2 { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.panel__head small { color: var(--fg-3); font-size: var(--fs-xs); }
.panel__head .spacer { flex: 1; }
.chart { width: 100%; }
.note { font-size: var(--fs-xs); color: var(--fg-3); margin-top: 8px; }
.section-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); margin: 20px 0 10px; }
.alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.alert {
  display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 6px; font-size: var(--fs-sm);
  border: 1px solid var(--warning-border); background: var(--warning-soft); color: var(--fg-1);
}
.alert svg { width: 16px; height: 16px; color: var(--warning); flex: none; }
.alert--info { border-color: var(--info-border); background: var(--info-soft); }
.alert--info svg { color: var(--info); }

/* listes compactes (récapitulatifs de 3 à 8 lignes, pas des tableaux de données) */
.list { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.list th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-3); font-weight: var(--fw-semibold); padding: 6px 8px; border-bottom: 1px solid var(--border-default); }
.list td { padding: 7px 8px; border-bottom: 1px solid var(--border-subtle); }
.list .is-num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums lining-nums; }
.list tfoot td { font-weight: var(--fw-semibold); border-bottom: 0; }

/* --- Tableau standard (§5) ------------------------------------------- */
.dt { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 6px; min-width: 0; margin-bottom: 12px; }
.dt-loading { padding: 20px; color: var(--fg-3); font-size: var(--fs-sm); }
.dt-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border-default); flex-wrap: wrap; }
.dt-groupby { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--fg-3); }
.dt-groupby select { height: 30px; border: 1px solid var(--border-default); border-radius: 4px; background: var(--bg-surface); font: inherit; font-size: var(--fs-sm); color: var(--fg-1); padding: 0 6px; }
.dt-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.chip--filter { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); gap: 6px; }
.chip--filter button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; font-size: 13px; line-height: 1; }
.dt-tools { display: flex; gap: 2px; margin-left: auto; }
.icon-btn[disabled] { opacity: .35; cursor: default; }
.icon-btn.is-on { background: var(--accent-soft); color: var(--accent); }
.icon-btn.is-on svg { color: var(--accent); }
/* Recherche rapide dans un tableau */
.dt-search { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border: 1px solid var(--border-default); border-radius: 4px; background: var(--bg-surface); color: var(--fg-3); }
.dt-search:focus-within { border-color: var(--border-focus); box-shadow: var(--ring-focus); }
.dt-search svg { width: 14px; height: 14px; flex: none; }
.dt-search input { border: 0; outline: none; background: none; font: inherit; font-size: var(--fs-sm); color: var(--fg-1); width: 190px; }
.chip--view { background: var(--bg-sunken); gap: 4px; }
.chip--view svg { width: 12px; height: 12px; color: var(--accent); }
/* Barre de proportion derrière un montant (colonne `bar`) */
.dt-bar { display: block; margin: 0 -4px; padding: 3px 4px; border-radius: 3px;
  background: linear-gradient(to left, var(--accent-soft) var(--w), transparent var(--w)); }
/* Analyse croisée */
.dt-pv__bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-bottom: 1px solid var(--border-default); background: var(--bg-page); font-size: var(--fs-xs); color: var(--fg-3); }
.dt-pv__bar label { display: inline-flex; align-items: center; gap: 6px; }
.dt-pv__bar select { height: 30px; max-width: 220px; border: 1px solid var(--border-default); border-radius: 4px; background: var(--bg-surface); font: inherit; font-size: var(--fs-sm); color: var(--fg-1); padding: 0 6px; }
.dt-pv__bar .segments__opt { height: 28px; }
.dt-pv { table-layout: auto; }
.dt-pv th, .dt-pv td { min-width: 96px; }
.dt-pv th:first-child, .dt-pv td:first-child { position: sticky; left: 0; background: var(--bg-surface); z-index: 1; min-width: 160px; max-width: 280px; }
.dt-pv thead th:first-child, .dt-pv .dt-total td:first-child { background: var(--bg-sunken); }
.dt-pv__corner { text-align: left; }
.dt-pv__cell { background: color-mix(in srgb, var(--accent) var(--heat, 0%), transparent); }
.dt-pv__tot { font-weight: var(--fw-semibold); background: var(--bg-page); }
.dt-pv__chart { padding: 12px 10px 4px; border-bottom: 1px solid var(--border-default); }
.pop__view { display: flex; align-items: center; border-radius: 4px; }
.pop__view.is-active { background: var(--accent-soft); }
.pop__view > button:first-child { flex: 1; }
.pop__view .icon-btn { width: 28px; height: 28px; }
.dt-scroll { overflow-x: auto; }
.dt-table { border-collapse: collapse; table-layout: fixed; min-width: 100%; font-size: var(--fs-sm); }
.dt-table thead th {
  position: relative; height: 38px; padding: 0 8px; background: var(--bg-sunken); text-align: left;
  border-bottom: 1px solid var(--border-default); font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--fg-3); font-weight: var(--fw-semibold); white-space: nowrap;
}
.dt-th { display: flex; align-items: center; gap: 2px; padding-right: 4px; }
.is-num .dt-th { justify-content: flex-end; }
.dt-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; overflow: hidden; text-overflow: ellipsis; }
.dt-sort svg { width: 12px; height: 12px; color: var(--accent); }
.dt-funnel { all: unset; position: relative; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 4px; cursor: pointer; color: var(--fg-4); flex: none; }
.dt-funnel svg { width: 11px; height: 11px; }
.dt-funnel:hover { background: var(--bg-hover); }
.dt-funnel.is-active { color: var(--accent); }
.dt-funnel.is-active::after { content: ''; position: absolute; top: 1px; right: 1px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.dt-resize { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; border-right: 1px solid var(--border-default); }
.dt-resize:hover { border-right-color: var(--accent); }
.dt-table td { height: 40px; padding: 0 8px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-density="compact"] .dt-table td { height: 32px; }
.dt-table td.is-num, .dt-table th.is-num { text-align: right; }
.dt-table tbody tr:hover { background: var(--bg-hover); }
.dt-group { cursor: pointer; background: var(--bg-page); }
.dt-group td { font-weight: var(--fw-semibold); }
/* Groupes imbriqués : niveaux 2 et 3 plus clairs, poignée de déplacement */
.dt-group--l1 { background: var(--bg-surface); }
.dt-group--l2 { background: var(--bg-surface); }
.dt-group--l1 td, .dt-group--l2 td { font-weight: var(--fw-medium); }
.dt-group .dt-grip { display: inline-flex; color: var(--fg-4); cursor: grab; margin-right: 2px; opacity: 0; transition: opacity var(--dur-fast); }
.dt-group:hover .dt-grip { opacity: 1; }
.dt-group .dt-grip svg { transform: none !important; width: 13px; height: 13px; margin: 0; }
.dt-group.is-drag { opacity: .45; }
.dt-group.is-drop-before td { box-shadow: inset 0 2px 0 var(--accent); }
.dt-group.is-drop-after td { box-shadow: inset 0 -2px 0 var(--accent); }
.dt-groupbtn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border: 1px solid var(--border-default); border-radius: 4px; background: var(--bg-surface); font: inherit; font-size: var(--fs-sm); color: var(--fg-2); cursor: pointer; max-width: 100%; }
.dt-groupbtn:hover { background: var(--bg-hover); }
.dt-groupbtn svg { width: 14px; height: 14px; flex: none; }
.dt-groupbtn strong { color: var(--fg-1); font-weight: var(--fw-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-groupbtn.is-on { border-color: var(--accent); background: var(--accent-soft); }
.dt-groupbtn.is-on strong { color: var(--accent); }
.pop__levels { counter-reset: none; margin-bottom: 8px; }
.pop__levels li { justify-content: flex-start; }
.pop__lvl { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: var(--fw-semibold); }
.pop__lvlname { flex: 1; }
.pop__levels .icon-btn { width: 26px; height: 26px; }
.pop select[data-gadd] { width: 100%; }
.pop__hint { font-size: var(--fs-xs); margin: 8px 0 4px; }
.dt-group svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; transition: transform var(--dur-fast); }
.dt-group.is-closed svg { transform: rotate(-90deg); }
.dt-count { color: var(--fg-3); font-weight: var(--fw-regular); }
.dt-group td:first-child, .dt-group td[colspan] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-more td { background: var(--bg-page); height: 36px; }
.dt-total td { font-weight: var(--fw-semibold); background: var(--bg-sunken); border-top: 1px solid var(--border-default); }
.dt-empty { text-align: center; color: var(--fg-3); height: 80px !important; white-space: normal !important; }
.dt-foot { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--border-default); font-size: var(--fs-xs); color: var(--fg-3); }
.dt-size .segments__opt { height: 26px; padding: 0 9px; }
.dt-size .segments__opt.is-active { background: var(--accent); color: var(--accent-fg); }
.dt-foot__count { margin-left: auto; }
.dt-pager { display: inline-flex; }

/* popovers (filtres, colonnes, export) */
.pop {
  position: absolute; z-index: 60; width: 250px; padding: 10px; background: var(--bg-surface);
  border: 1px solid var(--border-default); border-radius: 6px; box-shadow: var(--shadow-md); font-size: var(--fs-sm);
}
.pop__title { font-weight: var(--fw-semibold); margin-bottom: 8px; }
.pop__body { display: flex; flex-direction: column; gap: 6px; }
.pop__list { max-height: 220px; overflow: auto; display: flex; flex-direction: column; }
.pop__check { display: flex; align-items: center; gap: 8px; padding: 4px 2px; cursor: pointer; }
.pop__check[hidden] { display: none; }
.pop__presets { display: flex; flex-wrap: wrap; gap: 4px; }
.pop__presets button { border: 1px solid var(--border-default); background: var(--bg-surface); border-radius: var(--radius-pill); padding: 3px 9px; font: inherit; font-size: var(--fs-xs); cursor: pointer; }
.pop__presets button:hover { background: var(--bg-hover); }
.pop__actions { display: flex; gap: 6px; margin-top: 10px; }
.pop__actions span { flex: 1; }
.pop__cols { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; }
.pop__cols li { display: flex; align-items: center; gap: 6px; padding: 4px 2px; border-radius: 4px; cursor: grab; }
.pop__cols li.is-drag { opacity: .5; }
.pop__cols li svg { width: 14px; height: 14px; color: var(--fg-4); }
.pop__menu { display: flex; flex-direction: column; }
.pop__menu button { all: unset; display: flex; gap: 8px; align-items: center; padding: 8px; border-radius: 4px; cursor: pointer; }
.pop__menu button:hover { background: var(--bg-hover); }
.pop__menu svg { width: 15px; height: 15px; color: var(--fg-2); }
.pop:has(.pop__menu) { width: 160px; }

/* --- Budget : grille éditable --------------------------------------- */
.budget-cell { width: 100%; height: 32px; border: 1px solid transparent; border-radius: 4px; background: transparent; text-align: right; font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--fg-1); padding: 0 6px; }
.budget-cell:hover { border-color: var(--border-default); }
.budget-cell:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--ring-focus); background: var(--bg-surface); }
.budget-cell.is-saved { border-color: var(--success-border); background: var(--success-soft); }

/* --- Service en salle (tablette) ------------------------------------- */
.svc-bar { position: sticky; top: 0; z-index: 20; background: var(--bg-page); padding: 4px 0 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.svc-bar input[type=search] { height: 44px; min-width: 200px; flex: 1; padding: 0 14px; border: 1px solid var(--border-default); border-radius: 6px; font: inherit; font-size: var(--fs-md); background: var(--bg-surface); color: var(--fg-1); }
.svc-bar .segments__opt { height: 44px; padding: 0 16px; font-size: var(--fs-sm); }
.svc-day { display: inline-flex; align-items: center; gap: 4px; }
.svc-day .icon-btn { width: 44px; height: 44px; }
.svc-day input { height: 44px; border: 1px solid var(--border-default); border-radius: 6px; padding: 0 10px; font: inherit; background: var(--bg-surface); color: var(--fg-1); }
.svc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.svc-stats .kpi { padding: 12px 14px; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.card-room {
  display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--bg-surface);
  border: 1px solid var(--border-default); border-radius: 8px; transition: border-color var(--dur-fast);
}
.card-room.is-done { background: var(--bg-sunken); border-color: var(--success-border); }
.card-room.is-partial { border-color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.card-room.is-extra { border-style: dashed; }
.card-room__head { display: flex; align-items: center; gap: 10px; }
.card-room__num { font-family: var(--font-mono); font-size: 22px; font-weight: var(--fw-semibold); min-width: 44px; }
.card-room__who { flex: 1; min-width: 0; line-height: 1.25; }
.card-room__who strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-room__who small { color: var(--fg-3); font-size: var(--fs-xs); }
.card-room__count { font-family: var(--font-mono); font-size: 20px; font-weight: var(--fw-semibold); white-space: nowrap; }
.card-room__count small { color: var(--fg-3); font-size: 14px; }
.card-room__tags { display: flex; flex-wrap: wrap; gap: 4px; }
.card-room__note { font-size: var(--fs-xs); color: var(--fg-2); background: var(--warning-soft); border-radius: 4px; padding: 4px 8px; }
.card-room__actions { display: flex; gap: 6px; }
.card-room__actions .btn { flex: 1; height: 44px; font-size: var(--fs-md); }
.card-room__actions .btn--undo { flex: 0 0 52px; }
.svc-section { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-3); font-weight: var(--fw-semibold); margin: 18px 0 8px; }

/* --- Navigation mobile : menu « Plus » --------------------------------- */
.tabbar__more { flex: 1; position: relative; display: flex; }
.tabbar__more summary { list-style: none; cursor: pointer; }
.tabbar__more summary::-webkit-details-marker { display: none; }
.tabbar__menu {
  position: absolute; bottom: calc(100% + 6px); right: 6px; min-width: 200px; padding: 6px;
  background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 6px; box-shadow: var(--shadow-lg);
}
.tabbar__menu a { display: flex; gap: 10px; align-items: center; min-height: 44px; padding: 0 10px; color: var(--fg-1); text-decoration: none; border-radius: 4px; }
.tabbar__menu a.is-active { color: var(--accent); background: var(--accent-soft); }
.tabbar__menu svg { width: 18px; height: 18px; }

@media (max-width: 768px) {
  .grid--2, .grid--3, .grid--wide, .grid--wide-r { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { min-width: 0; padding: 12px; }
  .kpi__value { font-size: 18px; }
  .kpi__row { flex-wrap: wrap; row-gap: 2px; }
  .kpi__row .kpi__sub { flex-basis: 100%; }
  .topbar__meta { display: none; }
  .svc-bar { position: static; }
  .period__range input { width: 128px; }
  .period > .segments { max-width: 100%; overflow-x: auto; }
  .period > .segments .segments__opt { white-space: nowrap; flex: none; }
  .panel__head { flex-wrap: wrap; }
  /* Tableaux → cartes (§7bis) : une carte par ligne, 4 premières colonnes. */
  .dt-table, .dt-table tbody, .dt-table tr, .dt-table td { display: block; width: auto !important; }
  .dt-table thead, .dt-table colgroup { display: none; }
  .dt-table tbody tr { padding: 8px 10px; border-bottom: 1px solid var(--border-default); }
  .dt-table td { height: auto; min-height: 24px; border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: 12px; }
  .dt-table td::before { content: attr(data-label); color: var(--fg-3); font-size: var(--fs-xs); }
  .dt-table tbody tr:not(.dt-group) td:nth-child(n+5), .dt-group td:empty { display: none; }
  .dt-group td:first-child::before { content: none; }
  .dt-table tfoot { display: none; }
  .dt-foot__label { display: none; }
}

/* --- Impression (listes de service) ------------------------------------ */
.print-sheet { font-size: 11pt; }
.print-sheet h1 { font-size: 16pt; margin-bottom: 4px; }
.print-sheet table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.print-sheet th, .print-sheet td { border: 1px solid var(--border-strong); padding: 5px 6px; text-align: left; vertical-align: top; }
.print-sheet th { background: var(--bg-sunken); font-size: 9pt; text-transform: uppercase; }
.print-sheet .box { width: 22px; height: 22px; border: 1.5px solid var(--fg-1); display: inline-block; margin-right: 3px; }
@media print {
  .rail, .topbar, .tabbar, .no-print { display: none !important; }
  .content { padding: 0; }
  body { background: var(--zinc-0); }
}
.card-room[hidden], .empty-state[hidden] { display: none; }

/* --- Badge du rail ------------------------------------------------------ */
.rail__item { position: relative; }
.rail__badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill);
  background: var(--warning); color: var(--zinc-0); font-size: 10.5px; font-weight: var(--fw-semibold);
  display: inline-grid; place-items: center; font-family: var(--font-mono);
}
html[data-rail-collapsed] .rail__badge { position: absolute; top: 3px; right: 3px; margin: 0; min-width: 14px; height: 14px; font-size: 9px; padding: 0 3px; }

/* --- Panneau latéral (drawer) ----------------------------------------------- */
.drawer { position: fixed; inset: 0; z-index: 80; background: var(--bg-overlay); display: flex; justify-content: flex-end; }
.drawer[hidden] { display: none; }
.drawer__panel {
  position: relative; width: min(520px, 100%); height: 100%; overflow-y: auto; background: var(--bg-surface);
  border-left: 1px solid var(--border-default); box-shadow: var(--shadow-xl); padding: 20px;
}
.drawer__close { position: absolute; top: 12px; right: 12px; }
.drawer h2 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); margin: 0 40px 14px 0; }
.drawer h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-3); margin: 18px 0 8px; }
.drawer dl { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0; font-size: var(--fs-sm); }
.drawer dt { color: var(--fg-3); }
.drawer dd { margin: 0; overflow-wrap: anywhere; }
.box-accent { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 12px 14px; font-size: var(--fs-sm); }
.box-accent form { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.select { height: 34px; border: 1px solid var(--border-default); border-radius: 4px; background: var(--bg-surface); color: var(--fg-1); font: inherit; font-size: var(--fs-sm); padding: 0 8px; min-width: 0; }
.select:focus, .input:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--ring-focus); }
.input { height: 34px; border: 1px solid var(--border-default); border-radius: 4px; background: var(--bg-surface); color: var(--fg-1); font: inherit; font-size: var(--fs-sm); padding: 0 10px; min-width: 0; }

/* --- Sélection dans les tableaux --------------------------------------------- */
.dt-check { width: 40px; text-align: center; }
.dt-table tr.is-clickable { cursor: pointer; }
.dt-bulkbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--accent-soft); border-bottom: 1px solid var(--accent); font-size: var(--fs-sm); color: var(--fg-1); flex-wrap: wrap; }
@media (max-width: 768px) {
  /* L'analyse croisée reste un vrai tableau, à défilement horizontal. */
  .dt-table.dt-pv { display: table; }
  .dt-pv thead { display: table-header-group; } .dt-pv tbody { display: table-row-group; } .dt-pv tfoot { display: table-footer-group; }
  .dt-pv tr, .dt-pv tbody tr { display: table-row; padding: 0; }
  .dt-pv td, .dt-pv th { display: table-cell !important; padding: 0 8px; height: 36px; border-bottom: 1px solid var(--border-subtle); }
  .dt-pv td::before { content: none; }
}
@media (max-width: 768px) {
  /* Raccourcis de période et tableaux de synthèse : défilement horizontal, jamais la page. */
  .period { max-width: 100%; flex-wrap: wrap; }
  .period .segments { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  table.list { display: block; max-width: 100%; overflow-x: auto; }
}
@media (max-width: 768px) { .dt-search { flex: 1 1 100%; } .dt-search input { width: 100%; } .dt-check { display: none !important; } .drawer dl { grid-template-columns: 1fr; } }

/* --- Tableau de bord ---------------------------------------------------------- */
a.kpi--link { color: inherit; text-decoration: none; transition: border-color var(--dur-fast); }
a.kpi--link:hover { border-color: var(--accent); }
.kpi .chart { margin: 2px 0; }
a.alert { text-decoration: none; }
a.alert:hover { border-color: var(--warning); }
.activity .panel__head a { font-size: var(--fs-xs); }
.activity__big { font-size: 22px; font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums lining-nums; margin-bottom: 8px; }
.activity__big small { font-size: var(--fs-xs); font-weight: var(--fw-regular); color: var(--fg-3); }

@media (max-width: 480px) {
  /* Le titre de page reste lisible : la recherche se resserre. */
  .topbar__search { width: 96px; flex: none; }
  .topbar__crumb { flex: 1; }
}

/* --- Rapport mensuel (écran + PDF via impression) ------------------------------- */
.report { max-width: 1100px; }
.report__head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.report__head img { width: 48px; height: 48px; object-fit: contain; border-radius: 6px; background: var(--zinc-0); }
.report__head h1 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); }
.report__section { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: 6px; padding: 16px 18px; margin-bottom: 14px; }
.report__section h2 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); margin-bottom: 10px; }
.report__section > p { font-size: var(--fs-sm); color: var(--fg-2); margin-bottom: 10px; }
.report__lead { font-size: var(--fs-md) !important; color: var(--fg-1) !important; }
.report__table tfoot td, .report__total td { font-weight: var(--fw-semibold); background: var(--bg-sunken); }
.report__section .kpis { margin: 12px 0 0; }
.kpi--record { border-color: var(--accent); background: var(--accent-soft); }
.report-callout, .report-note textarea { font-size: var(--fs-sm); }
.report-callout { background: var(--warning-soft); border-radius: 6px; padding: 10px 12px; }
.report-note { margin-bottom: 4px; }
.print-only { display: none; }
.report-note textarea { height: auto; padding: 8px 10px; resize: vertical; }
@media print {
  @page { size: A4; margin: 12mm; }
  .content { padding: 0 !important; }
  .report { max-width: none; }
  .report__section { break-inside: avoid; border-color: var(--border-strong); }
  .no-break { break-inside: avoid; }
  .report-note { display: none; }
  .print-only { display: block; }
  .grid--wide { grid-template-columns: 1.6fr 1fr; }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
  .kpi { min-width: 0; padding: 10px; }
  .kpi__value { font-size: 17px; }
  .kpi__row { flex-wrap: wrap; row-gap: 2px; }
  .alert { border: 1px solid var(--border-strong); }
}
.budget-cell.is-missing { border-color: var(--warning-border); background: var(--warning-soft); }
