/* =============================================================================
   ERP Comté — feuille de style unique.
   Jetons de couleur en variables : thème clair par défaut, sombre selon le système
   ou le choix de la personne (data-theme sur <html>, voir base.html).
   ============================================================================= */

:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --card: #ffffff;
  --fg: #1b2330;
  --muted: #5f6b7a;
  --line: #dfe3e9;
  --line-strong: #c3cad4;
  --accent: #1f4e8c;
  --accent-fg: #ffffff;
  --accent-soft: #e8eefb;
  --hover: #f1f4f8;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #067647;
  --ok-soft: #e6f6ee;
  --warn: #9a3412;
  --warn-soft: #fff1e6;
  --star: #a16207;
  --neutral-soft: #eceff3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --focus: #2f6fd1;
  --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1419;
    --card: #171d25;
    --fg: #e7eaf0;
    --muted: #9aa5b4;
    --line: #2a3340;
    --line-strong: #3a4656;
    --accent: #7fb0ff;
    --accent-fg: #0b1220;
    --accent-soft: #1b2a42;
    --hover: #1e2632;
    --danger: #ff8a7a;
    --danger-soft: #3a1d1a;
    --ok: #6fd3a0;
    --ok-soft: #15301f;
    --warn: #f5b27a;
    --warn-soft: #3a2a18;
    --star: #facc15;
    --neutral-soft: #222b36;
    --shadow: none;
    --focus: #9cc2ff;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1419;
  --card: #171d25;
  --fg: #e7eaf0;
  --muted: #9aa5b4;
  --line: #2a3340;
  --line-strong: #3a4656;
  --accent: #7fb0ff;
  --accent-fg: #0b1220;
  --accent-soft: #1b2a42;
  --hover: #1e2632;
  --danger: #ff8a7a;
  --danger-soft: #3a1d1a;
  --ok: #6fd3a0;
  --ok-soft: #15301f;
  --warn: #f5b27a;
  --warn-soft: #3a2a18;
    --star: #facc15;
  --neutral-soft: #222b36;
  --shadow: none;
  --focus: #9cc2ff;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--fg); line-height: 1.5; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.inline { display: inline; }
[x-cloak] { display: none !important; }
[x-cloak] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* ---------- Barre du haut ---------- */
.topbar { display: flex; align-items: center; gap: 1rem 1.5rem; flex-wrap: wrap; padding: .6rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; color: var(--fg); }
.nav { display: flex; gap: .25rem; flex: 1; }
.nav a { text-decoration: none; font-weight: 500; padding: .4rem .7rem; border-radius: 6px; color: var(--fg); }
.nav a:hover { background: var(--hover); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.who { display: flex; gap: .75rem; align-items: center; font-size: .9rem; margin-left: auto; flex-wrap: wrap; }
.who .office::before { content: "· "; }
.theme-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--bg); }

/* ---------- Mise en page ---------- */
.container { max-width: 1800px; margin: 0 auto; padding: 1.5rem 1rem; }
.container.narrow { max-width: 800px; }
.container.medium { max-width: 1000px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
.card.narrow { max-width: 440px; margin: 2rem auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head .sub { color: var(--muted); margin: 0; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.title-row h1 { margin: 0; }
.page-head .meta { color: var(--muted); font-size: .82rem; margin: .25rem 0 0; }
.small { font-size: .85rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.msg { padding: .6rem .9rem; border-radius: 6px; margin-bottom: .5rem; background: var(--accent-soft); color: var(--fg); }
.msg.error { background: var(--danger-soft); color: var(--danger); }
.msg.success { background: var(--ok-soft); color: var(--ok); }

/* ---------- Boutons : trois niveaux ---------- */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 2.5rem; padding: .45rem 1rem; border-radius: 6px; border: 1px solid transparent;
  font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
  background: var(--accent); color: var(--accent-fg);
}
.btn.secondary, button.secondary { background: var(--card); color: var(--accent); border-color: var(--line-strong); }
.btn.secondary:hover, button.secondary:hover { background: var(--hover); }
.btn.tertiary, button.tertiary { background: transparent; color: var(--accent); border-color: transparent; }
.btn.tertiary:hover, button.tertiary:hover { background: var(--hover); }
.btn.danger, button.danger { background: var(--danger); color: #fff; }
.btn.danger.secondary, button.danger.secondary { background: var(--card); color: var(--danger); border-color: var(--danger); }
.btn[aria-disabled="true"], button:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm, button.sm { min-height: 2rem; padding: .25rem .7rem; font-size: .9rem; }
button.link { display: inline; min-height: 0; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }
.theme-switch button { display: inline; min-height: 0; background: none; border: 0; color: var(--muted); padding: .25rem .5rem; border-radius: 999px; font-weight: 400; }
.theme-switch button[aria-pressed="true"] { background: var(--card); color: var(--fg); box-shadow: var(--shadow); }

/* Menu déroulant léger (details/summary) */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: " ▾"; font-size: .8em; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); min-width: 200px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.12); padding: .35rem; z-index: 20; }
.menu-list a, .menu-list button { display: block; width: 100%; text-align: left; padding: .5rem .75rem; border-radius: 6px; color: var(--fg); background: none; border: 0; font: inherit; text-decoration: none; cursor: pointer; min-height: 2.5rem; }
.menu-list a:hover, .menu-list button:hover { background: var(--hover); }
.menu-list .danger { color: var(--danger); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: .35rem 0; }
.menu-list form { margin: 0; }
.menu-list form.inline-form { display: flex; gap: .35rem; align-items: center; padding: .35rem .75rem; flex-wrap: wrap; }
.menu-list form.inline-form select, .menu-list form.inline-form input[type=text] { min-height: 2rem; padding: .2rem .5rem; font-size: .88rem; width: auto; flex: 1 1 8rem; }
.menu-list form.inline-form button { width: auto; min-height: 2rem; padding: .2rem .7rem; background: var(--accent); color: var(--accent-fg); }

/* ---------- Champs ---------- */
.field { margin: 0 0 .9rem; }
.field label, .field .label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .92rem; }
.field .req { color: var(--danger); margin-left: .15rem; }
.field .help { display: block; color: var(--muted); font-size: .82rem; margin-top: .3rem; }
.field .errorlist { color: var(--danger); list-style: none; padding: 0; margin: .3rem 0 0; font-size: .88rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 2.5rem; padding: .45rem .7rem; border: 1px solid var(--line-strong); border-radius: 6px;
  font: inherit; background: var(--card); color: var(--fg);
}
select { appearance: none; -webkit-appearance: none; padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
select[multiple] { background-image: none; }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); cursor: pointer; }
textarea { min-height: 5rem; }
.input-file { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .5rem; border: 1px dashed var(--line-strong); border-radius: 6px; background: var(--bg); }
.input-file:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.input-file .names { color: var(--muted); font-size: .9rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
fieldset.section { border: 0; padding: 0; margin: 0 0 1.25rem; }
fieldset.section legend, details.section > summary { font-size: 1.05rem; font-weight: 700; padding: 0 0 .5rem; margin-bottom: .75rem; border-bottom: 1px solid var(--line); width: 100%; }
details.section > summary { cursor: pointer; list-style: none; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::after { content: "Afficher"; float: right; font-weight: 500; color: var(--accent); font-size: .9rem; }
details.section[open] > summary::after { content: "Réduire"; }
.form-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; padding-top: .5rem; border-top: 1px solid var(--line); margin-top: .5rem; }
.intro { color: var(--muted); margin: 0 0 1rem; }

/* ---------- Filtres ---------- */
.toolbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.toolbar .search { flex: 1 1 320px; }
.filters-row { display: none; gap: .5rem .75rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: .75rem; }
.filters-row.open { display: flex; }
/* Vues rapides et onglets au-dessus d'une liste */
.quick-views { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 .75rem; }
.quick-views a { padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: .88rem; font-weight: 600; text-decoration: none; }
.quick-views a:hover { color: var(--fg); background: var(--hover); }
.quick-views a[aria-current="page"] { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.quick-views.tabs { gap: 0; border-bottom: 1px solid var(--line); }
.quick-views.tabs a { border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: .45rem .9rem; margin-bottom: -1px; }
.quick-views.tabs a[aria-current="page"] { background: transparent; border-bottom-color: var(--accent); }
/* Filtres actifs en pastilles */
.filter-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .82rem; font-weight: 600; text-decoration: none; }
.filter-chip:hover { background: var(--danger-soft); color: var(--danger); }
.filters-row .filter { display: flex; flex-direction: column; gap: .15rem; font-size: .78rem; color: var(--muted); font-weight: 600; flex: 1 1 130px; max-width: 220px; }
.filters-row .filter select { min-height: 2rem; padding: .25rem 1.8rem .25rem .55rem; font-size: .88rem; font-weight: 400; color: var(--fg); }
.count-line { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; color: var(--muted); font-size: .92rem; margin: 0 0 .5rem; }
.count-line .badge-count { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: .1rem .6rem; font-weight: 600; }

/* ---------- Tableaux ---------- */
.table-wrap { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table caption { text-align: left; padding: .5rem .75rem; color: var(--muted); font-size: .85rem; }
.table th, .table td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: .93rem; }
.table th { background: var(--neutral-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table th a { color: inherit; text-decoration: none; display: inline-flex; gap: .3rem; align-items: center; }
.table th a:hover { color: var(--fg); }
.table th .dir { font-size: .9em; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.row-link { cursor: pointer; }
.table tr.row-link:hover { background: var(--hover); }
.table td.thumb img, .table td.thumb .ph { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; display: block; background: var(--neutral-soft); }
.table td.check, .table th.check { width: 2.5rem; }
.table .cell-id a { font-weight: 700; text-decoration: none; }
.table .cell-id a:hover { text-decoration: underline; }
.table.compact th, .table.compact td { padding: .45rem .6rem; font-size: .9rem; }
.selection-bar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; padding: .5rem .75rem; margin-bottom: .6rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); font-size: .92rem; }
.selection-bar .count { font-weight: 600; min-width: 8rem; }
.pagination { display: flex; gap: 1rem; justify-content: center; align-items: center; padding: 1rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty h2 { color: var(--fg); }
.empty .btn { margin-top: .75rem; }

/* Badges */
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); vertical-align: middle; white-space: nowrap; }
.badge.status-assigned { background: var(--warn-soft); color: var(--warn); }
.badge.status-in_repair { background: var(--danger-soft); color: var(--danger); }
.badge.status-retired { background: var(--neutral-soft); color: var(--muted); }
.badge.status-in_storage { background: var(--ok-soft); color: var(--ok); }
.badge.protected { background: var(--danger-soft); color: var(--danger); }
.badge.classification { background: var(--warn-soft); color: var(--warn); }
.badge.neutral { background: var(--neutral-soft); color: var(--muted); }
.badge.state-closed, .badge.state-archived { background: var(--neutral-soft); color: var(--muted); }
.badge.state-waiting { background: var(--warn-soft); color: var(--warn); }
.badge.state-open, .badge.state-active { background: var(--ok-soft); color: var(--ok); }

/* ---------- Fiche ---------- */
.detail-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 1rem; margin-bottom: 1rem; align-items: start; }
.detail-grid.even { grid-template-columns: 1fr 1fr; }
.props { display: grid; grid-template-columns: repeat(2, max-content 1fr); gap: .4rem 1.25rem; margin: 0; }
.props dt { color: var(--muted); font-size: .9rem; } .props dd { margin: 0; }
.props .wide { grid-column: 1 / -1; display: grid; grid-template-columns: max-content 1fr; gap: 1.25rem; }
.primary-action { margin: .75rem 0 1rem; }
.danger-zone { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.gallery { display: flex; gap: .75rem; flex-wrap: wrap; }
.gallery figure { margin: 0; width: 132px; }
.gallery img { width: 132px; height: 100px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.gallery figcaption { font-size: .8rem; display: flex; gap: .25rem; margin-top: .25rem; align-items: center; }
.gallery figcaption .btn { min-height: 2rem; padding: .2rem .5rem; }
.upload-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: .6rem; align-items: end; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.upload-row .field { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline > li { padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.timeline > li:last-child { border-bottom: 0; }
.timeline ul { margin: .25rem 0 0 1rem; padding: 0; }
.timeline time { color: var(--muted); margin-right: .5rem; }

/* ---------- En-tête de carte et bouton icône ---------- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .5rem; }
.card-head h2 { margin: 0; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; min-height: 0; padding: 0; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--card); color: var(--accent); cursor: pointer; }
.icon-btn:hover { background: var(--hover); }
a.icon-btn { text-decoration: none; }
.icon-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.row-actions { display: inline-flex; gap: .15rem; align-items: center; margin-left: .35rem; vertical-align: middle; }
.row-actions .btn.sm { min-height: 1.75rem; padding: .1rem .5rem; }

/* ---------- Équipe : pastilles et dialogues ---------- */
.team-row { display: flex; gap: .5rem 1rem; align-items: flex-start; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.team-row:last-of-type { border-bottom: 0; }
.team-label { flex: 0 0 7.5rem; color: var(--muted); font-size: .9rem; padding-top: .25rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; flex: 1; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .35rem .2rem .7rem; border-radius: 999px; font-size: .88rem; font-weight: 600; background: var(--neutral-soft); color: var(--fg); }
.chip.responsible { background: var(--accent); color: var(--accent-fg); padding-right: .7rem; }
.chip.collaborator { background: var(--accent-soft); color: var(--accent); }
.chip.collaborator.observer { background: var(--neutral-soft); color: var(--muted); }
.chip:not(:has(.chip-remove)) { padding-right: .7rem; }
.chip-remove { display: inline-flex; align-items: center; justify-content: center; width: 1.35rem; height: 1.35rem; min-height: 0; padding: 0; border-radius: 999px; border: 0; background: transparent; color: inherit; font-size: 1rem; line-height: 1; cursor: pointer; }
.chip-remove:hover { background: rgba(0, 0, 0, .12); }
dialog.modal { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--fg); padding: 1.25rem 1.5rem; width: min(480px, calc(100vw - 2rem)); box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
dialog.modal::backdrop { background: rgba(10, 14, 20, .55); }
dialog.modal h2 { margin-top: 0; }
dialog.modal .form-actions { border-top: 0; padding-top: 0; }
.dialog-items { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--warn); }
.dialog-items li { margin: .15rem 0; }
dialog.modal.wide { width: min(680px, calc(100vw - 2rem)); }
dialog.modal.xl { width: min(860px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0; overflow: hidden; }
dialog.modal.xl[open] { display: flex; flex-direction: column; }
dialog.modal.xl .form-dialog { display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 2rem); }
dialog.modal.xl .dialog-head { padding: 1rem 1.5rem .75rem; border-bottom: 1px solid var(--line); margin: 0; }
dialog.modal.xl .dialog-head .actions { display: flex; gap: .25rem; }
dialog.modal.xl .dialog-body { padding: .5rem 1.5rem 1rem; overflow-y: auto; min-height: 0; flex: 1; }
dialog.modal.xl .dialog-foot { padding: .75rem 1.5rem; margin: 0; border-top: 1px solid var(--line); background: var(--card); align-items: center; }
.kbd-hint { margin-left: auto; }
kbd { display: inline-block; padding: 0 .35rem; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; font: 600 .72rem/1.5 ui-monospace, monospace; color: var(--muted); background: var(--bg); }
@media (max-width: 760px) { .kbd-hint { display: none; } }
dialog.modal .card-head h2 { margin: 0; }
.dialog-section { padding: .75rem 0; border-top: 1px solid var(--line); }
.dialog-section h3 { margin: 0; font-size: 1rem; }
.manage-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .4rem 0; border-bottom: 1px dashed var(--line); }
.manage-row:last-child { border-bottom: 0; }
.danger-text { color: var(--danger) !important; }
.contact-list { grid-template-columns: max-content 1fr; }
.contact-list .contact-row { display: flex; flex-wrap: wrap; gap: .25rem .5rem; align-items: baseline; margin-bottom: .25rem; }
.contact-list dd { margin-bottom: .35rem; }
.contact-value { font-weight: 500; }
details.section.past { margin-top: 1rem; }

/* ---------- Tâches : avancement et états ---------- */
.progress { display: inline-flex; align-items: center; gap: .5rem; min-width: 7rem; }
.progress .bar { flex: 1; height: .5rem; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; min-width: 4rem; }
.progress .bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.progress .pct { font-size: .82rem; color: var(--muted); min-width: 2.6rem; text-align: right; }
.badge.state-todo { background: var(--neutral-soft); color: var(--muted); }
.badge.state-in_progress { background: var(--ok-soft); color: var(--ok); }
.badge.state-blocked { background: var(--warn-soft); color: var(--warn); }
.badge.state-done { background: var(--accent-soft); color: var(--accent); }
.badge.state-cancelled { background: var(--neutral-soft); color: var(--muted); text-decoration: line-through; }
.badge.overdue { background: var(--danger-soft); color: var(--danger); }
.tree { list-style: none; padding: 0; margin: 0; }
.tree > li { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.tree > li:last-child { border-bottom: 0; }
.tree .grow { flex: 1 1 12rem; }
.steps-list { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps-list > li { display: flex; gap: .6rem; align-items: flex-start; padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.steps-list > li:last-child { border-bottom: 0; }
.steps-list .num { flex: 0 0 1.6rem; height: 1.6rem; border-radius: 999px; background: var(--neutral-soft); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; }
.steps-list .approved .num { background: var(--ok-soft); color: var(--ok); }
.steps-list .rejected .num { background: var(--danger-soft); color: var(--danger); }
.steps-list .pending .num { background: var(--warn-soft); color: var(--warn); }
.choices-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.choices-list li { display: flex; gap: .6rem; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.choices-list li:last-child { border-bottom: 0; }

/* ---------- Fil d'Ariane ---------- */
.breadcrumbs { margin: 0 0 .6rem; font-size: .88rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .4rem; margin: 0; padding: 0; }
.breadcrumbs li { display: inline-flex; align-items: center; min-width: 0; }
.breadcrumbs li + li::before { content: "›"; color: var(--muted); margin-right: .4rem; }
.breadcrumbs a, .breadcrumbs span { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover, .breadcrumbs a:focus-visible { color: var(--accent); text-decoration: underline; }
.breadcrumbs [aria-current="page"] { color: var(--fg); font-weight: 600; }

/* ---------- Arbre des tâches d'un dossier (sous-tâches en retrait) ---------- */
.tt-wrap { container-type: inline-size; }
.tt { list-style: none; margin: 0; padding: 0; }
.tt-head, .tt-row { display: grid; grid-template-columns: minmax(0, 1fr) 8rem 4.5rem 6rem; gap: .6rem; align-items: center; }
.tt-head { padding: .2rem .35rem .4rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tt-row { padding: .4rem .35rem; border-bottom: 1px solid var(--line); font-size: .93rem; border-radius: 4px; }
.tt-row:hover { background: var(--hover); }
.tt-name { display: flex; align-items: center; gap: .45rem; min-width: 0; padding-left: calc(var(--depth, 0) * 1.6rem); }
.tt-caret, .tt-caret-spacer { flex: 0 0 1.4rem; width: 1.4rem; height: 1.4rem; }
.tt-caret { display: inline-flex; align-items: center; justify-content: center; min-height: 0; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: .8rem; cursor: pointer; transition: transform .15s ease; }
.tt-caret:hover { background: var(--neutral-soft); color: var(--fg); }
.tt-caret[aria-expanded="true"] { transform: rotate(90deg); }
.tt-title { flex: 0 1 auto; min-width: 2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); font-weight: 600; text-decoration: none; }
.tt-node .tt-node .tt-title { font-weight: 500; }
.tt-title:hover, .tt-title:focus-visible { color: var(--accent); text-decoration: underline; }
.tt-row.closed .tt-title { color: var(--muted); text-decoration: line-through; }
.tt-count { flex: 0 0 auto; color: var(--muted); font-size: .78rem; }
.tt-add { flex: 0 0 auto; display: none; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; min-height: 0; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: var(--card); color: var(--muted); font-weight: 700; cursor: pointer; }
.tt-row:hover .tt-add, .tt-row:focus-within .tt-add { display: inline-flex; }
.tt-add:hover { color: var(--accent); border-color: var(--accent); }
@media (hover: none) { .tt-add { display: inline-flex; } }
.tt-col { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.tt-qa { padding-left: calc(var(--depth, 0) * 1.6rem + 1.85rem); }
.tt-qa .quick-add { border-top: 0; margin-top: 0; }
.tt-node.just-added > .tt-row { animation: just-added 1.6s ease-out; }
@media (prefers-reduced-motion: reduce) { .tt-node.just-added > .tt-row { animation: none; } .tt-caret { transition: none; } }
/* Carte étroite : le responsable d'abord, puis l'échéance, cèdent la place au titre. */
@container (max-width: 520px) {
  .tt-head, .tt-row { grid-template-columns: minmax(0, 1fr) 4.5rem 6rem; }
  .tt-resp { display: none; }
}
@container (max-width: 360px) {
  .tt-head, .tt-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tt-due { display: none; }
  .tt-name { padding-left: calc(var(--depth, 0) * 1rem); }
}

/* ---------- Fiche du dossier : colonne principale large + colonne latérale compacte ---------- */
.dossier-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(320px, 1fr); gap: 1rem; align-items: start; }
.dossier-main, .dossier-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.dossier-layout .card + .card { margin-top: 0; }
.dossier-side .card { padding: .85rem 1rem; }
.card-progress { display: flex; align-items: center; gap: .6rem; flex: 0 1 18rem; min-width: 10rem; }
.card-progress .progress { flex: 1 1 auto; }
.card-progress .progress .bar { width: 100%; }
.dossier-side h2 { font-size: 1rem; }
.dossier-side .team-row { padding: .35rem 0; }
.dossier-side .team-label { flex-basis: 6.5rem; font-size: .85rem; }
/* Fiche : bandeau de propriétés puis le texte */
.fiche-card { padding: 1rem 1.25rem; }
.props-strip { display: flex; flex-wrap: wrap; gap: .5rem 2rem; margin: 0; }
.props-strip > div { min-width: 0; }
.props-strip dt { color: var(--muted); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.props-strip dd { margin: .1rem 0 0; font-size: .93rem; }
.fiche-text { margin: .85rem 0 0; padding-top: .85rem; border-top: 1px solid var(--line); line-height: 1.55; }
.fiche-card > h2 + .fiche-text { margin-top: 0; padding-top: 0; border-top: 0; }
/* Listes compactes de la colonne latérale */
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list > li { display: flex; align-items: center; gap: .35rem; padding: .35rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.side-list > li:last-child { border-bottom: 0; }
.side-list .grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.side-list .grow > a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.version-badge { border: 0; cursor: pointer; min-height: 0; font: inherit; font-size: .75rem; font-weight: 600; }
.note-item { padding: .55rem 0; border-top: 1px solid var(--line); }
.note-item:first-of-type { border-top: 0; padding-top: .1rem; }
.note-head { display: flex; align-items: center; gap: .35rem; }
.note-head .grow { flex: 1 1 auto; }
.note-title { font-weight: 600; color: var(--fg); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.note-title:hover { color: var(--accent); text-decoration: underline; }
.note-meta { margin: 0; color: var(--muted); font-size: .78rem; }
.note-body { margin: .3rem 0 0; font-size: .9rem; line-height: 1.45; }
.note-links { display: flex; flex-wrap: wrap; gap: .3rem; margin: .35rem 0 0; }
.note-links .chip { font-size: .78rem; font-weight: 500; }
.note-actions { display: flex; gap: .9rem; margin: .3rem 0 0; font-size: .82rem; }
.note-actions a, .linklike { color: var(--accent); text-decoration: none; background: none; border: 0; padding: 0; min-height: 0; font: inherit; font-weight: 600; cursor: pointer; }
.note-actions a:hover, .linklike:hover { text-decoration: underline; }
@media (max-width: 1100px) { .dossier-layout { grid-template-columns: 1fr; } }
.log-card > summary { display: flex; align-items: baseline; gap: .75rem; cursor: pointer; list-style: none; }
.log-card > summary::-webkit-details-marker { display: none; }
.log-card > summary::before { content: "▸"; color: var(--muted); transition: transform .15s ease; }
.log-card[open] > summary::before { transform: rotate(90deg); }
.log-card > summary h2 { margin: 0; font-size: 1rem; }
.log-card[open] > summary { margin-bottom: .5rem; }
@media (prefers-reduced-motion: reduce) { .log-card > summary::before { transition: none; } }

/* ---------- Boutons-icônes (participants) ---------- */
.col-icons { width: 1%; white-space: nowrap; text-align: right; }
/* Icône discrète dans une ligne (étoile, ×) ; .icon-btn seul = bouton carré de coin de carte. */
.icon-btn.ghost { width: 2rem; height: 2rem; border: 0; background: transparent; color: var(--muted); font-size: 1.15rem; line-height: 1; vertical-align: middle; }
.icon-btn.ghost:hover { background: var(--neutral-soft); color: var(--fg); }
.icon-btn.star.on { color: var(--star); cursor: default; }
.icon-btn.star.on:hover { background: transparent; }
button.icon-btn.star:hover { color: var(--star); }
.icon-btn.remove:hover { color: var(--danger); background: var(--danger-soft); }
.icon-btn.placeholder { cursor: default; }
.icon-btn.add { font-size: 1.25rem; font-weight: 600; line-height: 1; }
.icon-btn.sm { width: 1.85rem; height: 1.85rem; font-size: 1.05rem; }
/* Menus « Plus » : pas de séparateur orphelin, et pas de menu du tout s'il est vide. */
.menu-list > hr:first-child, .menu-list > hr:last-child, .menu-list > hr + hr { display: none; }
details.menu:not(:has(.menu-list :is(a, button))) { display: none; }

/* ---------- Tableau de bord ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 1rem; align-items: start; }
.dash-grid > .card, .dash-grid > .dash-widget > .card { margin: 0; }
.dash-grid > .dash-widget { min-width: 0; }

/* ---------- Menu du compte (barre du haut) ---------- */
.user-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .75rem; border: 1px solid var(--line); border-radius: 999px; font-weight: 600; font-size: .9rem; }
.user-chip:hover { background: var(--hover); }
.user-chip .office::before { content: "· "; }
.user-menu .menu-list { min-width: 240px; }
.menu-theme { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .4rem .75rem; }
.menu-list .theme-switch button { display: inline; width: auto; min-height: 0; padding: .25rem .55rem; border-radius: 999px; }

/* ---------- Allègement : ajouts compacts, lignes méta, pastilles ---------- */
.chip-add { display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem; min-height: 0; padding: 0; border: 1px dashed var(--line-strong); border-radius: 999px; background: transparent; color: var(--muted); font-size: 1rem; font-weight: 700; line-height: 1; cursor: pointer; }
.chip-add:hover, .chip-add:focus-visible { border-color: var(--accent); color: var(--accent); }
button.chip { border: 0; cursor: pointer; min-height: 0; font: inherit; font-size: .88rem; font-weight: 600; }
button.chip.responsible:hover { filter: brightness(1.1); }
.tag-row { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.add-row { display: flex; flex-wrap: wrap; gap: .35rem; margin: -.25rem 0 1rem; }
.add-row:not(:has(button)) { display: none; }
.meta-line { margin: .75rem 0 0; color: var(--muted); font-size: .8rem; }
.badge.priority-high { background: var(--danger-soft); color: var(--danger); }

/* ---------- Sélecteur de statut (pastille + menu, statut suivant, terminer) ---------- */
.status-picker { position: relative; display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); vertical-align: middle; }
.status-current { border: 0; cursor: pointer; min-height: 0; font: inherit; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: .25rem .6rem; border-radius: 6px; }
.status-current:hover { filter: brightness(1.15); }
.status-step { display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.6rem; min-height: 0; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: .85rem; cursor: pointer; }
.status-step:hover { background: var(--hover); color: var(--fg); }
.status-step.done:hover { background: var(--ok-soft); color: var(--ok); }
.status-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; width: 260px; max-height: 360px; overflow-y: auto; padding: .4rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.status-menu input[type=search] { width: 100%; min-height: 2rem; margin-bottom: .35rem; }
.status-group + .status-group { border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .3rem; }
.status-group-label { margin: .2rem .5rem .15rem; color: var(--muted); font-size: .72rem; font-weight: 600; }
.status-option { display: flex; align-items: center; justify-content: flex-start; gap: .5rem; width: 100%; min-height: 2rem; padding: .3rem .5rem; border: 0; border-radius: 6px; background: transparent; color: var(--fg); font: inherit; font-size: .82rem; font-weight: 700; text-transform: uppercase; text-align: left; cursor: pointer; }
.status-option:hover { background: var(--hover); }
.status-option.current { background: var(--hover); cursor: default; opacity: 1; }
.status-option .check { margin-left: auto; color: var(--muted); }
.status-dot { width: .6rem; height: .6rem; border-radius: 999px; flex: 0 0 auto; background: var(--muted); }
.status-dot.state-open, .status-dot.state-todo { background: var(--muted); }
.status-dot.state-active, .status-dot.state-in_progress { background: var(--accent); }
.status-dot.state-waiting, .status-dot.state-blocked { background: var(--warn); }
.status-dot.state-closed, .status-dot.state-done { background: var(--ok); }
.status-dot.state-cancelled, .status-dot.state-archived { background: var(--danger); }

/* ---------- Formulaires allégés : cases en ligne, sélecteurs à boutons, repli ---------- */
.field.check label { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; margin: 0; cursor: pointer; }
.field.check { margin-bottom: .6rem; }
.form-grid .field.check { align-self: end; }
.info-tip { display: inline-block; margin-left: .3rem; color: var(--muted); font-size: .85em; font-weight: 400; cursor: help; }
.info-tip:focus-visible { outline: 2px solid var(--focus); border-radius: 4px; }
fieldset.field { border: 0; padding: 0; min-width: 0; }
fieldset.field > legend { padding: 0; margin-bottom: .3rem; font-weight: 600; font-size: .92rem; }
.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.segmented label { position: relative; margin: 0; cursor: pointer; }
.segmented label + label { border-left: 1px solid var(--line-strong); }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; padding: .4rem .8rem; font-size: .88rem; font-weight: 600; color: var(--muted); }
.segmented input:checked + span { background: var(--accent-soft); color: var(--accent); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }
.segmented label:hover span { color: var(--fg); }
details.more { margin: 0 0 .75rem; }
.kind-picker { margin: 0 0 1rem; }
details.more > summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .88rem; list-style: none; margin-bottom: .6rem; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+ "; }
details.more[open] > summary::before { content: "− "; }
.input-file .thumbs { display: flex; flex-wrap: wrap; gap: .4rem; flex-basis: 100%; margin-top: .4rem; }
.input-file .thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* ---------- Saisie rapide d'une tâche ---------- */
.quick-add { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .35rem 0 .1rem; border-top: 1px dashed var(--line); margin-top: .25rem; }
.tree:empty + .quick-add, .quick-add-card .quick-add { border-top: 0; margin-top: 0; }
.quick-add-plus { color: var(--muted); font-weight: 700; width: 1rem; text-align: center; }
.quick-add input[name=title] { flex: 1 1 14rem; min-height: 2.25rem; border-color: transparent; background: transparent; padding-left: .35rem; }
.quick-add input[name=title]:hover { border-color: var(--line); }
.quick-add input[name=title]:focus { border-color: var(--line-strong); background: var(--card); }
.quick-add-error { flex: 1 0 100%; color: var(--danger); font-size: .85rem; padding-left: 1.5rem; }
.quick-add-error:empty { display: none; }
.quick-add-card { padding-top: .5rem; padding-bottom: .5rem; }
.tree > li.just-added { animation: just-added 1.6s ease-out; }
@keyframes just-added { from { background: var(--accent-soft); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .tree > li.just-added { animation: none; } }

/* ---------- Tableau de bord ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin: 1rem 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; text-decoration: none; color: inherit; }
.stat:hover { background: var(--hover); }
.stat .n { font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: .88rem; }
.module-card { display: block; padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); text-decoration: none; color: inherit; max-width: 480px; }
.module-card h2 { margin: 0 0 .25rem; color: var(--accent); }
.steps { color: var(--muted); }

/* ---------- Scan ---------- */
#reader { width: 100%; max-width: 360px; margin: 0 auto 1rem; }

/* ---------- Mobile ---------- */
.only-mobile { display: none; }
@media (max-width: 760px) {
  .only-desktop { display: none !important; }
  .only-mobile { display: initial; }
  .container { padding: 1rem .75rem; }
  .nav { flex: 1 0 100%; order: 3; overflow-x: auto; }
  .who span:not(.office) { display: none; }
  .who .office::before { content: ""; }
  h1 { font-size: 1.3rem; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .detail-grid, .detail-grid.even, .upload-row { grid-template-columns: 1fr; }
  .props { grid-template-columns: max-content 1fr; }
  .props .wide { grid-column: auto; display: contents; }
  .form-actions .btn, .form-actions button { flex: 1 1 auto; }
  /* Tableau des biens → cartes */
  .table.cards, .table.cards tbody, .table.cards tr, .table.cards td { display: block; }
  .table.cards thead { display: none; }
  .table.cards tr { padding: .75rem .9rem .75rem 3.6rem; position: relative; border-bottom: 1px solid var(--line); }
  .table.cards td { border: 0; padding: .1rem 0; font-size: .95rem; }
  .table.cards td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: .8rem; }
  .table.cards td.check { position: absolute; left: .75rem; top: .9rem; width: auto; padding: 0; }
  .table.cards td.thumb { position: absolute; left: 2.25rem; top: .8rem; padding: 0; display: none; }
  .table.cards td.cell-id { font-size: 1.05rem; }
  .table.cards td.hide-mobile { display: none; }
  .filters-row .filter { max-width: none; flex-basis: 45%; }
  .table-wrap { overflow-x: auto; }
  .hide-mobile { display: none !important; }
}

/* ---------- Relances et communications (Lot 4) ----------
   Pastilles sur les jetons de thème (clair et sombre) : mêmes paires que les états des tâches. */
.badge.fu-todo { background: var(--ok-soft); color: var(--ok); }
.badge.fu-done { background: var(--accent-soft); color: var(--accent); }
.badge.fu-cancelled { background: var(--neutral-soft); color: var(--muted); text-decoration: line-through; }
.badge.fu-suspended, .badge.rule-suspended { background: var(--warn-soft); color: var(--warn); }
.badge.rule-started { background: var(--ok-soft); color: var(--ok); }
.badge.rule-stopped { background: var(--neutral-soft); color: var(--muted); }
.badge.dir-inbound { background: var(--accent-soft); color: var(--accent); }
.badge.dir-outbound { background: var(--ok-soft); color: var(--ok); }
.badge.dir-internal { background: var(--neutral-soft); color: var(--muted); }
.badge.thread-open { background: var(--ok-soft); color: var(--ok); }
.badge.thread-closed { background: var(--neutral-soft); color: var(--muted); }
.impact-ok { color: var(--ok); } .impact-warn { color: var(--warn); } .impact-blocked { color: var(--danger); }
/* Puces du menu d'état (includes/status_picker.html) : états des relances et des règles. */
.status-dot.state-suspended { background: var(--warn); }
.status-dot.state-started { background: var(--ok); }
.status-dot.state-stopped { background: var(--danger); }
/* Rangée de liens discrets en pied de carte (« Toutes les relances », « + Règle de relance »). */
.card-links { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 0; }
.card-sub { font-size: .9rem; color: var(--muted); margin: .85rem 0 .25rem; }

/* ---------- Rencontres ---------- */
.badge.mt-planned { background: var(--accent-soft); color: var(--accent); }
.badge.mt-held { background: var(--ok-soft); color: var(--ok); }
.badge.mt-closed { background: var(--neutral-soft); color: var(--muted); }
.badge.mt-cancelled { background: var(--neutral-soft); color: var(--muted); text-decoration: line-through; }
/* ---------- Demandes de présence ---------- */
.badge.inv-pending { background: var(--warn-soft); color: var(--warn); }
.badge.inv-accepted { background: var(--ok-soft); color: var(--ok); }
.badge.inv-delegated { background: var(--accent-soft); color: var(--accent); }
.badge.inv-declined { background: var(--neutral-soft); color: var(--muted); }
.badge.inv-cancelled { background: var(--neutral-soft); color: var(--muted); text-decoration: line-through; }
.props.stack { grid-template-columns: minmax(0, 1fr); }
.props.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.props.stack dd, .props.two dd { overflow-wrap: anywhere; }
.badge.inv-speech { background: var(--ok-soft); color: var(--ok); }
.badge.inv-tag { background: var(--accent-soft); color: var(--accent); }
.badge.inv-fees { background: var(--warn-soft); color: var(--warn); }
/* ---------- Demandes de SAB ---------- */
.badge.sab-received { background: var(--warn-soft); color: var(--warn); }
.badge.sab-under_review { background: var(--accent-soft); color: var(--accent); }
.badge.sab-mp_approved { background: var(--ok-soft); color: var(--ok); }
.badge.sab-mp_rejected { background: var(--neutral-soft); color: var(--muted); }
.badge.sab-in_program { background: var(--accent-soft); color: var(--accent); }
.badge.sab-program_accepted { background: var(--ok-soft); color: var(--ok); }
.badge.sab-program_refused { background: var(--danger-soft); color: var(--danger); }
.badge.sab-archived { background: var(--neutral-soft); color: var(--muted); }
.sab-totals { margin: 0 0 .75rem; }
.sab-totals dd { font-weight: 600; font-variant-numeric: tabular-nums; }
.table th.num, .table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .table.cards td.num { text-align: left; } }
.badge.att-invited { background: var(--neutral-soft); color: var(--muted); }
.badge.att-present { background: var(--ok-soft); color: var(--ok); }
.badge.att-absent { background: var(--danger-soft); color: var(--danger); }
.badge.att-excused { background: var(--warn-soft); color: var(--warn); }
select.badge { appearance: none; -webkit-appearance: none; border: 0; min-height: 0; padding-right: 1.2rem; font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - .7rem) 55%, calc(100% - .45rem) 55%; background-size: .25rem .25rem, .25rem .25rem; background-repeat: no-repeat; }
.attendance-form { display: inline-flex; align-items: center; }
.agenda { list-style: none; margin: 0; padding: 0; counter-reset: agenda; }
.agenda-item { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.agenda-item:last-child { border-bottom: 0; }
.agenda-item.just-added { animation: agenda-in .6s ease; }
@keyframes agenda-in { from { background: var(--accent-soft); } to { background: transparent; } }
.agenda-head { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .6rem; }
.agenda-num { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 999px; background: var(--neutral-soft); color: var(--muted); font-size: .8rem; font-weight: 700; }
.agenda-item.filed .agenda-num { background: var(--ok-soft); color: var(--ok); }
.agenda-title { margin: 0; font-size: 1rem; flex: 1 1 12rem; min-width: 0; }
a.badge.agenda-dossier { text-decoration: none; background: var(--accent-soft); color: var(--accent); }
.agenda-actions { display: inline-flex; align-items: center; gap: .15rem; margin-left: auto; }
.agenda-notes-form { margin: .5rem 0 0 2.2rem; }
.agenda-notes-form textarea { width: 100%; min-height: 6rem; resize: vertical; line-height: 1.5; }
.agenda-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-top: .25rem; min-height: 1.5rem; }
.agenda-notes { margin: .5rem 0 0 2.2rem; line-height: 1.55; }
.agenda-notes.filed-notes { padding: .6rem .8rem; border-left: 3px solid var(--ok); background: var(--ok-soft); border-radius: 0 6px 6px 0; }
.agenda-add { flex-wrap: wrap; }
.agenda-add .agenda-dossier-select { flex: 0 1 16rem; min-width: 0; max-width: 100%; min-height: 2.25rem; font-size: .9rem; }
.agenda-add input[name=title] { min-width: 0; }
/* Une colonne de fiche ne s'élargit jamais au-delà de l'écran à cause d'une liste déroulante ou d'un mot long. */
.detail-grid > * { min-width: 0; }
@media (max-width: 760px) {
  .agenda-notes-form, .agenda-notes { margin-left: 0; }
  .agenda-actions { margin-left: 0; width: 100%; }
  .agenda-add .agenda-dossier-select { flex-basis: 100%; }
}

/* ---------- Recherche, tableaux de bord, rapports (Lot 6) ---------- */
.topbar-search { flex: 0 1 260px; min-width: 140px; }
.topbar-search input[type=search] { min-height: 2.25rem; padding: .3rem .7rem; font-size: .9rem; border-radius: 999px; }
.search-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1rem; align-items: start; }
.search-main, .search-side { min-width: 0; }
.search-main .card + .card { margin-top: 1rem; }
.search-card .toolbar { margin-bottom: .6rem; }
.search-card .filters-row { margin-bottom: 0; }
.type-filters { border: 0; padding: 0; margin: 0 0 .5rem; }
.chip.toggle { position: relative; cursor: pointer; padding: .2rem .7rem; background: var(--neutral-soft); color: var(--muted); }
.chip.toggle input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip.toggle:has(input:checked) { background: var(--accent-soft); color: var(--accent); }
.chip.toggle:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.results { list-style: none; margin: 0; padding: 0; }
.results > li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .6rem; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.results > li:last-child { border-bottom: 0; }
.result-title { font-weight: 600; text-decoration: none; color: var(--fg); min-width: 0; }
.result-title:hover { color: var(--accent); text-decoration: underline; }
.result-sub { flex-basis: 100%; }
.widget-order { list-style: none; margin: 0 0 1rem; padding: 0; }
.widget-order > li { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.widget-order > li:last-child { border-bottom: 0; }
.widget-order > li.is-hidden strong { color: var(--muted); }
.widget-order .num { flex: 0 0 1.6rem; height: 1.6rem; border-radius: 999px; background: var(--neutral-soft); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; }
.widget-order .grow { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.widget-actions { display: inline-flex; gap: .25rem; align-items: center; margin: 0; }
.source-choices li label { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; width: 100%; }
.source-choices li input { margin-top: .3rem; }
.bars { margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.bar-row { display: grid; grid-template-columns: minmax(6rem, 1fr) 3fr 3rem; gap: .5rem; align-items: center; font-size: .88rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: block; height: .9rem; background: var(--neutral-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar-value { text-align: right; }
@media (max-width: 900px) { .search-layout { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .topbar-search { flex: 1 1 100%; order: 4; } }

/* ---------------------------------------------------------------------------
   Fenêtres flottantes (static/js/ui.js) : menus contextuels et sélecteurs en ligne
   --------------------------------------------------------------------------- */
.pop { position: fixed; z-index: 60; min-width: 220px; max-width: min(320px, calc(100vw - 16px)); padding: .35rem; background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.pop-panel { width: 280px; }
.pop-title { margin: .15rem .45rem .4rem; color: var(--muted); font-size: .78rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-form { margin: 0; }
.pop-search, .pop input[type=date] { width: 100%; min-height: 2.1rem; margin-bottom: .35rem; }
.pop-options { max-height: 260px; overflow-y: auto; }
.pop-option, .ctx-menu a, .ctx-menu button { display: flex; align-items: center; gap: .55rem; width: 100%; min-height: 2.25rem; padding: .35rem .55rem; border: 0; border-radius: 6px; background: transparent; color: var(--fg); font: inherit; font-size: .9rem; text-align: left; text-decoration: none; cursor: pointer; }
.pop-option:hover, .pop-option:focus-visible, .ctx-menu a:hover, .ctx-menu a:focus-visible, .ctx-menu button:hover, .ctx-menu button:focus-visible { background: var(--hover); outline: none; }
.pop-option:focus-visible, .ctx-menu a:focus-visible, .ctx-menu button:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.pop-option .check { margin-left: auto; color: var(--accent); visibility: hidden; }
.pop-option.current { font-weight: 600; }
.pop-option.current .check { visibility: visible; }
.pop-option[hidden] { display: none; }
.pop .avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 1.6rem; height: 1.6rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .7rem; font-weight: 700; }
.pop-foot { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-top: .35rem; padding-top: .35rem; border-top: 1px solid var(--line); }
.pop-shortcuts { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .2rem; }
.pop-shortcuts .chip { border: 0; min-height: 0; cursor: pointer; font-size: .8rem; font-weight: 500; padding: .2rem .6rem; }
.pop-shortcuts .chip:hover { background: var(--accent-soft); color: var(--accent); }
.pop-empty { margin: .4rem .5rem; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: .3rem 0; }

/* Cellules cliquables de l'arbre des tâches */
.tt-cell-btn { display: inline-flex; align-items: center; max-width: 100%; min-height: 1.75rem; padding: .1rem .4rem; margin-left: -.4rem; border: 1px solid transparent; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-size: inherit; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-cell-btn:hover, .tt-cell-btn:focus-visible { border-color: var(--line-strong); background: var(--card); }
.tt-cell-btn.badge { margin-left: 0; min-height: 0; padding: .15rem .55rem; border: 0; font-size: .75rem; }
.tt-cell-btn.badge:hover, .tt-cell-btn.badge:focus-visible { filter: brightness(1.08); box-shadow: 0 0 0 2px var(--line-strong); }
.tt-cell-btn .badge { pointer-events: none; }
.tt-placeholder { color: var(--muted); font-size: .82rem; opacity: 0; }
.tt-row:hover .tt-placeholder, .tt-cell-btn:focus-visible .tt-placeholder { opacity: 1; }
@media (hover: none) { .tt-placeholder { opacity: 1; } }
.tt-row:target, .tt-row:focus { outline: none; animation: just-added 1.6s ease-out; }

/* ---------------------------------------------------------------------------
   Listes déroulantes cherchables (static/js/ui.js, section 4)
   --------------------------------------------------------------------------- */
.combo { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; min-width: 0; }
.combo.multiple { padding: .25rem .35rem; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--card); }
.combo.multiple:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.combo-chips { display: contents; }
.combo-chips .chip { font-size: .82rem; font-weight: 500; }
.combo-input { flex: 1 1 10rem; width: 100%; min-width: 6rem; padding-right: 2rem; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.combo.multiple .combo-input { border: 0; min-height: 2rem; padding: .2rem .35rem; background-image: none; outline: none; }
.combo-native { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; pointer-events: none; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50; max-height: 280px; overflow-y: auto; margin: 0; padding: .3rem; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.combo-option { padding: .45rem .6rem; border-radius: 6px; cursor: pointer; font-size: .9rem; }
.combo-option.empty { color: var(--muted); }
.combo-option:hover, .combo-option.active { background: var(--hover); }
.combo-option.active { box-shadow: inset 0 0 0 2px var(--focus); }
.combo-option[aria-selected="true"] { font-weight: 600; color: var(--accent); }
.combo-option[aria-selected="true"]::after { content: " ✓"; }
.combo-none { padding: .45rem .6rem; color: var(--muted); font-size: .88rem; }
dialog .combo-list { position: absolute; }
.ctx-menu a, .ctx-menu button { justify-content: flex-start; }
.tt-row { scroll-margin-top: 30vh; }

/* Dialogue « Ajouter des participants » (meetings/_participant_dialog.html) */
.pp-results { max-height: min(46vh, 420px); overflow-y: auto; overflow-x: hidden; margin: .25rem 0 .5rem; }
.pp-group + .pp-group { margin-top: .5rem; }
.pp-group-label { margin: .35rem 0 .2rem; color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.pp-org { border-bottom: 1px solid var(--line); padding-bottom: .2rem; margin-bottom: .2rem; }
.pp-row-wrap { display: flex; align-items: center; gap: .4rem; }
.pp-row-wrap .pp-row { flex: 1; min-width: 0; }
.pp-row-wrap .btn { flex: 0 0 auto; white-space: nowrap; }
.pp-row { display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 2.4rem; padding: .35rem .5rem; border: 0; border-radius: 6px; background: transparent; color: var(--fg); font: inherit; font-size: .92rem; text-align: left; cursor: pointer; }
.pp-row:hover:not(:disabled) { background: var(--hover); }
.pp-row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.pp-row.picked { background: var(--accent-soft); }
.pp-row.already { cursor: default; opacity: .65; }
.pp-child { padding-left: 2.2rem; }
.pp-check { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 1.15rem; height: 1.15rem; border: 1.5px solid var(--line-strong); border-radius: 4px; color: var(--accent-fg); font-size: .75rem; font-weight: 700; }
.pp-row.picked .pp-check { background: var(--accent); border-color: var(--accent); }
.pp-row.already .pp-check { background: var(--neutral-soft); color: var(--muted); }
.pp-label { flex: 1; min-width: 0; }
.pp-picked { margin: .25rem 0 .75rem; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.pp-picked .chip { font-weight: 500; }
/* ---------- Sélecteur de contacts commun (includes/entity_picker.html) ---------- */
.picker { position: relative; display: flex; flex-direction: column; gap: .35rem; min-width: 0; margin-bottom: .5rem; }
.picker > label { font-weight: 600; font-size: .9rem; }
.picker-search { position: relative; }
.picker-search input[type=search] { width: 100%; padding-left: 2rem; }
.picker .help { display: block; color: var(--muted); font-size: .8rem; }
.picker-glass { position: absolute; left: .65rem; top: 1.25rem; transform: translateY(-50%); color: var(--muted); font-size: 1.05rem; pointer-events: none; }
.picker-spinner { position: absolute; right: 2.2rem; top: 1.25rem; width: .9rem; height: .9rem; margin-top: -.45rem; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: picker-spin .7s linear infinite; }
@keyframes picker-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .picker-spinner { animation: none; } }
.picker.inline .picker-panel { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + .3rem); padding: .35rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card); box-shadow: 0 12px 32px rgba(0,0,0,.28); }
.picker.inline .pp-results { max-height: min(42vh, 360px); margin: 0; }
.picker:not(.inline) .picker-panel { display: block !important; }
.picker.has-error .picker-search input { border-color: var(--danger); }
.pp-row.active { outline: 2px solid var(--focus); outline-offset: -2px; }
.pp-empty { margin: .35rem .5rem; }
.pp-create-offer { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; margin-top: .35rem; padding: .45rem .5rem 0; border-top: 1px dashed var(--line); }
.pp-create { padding: .35rem .5rem .5rem; }
.pp-create .form-grid { margin-top: .25rem; }
.form-actions.tight { margin-top: .5rem; padding-top: 0; border-top: 0; }
.picker-picked { display: flex; flex-direction: column; gap: .35rem; }
.entity-chip { display: flex; align-items: center; gap: .55rem; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.entity-chip.organization { border-left: 3px solid var(--accent); }
.entity-chip.person { border-left: 3px solid var(--ok); }
.entity-icon { flex: 0 0 auto; font-size: 1rem; line-height: 1; }
.entity-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.entity-text .badge { margin-left: .25rem; }
.icon-btn.sm { width: 1.75rem; height: 1.75rem; font-size: .95rem; text-decoration: none; }

/* Tuiles de la vue d'ensemble : chiffre au-dessus du libellé */
.stat { display: flex; flex-direction: column; gap: .15rem; }
.nav a { white-space: nowrap; padding: .4rem .5rem; }
.nav { gap: .1rem; flex-wrap: wrap; row-gap: .15rem; }
.agenda-add .combo-list { left: auto; right: 0; width: min(30rem, calc(100vw - 2rem)); }
.sub-field { padding-left: 1.6rem; }
.help.warn-text { color: var(--warn); }
.tel-link::before { content: "☎ "; color: var(--muted); }
.contact-actions { display: inline-flex; gap: .1rem; }
.contact-row .icon-btn.sm { opacity: .55; }
.contact-row:hover .icon-btn.sm, .contact-row .icon-btn.sm:focus-visible { opacity: 1; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 1.5rem; transform: translateX(-50%); padding: .5rem .9rem; border-radius: 999px; background: var(--fg); color: var(--bg); font-size: .85rem; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.fiche-card > .card-head + .fiche-text { margin-top: 0; padding-top: 0; border-top: 0; }
.empty-prompt { display: block; width: 100%; padding: .7rem .8rem; border: 1px dashed var(--line-strong); border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; }
.empty-prompt:hover, .empty-prompt:focus-visible { border-color: var(--accent); color: var(--accent); }
/* ---------- Finitions 2026 : barre collante, dialogues animés, en-têtes de tableau collants ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px); }
dialog.modal::backdrop { backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
dialog.modal[open] { animation: dialog-in .16s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.pop { animation: pop-in .1s ease-out; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@media (min-width: 761px) {
  .table-wrap { overflow: clip; }
  .table-wrap .table thead th { position: sticky; top: 3.1rem; z-index: 2; background: linear-gradient(var(--neutral-soft), var(--neutral-soft)), var(--card); }
}
@media (prefers-reduced-motion: reduce) { dialog.modal[open], .pop { animation: none; } }
/* ---------- Suivi par étapes (demandes de présence) ---------- */
.steps-track { list-style: none; margin: .25rem 0 0; padding: 0; }
.steps-track > li { position: relative; display: flex; gap: .8rem; padding: 0 0 1rem; }
.steps-track > li:last-child { padding-bottom: 0; }
.steps-track > li:not(:last-child)::before { content: ""; position: absolute; left: .8rem; top: 1.75rem; bottom: .15rem; width: 2px; background: var(--line); }
.steps-track > li.done:not(:last-child)::before { background: var(--ok); }
.step-dot { flex: 0 0 1.6rem; height: 1.6rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--card); color: var(--muted); font-size: .8rem; font-weight: 700; position: relative; z-index: 1; }
.steps-track li.done .step-dot { background: var(--ok); border-color: var(--ok); color: var(--card); }
.steps-track li.current .step-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.steps-track li.skipped .step-dot, .steps-track li.todo .step-dot { border-style: dashed; }
.steps-track li.skipped strong, .steps-track li.todo strong { color: var(--muted); font-weight: 600; }
.step-body { flex: 1; min-width: 0; padding-top: .1rem; }
.step-body > strong { margin-right: .35rem; }
.step-meta { margin: .15rem 0 0; color: var(--muted); font-size: .85rem; }
.step-note { margin: .35rem 0 0; padding: .4rem .6rem; border-left: 3px solid var(--line-strong); font-size: .9rem; }
.step-action { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .5rem 0 0; }
.steps-track li.rejected .step-dot { background: var(--danger); border-color: var(--danger); color: var(--card); }
.steps-track > li.rejected:not(:last-child)::before { background: var(--danger-soft); }
.sab-amounts { margin: .25rem 0 1rem; padding: .6rem .75rem; border-radius: 8px; background: var(--bg); }
.sab-amounts dd { font-variant-numeric: tabular-nums; }
