/* =========================================================================
   Composants de données & visionneuse (agent Composants) — docs/COMPONENTS.md
   Variables du design system uniquement (thèmes clair / sombre automatiques).
   ========================================================================= */

/* ------------------------------------------------------------ Tons partagés */
.dv-ico, .ftile-icon, .ftile-thumb, .fdrop-thumb, .tl-dot { --t-fg: var(--text-2); --t-bg: var(--muted-soft); }
:is(.dv-ico, .ftile-icon, .ftile-thumb, .fdrop-thumb, .tl-dot, .pg, .pg-ring, .kb-col).tone-brand,
:is(.dv-ico, .ftile-icon, .ftile-thumb, .fdrop-thumb, .tl-dot, .pg, .pg-ring, .kb-col).tone-success { --t-fg: var(--success); --t-bg: var(--success-soft); --t-solid: var(--success-strong); }
:is(.dv-ico, .ftile-icon, .ftile-thumb, .fdrop-thumb, .tl-dot, .pg, .pg-ring, .kb-col).tone-info { --t-fg: var(--info); --t-bg: var(--info-soft); --t-solid: var(--info); }
:is(.dv-ico, .ftile-icon, .ftile-thumb, .fdrop-thumb, .tl-dot, .pg, .pg-ring, .kb-col).tone-warning { --t-fg: var(--warning); --t-bg: var(--warning-soft); --t-solid: var(--warning); }
:is(.dv-ico, .ftile-icon, .ftile-thumb, .fdrop-thumb, .tl-dot, .pg, .pg-ring, .kb-col).tone-danger { --t-fg: var(--danger); --t-bg: var(--danger-soft); --t-solid: var(--danger); }
:is(.dv-ico, .ftile-icon, .ftile-thumb, .fdrop-thumb, .tl-dot, .pg, .pg-ring, .kb-col).tone-violet { --t-fg: var(--violet); --t-bg: var(--violet-soft); --t-solid: var(--violet); }
:is(.dv-ico, .ftile-icon, .ftile-thumb, .fdrop-thumb, .tl-dot, .pg, .pg-ring, .kb-col).tone-orange { --t-fg: var(--orange); --t-bg: var(--orange-soft); --t-solid: var(--orange); }
:is(.dv-ico, .ftile-icon, .ftile-thumb, .fdrop-thumb, .tl-dot, .pg, .pg-ring, .kb-col).tone-muted { --t-fg: var(--text-2); --t-bg: var(--muted-soft); --t-solid: var(--text-3); }

/* Boîte d'icône parfaitement centrée */
.dv-ico { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: var(--r-sm); background: var(--t-bg); color: var(--t-fg); font-size: 1.2rem; flex-shrink: 0; line-height: 1; }
.dv-ico .ph, .ftile-icon .ph, .fdrop-thumb .ph, .tl-dot .ph, .fdrop-icon .ph, .wstep-dot .ph-bold { vertical-align: 0; display: block; }
.dv-ico-sm { width: 1.9rem; height: 1.9rem; font-size: 1rem; border-radius: var(--r-xs); }

/* ============================================================ x-data-view */
.dv { display: flex; flex-direction: column; min-width: 0; position: relative; }
.dv.is-plain { background: transparent; border: 0; box-shadow: none; }
.dv-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.dv.is-plain .dv-toolbar { padding: 0 0 .85rem; border: 0; }
.dv-title { font-weight: 750; font-size: 1rem; margin-right: auto; display: flex; align-items: center; gap: .5rem; }
.dv-search { position: relative; flex: 1 1 260px; max-width: 460px; display: flex; align-items: center; margin: 0; }
.dv-search-icon { position: absolute; left: .8rem; top: 0; bottom: 0; display: grid; place-items: center; color: var(--text-3); pointer-events: none; font-size: 1.05rem; }
.dv-search-icon .ph { vertical-align: 0; }
.dv-search-input { min-height: 2.5rem; padding-left: 2.4rem; padding-right: 2.6rem; border-radius: var(--r-pill); background: var(--bg-sunken); border-color: var(--line); }
.dv-search-input:focus { background: var(--bg-elev); }
.dv-search-input::-webkit-search-cancel-button { display: none; }
.dv-search-clear { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 0; background: transparent; color: var(--text-3); display: grid; place-items: center; cursor: pointer; }
.dv-search-clear:hover { background: var(--bg-hover); color: var(--text); }
.dv-search-clear .ph { vertical-align: 0; }
.dv-search-spin { position: absolute; right: 2.45rem; top: 50%; width: 1rem; height: 1rem; margin-top: -.5rem; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--brand); animation: spin .7s linear infinite; }
.dv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-left: auto; }
.dv-tools .btn-sm { min-height: 2.5rem; }
.dv-tools .btn-icon.btn-sm { width: 2.5rem; min-width: 2.5rem; }
.dv-filter-btn.is-on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.dv-filter-btn .count { margin-left: .1rem; }
.dv-views { padding: 3px; }
.dv-views button { width: 2.15rem; height: 2.15rem; padding: 0; justify-content: center; }
.dv-views button .ph { font-size: 1.1rem; vertical-align: 0; }
.dv-menu { min-width: 250px; }
.dv-menu .segmented { width: 100%; margin: .15rem 0 .35rem; }
.dv-menu .segmented button { flex: 1; justify-content: center; }
.dv-sort-row { display: flex; align-items: center; gap: .2rem; padding: .15rem .3rem .15rem .7rem; border-radius: var(--r-xs); }
.dv-sort-row:hover { background: var(--bg-hover); }
.dv-sort-label { flex: 1; font-size: .9rem; min-width: 0; }
.dv-sort-row .btn.is-current { background: var(--bg-inverse); color: var(--text-inverse); }
.dv-cols { display: flex; flex-direction: column; gap: .1rem; max-height: 260px; overflow-y: auto; padding: .1rem .3rem; }
.dv-col-check { padding: .35rem .4rem; border-radius: var(--r-xs); align-items: center; }
.dv-col-check:hover { background: var(--bg-hover); }
.dv-col-check input { margin-top: 0; }
.select-sm { min-height: 2.15rem; padding: .3rem 2rem .3rem .65rem; font-size: .86rem; background-position: right .6rem center; }

/* Puces de filtres */
.dv-chips-wrap:empty { display: none; }
.dv-chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .6rem 1rem 0; }
.dv.is-plain .dv-chips { padding: 0 0 .7rem; }
.dv-chip { display: inline-flex; align-items: center; gap: .35rem; min-height: 2rem; padding: .15rem .25rem .15rem .7rem; border-radius: var(--r-pill); background: var(--brand-soft); color: var(--brand-ink); font-size: .82rem; font-weight: 650; max-width: 100%; }
.dv-chip-label { color: var(--text-2); font-weight: 600; }
.dv-chip-label::after { content: " :"; }
.dv-chip-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dv-chip-x { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; color: inherit; flex-shrink: 0; text-decoration: none !important; }
.dv-chip-x:hover { background: color-mix(in srgb, var(--brand) 22%, transparent); }
.dv-chip-x .ph { vertical-align: 0; font-size: .95rem; }
.dv-chip-reset { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; font-weight: 650; color: var(--text-2); padding: .3rem .5rem; border-radius: var(--r-xs); }
.dv-chip-reset:hover { color: var(--danger); text-decoration: none; background: var(--danger-soft); }

/* Filtres (formulaire auto, tiroir, rangée en ligne) */
.dv-inline-filters { border-bottom: 1px solid var(--line); background: var(--bg-sunken); }
.dv-inline-filters .dv-filter-form { padding: .9rem 1rem; display: flex; flex-direction: column; gap: .8rem; }
.dv-filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .8rem 1rem; }
.dv-filter-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
.dv-drawer { z-index: 191; }
.dv-drawer-form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.dv-drawer-form .drawer-body { --gap: 1.15rem; }
.dv-drawer-foot { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
.dv-drawer-foot .btn-primary { flex: 1; }
.dv-filter .label { font-size: .85rem; }
.dv-filter .label .ph { color: var(--text-3); }
.dv-opts { display: flex; flex-wrap: wrap; gap: .35rem; }
.dv-opts.is-long { max-height: 210px; overflow-y: auto; padding: .1rem; flex-direction: column; flex-wrap: nowrap; }
.dv-opt { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.dv-opt input { position: absolute; opacity: 0; pointer-events: none; }
.dv-opt span { display: inline-flex; align-items: center; gap: .35rem; min-height: 2.2rem; padding: .3rem .8rem; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--bg-elev); font-size: .85rem; font-weight: 600; color: var(--text-2); transition: all .12s; }
.dv-opts.is-long .dv-opt span { border-radius: var(--r-xs); width: 100%; }
.dv-opt span::before { content: ""; width: .95rem; height: .95rem; border-radius: 4px; border: 1.5px solid var(--line-strong); flex-shrink: 0; background: var(--bg-elev) center / 70% no-repeat; }
.dv-opt input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.dv-opt input:checked + span::before { background-color: var(--brand); border-color: var(--brand); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3 3 7-7' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.dv-opt input:focus-visible + span { box-shadow: var(--ring); }
.dv-seg { width: 100%; }
.dv-seg label { flex: 1; position: relative; cursor: pointer; }
.dv-seg input { position: absolute; opacity: 0; pointer-events: none; }
.dv-seg span { display: flex; align-items: center; justify-content: center; min-height: 2.1rem; padding: .3rem .6rem; border-radius: 7px; font-size: .85rem; font-weight: 650; color: var(--text-2); }
.dv-seg input:checked + span { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-1); }
.dv-seg input:focus-visible + span { box-shadow: var(--ring); }
.dv-range { display: flex; align-items: center; gap: .45rem; }
.dv-range .input { flex: 1; min-width: 0; }
.dv-range > span { display: grid; place-items: center; }

/* Corps et volets */
.dv-body { position: relative; min-width: 0; min-height: 120px; }
.dv-pane { display: none; min-width: 0; }
.dv[data-view="table"] > .dv-body > .dv-pane-table,
.dv[data-view="cards"] > .dv-body > .dv-pane-cards,
.dv[data-view="list"] > .dv-body > .dv-pane-list,
.dv[data-view="kanban"] > .dv-body > .dv-pane-kanban { display: block; animation: dv-in .18s var(--ease); }
@keyframes dv-in { from { opacity: .4; } }
.dv-pane-table > .table-wrap, .dv-pane-table > .table { max-height: var(--dv-max-h, calc(100dvh - 280px)); }
.dv-pane-table > .table-wrap { overflow: auto; }
.dv-pane-table .table th:first-child, .dv-pane-table .table td:first-child { padding-left: 1.1rem; }
.dv-pane-table .table th:last-child, .dv-pane-table .table td:last-child { padding-right: 1.1rem; }
@media (min-width: 1024px) and (max-width: 1599px) { .dv-pane-table .table th:first-child, .dv-pane-table .table td:first-child { padding-left: .75rem; } .dv-pane-table .table th:last-child, .dv-pane-table .table td:last-child { padding-right: .75rem; } }
.dv-pane-cards { padding: 1rem; }
.dv.is-plain .dv-pane-cards { padding: 0; }
.dv-pane-kanban { padding: 1rem; }
.dv.is-plain .dv-pane-kanban { padding: 0; }
.dv-progress { position: absolute; left: 0; right: 0; top: 0; height: 3px; overflow: hidden; z-index: 3; opacity: 0; transition: opacity .2s; pointer-events: none; }
.dv-progress i { position: absolute; top: 0; bottom: 0; width: 35%; background: var(--brand); border-radius: 3px; animation: dv-bar 1s var(--ease) infinite; }
@keyframes dv-bar { from { left: -35%; } to { left: 100%; } }
.dv-body.is-loading .dv-progress { opacity: 1; }
.dv-body.is-loading > .dv-pane, .dv-body.is-loading > .empty { opacity: .45; pointer-events: none; transition: opacity .2s; }

/* Densité */
.dv[data-density="compact"] .table td { padding-top: .42rem; padding-bottom: .42rem; }
.dv[data-density="compact"] .table th { padding-top: .5rem; padding-bottom: .5rem; }
.dv[data-density="compact"] .dv-cards { gap: .6rem; }
.dv[data-density="compact"] .dv-card { padding: .7rem .8rem; gap: .5rem; }
.dv[data-density="compact"] .dv-item { padding-top: .45rem; padding-bottom: .45rem; }

/* Tableau : en-tête triable, cases */
.dv-th { white-space: nowrap; }
.th-sort { color: inherit; text-decoration: none !important; display: inline-flex; align-items: center; gap: .3rem; }
.th-sort:hover { color: var(--text); }
.th-sort-icon { display: inline-grid; place-items: center; width: 1rem; height: 1rem; opacity: .55; }
.th-sort-icon .ph { vertical-align: 0; font-size: .9rem; }
.th-sort.is-active .th-sort-icon { opacity: 1; color: var(--brand-ink); }
th.text-right .th-sort { flex-direction: row; }
.dv-check { display: inline-grid; place-items: center; width: 2rem; height: 2rem; margin: -.4rem; cursor: pointer; border-radius: var(--r-xs); flex-shrink: 0; }
.dv-check:hover { background: var(--bg-hover); }
.dv-check input { appearance: none; -webkit-appearance: none; width: 1.15rem; height: 1.15rem; margin: 0; border: 1.5px solid var(--line-strong); border-radius: 5px; background: var(--bg-elev) center / 72% no-repeat; cursor: pointer; transition: all .12s; display: block; }
.dv-check input:checked, .dv-check input:indeterminate { background-color: var(--brand); border-color: var(--brand); }
.dv-check input:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3 3 7-7' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.dv-check input:indeterminate { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8h8' stroke='%23000' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
.dv-check input:focus-visible { box-shadow: var(--ring); }
.table .col-check { width: 2.8rem; }
.table tr:has(.dv-row-check:checked) { background: var(--brand-soft); }
.table .cell-sub { display: block; font-size: .8rem; color: var(--text-3); font-weight: 500; }
.table .cell-strong { font-weight: 650; color: var(--text); }
.table .cell-person { display: flex; align-items: center; gap: .65rem; min-width: 0; white-space: nowrap; }

/* Cartes */
.dv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--dv-card-min, 270px)), 1fr)); gap: .9rem; }
.dv-card { position: relative; display: flex; flex-direction: column; gap: .7rem; padding: 1rem 1.05rem; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; transition: border-color .15s, box-shadow .15s; }
.dv-pane-cards .dv-card { box-shadow: var(--shadow-1); }
.dv-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.dv-card.is-selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.dv-card-media { margin: -1rem -1.05rem 0; aspect-ratio: 16 / 7; overflow: hidden; border-radius: var(--r-lg) var(--r-lg) 0 0; background: var(--bg-sunken); }
.dv-card-media img { width: 100%; height: 100%; object-fit: cover; }
.dv-card-head { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.dv-card-check { margin: -.4rem -.2rem -.4rem -.4rem; }
.dv-card-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .05rem; }
.dv-card-title { font-weight: 700; color: var(--text); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.dv-card-title { text-decoration: none; }
a.dv-card-title::after { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 0; }
a.dv-card-title:hover { color: var(--brand-ink); }
.dv-card-head .dv-check, .dv-card-badge, .dv-card-menu, .dv-card-foot, .dv-card-body a, .dv-card-body button { position: relative; z-index: 1; }
.dv-card-sub { font-size: .8rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-card-badge { flex-shrink: 0; }
.dv-card-body { display: flex; flex-direction: column; gap: .4rem; font-size: .87rem; }
.dv-card-foot { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; padding-top: .7rem; border-top: 1px solid var(--line); margin-top: auto; }
.dv-field { display: flex; align-items: baseline; justify-content: space-between; gap: .8rem; min-width: 0; }
.dv-field-label { display: inline-flex; align-items: center; gap: .35rem; color: var(--text-3); font-size: .8rem; font-weight: 600; flex-shrink: 0; }
.dv-field-label .ph { font-size: .95rem; vertical-align: 0; }
.dv-field-value { font-weight: 600; text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Liste compacte */
.dv-list { display: flex; flex-direction: column; }
.dv-item { position: relative; display: flex; align-items: center; gap: .75rem; padding: .65rem 1.1rem; border-bottom: 1px solid var(--line); min-width: 0; min-height: 3.4rem; }
.dv-item:last-child { border-bottom: 0; }
.dv-item:hover { background: var(--bg-hover); }
.dv-item.is-selected { background: var(--brand-soft); }
.dv-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--text); text-decoration: none !important; }
a.dv-item-main::after { content: ""; position: absolute; inset: 0; }
.dv-item .dv-check, .dv-item-actions, .dv-item .badge { position: relative; z-index: 1; }
.dv-item-title { font-weight: 650; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-item-sub { font-size: .79rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-item-meta { font-size: .8rem; color: var(--text-2); white-space: nowrap; }
.dv-item-actions { display: flex; align-items: center; gap: .2rem; }

/* Pied */
.dv-foot { display: flex; align-items: center; gap: .8rem 1.2rem; flex-wrap: wrap; padding: .75rem 1rem; border-top: 1px solid var(--line); }
.dv.is-plain .dv-foot { padding: .8rem 0 0; }
.dv-foot:empty { display: none; }
.dv-count { margin-right: auto; }
.dv-perpage { display: inline-flex; align-items: center; gap: .5rem; }
.dv-perpage .select { width: auto; }
.dv-pages .pagination a, .dv-pages .pagination span { min-width: 2.4rem; height: 2.4rem; }
.pagination .ph { vertical-align: 0; }

/* Actions groupées */
.dv-bulkbar { position: sticky; bottom: calc(14px + env(safe-area-inset-bottom)); margin: .75rem 1rem 1rem; z-index: 25; animation: dv-up .2s var(--ease); }
.dv.is-plain .dv-bulkbar { margin: .75rem 0 0; }
@keyframes dv-up { from { transform: translateY(10px); opacity: 0; } }
.dv-bulk-count { display: inline-flex; align-items: center; gap: .5rem; margin-right: auto; }
.dv-bulk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0; }
.dv-bulkbar .btn-sm { min-height: 2.4rem; }
.dv-bulk-close { --btn-bd: transparent !important; }
.has-tabbar .dv-bulkbar { bottom: calc(var(--tabbar-h, 64px) + 12px + env(safe-area-inset-bottom)); }

/* Squelettes */
.skel { display: flex; flex-direction: column; gap: .7rem; padding: 1rem; }
.skel-line { display: block; height: .8rem; border-radius: 6px; }
.skel-head { height: 2rem; }
.skel-row { display: flex; align-items: center; gap: .8rem; }
.skel-box { width: 1.1rem; height: 1.1rem; border-radius: 5px; flex-shrink: 0; }
.skel-circle { width: 2.3rem; height: 2.3rem; border-radius: 50%; flex-shrink: 0; }
.skel-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: .9rem; }
.skel-card { display: flex; flex-direction: column; gap: .7rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--r-lg); }
.skel-chart { display: flex; align-items: flex-end; gap: 6%; height: 220px; padding: 1rem .5rem 0; }
.skel-chart span { flex: 1; border-radius: 4px 4px 0 0; }

/* ============================================================ Kanban */
.kb { align-items: stretch; }
.kb-col { --t-solid: var(--text-3); }
.kb-head { gap: .5rem; }
.kb-title { display: inline-flex; align-items: center; gap: .5rem; min-width: 0; }
.kb-title > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-title .ph { color: var(--t-solid); font-size: 1.1rem; vertical-align: 0; }
.kb-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--t-solid); flex-shrink: 0; }
.kb-col { border-top: 3px solid var(--t-solid); }
.kb-list:empty::before { content: attr(data-empty); display: grid; place-items: center; min-height: 80px; border: 1.5px dashed var(--line-strong); border-radius: var(--r); color: var(--text-3); font-size: .82rem; text-align: center; padding: 1rem; }
.kb.is-dragging .kb-list { outline: 1.5px dashed transparent; }
.kb.is-dragging .kb-list:hover { outline-color: var(--brand-line); outline-offset: -2px; border-radius: var(--r); }
.kb-card { position: relative; cursor: default; }
.kb.is-sortable .kb-card { cursor: grab; }
.kb-card:focus-visible { box-shadow: var(--ring); outline: none; }
.kb-card.is-saving { opacity: .6; }
.kb-card.is-moved { animation: kb-flash .7s var(--ease); }
@keyframes kb-flash { 0% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: var(--shadow-1); } }
.kb-link { position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
.kb-card-body { position: relative; z-index: 0; display: flex; flex-direction: column; gap: .45rem; pointer-events: none; min-width: 0; }
.kb-card-body a, .kb-card-body button { pointer-events: auto; position: relative; z-index: 1; }
.kb-card:not(:has(.kb-link)) .kb-card-body { pointer-events: auto; }
.kb-move { position: absolute; top: .4rem; right: .4rem; z-index: 2; }
.kb-move-btn { opacity: 0; transition: opacity .15s; background: var(--bg-elev); }
.kb-card:hover .kb-move-btn, .kb-card:focus-within .kb-move-btn, .kb-move-btn:focus-visible { opacity: 1; }
@media (hover: none) { .kb-move-btn { opacity: 1; } }
.kb-move-menu { top: calc(100% + 4px); right: 0; min-width: 210px; }
.kb-foot { padding: 0 .6rem .7rem; }
.kb-card .kb-card-title { font-weight: 700; font-size: .9rem; line-height: 1.3; padding-right: 1.8rem; }
.kb-card .kb-card-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .78rem; color: var(--text-3); }
@media (max-width: 767px) {
  .kb { grid-auto-columns: minmax(82vw, 1fr); scroll-snap-type: x mandatory; margin-inline: -1rem; padding-inline: 1rem; scroll-padding-inline: 1rem; }
  .kb-col { scroll-snap-align: start; max-height: none; }
}

/* ============================================================ Timeline (.tl) */
.tl { list-style: none; margin: 0; padding: 0; }
.tl-item { position: relative; display: grid; grid-template-columns: 2.2rem minmax(0, 1fr); gap: .85rem; padding-bottom: 1.15rem; }
.tl-item::before { content: ""; position: absolute; left: calc(1.1rem - 1px); top: 2.4rem; bottom: .2rem; width: 2px; border-radius: 2px; background: var(--line); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::before { display: none; }
.tl-dot { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--t-bg); color: var(--t-fg); font-size: 1.05rem; box-shadow: 0 0 0 4px var(--bg-elev); position: relative; z-index: 1; }
.tl-body { min-width: 0; padding-top: .2rem; }
.tl-head { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .55rem; }
.tl-title { font-weight: 700; font-size: .93rem; color: var(--text); }
.tl-title a { color: inherit; }
.tl-time { margin-left: auto; font-size: .78rem; color: var(--text-3); white-space: nowrap; }
.tl-text { margin-top: .2rem; font-size: .87rem; color: var(--text-2); overflow-wrap: anywhere; }
.tl-user { margin-top: .3rem; display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--text-3); font-weight: 600; }
.tl-user .ph { vertical-align: 0; }
.tl-compact .tl-item { grid-template-columns: 1.7rem minmax(0, 1fr); gap: .65rem; padding-bottom: .75rem; }
.tl-compact .tl-dot { width: 1.7rem; height: 1.7rem; font-size: .85rem; }
.tl-compact .tl-item::before { left: calc(.85rem - 1px); top: 1.9rem; }
.tl-compact .tl-body { padding-top: .05rem; }
@media (max-width: 520px) { .tl-time { margin-left: 0; width: 100%; order: 3; } }

/* ============================================================ Progression */
.pg { --t-solid: var(--brand); display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.pg-top { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.pg-label { font-size: .85rem; font-weight: 650; color: var(--text-2); }
.pg-value { font-size: .85rem; font-weight: 750; }
.pg-track { height: .55rem; border-radius: var(--r-pill); background: var(--bg-sunken); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.pg-track > span { display: block; height: 100%; border-radius: inherit; background: var(--t-solid); transition: width .6s var(--ease); }
.pg-sm .pg-track { height: .35rem; } .pg-lg .pg-track { height: .8rem; }
.pg-hint { font-size: .78rem; color: var(--text-3); }
.pg-ring { --t-solid: var(--brand); --s: 4.2rem; display: inline-flex; align-items: center; gap: .8rem; }
.pg-ring.pg-sm { --s: 2.8rem; } .pg-ring.pg-lg { --s: 6rem; }
.pg-ring-circle { --p: 0; width: var(--s); height: var(--s); border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--t-solid) calc(var(--p) * 1%), var(--bg-sunken) 0); position: relative; flex-shrink: 0; }
.pg-ring-circle::before { content: ""; position: absolute; inset: calc(var(--s) * .11); border-radius: 50%; background: var(--bg-elev); }
.pg-ring-circle > span { position: relative; font-weight: 800; font-size: calc(var(--s) * .26); line-height: 1; display: inline-flex; align-items: baseline; }
.pg-ring-circle small { font-size: .55em; font-weight: 700; color: var(--text-3); margin-left: 1px; }
.pg-ring-text { display: flex; flex-direction: column; min-width: 0; }

/* ============================================================ Étapes de validation */
.wsteps { list-style: none; margin: 0; padding: 0; display: flex; counter-reset: none; }
.wstep { --c: var(--line-strong); --c-bg: var(--bg-elev); --c-fg: var(--text-3); position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .55rem; padding: 0 .4rem; }
.wstep::before { content: ""; position: absolute; top: 1.05rem; left: calc(-50% + 1.4rem); right: calc(50% + 1.4rem); height: 2px; border-radius: 2px; background: var(--line); }
.wstep:first-child::before { display: none; }
.wstep.is-done::before, .wstep.is-current::before, .wstep.is-rejected::before { background: var(--success-strong); }
.wstep-dot { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 2px solid var(--c); background: var(--c-bg); color: var(--c-fg); font-size: .9rem; font-weight: 800; flex-shrink: 0; position: relative; z-index: 1; }
.wstep-dot .ph-bold { font-size: 1rem; }
.wstep.is-done { --c: var(--success-strong); --c-bg: var(--success-strong); --c-fg: var(--on-success); }
.wstep.is-current { --c: var(--brand); --c-bg: var(--bg-elev); --c-fg: var(--brand-ink); }
.wstep.is-current .wstep-dot { box-shadow: 0 0 0 5px var(--brand-soft); }
.wstep.is-rejected { --c: var(--danger); --c-bg: var(--danger); --c-fg: #fff; }
.wstep.is-skipped { --c: var(--line-strong); --c-bg: var(--bg-sunken); --c-fg: var(--text-3); }
.wstep.is-waiting { --c: var(--warning); --c-bg: var(--warning-soft); --c-fg: var(--warning); }
.wstep-body { min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.wstep-label { font-weight: 700; font-size: .88rem; line-height: 1.25; color: var(--text); }
.wstep.is-pending .wstep-label, .wstep.is-skipped .wstep-label { color: var(--text-2); }
.wstep-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: .1rem .45rem; font-size: .76rem; color: var(--text-3); }
.wstep-status { font-weight: 700; }
.wstep.is-done .wstep-status { color: var(--success); } .wstep.is-current .wstep-status { color: var(--text); }
.wstep.is-rejected .wstep-status { color: var(--danger); } .wstep.is-waiting .wstep-status { color: var(--warning); }
.wstep-note { margin-top: .3rem; font-size: .8rem; color: var(--text-2); background: var(--bg-sunken); border-radius: var(--r-sm); padding: .4rem .6rem; text-align: left; overflow-wrap: anywhere; }
.wsteps-vertical { flex-direction: column; }
@media (max-width: 767px) { .wsteps-auto { flex-direction: column; } }
.wsteps-vertical .wstep, .wsteps-auto .wstep { }
.wsteps-vertical > .wstep { flex-direction: row; align-items: flex-start; text-align: left; gap: .8rem; padding: 0 0 1.1rem; }
.wsteps-vertical > .wstep::before { top: 2.3rem; bottom: .15rem; left: calc(1.05rem - 1px); right: auto; width: 2px; height: auto; }
.wsteps-vertical > .wstep:first-child::before { display: block; }
.wsteps-vertical > .wstep:last-child { padding-bottom: 0; }
.wsteps-vertical > .wstep:last-child::before { display: none; }
.wsteps-vertical > .wstep.is-done::before { background: var(--success-strong); }
.wsteps-vertical > .wstep:not(.is-done)::before { background: var(--line); }
.wsteps-vertical .wstep-meta { justify-content: flex-start; }
.wsteps-vertical .wstep-body { padding-top: .3rem; }
@media (max-width: 767px) {
  .wsteps-auto > .wstep { flex-direction: row; align-items: flex-start; text-align: left; gap: .8rem; padding: 0 0 1.1rem; }
  .wsteps-auto > .wstep::before { top: 2.3rem; bottom: .15rem; left: calc(1.05rem - 1px); right: auto; width: 2px; height: auto; display: block; }
  .wsteps-auto > .wstep:last-child { padding-bottom: 0; }
  .wsteps-auto > .wstep:last-child::before { display: none; }
  .wsteps-auto > .wstep.is-done::before { background: var(--success-strong); }
  .wsteps-auto > .wstep:not(.is-done)::before { background: var(--line); }
  .wsteps-auto .wstep-meta { justify-content: flex-start; }
  .wsteps-auto .wstep-body { padding-top: .3rem; }
}

/* ============================================================ Fichiers */
.ftile { display: flex; align-items: center; gap: .75rem; padding: .6rem .7rem; border-radius: var(--r); background: var(--bg-elev); border: 1px solid var(--line); min-width: 0; transition: border-color .15s; }
.ftile:hover { border-color: var(--line-strong); }
.ftile-icon { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: var(--r-sm); background: var(--t-bg); color: var(--t-fg); font-size: 1.35rem; flex-shrink: 0; }
.ftile-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .05rem; }
.ftile-label { font-size: .75rem; font-weight: 700; color: var(--text-3); }
.ftile-name { font-weight: 650; font-size: .9rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
a.ftile-name:hover { color: var(--brand-ink); }
.ftile-meta { font-size: .77rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftile-actions { display: flex; align-items: center; gap: .15rem; flex-shrink: 0; }
.ftile.is-missing { border-style: dashed; }
.ftile-card { flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; gap: 0; }
.ftile-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; border: 0; width: 100%; background: var(--t-bg); color: var(--t-fg); font-size: 2.6rem; cursor: zoom-in; padding: 0; overflow: hidden; }
.ftile-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.ftile-thumb:hover img { transform: scale(1.04); }
.ftile-thumb .ph { vertical-align: 0; }
.ftile-ext { position: absolute; bottom: .55rem; left: .6rem; font-size: .68rem; font-weight: 800; letter-spacing: .04em; padding: .12rem .4rem; border-radius: 5px; background: var(--bg-elev); color: var(--t-fg); }
.ftile-card .ftile-body { padding: .65rem .75rem .2rem; }
.ftile-card .ftile-actions { padding: 0 .4rem .45rem; justify-content: flex-end; }
.ftile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: .75rem; }
.ftile-stack { display: flex; flex-direction: column; gap: .5rem; }

/* Zone de dépôt */
.fdrop-zone { position: relative; display: flex; align-items: center; gap: 1rem; padding: 1.15rem 1.2rem; border-radius: var(--r-lg); border: 1.5px dashed var(--line-strong); background: var(--bg-sunken); transition: border-color .15s, background .15s; cursor: pointer; }
.fdrop-zone:hover, .fdrop-zone.is-over { border-color: var(--brand); background: var(--brand-soft); }
.fdrop-zone.is-over .fdrop-icon { transform: translateY(-3px); }
.fdrop-zone.is-invalid { border-color: var(--danger); }
.fdrop-zone:focus-within { box-shadow: var(--ring); border-color: var(--brand); }
.fdrop-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 1; }
.fdrop-icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: var(--r); background: var(--bg-elev); color: var(--brand-ink); font-size: 1.55rem; border: 1px solid var(--line); flex-shrink: 0; transition: transform .2s var(--ease); }
.fdrop-text { display: flex; flex-direction: column; min-width: 0; }
.fdrop-title { font-weight: 700; font-size: .94rem; }
.fdrop-meta { font-size: .8rem; color: var(--text-3); }
.fdrop.is-compact .fdrop-zone { padding: .7rem .9rem; }
.fdrop.is-compact .fdrop-icon { width: 2.4rem; height: 2.4rem; font-size: 1.25rem; }
.fdrop-list { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.fdrop-file { display: flex; align-items: center; gap: .65rem; padding: .45rem .5rem .45rem .5rem; border-radius: var(--r); background: var(--bg-elev); border: 1px solid var(--line); animation: dv-up .18s var(--ease); }
.fdrop-file.is-error { border-color: var(--danger); }
.fdrop-thumb { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: var(--r-sm); background: var(--t-bg); color: var(--t-fg); font-size: 1.3rem; flex-shrink: 0; overflow: hidden; }
.fdrop-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fdrop-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fdrop-name { font-weight: 650; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fdrop-size { font-size: .76rem; color: var(--text-3); }

/* ============================================================ Montants */
.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.money-cur { font-size: .82em; color: var(--text-3); font-weight: 600; }
.money.is-pos { color: var(--brand-ink); }
.money.is-neg, .money.is-neg-plain { color: var(--danger); }

/* ============================================================ Plein écran */
.fs-box { position: relative; min-width: 0; }
.fs-head { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.fs-title { font-weight: 750; display: flex; align-items: center; gap: .5rem; margin-right: auto; min-width: 0; }
.fs-actions { display: flex; align-items: center; gap: .35rem; }
.fs-float { position: absolute; top: .5rem; right: .5rem; z-index: 5; background: var(--bg-elev); box-shadow: var(--shadow-1); }
.fs-body { min-width: 0; }
.fs-box.is-fullscreen { position: fixed !important; inset: 0; z-index: 260; margin: 0 !important; border-radius: 0 !important; background: var(--bg-elev); display: flex; flex-direction: column; overflow: hidden; max-height: none !important; }
.fs-box.is-fullscreen > .fs-body { flex: 1; overflow: auto; padding: 1rem; }
.fs-box.is-fullscreen > .fs-head { padding-top: calc(.8rem + env(safe-area-inset-top)); }

/* ============================================================ Graphiques */
.xchart { display: flex; flex-direction: column; min-width: 0; }
.xchart-head { display: flex; align-items: center; gap: .6rem; padding: .85rem .9rem .5rem 1.1rem; }
.xchart:not(.panel) .xchart-head { padding: 0 0 .5rem; }
.xchart-titles { flex: 1; min-width: 0; }
.xchart-title { margin: 0; font-size: 1rem; font-weight: 750; display: flex; align-items: center; gap: .5rem; }
.xchart-title .ph { color: var(--text-3); vertical-align: 0; }
.xchart-sub { font-size: .8rem; color: var(--text-3); }
.xchart-tools { display: flex; align-items: center; gap: .2rem; flex-shrink: 0; }
.xchart-types button { width: 2rem; height: 2rem; padding: 0; justify-content: center; }
.xchart-types button .ph { vertical-align: 0; font-size: 1rem; }
.xchart-tools .btn.is-on { background: var(--bg-inverse); color: var(--text-inverse); }
.xchart-body { padding: 0 .6rem .6rem; min-width: 0; }
.xchart:not(.panel) .xchart-body { padding: 0; }
.xchart-canvas { min-width: 0; }
.xchart-table { max-height: 360px; border: 1px solid var(--line); border-radius: var(--r); margin: 0 .4rem .4rem; }
.xchart-foot { padding: .6rem 1.1rem .9rem; font-size: .8rem; color: var(--text-3); border-top: 1px solid var(--line); }
.xchart.is-fullscreen { position: fixed; inset: 0; z-index: 260; border-radius: 0; margin: 0; background: var(--bg-elev); }
.xchart.is-fullscreen .xchart-head { padding-top: calc(.85rem + env(safe-area-inset-top)); }
.xchart.is-fullscreen .xchart-body { flex: 1; overflow: auto; }
.xchart.is-fullscreen .xchart-table { max-height: none; }
.xchart .apexcharts-tooltip { border-radius: var(--r-sm) !important; box-shadow: var(--shadow-2) !important; }
.xchart .apexcharts-legend-text { color: var(--text-2) !important; }
/* Infobulle flottante des graphiques (components.js : chartTip) — position fixe, au-dessus de tout, clair / sombre */
.xchart-canvas.is-linked .apexcharts-pie-area, .xchart-canvas.is-linked .apexcharts-bar-area { cursor: pointer; }
.xchart-canvas .apexcharts-legend-series { cursor: pointer; }
.xchart-canvas .apexcharts-legend-series.is-off { opacity: .4; }
.xchart-canvas .apexcharts-legend-series.is-off .apexcharts-legend-text { text-decoration: line-through; }
.xchart-canvas .apexcharts-legend-series:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.xchart-tip { position: fixed; left: 0; top: 0; z-index: 2147483000; min-width: 12rem; max-width: min(22rem, calc(100vw - 20px)); padding: .65rem .8rem .7rem;
  background: var(--bg-elev); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-sm, 8px); box-shadow: var(--shadow-2);
  font-size: .82rem; line-height: 1.35; pointer-events: none; opacity: 0; transform: translateY(3px); transition: opacity .12s ease, transform .12s ease; }
.xchart-tip.is-on { opacity: 1; transform: none; }
.xchart-tip.is-pinned { pointer-events: auto; }
.xchart-tip[hidden] { display: none; }
.xchart-tip-head { display: flex; align-items: center; gap: .45rem; font-weight: 700; color: var(--text); margin-bottom: .3rem; overflow-wrap: anywhere; }
.xchart-tip-dot { flex: 0 0 auto; width: .7rem; height: .7rem; border-radius: 3px; display: inline-block; }
.xchart-tip-main { display: flex; align-items: baseline; gap: .55rem; }
.xchart-tip-main b { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.xchart-tip-pct { font-weight: 700; color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.xchart-tip-sub { color: var(--text-3); font-size: .76rem; margin-top: .15rem; }
.xchart-tip-sub b { color: var(--text-2); }
.xchart-tip-list, .xchart-tip-detail { list-style: none; margin: .4rem 0 0; padding: .4rem 0 0; border-top: 1px solid var(--line); display: grid; gap: .2rem; }
.xchart-tip-list li { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: .45rem; color: var(--text-2); }
.xchart-tip-list li:not(:has(.xchart-tip-dot)) { grid-template-columns: 1fr auto auto; }
.xchart-tip-list li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xchart-tip-list li b { font-variant-numeric: tabular-nums; color: var(--text); }
.xchart-tip-list li em { font-style: normal; font-variant-numeric: tabular-nums; color: var(--text-3); min-width: 3.4rem; text-align: right; }
.xchart-tip-list li.is-current span, .xchart-tip-list li.is-current b { color: var(--text); font-weight: 800; }
.xchart-tip-detail li { color: var(--text-2); padding-left: .8rem; position: relative; }
.xchart-tip-detail li::before { content: ''; position: absolute; left: .1rem; top: .55em; width: .3rem; height: .3rem; border-radius: 50%; background: var(--text-3); }
.xchart-tip-hint { margin-top: .45rem; color: var(--text-3); font-size: .74rem; display: flex; align-items: center; gap: .35rem; }
.xchart-tip-actions { margin-top: .55rem; display: flex; gap: .4rem; }
.xchart-tip-actions .btn { min-height: 2.5rem; }
/* Tableau de détail dans l'infobulle (zone → magasins, agent C2) */
.xchart-tip.is-wide { max-width: min(30rem, calc(100vw - 20px)); }
.xchart-tip-table { margin-top: .45rem; padding-top: .4rem; border-top: 1px solid var(--line); }
.xchart-tip-cap { font-size: .72rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--text-3); margin-bottom: .25rem; }
.xchart-tip-table table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.xchart-tip-table th { font-size: .7rem; font-weight: 600; color: var(--text-3); text-align: right; padding: 0 0 .2rem .55rem; white-space: nowrap; }
.xchart-tip-table th:first-child, .xchart-tip-table td:first-child { text-align: left; padding-left: 0; }
.xchart-tip-table td { padding: .18rem 0 .18rem .55rem; text-align: right; white-space: nowrap; color: var(--text-2); border-top: 1px solid var(--line); vertical-align: middle; }
.xchart-tip-table td:nth-child(2) { color: var(--text); font-weight: 700; }
.xchart-tip-table td:first-child { white-space: normal; max-width: 15rem; }
.xchart-tip-table tr.is-zero td { color: var(--text-3); font-weight: 400; }
.xchart-tip-table tr.is-off .xchart-tip-wh b { text-decoration: line-through; text-decoration-color: var(--text-3); }
.xchart-tip-table tr.is-extra td { font-style: italic; }
.xchart-tip-table tfoot td { border-top: 1px solid var(--line-strong); color: var(--text); font-weight: 800; }
.xchart-tip-wh { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .1rem .35rem; min-width: 0; }
.xchart-tip-wh .xchart-tip-dot { width: .55rem; height: .55rem; border-radius: 50%; }
.xchart-tip-wh b { color: var(--text); font-weight: 700; }
.xchart-tip-wh span { color: var(--text-2); overflow-wrap: anywhere; }
.xchart-tip-wh em { font-style: normal; font-size: .66rem; font-weight: 600; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 0 .35rem; line-height: 1.35; }
.xchart-tip-table a { color: inherit; text-decoration: none; display: inline-flex; min-height: 2rem; align-items: center; }
.xchart-tip-table a:hover b, .xchart-tip-table a:focus-visible b { color: var(--brand-ink); text-decoration: underline; }
@media (max-width: 480px) { .xchart-tip-wh span { display: none; } .xchart-tip-table td:first-child { max-width: 9rem; } }
@media (hover: none) { .xchart-tip-table a { min-height: 2.75rem; } }
@media (prefers-reduced-motion: reduce) { .xchart-tip { transition: none; transform: none; } }

/* ============================================================ Mobile */
.dv-hide-sm { display: inline; }
@media (max-width: 767px) {
  .dv-toolbar { padding: .7rem .75rem; gap: .5rem; }
  .dv-search { flex: 1 1 100%; max-width: none; order: 1; }
  .dv-title { order: 0; flex: 1 1 100%; }
  .dv-tools { order: 2; margin-left: 0; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .dv-tools::-webkit-scrollbar { display: none; }
  .dv-tools > * { flex-shrink: 0; }
  .dv-tools .dropdown { position: static; }
  .dv-tools .menu { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); min-width: 0; max-height: 70dvh; overflow-y: auto; z-index: 210; border-radius: var(--r-lg); padding: .5rem; }
  .has-tabbar .dv-tools .menu { bottom: calc(var(--tabbar-h, 64px) + 10px + env(safe-area-inset-bottom)); }
  .dv-search-input { min-height: 2.75rem; font-size: 1rem; }
  .dv-tools .btn-sm, .dv-views button { min-height: 2.75rem; }
  .dv-tools .btn-icon.btn-sm { width: 2.75rem; min-width: 2.75rem; }
  .dv-views button { width: 2.5rem; height: 2.5rem; }
  .dv-hide-sm { display: none; }
  .dv-chips { padding: .5rem .75rem 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .dv-chips::-webkit-scrollbar { display: none; }
  .dv-chip { flex-shrink: 0; }
  .dv-pane-cards, .dv-pane-kanban { padding: .75rem; }
  .dv-cards { gap: .65rem; }
  .dv-item { padding: .6rem .75rem; }
  .dv-foot { padding: .7rem .75rem; justify-content: center; }
  .dv-count { margin-right: 0; width: 100%; text-align: center; }
  .dv-bulkbar { margin: .6rem .5rem .75rem; padding: .55rem .6rem; }
  .dv-bulk-actions .btn { padding: 0; width: 2.5rem; min-width: 2.5rem; }
  .dv-bulk-actions .btn > span:not(.count) { display: none; }
  .dv-pane-table > .table-wrap { max-height: none; }
  .ftile-actions .btn-icon.btn-sm { width: 2.6rem; min-width: 2.6rem; min-height: 2.6rem; }
  .fdrop-file .btn-icon.btn-sm { width: 2.6rem; min-width: 2.6rem; min-height: 2.6rem; }
  .xchart-head { padding: .75rem .6rem .4rem .9rem; }
  .ftile-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: .6rem; }
  .ftile-card .ftile-thumb { font-size: 2.1rem; }
  .xchart-tools .btn-icon.btn-sm { width: 2.5rem; min-width: 2.5rem; min-height: 2.5rem; }
}
@media print {
  .dv-toolbar, .dv-chips-wrap, .dv-foot, .dv-bulkbar, .xchart-tools, .fs-head .btn, .ftile-actions, .kb-move { display: none !important; }
  .dv-pane { display: block !important; }
  .dv-pane:not(.dv-pane-table) { display: none !important; }
}

/* =========================================================================
   VISIONNEUSE (viewer.js)
   ========================================================================= */
html.vw-lock, html.vw-lock body { overflow: hidden !important; }
.vw {
  --vw-bg: #0B0D0A; --vw-stage: #16191403; --vw-bar: #111410; --vw-fg: #F3F5F1; --vw-mut: #9AA394; --vw-line: #262B22;
  --vw-btn: transparent; --vw-btn-h: rgba(255,255,255,.09); --vw-btn-on: rgba(255,255,255,.16); --vw-field: #1B1F18; --vw-card: #151813;
  --vw-page-shadow: 0 2px 10px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.04); --vw-hl: rgba(244,191,32,.42); --vw-hl-cur: rgba(244,123,32,.75);
  display: flex; flex-direction: column; background: var(--vw-bg); color: var(--vw-fg); font-family: var(--font); min-height: 0; position: relative; overflow: hidden; outline: none;
  color-scheme: dark;
}
.vw[data-vtheme="light"] {
  --vw-bg: #E7EAE4; --vw-bar: #FFFFFF; --vw-fg: #0A0D09; --vw-mut: #5E665A; --vw-line: #DCE0D7;
  --vw-btn-h: rgba(0,0,0,.06); --vw-btn-on: rgba(0,0,0,.1); --vw-field: #F1F3EF; --vw-card: #FFFFFF;
  --vw-page-shadow: 0 2px 10px rgba(10,13,9,.14), 0 0 0 1px rgba(10,13,9,.06); --vw-hl: rgba(255,200,0,.45); --vw-hl-cur: rgba(244,123,32,.7);
  color-scheme: light;
}
.vw-overlay { position: fixed; inset: 0; z-index: 330; animation: vw-in .18s var(--ease); }
@keyframes vw-in { from { opacity: 0; transform: scale(.985); } }
.vw-mount { min-height: 320px; }
.vw-inline { height: 100%; min-height: inherit; border-radius: var(--r-lg); border: 1px solid var(--line); }
.vw .ph { vertical-align: 0; line-height: 1; }
.vw [hidden] { display: none !important; }

/* Barre du haut */
.vw-bar { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; padding-top: max(.45rem, env(safe-area-inset-top)); background: var(--vw-bar); border-bottom: 1px solid var(--vw-line); min-height: 3.4rem; flex-shrink: 0; position: relative; z-index: 3; }
.vw-start { display: flex; align-items: center; gap: .55rem; min-width: 0; flex: 1 1 auto; }
.vw-tools { display: flex; align-items: center; gap: .25rem; flex-shrink: 0; }
.vw-end { display: flex; align-items: center; gap: .2rem; flex-shrink: 0; }
.vw-group { display: inline-flex; align-items: center; gap: .1rem; padding: 0 .25rem; border-right: 1px solid var(--vw-line); margin-right: .15rem; }
.vw-group:last-child { border-right: 0; }
.vw-btn { display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: var(--r-sm); border: 0; background: var(--vw-btn); color: var(--vw-fg); font-size: 1.2rem; cursor: pointer; flex-shrink: 0; text-decoration: none !important; transition: background .12s; position: relative; }
.vw-btn:hover { background: var(--vw-btn-h); }
.vw-btn.is-on { background: var(--vw-btn-on); color: var(--brand); }
.vw-btn:focus-visible, .vw-zoomval:focus-visible, .vw-mi:focus-visible, .vw-thumb:focus-visible, .vw-sheet-tab:focus-visible { box-shadow: var(--ring); outline: none; }
.vw [data-tip]:hover::after { background: var(--vw-fg); color: var(--vw-bg); top: calc(100% + 6px); bottom: auto; }
.vw-ficon { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: var(--r-sm); font-size: 1.25rem; flex-shrink: 0; background: var(--t-bg, rgba(255,255,255,.08)); color: var(--t-fg, var(--vw-fg)); }
.vw-ficon.tone-danger { --t-bg: color-mix(in srgb, #FF6B5E 18%, transparent); --t-fg: #FF8A80; }
.vw-ficon.tone-success { --t-bg: color-mix(in srgb, var(--signal) 20%, transparent); --t-fg: #8BD35F; }
.vw-ficon.tone-info { --t-bg: color-mix(in srgb, #4C8DFF 20%, transparent); --t-fg: #7FAEFF; }
.vw-ficon.tone-violet { --t-bg: color-mix(in srgb, #9D7BFF 20%, transparent); --t-fg: #B79BFF; }
.vw-ficon.tone-orange { --t-bg: color-mix(in srgb, #F47B20 20%, transparent); --t-fg: #FFA466; }
.vw-ficon.tone-muted { --t-bg: rgba(127,127,127,.18); --t-fg: var(--vw-mut); }
.vw[data-vtheme="light"] .vw-ficon.tone-danger { --t-fg: #C62828; } .vw[data-vtheme="light"] .vw-ficon.tone-success { --t-fg: #3B7A1B; }
.vw[data-vtheme="light"] .vw-ficon.tone-info { --t-fg: #1D5FD0; } .vw[data-vtheme="light"] .vw-ficon.tone-violet { --t-fg: #6D3FD6; } .vw[data-vtheme="light"] .vw-ficon.tone-orange { --t-fg: #C2560A; }
.vw-titles { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.vw-name { font-weight: 700; font-size: .93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-sub { font-size: .76rem; color: var(--vw-mut); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.vw-pageno { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; color: var(--vw-mut); font-variant-numeric: tabular-nums; }
.vw-pageinput { width: 3rem; height: 2rem; text-align: center; border-radius: var(--r-xs); border: 1px solid var(--vw-line); background: var(--vw-field); color: var(--vw-fg); font: inherit; font-weight: 700; font-size: .85rem; }
.vw-pageinput:focus { outline: none; box-shadow: var(--ring); border-color: var(--brand); }
.vw-pagecount { white-space: nowrap; }
.vw-zoomval { min-width: 3.9rem; height: 2.2rem; border: 0; border-radius: var(--r-xs); background: transparent; color: var(--vw-fg); font: inherit; font-weight: 700; font-size: .8rem; cursor: pointer; font-variant-numeric: tabular-nums; }
.vw-zoomval:hover { background: var(--vw-btn-h); }
.vw-more-wrap { position: relative; }
.vw-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; padding: .35rem; border-radius: var(--r); background: var(--vw-card); border: 1px solid var(--vw-line); box-shadow: 0 20px 50px -10px rgba(0,0,0,.6); z-index: 10; }
.vw-mi { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .6rem .7rem; border: 0; border-radius: var(--r-xs); background: transparent; color: var(--vw-fg); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; text-decoration: none !important; }
.vw-mi:hover { background: var(--vw-btn-h); }
.vw-mi .ph { color: var(--vw-mut); font-size: 1.1rem; }

/* Recherche */
.vw-search { display: flex; align-items: center; gap: .3rem; padding: .4rem .6rem; background: var(--vw-bar); border-bottom: 1px solid var(--vw-line); flex-shrink: 0; position: relative; z-index: 2; animation: vw-drop .15s var(--ease); }
@keyframes vw-drop { from { transform: translateY(-6px); opacity: 0; } }
.vw-search-ico { display: grid; place-items: center; width: 2rem; color: var(--vw-mut); font-size: 1.1rem; }
.vw-search-input { flex: 1; min-width: 0; height: 2.4rem; padding: 0 .8rem; border-radius: var(--r-pill); border: 1px solid var(--vw-line); background: var(--vw-field); color: var(--vw-fg); font: inherit; font-size: .95rem; }
.vw-search-input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.vw-search-count { font-size: .8rem; color: var(--vw-mut); white-space: nowrap; min-width: 4.5rem; text-align: center; font-variant-numeric: tabular-nums; }

/* Zone principale */
.vw-main { flex: 1; min-height: 0; display: flex; position: relative; }
.vw-stage { flex: 1; min-width: 0; overflow: auto; position: relative; outline: none; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.vw-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); }
.vw-center { display: grid; place-items: center; padding: 1.5rem; }
.vw-side { width: 188px; flex-shrink: 0; overflow-y: auto; padding: .75rem .7rem; background: var(--vw-bar); border-right: 1px solid var(--vw-line); display: flex; flex-direction: column; gap: .7rem; scrollbar-width: thin; }
.vw-thumb { display: flex; flex-direction: column; align-items: center; gap: .3rem; border: 0; background: transparent; color: var(--vw-mut); padding: .35rem; border-radius: var(--r-sm); cursor: pointer; font: inherit; font-size: .75rem; font-weight: 700; }
.vw-thumb:hover { background: var(--vw-btn-h); }
.vw-thumb-img { display: block; width: 100%; background: #fff; border-radius: 3px; overflow: hidden; box-shadow: var(--vw-page-shadow); outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .12s; }
.vw-thumb-img canvas { width: 100%; height: auto; display: block; }
.vw-thumb.is-current { color: var(--vw-fg); }
.vw-thumb.is-current .vw-thumb-img { outline-color: var(--brand); }
.vw-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 4; width: 3rem; height: 3rem; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: 1.35rem; cursor: pointer; background: color-mix(in srgb, var(--vw-bar) 82%, transparent); color: var(--vw-fg); box-shadow: 0 6px 20px rgba(0,0,0,.35); backdrop-filter: blur(6px); transition: transform .15s, background .15s; }
.vw-nav:hover { background: var(--vw-bar); transform: translateY(-50%) scale(1.06); }
.vw-prev { left: 14px; } .vw-next { right: 14px; }
.has-side .vw-prev { left: 202px; }

/* Chargement / erreurs / fiche */
.vw-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem; color: var(--vw-mut); font-size: .9rem; z-index: 2; }
.vw-spinner { width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 3px solid var(--vw-line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.vw-loading-bar { width: 180px; height: 4px; border-radius: 4px; background: var(--vw-line); overflow: hidden; opacity: 0; }
.vw-loading.has-progress .vw-loading-bar { opacity: 1; }
.vw-loading-bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.vw-card { width: min(440px, 100%); display: flex; flex-direction: column; align-items: center; text-align: center; gap: .55rem; padding: 2rem 1.5rem; border-radius: var(--r-xl); background: var(--vw-card); border: 1px solid var(--vw-line); box-shadow: 0 20px 60px -20px rgba(0,0,0,.5); }
.vw-card-icon { position: relative; display: grid; place-items: center; width: 4.6rem; height: 4.6rem; border-radius: var(--r-lg); font-size: 2.3rem; background: rgba(127,127,127,.14); color: var(--vw-fg); margin-bottom: .4rem; }
.vw-card-icon.tone-danger { background: color-mix(in srgb, #FF6B5E 18%, transparent); color: #FF8A80; }
.vw-card-icon.tone-success { background: color-mix(in srgb, var(--signal) 20%, transparent); color: #8BD35F; }
.vw-card-icon.tone-info { background: color-mix(in srgb, #4C8DFF 20%, transparent); color: #7FAEFF; }
.vw-card-icon.tone-orange { background: color-mix(in srgb, #F47B20 20%, transparent); color: #FFA466; }
.vw-card-icon.tone-violet { background: color-mix(in srgb, #9D7BFF 20%, transparent); color: #B79BFF; }
.vw[data-vtheme="light"] .vw-card-icon.tone-danger { color: #C62828; } .vw[data-vtheme="light"] .vw-card-icon.tone-success { color: #3B7A1B; } .vw[data-vtheme="light"] .vw-card-icon.tone-info { color: #1D5FD0; } .vw[data-vtheme="light"] .vw-card-icon.tone-orange { color: #C2560A; } .vw[data-vtheme="light"] .vw-card-icon.tone-violet { color: #6D3FD6; }
.vw-card-ext { position: absolute; bottom: -.45rem; left: 50%; transform: translateX(-50%); font-size: .66rem; font-weight: 800; letter-spacing: .04em; padding: .12rem .45rem; border-radius: 5px; background: var(--vw-fg); color: var(--vw-bg); }
.vw-card-title { font-weight: 750; font-size: 1.05rem; overflow-wrap: anywhere; }
.vw-card-meta { font-size: .82rem; color: var(--vw-mut); font-weight: 600; }
.vw-card-text { font-size: .88rem; color: var(--vw-mut); max-width: 36ch; }
.vw-card-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .6rem; }
.vw-card .btn-outline { --btn-fg: var(--vw-fg); --btn-bd: var(--vw-line); }
.vw-card .btn-outline:hover { background: var(--vw-btn-h); }
.vw-note { display: flex; align-items: center; gap: .5rem; margin: 1rem auto; padding: .6rem .9rem; border-radius: var(--r); background: var(--vw-card); color: var(--vw-mut); font-size: .84rem; width: fit-content; max-width: 90%; border: 1px solid var(--vw-line); }

/* PDF */
.vw-pdf { touch-action: pan-x pan-y; }
.vw-pages { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 24px; width: 100%; }
.vw-page { position: relative; background: #fff; box-shadow: var(--vw-page-shadow); flex-shrink: 0; border-radius: 2px; overflow: hidden; margin-inline: auto; }
.vw-page canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; max-width: none; }
.vw-page-ph { position: absolute; inset: 0; background: linear-gradient(90deg, #f3f4f1 25%, #fafaf8 37%, #f3f4f1 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
.vw-native { padding: 0; }
.vw-native iframe { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
/* Couche texte pdf.js (sélection, recherche) */
.vw .textLayer { position: absolute; text-align: initial; inset: 0; overflow: clip; opacity: 1; line-height: 1; -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText; z-index: 1; }
.vw .textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.vw .textLayer > :not(.markedContent), .vw .textLayer .markedContent span:not(.markedContent) { z-index: 1; }
.vw .textLayer span.markedContent { top: 0; height: 0; }
.vw .textLayer ::selection { background: rgba(29, 95, 208, .3); color: transparent; }
.vw .textLayer br::selection { background: transparent; }
.vw .textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }
.vw .textLayer .vw-hl { position: static; background: var(--vw-hl); border-radius: 2px; margin: -1px; padding: 1px; }
.vw .textLayer .vw-hl.is-current { background: var(--vw-hl-cur); }

/* Images */
.vw-image { overflow: hidden; cursor: grab; touch-action: none; background-image: radial-gradient(color-mix(in srgb, var(--vw-fg) 7%, transparent) 1px, transparent 1px); background-size: 18px 18px; }
.vw-image.is-grabbing { cursor: grabbing; }
.vw-image:not(.is-zoomed) { cursor: zoom-in; }
.vw-img { position: absolute; left: 50%; top: 50%; max-width: none; transform-origin: center; user-select: none; -webkit-user-drag: none; box-shadow: 0 10px 40px rgba(0,0,0,.35); image-rendering: auto; }

/* Word */
.vw-docx-stage { padding: 0; }
.vw-docx .docx-wrapper { background: transparent !important; padding: 24px 12px !important; display: flex; flex-direction: column; align-items: center; }
.vw-docx .docx-wrapper > section.docx { box-shadow: var(--vw-page-shadow) !important; margin: 0 auto 16px !important; color: #000; }
.vw-docx mark.vw-hl, .vw-code mark.vw-hl, .vw-prose mark.vw-hl, .vw-grid mark.vw-hl { background: var(--vw-hl); color: inherit; border-radius: 2px; padding: 0 1px; }
.vw-docx mark.vw-hl.is-current, .vw-code mark.vw-hl.is-current, .vw-prose mark.vw-hl.is-current { background: var(--vw-hl-cur); }

/* Tableurs */
.vw-sheet-stage { padding: 0; background: var(--vw-card); }
.vw-sheet { min-width: max-content; }
.vw-grid { --vw-z: 1; border-collapse: separate; border-spacing: 0; font-size: calc(.84rem * var(--vw-z)); font-variant-numeric: tabular-nums; background: var(--vw-card); color: var(--vw-fg); }
.vw-grid th, .vw-grid td { border-right: 1px solid var(--vw-line); border-bottom: 1px solid var(--vw-line); padding: calc(.32rem * var(--vw-z)) calc(.6rem * var(--vw-z)); white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis; text-align: left; vertical-align: middle; }
.vw-grid thead th { position: sticky; top: 0; z-index: 2; background: var(--vw-bar); color: var(--vw-mut); font-weight: 700; font-size: .92em; text-align: center; }
.vw-grid tbody th { position: sticky; left: 0; z-index: 1; background: var(--vw-bar); color: var(--vw-mut); font-weight: 650; text-align: right; min-width: 3rem; font-size: .9em; }
.vw-grid .vw-corner { left: 0; z-index: 3; }
.vw-grid td.is-num { text-align: right; }
.vw-grid tbody tr:hover td { background: var(--vw-btn-h); }
.vw-more-rows { padding: 1rem; display: flex; justify-content: center; position: sticky; left: 0; width: 100vw; max-width: 100%; }
.vw-more-rows .btn { --btn-fg: var(--vw-fg); --btn-bd: var(--vw-line); --btn-bg: transparent; }
.vw-foot { flex-shrink: 0; background: var(--vw-bar); border-top: 1px solid var(--vw-line); padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom)); }
.vw-sheets { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
.vw-sheets::-webkit-scrollbar { display: none; }
.vw-sheet-tab { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.4rem; padding: .3rem .85rem; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--vw-mut); font: inherit; font-size: .86rem; font-weight: 650; cursor: pointer; white-space: nowrap; }
.vw-sheet-tab:hover { background: var(--vw-btn-h); color: var(--vw-fg); }
.vw-sheet-tab.is-active { background: var(--vw-btn-on); color: var(--vw-fg); box-shadow: inset 0 -2px 0 var(--brand); }

/* Texte, JSON, Markdown */
.vw-text-stage { padding: 0; }
.vw-code { --vw-z: 1; margin: 0; padding: 1rem 0 2rem; font: calc(.84rem * var(--vw-z)) / 1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--vw-fg); min-width: max-content; }
.vw-code.is-wrap { min-width: 0; }
.vw-line { display: flex; }
.vw-line:hover { background: var(--vw-btn-h); }
.vw-ln { flex-shrink: 0; width: 4.2em; padding-right: 1em; text-align: right; color: var(--vw-mut); opacity: .7; user-select: none; position: sticky; left: 0; background: var(--vw-bg); }
.vw-lc { white-space: pre; padding-right: 1.5rem; }
.vw-code.is-wrap .vw-lc { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.vw-code .j-key { color: #7FAEFF; } .vw-code .j-str { color: #8BD35F; } .vw-code .j-num { color: #FFA466; } .vw-code .j-kw { color: #B79BFF; }
.vw[data-vtheme="light"] .vw-code .j-key { color: #1D5FD0; } .vw[data-vtheme="light"] .vw-code .j-str { color: #3B7A1B; } .vw[data-vtheme="light"] .vw-code .j-num { color: #C2560A; } .vw[data-vtheme="light"] .vw-code .j-kw { color: #6D3FD6; }
.vw-prose { --vw-z: 1; max-width: 76ch; margin: 1.5rem auto 3rem; padding: 2rem clamp(1rem, 4vw, 3rem); background: var(--vw-card); border-radius: var(--r-lg); border: 1px solid var(--vw-line); font-size: calc(1rem * var(--vw-z)); color: var(--vw-fg); }
.vw-prose a { color: var(--brand); }
.vw-prose pre, .vw-prose code { background: var(--vw-field); border-radius: 6px; padding: .1em .35em; font-size: .9em; }
.vw-prose pre { padding: .8rem 1rem; overflow-x: auto; }
.vw-prose table { border-collapse: collapse; margin: 1em 0; } .vw-prose th, .vw-prose td { border: 1px solid var(--vw-line); padding: .35em .7em; }
.vw-prose img { max-width: 100%; }

/* Audio / vidéo */
.vw-video-stage { padding: 1rem; background: #000; }
.vw-video { max-width: 100%; max-height: 100%; width: auto; border-radius: var(--r); box-shadow: 0 20px 60px rgba(0,0,0,.6); background: #000; }
.vw-audio { width: 100%; margin-top: .8rem; }
.vw-pulse { animation: vw-pulse 2.2s ease-in-out infinite; }
@keyframes vw-pulse { 50% { transform: scale(1.05); } }

/* Mobile : barre d'outils en bas, au pouce */
@media (max-width: 767px) {
  .vw-bar { padding-left: .35rem; padding-right: .35rem; gap: .25rem; }
  .vw-ficon { display: none; }
  .vw-btn { width: 2.75rem; height: 2.75rem; }
  .vw-end [data-hide-sm] { display: none !important; }
  .vw-overlay.has-tools .vw-tools { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); top: auto; z-index: 6; max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; padding: .3rem; border-radius: var(--r-pill); background: color-mix(in srgb, var(--vw-bar) 94%, transparent); border: 1px solid var(--vw-line); box-shadow: 0 12px 30px rgba(0,0,0,.45); backdrop-filter: blur(10px); }
  .vw-overlay.has-tools .vw-bar { position: static; }
  .vw-overlay .vw-tools .vw-group { border-right: 0; padding: 0; margin: 0; }
  .vw-overlay .vw-tools .vw-zoomval { min-width: 3.4rem; }
  .vw-overlay .vw-pageinput { width: 2.6rem; height: 2.3rem; }
  .vw-overlay .vw-fit { display: none; }
  .vw-overlay.has-tools[data-kind="xlsx"] .vw-tools, .vw-overlay.has-tools[data-kind="csv"] .vw-tools { bottom: calc(64px + env(safe-area-inset-bottom)); }
  .vw-overlay.has-tools .vw-pages { padding-bottom: 90px; }
  .vw-inline .vw-tools { display: none; }
  .vw-pages { padding: 10px 8px; gap: 10px; }
  .vw-side { position: absolute; left: 0; top: 0; bottom: 0; z-index: 7; width: 150px; box-shadow: 10px 0 30px rgba(0,0,0,.4); }
  .has-side .vw-prev { left: 14px; }
  .vw-nav { width: 2.6rem; height: 2.6rem; top: auto; bottom: calc(80px + env(safe-area-inset-bottom)); transform: none; opacity: .92; }
  .vw-nav:hover { transform: none; }
  .vw-search-count { min-width: 3.2rem; }
  .vw-menu { position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(8px + env(safe-area-inset-bottom)); min-width: 0; border-radius: var(--r-lg); padding: .5rem; }
  .vw-mi { min-height: 2.9rem; }
  .vw [data-tip]:hover::after { display: none; }
}
@media (min-width: 768px) and (max-width: 1100px) { .vw-overlay .vw-tools .vw-fit { display: none; } }
@media print { .vw-host, .vw-overlay { display: none !important; } }

/* =========================================================================
   v2.0 (agent 1) — vues enregistrées, périodes rapides, vue de données « fill »
   ========================================================================= */
.dv-saved-menu { width: 300px; }
.dv-saved-row { display: flex; align-items: center; gap: .15rem; border-radius: 7px; }
.dv-saved-row .menu-item { flex: 1; min-width: 0; }
.dv-saved-row.is-current .menu-item { background: var(--brand-soft); }
.dv-saved-row.is-current .menu-item > .ph { color: var(--brand-ink); }
.dv-saved-empty { padding: .2rem .65rem .45rem; line-height: 1.45; }
.dv-saved-form { display: flex; gap: .35rem; padding: .25rem .35rem .3rem; }
.dv-saved-form .input { flex: 1; min-width: 0; }
.dv-presets { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.dv-presets .chip { font-size: .74rem; padding: .18rem .55rem; cursor: pointer; }
.dv-presets .chip.is-active { background: var(--bg-inverse); color: var(--text-inverse); border-color: var(--bg-inverse); }
/* Vue de données en hauteur pleine (prop « fill ») : barre d'outils et pied fixes, corps défilant */
.dv.fill { min-height: 0; }
.dv.fill > .dv-toolbar, .dv.fill > .dv-chips-wrap, .dv.fill > .dv-foot, .dv.fill > .dv-inline-filters { flex-shrink: 0; }
@media (min-width: 768px) {
  .dv.fill > .dv-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
  .dv.fill .dv-pane-table > .table-wrap, .dv.fill .dv-pane-table > .table { max-height: none; overflow: visible; }
  .dv.fill .dv-pane-table .table th { top: 0; }
}

/* =========================================================================
   KIT STOCK IT (agent Design) — composants des modules métier.
   <x-stat-link>, <x-qty>, <x-tile>, <x-stock-status>, <x-split-bar>, <x-breadcrumb>, <x-page-head>
   Documentation et exemples à copier : docs/COMPONENTS.md § 12 · démonstration : /app/composants (onglet « Kit Stock IT »).
   Couleurs de statut (identiques dans les pastilles, cartes, tuiles, répartitions et graphiques) :
     owned = accent · in_stock = succès · usable = teal · deployed = info · in_transit = ambre · rma = violet · scrapped / lost = danger · consumed = neutre
   ========================================================================= */
:root {
  --st-owned: var(--brand); --st-in_stock: var(--success-strong); --st-usable: var(--c-teal-strong); --st-deployed: var(--c-blue-strong);
  --st-in_transit: var(--c-amber-strong); --st-rma: var(--c-violet-strong); --st-scrapped: var(--c-rose-strong); --st-lost: var(--c-rose-strong); --st-consumed: var(--c-slate-strong);
}
/* Aplat d'un ton (segments de répartition, points de légende) */
.tone-brand { --seg: var(--brand); }
.tone-success { --seg: var(--success-strong); }
.tone-teal { --seg: var(--c-teal-strong); }
.tone-info { --seg: var(--c-blue-strong); }
.tone-warning { --seg: var(--c-amber-strong); }
.tone-violet { --seg: var(--c-violet-strong); }
.tone-orange { --seg: color-mix(in srgb, var(--orange) 80%, var(--bg-elev)); }
.tone-danger { --seg: var(--c-rose-strong); }
.tone-muted { --seg: var(--c-slate-strong); }

/* ---------------------------------------------------------------- En-tête de page (<x-page-head icon count>) */
.page-title.has-extras { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .65rem; }
.page-title-icon { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 10px; background: var(--bg-inverse); color: var(--text-inverse); font-size: 1.15rem; line-height: 1; flex-shrink: 0; }
.page-title-icon > .ph { font-size: 1em; }
.page-title-count { font-size: .78rem; height: 1.5rem; min-width: 1.5rem; padding: 0 .5rem; font-stretch: 100%; letter-spacing: 0; }
.page-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .45rem; }

/* ---------------------------------------------------------------- Pastille de statut (<x-stock-status>) */
.st-pill { gap: .32rem; }
.st-pill.has-icon { padding-left: .42rem; }
.st-pill > .ph { font-size: 1.1em; }
.st-pill-count { font-weight: 800; padding-left: .38rem; margin-left: .08rem; border-left: 1px solid color-mix(in srgb, currentColor 28%, transparent); }
a.st-pill { text-decoration: none !important; transition: filter .15s, box-shadow .15s; }
a.st-pill:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 45%, transparent); }
.badge.tone-brand.is-solid { --b-bg: var(--brand); color: var(--on-brand); }
.badge.tone-success.is-solid { --b-bg: var(--success-strong); color: var(--on-success); }

/* ---------------------------------------------------------------- Quantité (<x-qty>) */
.qty { display: inline-flex; align-items: baseline; gap: .35rem; font-weight: 700; color: var(--text); white-space: nowrap; text-decoration: none !important; line-height: 1.2; }
.qty-num { font-variant-numeric: tabular-nums; }
.qty-unit { font-size: .78em; font-weight: 600; color: var(--text-3); }
.qty-dot { align-self: center; width: .5rem; height: .5rem; border-radius: 50%; background: var(--c-slate-strong); flex-shrink: 0; }
.qty[data-status="owned"] .qty-dot { background: var(--st-owned); } .qty[data-status="in_stock"] .qty-dot { background: var(--st-in_stock); }
.qty[data-status="usable"] .qty-dot { background: var(--st-usable); } .qty[data-status="deployed"] .qty-dot { background: var(--st-deployed); }
.qty[data-status="in_transit"] .qty-dot { background: var(--st-in_transit); } .qty[data-status="rma"] .qty-dot { background: var(--st-rma); }
.qty[data-status="scrapped"] .qty-dot, .qty[data-status="lost"] .qty-dot { background: var(--st-scrapped); } .qty[data-status="consumed"] .qty-dot { background: var(--st-consumed); }
.qty.is-zero { color: var(--text-3); font-weight: 500; }
.qty.is-zero .qty-dot { opacity: .35; }
.qty.is-pos { color: var(--success); } .qty.is-neg { color: var(--danger); }
a.qty { border-radius: 6px; padding: .08rem .3rem; margin: -.08rem -.3rem; transition: background .15s, color .15s; }
a.qty:hover { background: var(--brand-soft); color: var(--brand-ink); }
.qty-sm { font-size: .82rem; } .qty-lg { font-size: 1.35rem; font-weight: 800; font-stretch: 108%; letter-spacing: -.015em; } .qty-xl { font-size: clamp(1.8rem, 1.4rem + 1.2vw, 2.6rem); font-weight: 800; font-stretch: 110%; letter-spacing: -.025em; line-height: 1.05; }
td .qty, th .qty { vertical-align: baseline; }

/* ---------------------------------------------------------------- Carte statistique cliquable (<x-stat-link>) */
.stat-link { text-decoration: none !important; color: inherit; overflow: hidden; }
.stat-link > span { display: flex; }
.stat-link > .stat-value { display: block; }
.stat-link-go { margin-left: auto; font-size: 1rem; color: var(--text-3); opacity: .55; transition: transform .2s var(--ease-out), opacity .2s, color .2s; }
.stat-link.is-clickable:hover .stat-link-go { opacity: 1; color: var(--brand-ink); transform: translate(2px, -2px); }
.stat-link.is-clickable:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line-strong)); }
.stat-link-hint { margin-left: auto; font-weight: 600; color: var(--text-2); opacity: 0; transition: opacity .2s; }
.stat-link.is-clickable:hover .stat-link-hint, .stat-link:focus-visible .stat-link-hint { opacity: 1; }
.stat-link.has-accent::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--seg, var(--brand)); }
.stat-card.tone-teal .stat-icon { background: var(--c-teal-soft); color: var(--c-teal); }
@media (hover: none) { .stat-link-hint { opacity: 1; } }

/* ---------------------------------------------------------------- Tuile de famille / type / site (<x-tile>) */
/* auto-fit : les tuiles s'élargissent pour occuper toute la rangée (grands écrans, télévision) ; .is-fixed garde des colonnes de largeur constante */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: .75rem; }
.tile-grid.is-fixed { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.tile-grid > .tile { max-width: 640px; }
.tile-grid.is-dense { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: .6rem; }
.tile-grid.is-wide { grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); }
.tile { --tile-c: var(--text); position: relative; display: flex; flex-direction: column; gap: .6rem; min-width: 0; padding: .9rem 1rem; border-radius: 14px; background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow-1); color: var(--text); text-decoration: none !important; }
.tile-head { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.tile-icon { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; flex-shrink: 0; border-radius: 10px; background: var(--bg-sunken); color: var(--tile-c); font-size: 1.2rem; line-height: 1; transition: background .2s, color .2s; }
.tile[style*="--tile-c"] .tile-icon { background: color-mix(in srgb, var(--tile-c) 13%, var(--bg-elev)); color: color-mix(in srgb, var(--tile-c) 72%, var(--text)); }
.tile-icon > .ph { font-size: 1em; }
.tile.is-clickable:hover .tile-icon { background: var(--bg-inverse); color: var(--text-inverse); }
.tile-names { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.tile-title { font-weight: 700; font-size: .93rem; letter-spacing: -.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-sub { font-size: .76rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-go { margin-left: auto; color: var(--text-3); font-size: 1rem; opacity: 0; flex-shrink: 0; }
.tile.is-clickable:hover .tile-go, .tile:focus-visible .tile-go { opacity: 1; color: var(--brand-ink); }
.tile-badge { margin-left: auto; flex-shrink: 0; }
.tile-qty { display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; }
.tile-qty-num { font-size: clamp(1.55rem, 1.3rem + .8vw, 2.05rem); font-weight: 800; font-stretch: 110%; letter-spacing: -.025em; line-height: 1.05; }
.tile-qty-unit { font-size: .8rem; font-weight: 700; color: var(--text-2); }
.tile-qty-label { font-size: .78rem; font-weight: 600; color: var(--text-3); }
.tile-metrics { display: flex; flex-direction: column; gap: .22rem; }
.tile-metric { display: flex; align-items: center; gap: .45rem; font-size: .8rem; color: var(--text-2); line-height: 1.3; }
.tile-metric > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-metric > b { color: var(--text); font-weight: 700; }
.tile-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--seg, var(--c-slate-strong)); flex-shrink: 0; }
.tile.is-compact { gap: .35rem; padding: .7rem .8rem; }
.tile.is-compact .tile-qty-num { font-size: 1.35rem; }
.tile.is-compact .tile-icon { width: 2rem; height: 2rem; font-size: 1.05rem; }
@media (hover: none) { .tile-go { opacity: .6; } }
@media (max-width: 480px) { .tile-grid, .tile-grid.is-dense { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; } .tile { padding: .75rem .8rem; } .tile-grid.is-wide { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- Barre de répartition (<x-split-bar>) */
.split { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.split-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.split-label { font-size: .84rem; font-weight: 650; color: var(--text-2); }
.split-total { font-size: 1.05rem; font-weight: 800; font-stretch: 108%; letter-spacing: -.015em; }
.split-bar { display: flex; gap: 2px; width: 100%; height: .7rem; border-radius: 999px; overflow: hidden; background: var(--bg-sunken); }
.split-bar.is-sm { height: .38rem; gap: 1.5px; } .split-bar.is-lg { height: 1.1rem; gap: 3px; }
.split-bar > * { display: block; flex: 0 0 auto; width: var(--w, 0%); min-width: 3px; height: 100%; background: var(--seg, var(--c-slate-strong)); transition: filter .15s, transform .15s; transform-origin: bottom; }
.split-bar > :first-child { border-radius: 999px 0 0 999px; } .split-bar > :last-child { border-radius: 0 999px 999px 0; } .split-bar > :only-child { border-radius: 999px; }
.split-bar > a:hover { filter: brightness(1.12) saturate(1.1); }
html[data-effects="on"] .split-bar > * { animation: split-grow .7s var(--ease-out) backwards; }
@keyframes split-grow { from { width: 0; min-width: 0; } }
.split-legend { display: flex; flex-wrap: wrap; gap: .3rem .5rem; }
.split-item { display: inline-flex; align-items: center; gap: .4rem; padding: .16rem .5rem .16rem .4rem; border-radius: 999px; font-size: .8rem; line-height: 1.35; color: var(--text-2); text-decoration: none !important; white-space: nowrap; transition: background .15s, color .15s; }
.split-item > b { color: var(--text); font-weight: 750; }
.split-pct { color: var(--text-3); font-size: .74rem; }
.split-dot { width: .55rem; height: .55rem; border-radius: 3px; background: var(--seg, var(--c-slate-strong)); flex-shrink: 0; }
a.split-item:hover { background: var(--bg-hover); color: var(--text); }
.split-item.is-zero { opacity: .55; }
.split.is-sm .split-legend { gap: .15rem .35rem; } .split.is-sm .split-item { font-size: .75rem; padding-inline: .3rem .4rem; }

/* ---------------------------------------------------------------- Apparitions échelonnées du kit */
html[data-effects="on"] .tile-grid > *, html[data-effects="on"] .stat-links > * { animation: anim-rise .46s var(--ease-out) backwards; }
html[data-effects="on"] :is(.tile-grid, .stat-links) > :nth-child(2) { animation-delay: .035s; }
html[data-effects="on"] :is(.tile-grid, .stat-links) > :nth-child(3) { animation-delay: .07s; }
html[data-effects="on"] :is(.tile-grid, .stat-links) > :nth-child(4) { animation-delay: .105s; }
html[data-effects="on"] :is(.tile-grid, .stat-links) > :nth-child(5) { animation-delay: .14s; }
html[data-effects="on"] :is(.tile-grid, .stat-links) > :nth-child(6) { animation-delay: .175s; }
html[data-effects="on"] :is(.tile-grid, .stat-links) > :nth-child(7) { animation-delay: .21s; }
html[data-effects="on"] :is(.tile-grid, .stat-links) > :nth-child(n+8) { animation-delay: .245s; }
.stat-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: .6rem; }
@media (min-width: 1920px) { .tile-grid { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: .9rem; } .tile-grid.is-dense { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); } .stat-links { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; } }
@media (max-width: 480px) { .stat-links { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------------------------------------------------------------- Démonstration du kit (/app/composants) */
.kit { display: flex; flex-direction: column; gap: 1.4rem; padding-bottom: 1rem; }
.kit-block { display: flex; flex-direction: column; gap: .7rem; }
.kit-block > h2 { margin: 0; display: flex; align-items: center; gap: .5rem; font-size: .95rem; font-weight: 750; }
.kit-block > h2 > .ph { color: var(--text-3); }
.kit-block > h2 code, .kit-note code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; font-weight: 600; padding: .1rem .4rem; border-radius: 6px; background: var(--bg-sunken); color: var(--text-2); }
.kit-note { margin: -.35rem 0 0; font-size: .82rem; color: var(--text-3); max-width: 86ch; }
.kit-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .6rem; }
.kit-themes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.kit-themes > div { padding: .9rem 1rem; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-elev); display: flex; flex-direction: column; gap: .6rem; }
.kit-themes small { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.kit-code { margin: 0; padding: .7rem .85rem; border-radius: 10px; background: var(--bg-sunken); border: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .74rem; line-height: 1.55; color: var(--text-2); white-space: pre; overflow-x: auto; }
@media (max-width: 767px) { .kit-themes { grid-template-columns: 1fr; } }
