:root {
  --bg: #F5F7F8;
  --surface: #FFFFFF;
  --surface-2: #FBFCFD;
  --border: #E1E6EA;
  --border-strong: #CBD3D9;
  --text: #1C2427;
  --text-muted: #5B6A72;
  --text-faint: #8A97A0;
  --accent: #1F6F72;
  --accent-hover: #185A5C;
  --accent-soft: #E4F0EF;
  --focus: #1F6F72;

  /* Palette des catégories (Paramètres → Catégories) */
  --cat-indigo: #5C6BC0;
  --cat-vert: #2E9E7E;
  --cat-ambre: #A9790A;
  --cat-violet: #8656C8;
  --cat-rose: #BD5586;
  --cat-bleu: #2F7FC1;
  --cat-turquoise: #13899B;
  --cat-orange: #C2621F;
  --cat-olive: #6F8A2E;
  --cat-ardoise: #5F7482;

  --status-idle-fg: #6B7680;
  --status-idle-bg: #EEF1F3;
  --status-progress-fg: #9A6B10;
  --status-progress-bg: #FBF0DA;
  --status-done-fg: #23794F;
  --status-done-bg: #E1F3E8;
  --status-late-fg: #B23A2E;
  --status-late-bg: #FBE7E4;

  --danger: #B23A2E;

  --shadow-sm: 0 1px 2px rgba(20, 30, 33, 0.06);
  --shadow-md: 0 4px 16px rgba(20, 30, 33, 0.08);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14191B;
    --surface: #1B2225;
    --surface-2: #202829;
    --border: #2C363A;
    --border-strong: #3B474C;
    --text: #E7ECEE;
    --text-muted: #A2AEB4;
    --text-faint: #71808A;
    --accent: #4FAFAE;
    --accent-hover: #6BC2C1;
    --accent-soft: #1E3634;
    --focus: #4FAFAE;

    --cat-indigo: #8B96E8;
    --cat-vert: #5CC9A5;
    --cat-ambre: #D9A63C;
    --cat-violet: #B08AE8;
    --cat-rose: #E389B0;
    --cat-bleu: #6EB0EA;
    --cat-turquoise: #4FC3D3;
    --cat-orange: #EE9A5C;
    --cat-olive: #A9C466;
    --cat-ardoise: #9DB0BD;

    --status-idle-fg: #97A3AB;
    --status-idle-bg: #262F32;
    --status-progress-fg: #E5B25B;
    --status-progress-bg: #362C18;
    --status-done-fg: #6FCB98;
    --status-done-bg: #1B3628;
    --status-late-fg: #E68A7C;
    --status-late-bg: #3A2220;

    --danger: #E68A7C;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

h1, h2, h3 {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

table { font-variant-numeric: tabular-nums; }
button, select, input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--accent); }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }

/* ---------------- Page de connexion ---------------- */

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 30px 28px;
  width: 380px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.gate-card h1 { font-size: 20px; margin: 6px 0 0; }
.gate-card p { margin: 0; color: var(--text-muted); font-size: 13px; }
.gate-card label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-top: 6px; }
.gate-card input {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
}
.gate-card input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.gate-error {
  background: var(--status-late-bg);
  color: var(--status-late-fg);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
}

/* ---------------- Structure ---------------- */

.app { max-width: 1760px; margin: 0 auto; padding: 20px 24px 64px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-bottom: 16px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-family: "Fraunces", serif; font-weight: 700; font-size: 15px;
  flex: none;
}
.brand h1 { font-size: 19px; margin: 0; color: var(--text); }
.brand .sub { font-size: 12px; color: var(--text-faint); }

.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.whoami { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); }
.whoami select { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 6px; padding: 5px 8px; }
.whoami.unset select { border-color: var(--status-progress-fg); background: var(--status-progress-bg); }

.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.tab-btn {
  border: none; background: transparent; padding: 6px 13px; border-radius: 7px;
  cursor: pointer; color: var(--text-muted); font-weight: 500; font-size: 13px;
}
.tab-btn.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 7px 13px; border-radius: 7px; cursor: pointer; font-weight: 500; font-size: 13px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.subtle { border-color: transparent; background: transparent; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn svg { flex: none; }

.banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--status-late-bg); color: var(--status-late-fg);
  border: 1px solid var(--status-late-fg); border-radius: 9px; padding: 10px 14px;
  font-size: 13px; margin-bottom: 16px;
}
.banner.info { background: var(--status-progress-bg); color: var(--status-progress-fg); border-color: var(--status-progress-fg); }

/* ---------------- Filtres ---------------- */

.filterbar {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
  padding: 12px 14px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.field { display: flex; flex-direction: column; gap: 3px; }
/* Uniquement l'intitulé du champ, pas les libellés à l'intérieur du contrôle. */
.field > label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); }
.field > select, .field > input {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 7px; padding: 6px 9px; min-width: 120px;
}
.field > input[type="search"] { min-width: 200px; }
.field > select:focus, .field > input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.filter-spacer { flex: 1; }
.sync-note { font-size: 11.5px; color: var(--text-faint); align-self: center; }

/* ---------------- Compteurs ---------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
  padding: 12px 14px; box-shadow: var(--shadow-sm);
}
.stat .n { font-family: "Fraunces", serif; font-size: 26px; font-weight: 600; line-height: 1; }
.stat .l { font-size: 12px; color: var(--text-muted); margin-top: 5px; display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-sm); margin-bottom: 22px; overflow: hidden;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; }
.panel-head h2 { font-size: 16px; margin: 0; }
.panel-head .count { font-size: 12px; color: var(--text-faint); }
.panel-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.panel-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* Avancement d'un bloc : part des tâches terminées */
.progress { display: flex; align-items: center; gap: 8px; }
.progress-track {
  width: 120px; height: 6px; border-radius: 999px; overflow: hidden;
  background: var(--status-idle-bg);
}
.progress-track span { display: block; height: 100%; background: var(--status-done-fg); border-radius: 999px; }
.progress-text { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Période verrouillée */
.lock-icon { display: inline-flex; align-items: center; }
.lock-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--status-idle-bg); color: var(--text-muted); border: 1px solid var(--border-strong);
}
.panel.is-locked .panel-head { background: var(--surface-2); border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.modal-locked {
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--status-idle-bg); color: var(--text-muted);
  border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 10px 12px; font-size: 12.5px; line-height: 1.5;
}
.modal-locked .lock-icon { margin-top: 2px; }
.mfield-hint { font-size: 11.5px; color: var(--status-progress-fg); }

/* Barre d'outils du tableau de bord : légende et choix d'affichage */
.dash-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.dash-toolbar .legend { margin-bottom: 0; }
.dash-toolbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.group-switch { display: inline-flex; align-items: center; gap: 8px; }
.group-switch-label { font-size: 12px; color: var(--text-faint); }
.panel-head h2.cat-title { display: inline-flex; align-items: center; gap: 8px; }
.panel-head h2.cat-title .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
table.matrix thead tr.group-row th.period-group { color: var(--text-muted); }
table.matrix thead tr.group-row th.period-group span { display: inline-flex; align-items: center; gap: 4px; border-bottom-color: var(--border-strong); }
.view-seg { display: inline-flex; gap: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.seg-btn {
  border: none; background: transparent; padding: 5px 12px; border-radius: 7px;
  cursor: pointer; color: var(--text-muted); font-weight: 500; font-size: 12.5px;
}
.seg-btn.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.seg-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Synthèse d'avancement */
.synth-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
  padding: 18px 18px 10px; flex-wrap: wrap;
}
.synth-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.synth-title h2 { margin: 0; font-size: 19px; }
.synth-sub { font-size: 12.5px; color: var(--text-muted); }
.synth-extra { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.synth-kpi { text-align: right; }
.synth-pct {
  font-family: "Fraunces", Georgia, serif; font-size: 34px; font-weight: 600; line-height: 1;
  color: var(--status-done-fg); font-variant-numeric: tabular-nums;
}
.synth-pct-l { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.synth-bar-wrap { padding: 4px 18px 16px; display: flex; flex-direction: column; gap: 9px; border-bottom: 1px solid var(--border); }

.stack-bar {
  display: flex; width: 100%; height: 7px; border-radius: 999px; overflow: hidden;
  background: var(--status-idle-bg);
}
.stack-bar.big { height: 12px; }
.stack-bar .seg { display: block; height: 100%; }
.stack-bar .seg.done { background: var(--status-done-fg); }
.stack-bar .seg.progress { background: var(--status-progress-fg); }
.stack-bar .seg.late { background: var(--status-late-fg); }
.stack-bar .seg.idle { background: var(--border-strong); }

.counts-line { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-muted); }
.counts-line .item { display: inline-flex; align-items: center; gap: 6px; }
.counts-line strong { color: var(--text); font-variant-numeric: tabular-nums; }
.counts-line .item.zero { opacity: 0.5; }

table.synth-table { width: 100%; border-collapse: collapse; min-width: 620px; }
table.synth-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-faint); padding: 8px 10px; border-bottom: 1px solid var(--border-strong);
  background: var(--surface-2); white-space: nowrap; font-weight: 600;
}
table.synth-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
table.synth-table tbody tr:last-child td { border-bottom: none; }
table.synth-table tr.clickable { cursor: pointer; }
table.synth-table tr.clickable:hover td { background: var(--surface-2); }
table.synth-table tr.clickable:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
table.synth-table .num { text-align: right; font-variant-numeric: tabular-nums; }
table.synth-table td.num { font-weight: 600; }
table.synth-table td.zero { color: var(--text-faint); font-weight: 400; }
table.synth-table td.alert { color: var(--status-late-fg); }
table.synth-table td.date { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-muted); }
table.synth-table td.bar-cell { min-width: 150px; display: table-cell; white-space: nowrap; }
table.synth-table td.bar-cell .stack-bar { display: inline-flex; width: 110px; vertical-align: middle; }
.bar-pct { display: inline-block; min-width: 42px; text-align: right; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.synth-main { font-weight: 600; }
.synth-meta { font-size: 11.5px; color: var(--text-faint); display: inline-flex; align-items: center; gap: 5px; }
.note-cell { font-size: 12px; color: var(--text-muted); max-width: 260px; }
.faint { color: var(--text-faint); }
.synth-foot { font-size: 12px; color: var(--text-faint); padding: 10px 18px 14px; border-top: 1px solid var(--border); }

.status-pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.status-pill.idle { background: var(--status-idle-bg); color: var(--status-idle-fg); }
.status-pill.progress { background: var(--status-progress-bg); color: var(--status-progress-fg); }
.status-pill.done { background: var(--status-done-bg); color: var(--status-done-fg); }
.status-pill.late { background: var(--status-late-bg); color: var(--status-late-fg); }

@media (max-width: 720px) {
  .synth-kpi { text-align: left; }
}

/* Retards des périodes antérieures */
.stats .stat-backlog {
  font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%;
}
.stats .stat-backlog[disabled] { cursor: default; }
.stats .stat-backlog.has-late { border-color: var(--status-late-fg); background: var(--status-late-bg); }
.stats .stat-backlog.has-late .n { color: var(--status-late-fg); }
.stats .stat-backlog:not([disabled]):hover { box-shadow: var(--shadow-md); }
.stats .stat-backlog:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.panel.backlog .panel-head { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.backlog-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px;
  padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--status-late-bg); color: var(--status-late-fg); font-variant-numeric: tabular-nums;
}

/* Filtres des sous-onglets de paramétrage : intégrés au panneau */
.panel .settings-filterbar {
  margin: 0 12px 12px; box-shadow: none; background: var(--surface-2); padding: 10px 12px;
}
.panel .settings-filterbar .field > select { max-width: 240px; }
.filter-hint {
  margin: 0 12px 10px; padding: 8px 12px; border-radius: 8px; font-size: 12.5px;
  background: var(--status-progress-bg); color: var(--status-progress-fg);
}

/* Menus déroulants (Types de tâches : étapes, habilités) */
.dd { position: relative; min-width: 0; }
.dd-toggle {
  display: flex; align-items: center; gap: 6px; width: 100%; min-width: 130px; max-width: 190px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 6px; padding: 5px 8px; cursor: pointer; font-size: 12.5px; text-align: left;
}
.dd-toggle:hover { border-color: var(--accent); }
.dd-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.dd-toggle[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.dd-toggle.dd-invalid { border-color: var(--status-late-fg); color: var(--status-late-fg); }
.dd-summary { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-summary.dd-muted { color: var(--text-faint); font-style: italic; }
.dd-caret { flex: none; color: var(--text-faint); font-size: 10px; }
.dd-panel {
  position: fixed; z-index: 60; max-width: min(440px, calc(100vw - 16px)); max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: var(--shadow-md); padding: 10px;
}
.dd-body { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.dd-body > .btn { align-self: flex-start; }
.dd-hint { font-size: 11.5px; color: var(--text-faint); line-height: 1.45; }
.select-all { display: flex; gap: 6px; flex-wrap: wrap; }
.select-all-btn {
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--accent);
  border-radius: 6px; padding: 3px 9px; font-size: 12px; font-weight: 500; cursor: pointer;
}
.select-all-btn:hover { background: var(--accent-soft); }
.select-all-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.dd-panel .collab-picker { max-height: none; border: none; padding: 0; }

.steps-editor { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.steps-editor li { display: flex; align-items: center; gap: 5px; }
.steps-editor .step-num {
  flex: none; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; background: var(--accent-soft); color: var(--accent); font-variant-numeric: tabular-nums;
}
.steps-editor input {
  flex: 1; min-width: 150px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 6px; padding: 5px 8px;
}
.steps-editor input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.steps-editor .step-role { flex: none; width: 50px; font-size: 10.5px; color: var(--text-faint); text-align: center; }
.steps-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.picker-group {
  display: flex; align-items: center; gap: 6px; margin-top: 6px; padding-top: 6px;
  border-top: 1px solid var(--border); font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint);
}
.picker-group:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.picker-group .dot { width: 7px; height: 7px; }
.check-field { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 6px 0; white-space: nowrap; }
.lib-select {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 6px; padding: 5px 8px; font-size: 12.5px; max-width: 260px;
}
table.settings-table td.usage-list { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; min-width: 220px; }
.icon-btn {
  flex: none; width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-muted); cursor: pointer; font-size: 12px; line-height: 1;
}
.icon-btn:hover:not([disabled]) { border-color: var(--accent); color: var(--accent); }
.icon-btn[disabled] { opacity: 0.35; cursor: default; }

/* Paramètres → Catégories */
.category-picker .dot { width: 8px; height: 8px; flex: none; }
.color-field { display: flex; align-items: center; gap: 8px; }
.color-field select {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 6px; padding: 5px 8px; min-width: 120px;
}
.color-dot { width: 16px; height: 16px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
table.settings-table td.order-cell input { min-width: 0; width: 64px; }
table.settings-table td.usage-cell { font-size: 12.5px; white-space: nowrap; }

/* Paramètres → Général */
.settings-section { padding: 4px 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.settings-section h3 { margin: 0; font-size: 15px; }
.settings-section p { margin: 0; font-size: 13px; color: var(--text-muted); max-width: 75ch; line-height: 1.55; }
.settings-section .settings-state { color: var(--text); font-weight: 500; }

/* Filtre collaborateur : tâches d'un autre responsable */
.badge.dim { opacity: 0.35; }
.badge.dim:hover, .badge.dim:focus-visible { opacity: 0.75; }
.legend .legend-note { color: var(--text-faint); font-style: italic; }

/* ---------------- Tableau matriciel ---------------- */

.table-scroll { overflow-x: auto; }
/* Grille du tableau de bord : le cadre défile (pas la page), pour que l'en-tête
   et la colonne Client restent visibles pendant la lecture. */
.matrix-scroll { overflow: auto; max-height: calc(100vh - 140px); }
@media (max-width: 720px) { .matrix-scroll { max-height: calc(100vh - 90px); } }
@media print { .matrix-scroll { max-height: none; overflow: visible; } }
/* Grille : colonnes de largeur égale réparties sur l'écran (table-layout fixe).
   La largeur minimale posée en ligne par app.js ne déclenche le défilement
   horizontal que si les colonnes devenaient trop étroites pour être lues. */
table.matrix { border-collapse: separate; border-spacing: 0; width: 100%; table-layout: fixed; }
table.matrix col.client-col { width: 176px; }
table.matrix th, table.matrix td { border-bottom: 1px solid var(--border); padding: 0; }
table.matrix thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2);
  font-weight: 600; text-align: left; padding: 7px 6px; font-size: 11.5px; color: var(--text-muted);
  border-bottom: 1px solid var(--border-strong); vertical-align: bottom; line-height: 1.25;
}
table.matrix thead th .head-label {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
table.matrix thead tr.group-row th {
  padding: 7px 6px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: none; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
table.matrix thead tr.group-row th.cat span { display: inline-block; padding-bottom: 3px; border-bottom: 2px solid currentColor; }
table.matrix td.client-cell, table.matrix th.client-head {
  position: sticky; left: 0; background: var(--surface); z-index: 1;
  padding: 7px 10px; border-right: 1px solid var(--border);
}
table.matrix thead th.client-head { background: var(--surface-2); z-index: 4; }
/* Ombres discrètes : on voit que l'en-tête et la colonne figée recouvrent la grille. */
table.matrix thead tr:last-child th { box-shadow: 0 1px 0 var(--border-strong); }
table.matrix tbody tr:hover td, table.matrix tbody tr:hover td.client-cell { background: var(--surface-2); }
.client-name { font-weight: 600; font-size: 12.5px; line-height: 1.3; overflow-wrap: anywhere; }
.client-sub {
  font-size: 11px; color: var(--text-faint); margin-top: 1px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.client-sub .lead-name { color: var(--text-muted); font-weight: 600; }

td.task-cell { padding: 4px 3px; vertical-align: middle; }
.badge {
  display: flex; flex-direction: column; align-items: stretch; gap: 1px; width: 100%;
  border: 1px solid transparent; border-radius: 6px; padding: 5px 7px;
  cursor: pointer; font-size: 11.5px; font-weight: 500; text-align: left; line-height: 1.2;
}
.badge:hover { filter: brightness(0.97); }
.badge:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.badge .badge-line { display: flex; align-items: flex-start; gap: 3px; min-width: 0; }
.badge .stepname {
  flex: 1; min-width: 0; overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.badge .due { font-size: 10px; opacity: 0.85; font-weight: 400; font-variant-numeric: tabular-nums; }
.badge .flag { flex: none; opacity: 0.7; }
.badge.idle { background: var(--status-idle-bg); color: var(--status-idle-fg); }
.badge.progress { background: var(--status-progress-bg); color: var(--status-progress-fg); }
.badge.done { background: var(--status-done-bg); color: var(--status-done-fg); }
.badge.late { background: var(--status-late-bg); color: var(--status-late-fg); }
.badge.na {
  background: transparent; color: var(--text-faint); cursor: default;
  align-items: center; justify-content: center; min-height: 36px; border-style: dashed; border-color: var(--border);
}

.empty-state { padding: 40px 20px; text-align: center; color: var(--text-faint); }
.empty-state .big { font-family: "Fraunces", serif; font-size: 17px; color: var(--text-muted); margin-bottom: 6px; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }
.legend .item { display: flex; align-items: center; gap: 6px; }

/* ---------------- Fenetre modale ---------------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 14, 16, 0.45); display: flex;
  align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: 14px; width: 430px; max-width: 100%;
  box-shadow: var(--shadow-md); border: 1px solid var(--border); max-height: 90vh; overflow-y: auto;
}
.modal-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .cat-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.modal-body { padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { padding: 12px 18px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); }
.mfield { display: flex; flex-direction: column; gap: 4px; }
.mfield label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.mfield select, .mfield input, .mfield textarea {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 8px 10px; width: 100%;
}
.mfield textarea { resize: vertical; min-height: 56px; }
.steps-row { display: flex; flex-wrap: wrap; gap: 6px; }
.step-chip {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px;
  padding: 5px 12px; font-size: 12px; cursor: pointer; color: var(--text-muted);
}
.step-chip.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.step-chip[disabled] { cursor: default; }
.step-chip[disabled]:not(.selected) { opacity: 0.55; }
.mfield input[disabled], .mfield select[disabled], .mfield textarea[disabled] {
  background: var(--surface-2); color: var(--text-muted); cursor: default;
}
.modal-meta { font-size: 11.5px; color: var(--text-faint); }

/* Suivi par cycles (ex. dossier de révision) */
.modal.modal-wide { width: 820px; }
.cycles-count { margin-left: 6px; font-weight: 400; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.cycles-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.cycle-row {
  display: grid; grid-template-columns: minmax(130px, 1fr) auto minmax(150px, 1.2fr); gap: 10px; align-items: center;
  padding: 7px 10px; border-top: 1px solid var(--border);
}
.cycle-row:first-child { border-top: none; }
.cycle-name { font-size: 13px; font-weight: 500; min-width: 0; }
.cycle-meta { font-size: 11px; color: var(--text-faint); font-weight: 400; }
.cycle-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.cycle-btn {
  border: none; border-left: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted);
  font-size: 12px; padding: 5px 9px; cursor: pointer; white-space: nowrap; text-align: center;
}
.cycle-btn:first-child { border-left: none; }
.cycle-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.cycle-btn.selected { font-weight: 600; }
.cycle-btn.selected.idle { background: var(--status-idle-bg); color: var(--status-idle-fg); }
.cycle-btn.selected.progress { background: var(--status-progress-bg); color: var(--status-progress-fg); }
.cycle-btn.selected.late { background: var(--status-late-bg); color: var(--status-late-fg); }
.cycle-btn.selected.done { background: var(--status-done-bg); color: var(--status-done-fg); }
.cycle-btn[disabled] { cursor: default; }
.cycle-btn[disabled]:not(.selected) { opacity: 0.55; }
.mfield input.cycle-note { padding: 5px 8px; border-radius: 6px; font-size: 12.5px; }
.cycle-progress { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.cycle-progress .stack-bar { width: 120px; }
.stacked-dd { display: flex; flex-direction: column; gap: 5px; }
@media (max-width: 760px) {
  .cycle-row { grid-template-columns: 1fr; gap: 6px; }
  .cycle-seg { width: 100%; }
  .cycle-btn { flex: 1; padding: 6px 4px; }
}

/* ---------------- Parametres ---------------- */

/* Accès administrateur */
.admin-gate {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-sm); padding: 28px 26px; max-width: 480px; margin: 12px auto 0;
  display: flex; flex-direction: column; gap: 12px;
}
.admin-gate h2 { margin: 0; font-size: 18px; }
.admin-gate p { margin: 0; font-size: 13.5px; color: var(--text-muted); line-height: 1.55; }
.admin-gate input {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 9px 11px; width: 100%;
}
.admin-gate input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.admin-gate .btn { justify-content: center; }
.gate-warn {
  background: var(--status-progress-bg); color: var(--status-progress-fg);
  border-radius: 8px; padding: 10px 12px; font-size: 12.5px; line-height: 1.5;
}

.admin-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 9px 12px;
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 9px;
}
.admin-badge {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent);
}
.admin-warn { font-size: 12px; color: var(--status-progress-fg); }
.admin-bar .btn { margin-left: auto; }

.subtabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.subtab-btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 5px 13px; font-size: 12.5px; cursor: pointer; color: var(--text-muted);
}
.subtab-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

table.settings-table { width: 100%; border-collapse: collapse; }
table.settings-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-faint); padding: 8px 9px; border-bottom: 1px solid var(--border-strong); white-space: nowrap;
}
table.settings-table td { padding: 8px 9px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
table.settings-table input[type="text"], table.settings-table select, table.settings-table input[type="number"] {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 6px; padding: 5px 8px; width: 100%;
}
table.settings-table input[type="number"] { min-width: 58px; }
table.settings-table input[type="text"] { min-width: 132px; }
table.settings-table select { min-width: 108px; }
/* « Supprimer » sous « Enregistrer » : colonne étroite, et l'action destructrice à l'écart du clic courant. */
table.settings-table td.actions { width: 1%; white-space: nowrap; }
.row-actions { display: flex; flex-direction: column; align-items: stretch; gap: 5px; }
.row-actions .btn { justify-content: center; }
.inactive-row { opacity: 0.55; }
.row-dirty td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.btn.odoo-on { color: var(--status-done-fg); border-color: var(--status-done-fg); }
.rv-pieces-btn { white-space: nowrap; }
.rv-pieces-btn.has { color: var(--status-done-fg); font-weight: 600; }
table.rv-programme td .rv-pieces-btn { margin-top: 4px; }
.rv-piece-link { color: var(--accent); text-decoration: underline; word-break: break-all; }

/* Sélecteur multiple de collaborateurs (Paramètres → Clients) */
.collab-picker {
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 5px 7px; min-width: 172px; max-height: 96px; overflow-y: auto;
  background: var(--surface);
}
.collab-picker label {
  display: flex; align-items: center; justify-content: flex-start; gap: 6px;
  font-size: 12.5px; white-space: nowrap; cursor: pointer; padding: 1px 0;
  text-transform: none; letter-spacing: normal; color: var(--text);
}
.collab-picker input { flex: none; margin: 0; min-width: 0; width: auto; padding: 0; }
.collab-picker label:hover { color: var(--accent); }
.collab-picker .role { color: var(--text-faint); font-size: 11px; }
.collab-picker .role::before { content: "· "; }
.collab-empty { font-size: 12px; color: var(--text-faint); font-style: italic; }
.collab-picker .role:empty { display: none; }

/* Répartition des dossiers */
.rep-head .panel-head { padding-bottom: 14px; }
.stats .stat-alert { border-color: var(--status-late-fg); background: var(--status-late-bg); }
.stats .stat-alert .n { color: var(--status-late-fg); }
.rep-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; margin-bottom: 18px; }
.rep-card { margin-bottom: 0; padding: 14px 16px 16px; }
.rep-card-head { margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.rep-card-head h3 { margin: 0; font-size: 15px; }
.rep-card-sub { font-size: 12px; color: var(--text-faint); }
.hbar-chart { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: minmax(110px, 170px) 1fr minmax(118px, auto); align-items: center; gap: 12px; }
.hbar-name { font-size: 13px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; line-height: 1.25; }
.hbar-sub { font-size: 11px; font-weight: 400; color: var(--text-faint); }
.hbar-track { height: 14px; position: relative; border-left: 1px solid var(--border-strong); }
.hbar-fill {
  position: absolute; left: 0; top: 0; bottom: 0; min-width: 3px;
  background: var(--accent); border-radius: 0 4px 4px 0;
}
.hbar-fill.muted { background: var(--border-strong); }
.hbar-row:hover .hbar-fill { filter: brightness(1.12); }
.hbar-value { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.hbar-value strong { color: var(--text); }
.hbar-pct { display: inline-block; min-width: 42px; margin-left: 8px; color: var(--text); font-weight: 600; }
.hbar-empty { font-size: 12px; }
table.synth-table td.num.alert { color: var(--status-late-fg); font-weight: 600; }
.rep-name { display: flex; align-items: center; gap: 8px; }
.rep-toggle {
  flex: none; width: 20px; height: 20px; padding: 0; border-radius: 5px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--accent);
  font-size: 14px; font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.rep-toggle:hover { background: var(--accent-soft); }
.rep-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
table.synth-table tr.rep-open td { background: var(--surface-2); }
table.synth-table tr.rep-sub td { background: var(--surface-2); font-size: 12.5px; padding-top: 5px; padding-bottom: 5px; }
.rep-sub-name { padding-left: 28px; position: relative; }
.rep-sub-name::before { content: ""; position: absolute; left: 9px; top: -6px; bottom: 50%; width: 10px; border-left: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); }
.rep-sub-meta { color: var(--text-faint); font-size: 11.5px; }
@media print { .rep-toggle { display: none; } }
@media (max-width: 560px) {
  .rep-grid { grid-template-columns: 1fr; }
  .hbar-row { grid-template-columns: 1fr auto; }
  .hbar-row .hbar-track, .hbar-row .stack-bar, .hbar-row .hbar-empty { grid-column: 1 / -1; grid-row: 2; }
}

/* Impression : l'onglet affiché seul, sans barre d'outils. */
@media print {
  .topbar, #banners, .no-print, .filter-bar, #modalRoot { display: none !important; }
  body { background: #fff; }
  .panel, .stat { box-shadow: none !important; break-inside: avoid; }
  .rep-grid { grid-template-columns: 1fr; }
  .hbar-fill, .stack-bar .seg, .dot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Tâches ponctuelles */
.adhoc-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px;
  padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); font-variant-numeric: tabular-nums;
}
.panel.adhoc-panel .panel-head { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.urgent-flag {
  display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 4px; vertical-align: 1px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  background: var(--status-late-bg); color: var(--status-late-fg);
}
table.synth-table td.date.alert { color: var(--status-late-fg); font-weight: 600; }
.modal.modal-adhoc { width: 560px; }
.mfield-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .mfield-row { grid-template-columns: 1fr; } }
.collab-picker.adhoc-assignees { max-height: 170px; }
.collab-picker label.is-blocked { color: var(--text-faint); cursor: not-allowed; }
.modal-foot .modal-del { margin-right: auto; }
/* Clôture d'une fiche sans objet (déclaration à néant…) */
.closed-field { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; gap: 7px; }
.closed-field.is-closed { border-color: var(--status-done-fg); background: var(--status-done-bg); }
.closed-field .check-field { font-size: 12.5px; color: var(--text); font-weight: 500; }
.mfield input.closed-reason { padding: 6px 9px; font-size: 12.5px; }

/* Journal des étapes */
.panel.journal .panel-head { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
table.journal-table tr.journal-day td {
  background: var(--surface-2); font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-faint); padding: 6px 14px;
}
.journal-step {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
}
.journal-by { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
td.journal-last { font-size: 12.5px; color: var(--text-muted); }

/* Historique des étapes d'une fiche */
.hist-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.hist-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 6px 10px; border-top: 1px solid var(--border);
}
.hist-row:first-child { border-top: none; }
.hist-step { font-size: 13px; font-weight: 500; min-width: 0; }
.hist-meta { font-size: 11px; color: var(--text-faint); font-weight: 400; }
.hist-date-text { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-muted); min-width: 66px; }
.mfield input.hist-date { width: auto; padding: 4px 7px; font-size: 12.5px; border-radius: 6px; }
.hist-empty { padding: 10px; font-size: 12px; color: var(--text-faint); font-style: italic; }
.step-date-field { background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; }

/* Enregistrement groupé d'un tableau de réglages */
.bulk-bar {
  position: sticky; bottom: 10px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 10px 12px 4px; padding: 10px 14px; border-radius: 10px;
  background: var(--accent-soft); border: 1px solid var(--accent); box-shadow: var(--shadow-md);
}
.bulk-text { font-size: 13px; font-weight: 600; color: var(--accent); }
.bulk-actions { display: flex; gap: 8px; }
table.settings-table tr.row-dirty > td { background: var(--accent-soft); }
table.settings-table tr.row-dirty > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.private-flag {
  display: inline-flex; align-items: center; gap: 3px; margin-right: 6px; padding: 1px 6px; border-radius: 4px;
  vertical-align: 1px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  background: var(--status-idle-bg); color: var(--text-muted); border: 1px solid var(--border-strong);
}
.private-flag svg { width: 10px; height: 10px; }
.mfield label.private-field { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 12.5px; cursor: pointer; }
.mfield label.private-field input { width: auto; margin: 0; }
.form-inline {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px; background: var(--surface-2); border-top: 1px solid var(--border);
}
.form-inline .field { min-width: 150px; }
.note-disclaimer { font-size: 12px; color: var(--text-faint); padding: 12px 16px 16px; line-height: 1.5; }

/* ---------------- Lettres de mission et budget ---------------- */

table.lm-table { width: 100%; border-collapse: collapse; }
table.lm-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-faint); padding: 8px 9px; border-bottom: 1px solid var(--border-strong); white-space: nowrap;
  background: var(--surface-2);
}
table.lm-table td { padding: 8px 9px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
table.lm-table th.num, table.lm-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.lm-table td.num.zero { color: var(--text-faint); }
table.lm-table td.total, table.lm-table tfoot td { font-weight: 600; }
table.lm-table tfoot td { border-top: 2px solid var(--border-strong); border-bottom: none; background: var(--surface-2); }
table.lm-table tr.clickable { cursor: pointer; }
table.lm-table tr.clickable:hover td { background: var(--surface-2); }
table.lm-table tr.clickable:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
table.lm-table td.actions { width: 1%; white-space: nowrap; }
.lm-actions { display: flex; gap: 5px; }
table.lm-budget th.lm-sticky, table.lm-budget td.lm-sticky {
  position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 200px; border-right: 1px solid var(--border);
}
table.lm-budget thead th.lm-sticky { background: var(--surface-2); z-index: 2; }
table.lm-budget tfoot td.lm-sticky { background: var(--surface-2); }
table.lm-budget tr.clickable:hover td.lm-sticky { background: var(--surface-2); }
/* Coche « facture émise » du budget */
.lm-fact-cell { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
input.lm-fact { margin: 0; width: 14px; height: 14px; cursor: pointer; accent-color: var(--status-done-fg); }
input.lm-fact[disabled] { cursor: wait; }
table.lm-budget td.facturee { background: var(--status-done-bg); color: var(--status-done-fg); font-weight: 600; }
table.lm-budget tr.clickable:hover td.facturee { background: var(--status-done-bg); }
.lm-ech-row.facturee .lm-ech-ttc { color: var(--status-done-fg); font-weight: 600; }
/* Charges et trésorerie */
table.lm-budget tr.lm-cat-row td { background: var(--surface-2); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.lm-moves { display: inline-flex; flex-direction: column; gap: 0; margin-right: 8px; vertical-align: middle; }
.lm-moves .lm-move { width: 18px; height: 13px; line-height: 1; font-size: 9px; padding: 0; border: none; background: transparent; color: var(--text-faint); cursor: pointer; }
.lm-moves .lm-move:hover { color: var(--accent); }
.lm-moves .lm-move[disabled] { opacity: 0.25; cursor: default; }
.lm-charge-ligne { display: flex; align-items: center; gap: 2px; }
table.lm-budget tr.lm-total-row td { font-weight: 600; border-top: 2px solid var(--border-strong); }
table.lm-budget tr.lm-auto-row td { font-style: italic; color: var(--text-muted); }
table.lm-budget tr.lm-solde-row td { font-weight: 600; background: var(--surface-2); }
table.lm-budget tr.lm-cumul-row td { font-weight: 700; background: var(--accent-soft); }
table.lm-budget td.num.negatif { color: var(--status-late-fg); }
table.lm-budget td.num.positif { color: var(--status-done-fg); }
table.lm-realise tr.lm-ecart-row td { font-style: italic; background: var(--surface-2); }
table.lm-realise td.lm-saisie { padding: 3px 4px; }
input.lm-realise-input { width: 96px; border-color: var(--border-strong); }
input.lm-realise-input:focus { border-color: var(--accent); outline: none; }
table.lm-budget td.editable { cursor: text; }
table.lm-budget td.editable:hover { box-shadow: inset 0 0 0 1px var(--accent); }
table.lm-budget td.ajuste { background: var(--status-progress-bg); color: var(--status-progress-fg); font-weight: 600; }
table.lm-budget tr.clickable:hover td.ajuste { background: var(--status-progress-bg); }
input.lm-cell-input { width: 100px; padding: 3px 6px; border: 1px solid var(--accent); border-radius: 5px; font-size: 12.5px; text-align: right; background: var(--surface); color: var(--text); }
.stat .n.alert { color: var(--status-late-fg); }
.lm-check input[type="number"] { width: 130px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 6px; padding: 4px 7px; text-align: right; }
.lm-check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); align-self: center; }
.lm-check input { margin: 0; }

.modal.modal-lettre { width: 1180px; max-width: calc(100vw - 40px); }
.modal.modal-modele { width: 980px; }
.lm-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.modal-lettre.has-texte .lm-body { grid-template-columns: minmax(380px, 5fr) minmax(360px, 6fr); }
@media (max-width: 900px) { .modal-lettre.has-texte .lm-body { grid-template-columns: 1fr; } }
.lm-form { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.lm-form h4 {
  margin: 8px 0 -2px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint);
  font-family: "Inter", sans-serif; font-weight: 700; border-bottom: 1px solid var(--border); padding-bottom: 4px;
}
.lm-form h4:first-child { margin-top: 0; }
.lm-personne { display: grid; grid-template-columns: 105px minmax(0, 1.4fr) minmax(0, 1fr); gap: 6px; }
.lm-personne select, .lm-personne input { min-width: 0; }
.mfield .check-field { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text); cursor: pointer; }
.mfield .check-field input { width: auto; margin: 0; }
.lm-ech-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lm-ech-head > label:first-child { flex: 1; }
.lm-echeancier {
  display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 8px; background: var(--surface-2); max-height: 260px; overflow-y: auto;
}
.lm-ech-row { display: grid; grid-template-columns: 130px minmax(90px, 1fr) auto 24px; align-items: center; gap: 8px; }
.lm-ech-mois { font-size: 12.5px; text-transform: capitalize; }
.lm-ech-row input { padding: 4px 7px; border-radius: 6px; font-size: 12.5px; text-align: right; }
.lm-ech-row input[disabled] { background: var(--surface); color: var(--text); }
.lm-ech-ttc { font-size: 11px; color: var(--text-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lm-ech-add { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.lm-ech-add input { width: auto; padding: 4px 7px; font-size: 12.5px; }
.lm-ech-total { font-size: 12px; color: var(--text-muted); }
.lm-ech-total.alert { color: var(--status-late-fg); font-weight: 600; }

/* Lignes de facturation d'une lettre (périodicités différentes) */
.lm-single, .lm-multi { display: flex; flex-direction: column; gap: 10px; }
.lm-lignes { display: flex; flex-direction: column; gap: 10px; }
.lm-ligne { position: relative; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.lm-ligne-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: start; }
.lm-ligne-grid .mfield { min-width: 0; }
.lm-ligne-grid .mfield:first-child { grid-column: 1 / -1; padding-right: 28px; }
.lm-ligne-grid .mfield-hint { font-size: 11px; }
.lm-ligne-del { position: absolute; top: 8px; right: 8px; }
.lm-ligne .lm-echeancier { max-height: 180px; }
.lm-lignes-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.lm-texte { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lm-texte-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.lm-texte-head label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.lm-texte-tools { display: flex; gap: 5px; flex-wrap: wrap; }
textarea.lm-contenu {
  width: 100%; min-height: 520px; height: 70vh; resize: vertical; font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px; line-height: 1.5; border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 12px;
  background: var(--surface); color: var(--text); tab-size: 2;
}
textarea.lm-contenu-modele { height: 60vh; }
.lm-options {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px;
  border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 7px 10px;
}
.lm-options-title { font-weight: 600; color: var(--accent); }
.collab-picker.lm-clients-picker { max-height: 180px; min-width: 0; }
.lm-options .check-field { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.lm-options .check-field input { margin: 0; }
.lm-help {
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); padding: 8px 10px;
  max-height: 220px; overflow-y: auto; font-size: 12px; display: flex; flex-direction: column; gap: 3px;
}
.lm-help-title { font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.lm-help-row { display: grid; grid-template-columns: minmax(150px, 2fr) 3fr; gap: 10px; padding: 2px 4px; border-radius: 5px; }
.lm-help-row.clickable { cursor: pointer; }
.lm-help-row.clickable:hover { background: var(--accent-soft); }
.lm-help-row code { font-family: Consolas, Menlo, monospace; font-size: 11.5px; color: var(--accent); overflow-wrap: anywhere; }
.lm-help-row span { color: var(--text-muted); }

.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--text); color: var(--bg);
  padding: 9px 15px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow-md); z-index: 100;
  opacity: 0; transform: translateY(6px); transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none; max-width: 340px;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 720px) {
  .app { padding: 14px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar-right { justify-content: space-between; }
}

/* ---------------- Guide d'utilisation (onglet Guide) ---------------- */
/* Entièrement construit sur les jetons de couleur ci-dessus : le guide
   suit donc automatiquement le thème clair ou sombre du navigateur. */

.guide {
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 0 60px;
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 44px;
}

.guide p { margin: 0; max-width: 68ch; }
.guide h1, .guide h2, .guide h3 { margin: 0; }
.guide em { color: inherit; }

.guide .rule-top { height: 3px; width: 52px; border-radius: 2px; background: var(--accent); }
.guide .eyebrow {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.11em;
  font-weight: 600; color: var(--accent);
}

.guide-head { display: flex; flex-direction: column; gap: 12px; }
.guide-head h1 { font-size: 34px; line-height: 1.15; }
.guide-head .lede { font-size: 17px; color: var(--text-muted); max-width: 62ch; }

.guide section { display: flex; flex-direction: column; gap: 18px; }
.guide section > h2 { font-size: 23px; }
.guide .sec-head { display: flex; flex-direction: column; gap: 6px; }
.guide h3 { font-size: 17px; }
.guide .stack { display: flex; flex-direction: column; gap: 14px; }

.guide .steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.guide .step {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 7px; box-shadow: var(--shadow-sm);
}
.guide .step .ord {
  font-family: "Fraunces", Georgia, serif; font-size: 13px; font-weight: 600;
  color: var(--accent); letter-spacing: 0.04em;
}
.guide .step h3 { font-size: 16px; }
.guide .step p { font-size: 13.5px; color: var(--text-muted); }

.guide .table-wrap {
  overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.guide table { border-collapse: collapse; width: 100%; font-size: 14px; }
.guide caption {
  caption-side: top; text-align: left; padding: 13px 18px 11px;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600;
  color: var(--text-faint); border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.guide th, .guide td {
  text-align: left; padding: 11px 18px; vertical-align: top; border-bottom: 1px solid var(--border);
}
.guide thead th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); font-weight: 600; background: var(--surface-2); white-space: nowrap;
}
.guide tbody tr:last-child th, .guide tbody tr:last-child td { border-bottom: none; }
.guide td.compare { font-variant-numeric: tabular-nums; }
.guide th.row-label { font-weight: 500; color: var(--text-muted); font-size: 13.5px; white-space: nowrap; }

.guide code, .guide .ui-name {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.87em;
}
.guide .ui-name {
  background: var(--accent-soft); color: var(--accent);
  padding: 2px 7px; border-radius: 5px; white-space: nowrap; font-weight: 500;
}
.guide .btnref {
  display: inline-block; border: 1px solid var(--border-strong); border-radius: 5px;
  padding: 1px 7px; font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.guide .btnref.stop { border-color: var(--danger); color: var(--danger); }

.guide .note {
  border-radius: 10px; padding: 14px 18px; display: flex; flex-direction: column; gap: 5px;
  font-size: 14px; max-width: 72ch;
}
.guide .note .tag { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.guide .note p { max-width: none; color: inherit; }
.guide .note.warn { background: var(--status-progress-bg); color: var(--status-progress-fg); }
.guide .note.stop { background: var(--status-late-bg);     color: var(--status-late-fg); }
.guide .note.go   { background: var(--status-done-bg);     color: var(--status-done-fg); }
.guide .note.stop .btnref.stop { border-color: currentColor; color: inherit; }

.guide .chain { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.guide .pill { border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.guide .pill.idle { background: var(--status-idle-bg); color: var(--status-idle-fg); border: 1px solid var(--border-strong); }
.guide .pill.mid  { background: var(--status-progress-bg); color: var(--status-progress-fg); }
.guide .pill.end  { background: var(--status-done-bg);     color: var(--status-done-fg); }
.guide .pill.late { background: var(--status-late-bg);     color: var(--status-late-fg); }
.guide .arrow { color: var(--text-faint); font-size: 13px; }

.guide .swatch-list { display: flex; flex-direction: column; gap: 9px; margin: 0; padding: 0; list-style: none; }
.guide .swatch-list li { display: flex; gap: 11px; align-items: baseline; font-size: 14px; }
.guide .swatch-list .pill { flex: none; min-width: 96px; text-align: center; }

.guide .recipes {
  display: flex; flex-direction: column; border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; background: var(--surface); margin: 0;
}
.guide .recipe {
  display: grid; grid-template-columns: minmax(190px, 1fr) 2fr; gap: 4px 22px;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.guide .recipe:last-child { border-bottom: none; }
.guide .recipe dt { font-weight: 600; font-size: 14.5px; }
.guide .recipe dd { margin: 0; font-size: 14px; color: var(--text-muted); }

.guide-foot {
  border-top: 1px solid var(--border); padding-top: 20px;
  font-size: 13.5px; color: var(--text-faint);
  display: flex; flex-direction: column; gap: 8px;
}

@media (max-width: 620px) {
  .guide { gap: 36px; }
  .guide-head h1 { font-size: 27px; }
  .guide .recipe { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------------- Dossiers de révision (revision.js) ---------------- */

.rv .panel { margin-bottom: 14px; }
.rv-head { padding: 14px 16px; }
.rv-head-main { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.rv-head-main h2 { margin: 0 0 4px; font-size: 19px; }
.rv-head-meta { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.rv-head-status { display: flex; align-items: center; gap: 8px; }
.rv-statut-select { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 6px; padding: 4px 7px; font-size: 12.5px; }
.rv-head-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.rv-head .modal-locked { margin-top: 10px; }
.rv-sections .subtab-btn { display: inline-flex; align-items: center; gap: 6px; }
.rv-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; font-size: 10.5px; font-weight: 700; background: var(--status-late-bg); color: var(--status-late-fg);
}
.rv-sections .subtab-btn.active .rv-count { background: var(--accent); color: #fff; }

.rv-progress { display: inline-flex; align-items: center; gap: 7px; }
.rv-progress-bar { width: 70px; height: 7px; border-radius: 999px; background: var(--status-idle-bg); overflow: hidden; }
.rv-progress-fill { height: 100%; background: var(--status-done-fg); }
.rv-progress-txt { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.rv-controls { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.rv-control { border-radius: 8px; padding: 8px 12px; font-size: 12.5px; }
.rv-control.go { background: var(--status-done-bg); color: var(--status-done-fg); }
.rv-control.warn { background: var(--status-progress-bg); color: var(--status-progress-fg); }
.rv-control.stop { background: var(--status-late-bg); color: var(--status-late-fg); font-weight: 600; }

.rv-pad { padding: 4px 16px 16px; }
.rv-pad textarea {
  width: 100%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 8px 10px; resize: vertical; min-height: 80px;
}
.rv-h4 { margin: 10px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); font-family: inherit; }
.rv-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.rv-grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 14px; }
.rv-grid2 .rv-full, .rv-grid4 .rv-full { grid-column: 1 / -1; }
.rv-grid4 .mfield input, .rv-grid4 .mfield select { padding: 5px 8px; border-radius: 6px; font-size: 12.5px; }
.rv-objectifs { display: grid; grid-template-columns: 3fr 2fr; gap: 10px 24px; margin-top: 10px; }
.rv-objectifs ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-muted); }
.rv-objectifs li { margin: 2px 0; }
.rv-assertions b { color: var(--accent); margin-right: 2px; }

.rv-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }
.rv-chip {
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 5px 10px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; background: var(--surface); color: var(--text-muted);
}
.rv-chip.idle { background: var(--status-idle-bg); color: var(--status-idle-fg); }
.rv-chip.progress { background: var(--status-progress-bg); color: var(--status-progress-fg); }
.rv-chip.done { background: var(--status-done-bg); color: var(--status-done-fg); }
.rv-chip.late { background: var(--status-late-bg); color: var(--status-late-fg); }
.rv-chip.active { outline: 2px solid var(--accent); outline-offset: 1px; }

table.rv-table th { position: sticky; top: 0; background: var(--surface-2); z-index: 1; }
table.rv-table td.rv-wrap { max-width: 320px; overflow-wrap: anywhere; font-size: 12.5px; }
table.rv-table td.rv-strong { font-weight: 600; }
table.rv-table td.rv-alert, table.rv-table td.num.rv-alert { color: var(--status-late-fg); font-weight: 600; }
table.rv-table td.rv-link { color: var(--accent); cursor: pointer; font-weight: 600; }
table.rv-table td.rv-link:hover { text-decoration: underline; }
table.rv-table td.rv-cell-wide { min-width: 220px; }
table.rv-table input, table.rv-table select, table.rv-table textarea {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 6px; padding: 4px 7px; width: 100%; min-width: 90px; font-size: 12.5px;
}
table.rv-table textarea { resize: vertical; min-height: 40px; min-width: 200px; }
table.rv-table input.rv-short { min-width: 60px; width: 80px; }
table.rv-table input[type="date"] { min-width: 128px; }
table.rv-table input[disabled], table.rv-table select[disabled], table.rv-table textarea[disabled] { background: var(--surface-2); color: var(--text-muted); }
table.rv-table .rv-cycle-select { min-width: 150px; }
table.rv-table .rv-cycle-select.rv-override { border-color: var(--accent); font-weight: 600; }
.rv-pill-select { border-radius: 999px !important; font-weight: 600; min-width: 120px !important; }
.rv-pill-select.idle { background: var(--status-idle-bg) !important; color: var(--status-idle-fg) !important; }
.rv-pill-select.progress { background: var(--status-progress-bg) !important; color: var(--status-progress-fg) !important; }
.rv-pill-select.done { background: var(--status-done-bg) !important; color: var(--status-done-fg) !important; }
.rv-pill-select.late { background: var(--status-late-bg) !important; color: var(--status-late-fg) !important; }
.rv-saved { box-shadow: 0 0 0 2px var(--status-done-fg) !important; transition: box-shadow 0.3s; }
.rv-num { text-align: right; font-variant-numeric: tabular-nums; }
.rv-scroll { max-height: calc(100vh - 220px); overflow: auto; }
table.rv-balance th { padding-left: 5px; padding-right: 5px; }
table.rv-balance td { padding: 4px 5px; font-size: 12px; white-space: nowrap; }
table.rv-balance td.rv-wrap { white-space: normal; min-width: 120px; }
table.rv-balance input, table.rv-balance select { min-width: 70px; padding: 3px 5px; font-size: 12px; }
table.rv-balance .rv-cycle-select { min-width: 96px; }
table.rv-programme td { vertical-align: top; }

/* Programme de travail : une fiche par diligence, sur deux lignes, sans défilement horizontal. */
.rv-dil-list { display: flex; flex-direction: column; }
.rv-dil { padding: 10px 16px 12px; border-bottom: 1px solid var(--border); border-left: 4px solid var(--status-idle-bg); }
.rv-dil.progress { border-left-color: var(--status-progress-fg); }
.rv-dil.done { border-left-color: var(--status-done-fg); }
.rv-dil.late { border-left-color: var(--status-late-fg); }
.rv-dil:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.rv-dil-top { display: grid; grid-template-columns: 110px 86px minmax(0, 1fr) 220px; gap: 10px 14px; align-items: start; }
.rv-dil-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 150px 140px 150px 150px 96px; gap: 10px 14px; align-items: start; margin-top: 8px; }
.rv-dil-field { min-width: 0; }
.rv-dil-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin-bottom: 3px; min-height: 12px; }
.rv-dil input, .rv-dil select, .rv-dil textarea {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 6px; padding: 5px 8px; width: 100%; min-width: 0; font-size: 12.5px;
}
.rv-dil input[disabled], .rv-dil select[disabled], .rv-dil textarea[disabled] { background: var(--surface-2); color: var(--text-muted); }
.rv-dil textarea { resize: none; overflow: hidden; line-height: 1.45; }
.rv-dil textarea.rv-dil-text { font-size: 13.5px; }
.rv-dil input.rv-short { width: 100%; }
.rv-dil .rv-pill-select { min-width: 0 !important; }
.rv-dil-preuve { display: flex; gap: 6px; align-items: center; }
.rv-dil-preuve input { flex: 1; }
.rv-dil .lm-actions { padding-top: 2px; }
@media (max-width: 1100px) {
  .rv-dil-top { grid-template-columns: 110px 86px minmax(0, 1fr); }
  .rv-dil-top .rv-dil-field:nth-child(4) { grid-column: 1 / -1; }
  .rv-dil-bottom { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rv-dil-bottom .rv-dil-field:first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .rv-dil-top, .rv-dil-bottom { grid-template-columns: 1fr; }
}

table.rv-etat tr.rv-section td { background: var(--surface-2); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
table.rv-etat tr.rv-total td { font-weight: 600; border-top: 2px solid var(--border-strong); }
table.rv-etat tr.rv-grand td { font-weight: 700; background: var(--accent-soft); }
table.rv-etat tr.rv-ouverture td, table.rv-etat tr.rv-cloture td { font-weight: 600; background: var(--surface-2); }
table.rv-etat tr.rv-info td { font-style: italic; color: var(--text-muted); }
table.rv-etat tr.rv-ctrl td { font-weight: 700; background: var(--status-progress-bg); color: var(--status-progress-fg); }

.rv-modal .modal-body { gap: 10px; }
.rv-modal .mfield textarea { min-height: 64px; }
.rv-mapping { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 12px; }
.rv-mapping .mfield label { font-size: 11px; }
.rv-mapping .mfield select { padding: 4px 7px; font-size: 12.5px; }

@media (max-width: 760px) {
  .rv-grid2, .rv-grid4, .rv-objectifs { grid-template-columns: 1fr; }
}

.rv-liaison { margin-top: 10px; }
.rv-add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.rv-add-row input { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 7px; padding: 6px 9px; min-width: 200px; }

