/* Investy CGP dashboard. Every value comes from the tokens below (docs/design-system.md):
   colours by role, surfaces L0/L1, spacing on a 4/8 grid, type sizes and weights. One
   breakpoint at 768px; hit targets of 44px. Profile: .ux-profile.md. Visual direction:
   Claude Design handoff « Refonte Investy » (02/10/2026): navy, mint on dark, IBM Plex. */

/* IBM Plex (SIL Open Font License 1.1), latin subset, served by the app itself: the CSP
   allows no font host. Sans is one variable file for every weight. */
@font-face {
  font-family: "IBM Plex Sans"; font-style: normal; font-weight: 100 700; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/ibm-plex-mono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Colour: neutrals by role */
  --fg: #142033;
  --fg-muted: #5a6577; /* 5.4:1 on L0, 5.9:1 on L1 */
  --fg-muted-strong: #3d4859;
  --fg-on-strong: #ffffff; /* text on brand, danger and dark fills */
  --surface-l0: #f4f6f9; /* canvas */
  --surface-l1: #ffffff; /* cards, tables */
  --surface-sunken: #f7f9fb; /* table heads, side tabs */
  --border-subtle: #dde3ea; /* card edges */
  --border-hairline: #eef1f4; /* lines inside a card */
  --border-strong: #c9d2dd; /* secondary buttons (named by their text) */
  --border-control: #7d8799; /* fields: at least 3:1 on L0, L1 and --pending-bg (WCAG 1.4.11) */
  /* Colour: brand. Navy is the one action colour on light surfaces; mint only on navy. */
  --brand: #0b1f3a; /* primary buttons, active filter, page titles */
  --brand-strong: #1d3a63; /* links, active item of the side navigation */
  --brand-soft: #e6ebf2; /* row hover, quiet fills */
  --brand-line: #c9d2dd;
  --mint: #2fbf8f; /* on navy only (side navigation, focus on navy): 2.3:1 on white */
  --nav-bg: #0b1f3a;
  --nav-fg: #c9d3e0;
  --nav-fg-muted: #a9b7c9;
  --nav-line: #23395a;
  /* Kept names: --accent is the action colour every component already uses. */
  --accent: var(--brand);
  --accent-bg: var(--brand-soft);
  --accent-line: var(--brand-line);
  --link: var(--brand-strong);
  /* Colour: states (text colour on its tint, at least 4.5:1) */
  --ok: #0b6b4f;
  --ok-bg: #e3f5ee;
  --ok-line: #b7e2cc;
  --warn: #8a5a00;
  --warn-bg: #fff4e0;
  --warn-line: #f1d9a6;
  --info: #1e40af; /* « données à compléter » */
  --info-bg: #e8effd;
  --pending-bg: #fff8ec;
  --danger: #9b1c1c; /* text */
  --danger-strong: #b42318; /* borders and fills of errors */
  --danger-bg: #fdecec;
  --danger-line: #f3c1c1;
  /* Spacing: 4px micro steps, 8px grid */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  /* Type: dense tool, 14px body; fields stay at 16px on phones (no zoom on focus) */
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --text-meta: 0.75rem; /* 12px: column heads, dates, tags */
  --text-secondary: 0.8125rem; /* 13px */
  --text-body: 0.875rem; /* 14px */
  --text-field: 0.9375rem; /* 15px; 16px below 768px */
  --text-h3: 0.9375rem; /* 15px: card titles */
  --text-h2: 1.0625rem; /* 17px: next step, section titles */
  --text-h1: 1.5rem; /* 24px: page title */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600; /* the heaviest weight: never 700 */
  --leading-tight: 1.25;
  --leading-body: 1.5;
  /* Shape and sizes */
  --radius-tag: 4px; /* status tags */
  --radius-control: 6px; /* buttons, fields */
  --radius: 10px; /* cards */
  --radius-lg: 12px; /* login card, drop zone */
  --radius-full: 999px;
  --shadow-toast: 0 6px 20px rgba(11, 31, 58, .2);
  --hit: 44px;
  --focus-ring: 3px;
  --prose: 72ch;
  --page-max: 1280px;
  --nav-width: 232px;
  --form-max: 900px;
  --dialog-max: 440px;
  --label-col: 14rem;
}
* { box-sizing: border-box; }
/* Hidden means hidden, whatever a component's display (buttons are inline-flex). */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--fg);
  background: var(--surface-l0);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
a:not(.button):hover { color: var(--ok); }
/* Chrome and button-links are named by their shape, not underlined. */
.button, .brand, .side-nav a, .filters a { text-decoration: none; }
h1, h2, h3 { line-height: var(--leading-tight); font-weight: var(--weight-semibold); color: var(--brand); }
strong, b, th, legend { font-weight: var(--weight-semibold); } /* browsers default to 700 */
h1 { font-size: var(--text-h1); margin: 0 0 var(--space-2); }
h2 { font-size: var(--text-h2); margin: 0 0 var(--space-4); }
p, .meta, .notice, .warning { max-width: var(--prose); }
.meta { color: var(--fg-muted); margin: 0; }

/* Chrome (refonte UX lot 2): a navy side navigation when signed in, the logo alone when
   signed out. Below 768px the side navigation becomes a top bar. */
.shell { display: grid; grid-template-columns: var(--nav-width) minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--nav-bg); color: var(--fg-on-strong); padding: var(--space-5) var(--space-3);
  display: flex; flex-direction: column; gap: var(--space-1);
  position: sticky; top: 0; height: 100vh;
}
.side .brand { padding: var(--space-1) var(--space-3) var(--space-5); }
.brand { display: inline-flex; align-items: center; min-height: var(--hit); }
.brand img { display: block; height: 24px; width: auto; }
/* « + Nouveau dossier »: the one mint control, on navy (the prototype's main entry). */
.side-new {
  display: flex; align-items: center; justify-content: center; min-height: var(--hit); margin-bottom: var(--space-3);
  border-radius: var(--radius-control); background: var(--mint); color: var(--brand);
  font-weight: var(--weight-semibold); text-decoration: none; gap: var(--space-1);
}
.side-new:hover { color: var(--brand); filter: brightness(1.06); }
.side :focus-visible.side-new { outline-color: var(--fg-on-strong); }
/* Dropping a client's files (add-web-upload). */
.drop-page { max-width: var(--form-max); }
.drop-lead { color: var(--fg-muted-strong); max-width: var(--prose); }
.drop-zone {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3); text-align: center;
  padding: var(--space-12) var(--space-6); border: 2px dashed var(--border-control); border-radius: var(--radius-lg);
  background: var(--surface-l1);
}
.drop-zone.is-over { border-color: var(--brand); background: var(--brand-soft); }
.drop-zone[aria-busy="true"] { opacity: .7; cursor: progress; }
.drop-mark {
  display: inline-grid; place-items: center; width: var(--space-12); height: var(--space-12); border-radius: var(--radius-lg);
  background: var(--brand-soft); color: var(--brand); font-size: var(--text-h1);
}
.drop-title { font-size: var(--text-h2); font-weight: var(--weight-semibold); color: var(--brand); margin: 0; }
.drop-zone .meta { max-width: 34rem; margin: 0; }
.drop-pick { position: relative; }
.drop-pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-pick:focus-within { outline: var(--focus-ring) solid var(--brand); outline-offset: var(--space-1); }
.drop-note { margin-top: var(--space-3); }
.drop-follow { margin-top: var(--space-5); }
/* Without script the follow-up card has no header: its first line opens the card. */
.drop-follow > [data-refresh] .piece-row:first-child { border-top: none; padding-top: 0; }
.drop-file-name { font-weight: var(--weight-regular); color: var(--fg-muted); overflow-wrap: anywhere; }
.drop-dossier { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: var(--space-4) 0 0; }
.card-head .card-action { margin-left: auto; font-size: var(--text-secondary); }
.side-nav { display: flex; flex-direction: column; gap: var(--space-1); }
.side-nav a {
  display: flex; align-items: center; min-height: var(--hit); padding: 0 var(--space-3);
  border-radius: var(--radius-control); color: var(--nav-fg); font-weight: var(--weight-medium);
}
.side-nav a:hover { color: var(--fg-on-strong); background: var(--nav-line); }
.side-nav a[aria-current="page"] { background: var(--brand-strong); color: var(--fg-on-strong); }
.side-foot { margin-top: auto; padding-top: var(--space-3); border-top: 1px solid var(--nav-line); }
.side button.logout {
  background: none; border: none; color: var(--nav-fg); padding: 0 var(--space-3); gap: var(--space-2);
  justify-content: flex-start; width: 100%;
}
.side button.logout:hover { color: var(--fg-on-strong); }
/* On navy, the focus ring is mint (the navy ring would not show). */
.side :focus-visible { outline-color: var(--mint); }
.public-bar { display: flex; justify-content: center; padding: var(--space-12) var(--space-4) 0; }
.public-bar .brand img { height: 36px; }
main { max-width: var(--page-max); width: 100%; padding: var(--space-8) var(--space-8) var(--space-12); position: relative; }
.public main { margin: 0 auto; padding-top: var(--space-4); }
.head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); }
.head a { display: inline-flex; align-items: center; min-height: var(--hit); }
/* Back link above a record: close to the card it leads away from. */
.back { margin: 0; }
.back a { display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--hit); }
.head:has(> .back) { margin-bottom: var(--space-2); }

/* Controls: every target at least 44px high */
button, .button {
  font: inherit; font-weight: var(--weight-medium); cursor: pointer; border-radius: var(--radius-control); padding: var(--space-2) var(--space-4);
  min-height: var(--hit); display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2); border: 1px solid var(--border-strong); background: var(--surface-l1); color: var(--fg);
}
a.button:hover, button:not(.primary):not(.danger):not(.link):not(.logout):hover { text-decoration: none; border-color: var(--border-control); }
button.primary:hover, .button.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
button.primary, .button.primary { background: var(--accent); color: var(--fg-on-strong); border-color: var(--accent); }
/* Blocked, still clickable: a click lists what to fix. It looks like a live secondary
   button with a warning icon, never like a greyed-out disabled one. */
button.primary.blocked { background: var(--surface-l1); color: var(--fg); border-color: var(--border-control); }
button.link { border: none; background: none; color: var(--link); text-decoration: underline; text-underline-offset: 2px; padding: 0 var(--space-2); }
button.danger, .button.danger { background: var(--danger-strong); color: var(--fg-on-strong); border-color: var(--danger-strong); }
.button.danger:hover { text-decoration: none; }
.button.danger-outline {
  background: var(--surface-l1); color: var(--danger); border-color: var(--danger-strong); font-size: var(--text-secondary);
}
.button.danger-outline:hover { background: var(--danger-bg); }
button.is-busy { cursor: progress; opacity: .8; }
:focus-visible { outline: var(--focus-ring) solid var(--accent); outline-offset: 2px; }
button:focus-visible, .button:focus-visible { outline-offset: var(--space-1); }
.filters { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.filters a {
  display: inline-flex; align-items: center; min-height: var(--hit); padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full); border: 1px solid var(--border-strong); background: var(--surface-l1); color: var(--fg);
  font-size: var(--text-secondary);
}
.filters a:hover { border-color: var(--border-control); }
.filters a.active { background: var(--brand); color: var(--fg-on-strong); border-color: var(--brand); }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-top: var(--space-4); }
form.inline { display: inline-flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: var(--space-2) 0; }
form.inline.stacked { flex-direction: column; align-items: flex-start; }
.row-actions { white-space: nowrap; }
.row-actions a:not(.button) { display: inline-flex; align-items: center; min-height: var(--hit); margin-left: var(--space-4); }
.danger-zone { text-align: right; margin-top: var(--space-6); max-width: none; }

/* List page: heading and sentence, then search and filters above the table. */
.list-head { margin-bottom: var(--space-4); }
.list-head h1 { margin-bottom: var(--space-1); }
.toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--space-4); margin-bottom: var(--space-4);
}
.search { display: grid; gap: var(--space-1); min-width: 16rem; }
.search label { font-size: var(--text-secondary); font-weight: var(--weight-medium); }
.search input {
  font: inherit; font-size: var(--text-field); min-height: var(--hit); padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-control); border-radius: var(--radius-control); background: var(--surface-l1);
}
.search .hint { font-size: var(--text-meta); color: var(--fg-muted); }
/* Every dossier: the filters and the search above the table, in one card. */
.table-card { background: var(--surface-l1); border: 1px solid var(--border-subtle); border-radius: var(--radius); overflow: hidden; }
.table-card .toolbar { padding: var(--space-3) var(--space-4); margin: 0; border-bottom: 1px solid var(--border-hairline); }
.table-card table.dossiers { border: none; border-radius: 0; }

/* Pieces of a dossier in the list: one short chip per piece, icon first. */
.items { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); }
.item { display: inline-flex; align-items: baseline; gap: var(--space-1); }
/* Log out: the word on wide screens, the icon alone (named) on narrow ones. */
button.logout { gap: var(--space-2); padding: 0 var(--space-2); min-width: var(--hit); }

.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-2); }
.card-head h2 { margin: 0; font-size: var(--text-h3); }
.card h2 { font-size: var(--text-h3); }
.card.pieces { padding-bottom: var(--space-2); }
.piece-list { list-style: none; margin: 0 calc(-1 * var(--space-5)); padding: 0; }
.piece-row {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--space-3);
  padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border-hairline);
}
.piece-row .mark { margin-top: 2px; }
.piece-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.piece-name { font-weight: var(--weight-medium); }
.piece-help { font-size: var(--text-secondary); color: var(--fg-muted); overflow-wrap: anywhere; }
.piece-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-4); margin-top: var(--space-1); }
.piece-actions .icon-link { font-size: var(--text-secondary); }

/* Bulletin card (refonte UX): the blank form to fill, then the data and the fill action. */
.card-head .tag { flex-shrink: 0; }
.target-form { display: grid; gap: var(--space-2); margin: var(--space-2) 0 var(--space-3); }
.target-form label { font-size: var(--text-secondary); font-weight: var(--weight-medium); }
.target-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.target-row select { flex: 1 1 16rem; min-width: 0; }
.bulletin-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-4); margin: 0 0 var(--space-3); }
#extension .actions { margin-top: var(--space-3); }
#extension [data-extension-status]:empty { display: none; }

/* Bulletins generated: one line each, its actions wrapping under it. */
.acts { list-style: none; margin: var(--space-4) 0 0; padding: 0; }
.acts li { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3) 0; border-top: 1px solid var(--border-hairline); }
.acts-title { font-weight: var(--weight-medium); }
.acts-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-4); margin-top: var(--space-1); }
.acts-actions .icon-link { font-size: var(--text-secondary); }

/* A secondary action inside a table or a line: text and icon, 44px high, no border. */
.icon-link { display: inline-flex; align-items: center; gap: var(--space-1); min-height: var(--hit); }

/* Surfaces */
.card {
  background: var(--surface-l1); border: 1px solid var(--border-subtle); border-radius: var(--radius);
  padding: var(--space-5); margin-bottom: var(--space-5);
}
.card > h2:first-child { font-size: var(--text-h3); }
.card.narrow { border-radius: var(--radius-lg); padding: var(--space-8) var(--space-6); }
.card.narrow { max-width: var(--dialog-max); margin: var(--space-6) auto var(--space-12); }
/* Login page (Form (auth)): one labelled field above a full-width primary action. */
.auth-form { display: grid; gap: var(--space-2); margin: var(--space-4) 0; }
.auth-form label { font-weight: var(--weight-medium); }
.auth-form input {
  font: inherit; font-size: var(--text-field); min-height: var(--hit); padding: var(--space-2) var(--space-3); width: 100%;
  border: 1px solid var(--border-control); border-radius: var(--radius-control); background: var(--surface-l1);
}
.auth-form button { margin-top: var(--space-2); }
/* Refonte UX lot 3: the login card, the « link sent » state, what the firm can rely on. */
.auth .meta { font-size: var(--text-secondary); }
.auth button.wide { width: 100%; }
.auth-sent { display: flex; flex-direction: column; align-items: center; text-align: center; }
.auth-sent p { margin: 0 0 var(--space-3); }
.auth-sent-mark {
  display: inline-grid; place-items: center; width: var(--hit); height: var(--hit); border-radius: 50%;
  background: var(--ok-bg); color: var(--ok); margin-bottom: var(--space-3);
}
.trust {
  list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2) var(--space-4);
  margin: 0 auto; padding: 0; font-size: var(--text-secondary); color: var(--fg-muted);
}
.trust li::before {
  content: ""; display: inline-block; width: var(--space-2); height: var(--space-2); margin-right: var(--space-2);
  background: var(--fg-muted); vertical-align: middle;
}
.notice {
  background: var(--info-bg); border: 1px solid var(--accent-line); border-radius: var(--radius-control);
  padding: var(--space-3) var(--space-4); color: var(--fg);
}
.notice.error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.notice.error ul, .blockers ul { margin: var(--space-2) 0 0; padding-left: var(--space-6); }
.warning {
  background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius-control);
  padding: var(--space-2) var(--space-4); margin: var(--space-4) 0;
}
.blockers {
  color: var(--danger); background: var(--danger-bg); border: 1px solid var(--danger-strong);
  border-radius: var(--radius); padding: var(--space-2) var(--space-4); margin: var(--space-2) 0;
}
ul.blockers { padding-left: var(--space-8); }
.card > .blockers { max-width: var(--form-max); } /* aligned with the form under it */
/* One-click corrections under a reason: dark text on the red list, one form each. */
.blockers .suggestions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-1) 0 var(--space-2); }
.blockers .suggestions form.inline { margin: 0; }
.blockers .suggestions button { color: var(--fg); text-align: left; }
.blockers .icon-link { color: var(--accent); }
.blockers li { margin: var(--space-1) 0; }
.blockers:focus { outline: var(--focus-ring) solid var(--danger-strong); outline-offset: 2px; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--surface-l1); }
th, td {
  text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
th { font-size: var(--text-meta); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: .04em; color: var(--fg-muted); background: var(--surface-sunken); }
td { border-bottom-color: var(--border-hairline); }
.checklist th, .checklist td { padding: var(--space-2); }
table.dossiers { border: 1px solid var(--border-subtle); border-radius: var(--radius); overflow: hidden; }
table.dossiers tbody tr:hover { background: var(--surface-sunken); }
/* The client's name opens the dossier: a 44px-high target, like every control. */
table.dossiers td:first-child a { display: inline-flex; align-items: center; min-height: var(--hit); }
tr.attention { background: var(--danger-bg); }
.table-scroll { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.empty { color: var(--fg-muted); text-align: center; padding: var(--space-8); }
.empty p { margin: var(--space-1) auto var(--space-3); }
.empty .button { margin-top: var(--space-2); }
/* Status: a tag, the word on its state's tint (refonte UX): status is the one place for colour. */
.status, .tag {
  display: inline-flex; align-items: center; gap: var(--space-1); padding: 3px var(--space-2);
  border-radius: var(--radius-tag); font-size: var(--text-meta); font-weight: var(--weight-semibold);
  white-space: nowrap; line-height: var(--leading-body);
}
.status.complet, .tag.ok { color: var(--ok); background: var(--ok-bg); }
.status.en_cours, .tag.warn { color: var(--warn); background: var(--warn-bg); }
.status.suspendu, .tag.neutral { color: var(--fg-muted-strong); background: var(--border-hairline); }
.status.donnees, .tag.info { color: var(--info); background: var(--info-bg); }
.tag.danger { color: var(--danger); background: var(--danger-bg); }
/* A round state mark in front of a line (pieces): the icon on the state's tint. */
.mark {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  font-size: var(--text-meta);
}
.mark.ok { color: var(--ok); background: var(--ok-bg); }
.mark.warn { color: var(--warn); background: var(--warn-bg); }
.mark.info { color: var(--info); background: var(--info-bg); }
.mark.danger { color: var(--danger); background: var(--danger-bg); }
.mark.neutral { color: var(--fg-muted-strong); background: var(--border-hairline); }
.mark .icon { width: 12px; height: 12px; }
.badge { color: var(--danger); font-weight: var(--weight-semibold); }
.items .reason { color: var(--danger); font-size: var(--text-meta); } /* never below 12px */
.unit { color: var(--fg-muted); font-size: var(--text-secondary); }

/* History */
details summary {
  cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline;
  gap: var(--space-1) var(--space-4); min-height: var(--hit); padding-top: var(--space-2);
}
.summary-meta { color: var(--fg-muted); font-size: var(--text-secondary); }
details summary::-webkit-details-marker { display: none; }
.summary-title { font-size: var(--text-h3); font-weight: var(--weight-semibold); line-height: var(--leading-tight); }
.summary-title::before { content: "▸ "; color: var(--fg-muted); }
details[open] .summary-title::before { content: "▾ "; }
details[open] summary { margin-bottom: var(--space-2); }
.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: var(--space-2) 0; border-bottom: 1px solid var(--border-subtle); }
.history time { color: var(--fg-muted); margin-right: var(--space-4); font-family: var(--font-mono); font-size: var(--text-meta); }

/* Bulletin steps */
.step { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-h3); margin: var(--space-6) 0 var(--space-2); }
.step span {
  display: inline-grid; place-items: center; width: var(--space-6); height: var(--space-6); border-radius: 50%;
  background: var(--fg); color: var(--fg-on-strong); font-size: var(--text-meta);
}
select {
  font: inherit; font-size: var(--text-field); min-height: var(--hit); padding: var(--space-2); border: 1px solid var(--border-control);
  border-radius: var(--radius-control); background: var(--surface-l1);
}

/* Forms: one readable column, 16px text (no zoom on phones), 44px fields */
.data-form { max-width: var(--form-max); }
.data-form fieldset {
  border: 1px solid var(--border-subtle); border-radius: var(--radius); margin: var(--space-4) 0;
  padding: var(--space-2) var(--space-4) var(--space-4);
}
.data-form legend { font-weight: var(--weight-semibold); padding: 0 var(--space-2); }
.data-form .field {
  display: grid; grid-template-columns: var(--label-col) 1fr; gap: var(--space-1) var(--space-4);
  align-items: center; margin: var(--space-2) 0;
}
.data-form .field input, .data-form .field select {
  font: inherit; font-size: var(--text-field); min-height: var(--hit); padding: var(--space-2) var(--space-3); border: 1px solid var(--border-control);
  border-radius: var(--radius-control); width: 100%;
}
.data-form .field em, .data-form .badge-source, .data-form .hint {
  grid-column: 2; font-style: normal; font-size: var(--text-secondary);
}
.data-form .field em { color: var(--danger); }
.data-form .badge-source, .data-form .hint { color: var(--fg-muted); }
.data-form .field.invalid input, .data-form .field.invalid select { border-color: var(--danger-strong); }
/* To check: a tinted field plus a 4px bar on its left edge (same box: nothing moves);
   the badge under the field says it in words. */
.data-form .field.pending input, .data-form .field.pending select {
  background: var(--pending-bg); box-shadow: inset var(--space-1) 0 0 var(--warn);
}
/* Data groups (refonte UX lot 6): to complete, diverging values, already filled (folded). */
.data-group { margin: var(--space-6) 0; }
.data-group > h2 { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-h3); margin: 0 0 var(--space-1); }
.data-group > .meta { margin-bottom: var(--space-2); font-size: var(--text-secondary); }
.data-group > .field {
  background: var(--surface-l1); border: 1px solid var(--warn-line); border-radius: var(--radius);
  padding: var(--space-3) var(--space-4); margin: var(--space-2) 0;
}
.data-group > .field.invalid { border-color: var(--danger-strong); }
.data-group.filled { border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: 0 var(--space-4) var(--space-2); }
.data-group.filled summary { padding: var(--space-2) 0; }
fieldset.choice {
  border: 1px solid var(--warn-line); border-radius: var(--radius); margin: var(--space-2) 0;
  padding: var(--space-2) var(--space-4) var(--space-4); display: grid; gap: var(--space-2);
}
fieldset.choice legend { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-semibold); padding: 0 var(--space-2); }
.choice-option {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-1) var(--space-3); align-items: center;
  padding: var(--space-3) var(--space-4); border: 1px solid var(--border-strong); border-radius: var(--radius-control);
  cursor: pointer; min-height: var(--hit);
}
.choice-option:has(input:checked) { border: 2px solid var(--brand); padding: calc(var(--space-3) - 1px) calc(var(--space-4) - 1px); }
.choice-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.choice-option .tag { grid-column: 2; justify-self: start; }
.notice.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.sticky-actions {
  position: sticky; bottom: 0; background: var(--surface-l1); padding: var(--space-2) 0;
  border-top: 1px solid var(--border-subtle); margin-top: var(--space-4);
}
.sticky-actions a { display: inline-flex; align-items: center; min-height: var(--hit); }
.sticky-actions .actions { margin-top: 0; }
/* What the primary action commits to, right above it. */
.certify-note { font-size: var(--text-secondary); color: var(--fg-muted-strong); margin: 0 0 var(--space-2); }
/* A section's own save: a secondary text action, under its fields. */
.section-save { margin-top: var(--space-2); }
.section-save button.link { padding: 0; }

/* Redesign v3 (redesign-dossier-flow-v3, Claude Design « Investy Prototype v3 »). */
.kicker {
  margin: 0; font-size: var(--text-meta); font-weight: var(--weight-semibold); letter-spacing: .05em;
  text-transform: uppercase; color: var(--fg-muted);
}
.kicker.ok { color: var(--ok); }
.chip {
  display: inline-flex; align-items: center; padding: 2px var(--space-2); border-radius: var(--radius-tag);
  font-size: var(--text-meta); color: var(--fg-muted-strong); background: var(--border-hairline); white-space: nowrap;
}
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.status.ok { color: var(--ok); background: var(--ok-bg); }
.status.warn { color: var(--warn); background: var(--warn-bg); }
.status.info { color: var(--info); background: var(--info-bg); }
.status.brand { color: var(--brand); background: var(--brand-soft); }
.status.neutral { color: var(--fg-muted-strong); background: var(--border-hairline); }
.status .icon, .tag .icon { width: 12px; height: 12px; }
.danger-text { color: var(--danger); }

/* List: « À faire maintenant », then every dossier with its progress. */
.table-card.todo { margin-bottom: var(--space-5); }
.todo-head, .toolbar-main h2 { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.todo-head { padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--border-hairline); }
.todo-head h2, .toolbar-main h2 { margin: 0; font-size: var(--text-h2); color: var(--fg); }
.toolbar-main { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.todo-empty { margin: 0; padding: var(--space-4) var(--space-5); color: var(--ok); }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-line {
  display: grid; grid-template-columns: 11rem minmax(0, 1fr) auto; gap: var(--space-2) var(--space-4); align-items: center;
  padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--border-hairline);
}
.todo-line:last-child { border-bottom: none; }
.todo-line > .status { justify-self: start; }
.todo-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.todo-client { font-weight: var(--weight-semibold); color: var(--brand); align-self: flex-start; }
.todo-why { font-size: var(--text-secondary); color: var(--fg-muted-strong); }
.progress { display: flex; gap: 3px; width: 96px; margin-bottom: var(--space-1); }
.progress-step { flex: 1; height: 4px; border-radius: 2px; background: var(--border-subtle); }
.progress-step.ok { background: var(--ok); }
.progress-step.info { background: var(--info); }
.progress-step.brand { background: var(--brand); }
.status-word { display: block; font-size: var(--text-meta); font-weight: var(--weight-semibold); }
.status-word.ok { color: var(--ok); }
.status-word.warn { color: var(--warn); }
.status-word.info { color: var(--info); }
.status-word.brand { color: var(--brand); }
.status-word.neutral { color: var(--fg-muted-strong); }
.row-note { display: block; font-size: var(--text-meta); color: var(--fg-muted); }
table.dossiers td.activity { color: var(--fg-muted); font-size: var(--text-secondary); white-space: nowrap; }

/* Record: name and status, then the document's three steps; the pieces and the follow-up
   on the right (one column below 1180px, the steps first). */
.record-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-5); }
.record-head h1 { margin-bottom: var(--space-1); }
.record-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--text-secondary); }
.record-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); align-items: start; }
@media (min-width: 1180px) {
  .record-grid { grid-template-columns: minmax(0, 1fr) 320px; }
}
.record-side { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.record-side .card { margin-bottom: 0; }
.card.step-card { padding: 0; overflow: hidden; margin-bottom: 0; }
.step-card:focus { outline: none; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--border-hairline); }
.step-cell { display: flex; gap: var(--space-2); align-items: center; min-width: 0; padding: var(--space-3) var(--space-3); box-shadow: inset 0 -3px 0 transparent; }
.step-dot {
  display: inline-grid; place-items: center; width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%;
  font-size: var(--text-meta); font-weight: var(--weight-semibold); background: var(--surface-l1);
  color: var(--fg-muted); border: 1px solid var(--border-strong);
}
.step-dot .icon { width: 14px; height: 14px; }
.step-text { display: flex; flex-direction: column; min-width: 0; }
.step-name { font-weight: var(--weight-medium); }
.step-sub { font-size: var(--text-meta); color: var(--fg-muted); overflow-wrap: anywhere; }
.step-long { display: none; }
@media (min-width: 1180px) {
  .step-short { display: none; }
  .step-long { display: inline; }
}
.step-cell.done { box-shadow: inset 0 -3px 0 var(--ok); }
.step-cell.done .step-dot { background: var(--ok); border-color: var(--ok); color: var(--fg-on-strong); }
.step-cell.now { background: var(--surface-sunken); box-shadow: inset 0 -3px 0 var(--brand); }
.step-cell.now .step-dot { color: var(--brand); border-color: var(--brand); }
.step-cell.now .step-name, .step-cell.block .step-name { font-weight: var(--weight-semibold); }
.step-cell.now .step-sub { color: var(--brand); }
.step-cell.block { background: var(--danger-bg); box-shadow: inset 0 -3px 0 var(--danger-strong); }
.step-cell.block .step-dot { color: var(--danger-strong); border-color: var(--danger-strong); }
.step-cell.block .step-sub { color: var(--danger); }
.step-body { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); }
.step-body h2 { margin: 0; color: var(--fg); }
.step-body.step-head { padding-bottom: var(--space-2); }
.step-head { flex-direction: row; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
div.step-head { display: flex; }
.step-head > div { display: flex; flex-direction: column; gap: var(--space-1); }
.step-note { display: flex; align-items: center; gap: var(--space-2); margin: 0; padding: var(--space-2) var(--space-5); font-size: var(--text-secondary); color: var(--info); background: var(--info-bg); border-bottom: 1px solid var(--border-hairline); max-width: none; }
.step-lead { margin: 0; color: var(--fg-muted-strong); }
.step-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.step-actions form.inline { margin: 0; }
.step-actions.reversed { flex-direction: row-reverse; }
.step-more {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-2);
  padding-top: var(--space-3); border-top: 1px solid var(--border-hairline); color: var(--fg-muted-strong);
}
.step-body .warning { margin: 0; font-size: var(--text-secondary); }
fieldset.target-choice { border: none; padding: 0; margin: 0; }
.group-label { font-size: var(--text-meta); font-weight: var(--weight-semibold); letter-spacing: .04em; text-transform: uppercase; color: var(--fg-muted); padding: 0; margin-bottom: var(--space-2); }
.choice-option { grid-template-columns: auto minmax(0, 1fr) auto; }
.choice-option .tag { grid-column: auto; justify-self: end; }
.choice-option .meta { font-size: var(--text-secondary); }
/* Points to settle: one row each, its tag (word and icon), then its own control. */
.points { list-style: none; margin: 0; padding: 0; }
.points:focus { outline: var(--focus-ring) solid var(--danger-strong); outline-offset: -3px; }
.point {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--space-2) var(--space-4);
  padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border-hairline);
}
.point-tag { justify-self: start; align-self: start; }
.point-body { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.point-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--space-2) var(--space-3); }
.point-help { margin: 0; font-size: var(--text-secondary); color: var(--fg-muted); }
.point-help s { color: var(--fg-muted-strong); }
.point-value { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-2) var(--space-3); }
.point-text { font-size: var(--text-field); overflow-wrap: anywhere; }
.point-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.point-actions form.inline, .point-short form.inline { margin: 0; }
.point-form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-start; margin: 0; }
.point-form input, .point-form select {
  font: inherit; font-size: var(--text-field); flex: 1 1 12rem; min-width: 0; min-height: var(--hit);
  padding: var(--space-2) var(--space-3); border: 1px solid var(--border-control); border-radius: var(--radius-control);
  background: var(--pending-bg);
}
.point-form fieldset.point-choice { flex: 1 1 100%; border: none; padding: 0; margin: 0; }
.point-form .point-confirm { margin-left: auto; }
.point-edit summary { display: inline-flex; min-height: var(--hit); padding: 0; color: var(--link); text-decoration: underline; text-underline-offset: 2px; font-size: var(--text-secondary); }
.point-edit[open] summary { margin-bottom: var(--space-2); }
.point-short {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-2) var(--space-3);
  padding: var(--space-2) var(--space-3); border: 1px solid var(--ok-line); background: var(--ok-bg); border-radius: var(--radius-control);
}
.point-short-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.point-short-label { font-size: var(--text-meta); font-weight: var(--weight-semibold); color: var(--ok); }
.step-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-4);
  padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border-subtle); background: var(--surface-sunken);
}
.step-foot-note { display: flex; flex-direction: column; gap: var(--space-1); max-width: 22rem; }
.step-foot-note .meta { font-size: var(--text-secondary); color: var(--fg-muted-strong); }
.step-foot-note .icon-link { min-height: auto; font-size: var(--text-secondary); }
/* Right column: compact cards, one line per piece or document, folds for the rest. */
.card.side-card { padding: 0; overflow: hidden; }
.side-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-hairline); }
.side-head h2 { margin: 0; font-size: var(--text-h3); color: var(--fg); }
.side-head .meta { font-size: var(--text-meta); font-weight: var(--weight-medium); }
.side-head .meta.ok { color: var(--ok); }
.side-empty { margin: 0; padding: var(--space-3) var(--space-4); font-size: var(--text-secondary); color: var(--fg-muted); }
.side-note { margin: var(--space-3) var(--space-4); font-size: var(--text-meta); }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-card .piece-list { margin: 0; }
.side-card .piece-row {
  grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: var(--space-3);
  padding: var(--space-1) var(--space-4); min-height: var(--hit); border-top: none; border-bottom: 1px solid var(--border-hairline);
  font-size: var(--text-secondary);
}
.side-card .piece-row .mark { margin-top: 0; }
.side-card .piece-name { font-weight: var(--weight-regular); }
.piece-help.danger { color: var(--danger); }
.piece-help.warn { color: var(--warn); }
.side-card .icon-link { font-size: var(--text-secondary); }
.act-line {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--space-3); align-items: center;
  padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--border-hairline); font-size: var(--text-secondary);
}
.act-name { display: flex; flex-direction: column; min-width: 0; font-weight: var(--weight-medium); }
.act-name .meta { font-weight: var(--weight-regular); font-size: var(--text-meta); }
.act-links { display: flex; gap: var(--space-3); }
.act-older { grid-column: 1 / -1; }
.act-older summary { min-height: var(--hit); padding: 0; font-size: var(--text-meta); color: var(--fg-muted); }
.act-older ul { margin: 0 0 var(--space-2); padding-left: var(--space-4); font-size: var(--text-meta); }
.folds details { border-bottom: 1px solid var(--border-hairline); }
.folds details:last-child { border-bottom: none; }
.folds summary { padding: 0 var(--space-4); align-items: center; justify-content: space-between; gap: var(--space-2); }
.folds .summary-title { font-size: var(--text-body); font-weight: var(--weight-medium); }
.folds details[open] summary { margin-bottom: 0; }
.fold-body, .folds .history, .fold-list { padding: 0 var(--space-4) var(--space-3) var(--space-8); }
.fold-body .meta, .folds .history { font-size: var(--text-secondary); }
.fold-body .actions { margin-top: var(--space-2); }
.fold-list { list-style: none; margin: 0; }
.fold-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0 var(--space-3); border-bottom: 1px solid var(--border-hairline); font-size: var(--text-secondary); }
.fold-line { display: flex; flex-direction: column; padding: var(--space-1) 0; }
.fold-line .meta { font-size: var(--text-meta); }
.fold-actions { display: flex; gap: var(--space-3); }
.folds .history li { padding: var(--space-1) 0; }
.danger-zone { margin: 0; }
.danger-zone .danger-link { font-size: var(--text-secondary); }

/* Settings, guided: the steps on the left with what each still needs, one step on the right. */
.settings-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--space-4); margin-bottom: var(--space-5); }
.settings-head h1 { margin-bottom: var(--space-1); }
.settings-progress { display: flex; flex-direction: column; gap: var(--space-1); width: 16rem; max-width: 100%; font-size: var(--text-secondary); color: var(--fg-muted-strong); }
progress.bar { appearance: none; width: 100%; height: 6px; border: none; border-radius: 3px; background: var(--border-subtle); overflow: hidden; }
progress.bar::-webkit-progress-bar { background: var(--border-subtle); border-radius: 3px; }
progress.bar::-webkit-progress-value { background: var(--ok); border-radius: 3px; }
progress.bar::-moz-progress-bar { background: var(--ok); border-radius: 3px; }
.settings-grid { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: var(--space-6); align-items: start; max-width: 1040px; }
.settings-steps { background: var(--surface-l1); border: 1px solid var(--border-subtle); border-radius: var(--radius); padding: var(--space-1); position: sticky; top: var(--space-4); }
.settings-steps ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.settings-steps a {
  display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: var(--space-2) var(--space-3); align-items: center;
  min-height: 52px; padding: var(--space-1) var(--space-3); border-radius: var(--radius-control); color: var(--fg); text-decoration: none;
}
.settings-steps a:hover { background: var(--surface-sunken); color: var(--fg); }
.settings-steps a[aria-current="step"] { background: var(--brand-soft); }
.settings-steps a[aria-current="step"] .step-name { font-weight: var(--weight-semibold); }
.settings-steps a[aria-current="step"] .step-dot { color: var(--brand); border-color: var(--brand); }
.settings-steps a.full .step-dot { background: var(--ok); border-color: var(--ok); color: var(--fg-on-strong); }
.settings-steps .step-sub.warn { color: var(--warn); }
.card.settings-card { padding: 0; overflow: clip; margin-bottom: 0; }
.settings-card-head { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border-hairline); }
.settings-card-head h2 { margin: 0; color: var(--fg); }
.settings-card > .notice { margin: var(--space-4) var(--space-6) 0; }
.settings-form { max-width: none; padding: var(--space-2) var(--space-6) 0; }
.settings-form .field { margin: 0; padding: var(--space-3) 0; border-bottom: 1px solid var(--border-hairline); align-items: start; }
.settings-form .field > label { display: flex; flex-direction: column; gap: 2px; padding-top: var(--space-3); font-weight: var(--weight-medium); }
.settings-form .field.blank input, .settings-form .field.blank select { background: var(--pending-bg); }
.settings-form .hint.to-fill { grid-column: auto; color: var(--warn); font-weight: var(--weight-regular); }
.settings-form .check-field { display: block; border-bottom: none; }
.settings-form .check-field label { flex-direction: row; align-items: flex-start; gap: var(--space-3); padding-top: var(--space-2); }
.settings-form .check-field input { width: 20px; height: 20px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--brand); }
.settings-form .check-field .hint { display: block; margin-top: var(--space-2); }
.settings-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-3);
  margin: var(--space-4) calc(-1 * var(--space-6)) 0; padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--border-subtle); background: var(--surface-sunken);
}
.settings-foot button.link { padding: 0; min-height: var(--hit); }

/* Toast (refonte UX): the outcome of an action. Stays until closed: never lost. */
.toast {
  position: absolute; top: var(--space-5); right: var(--space-6); z-index: 300; max-width: 400px;
  display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  background: var(--brand); color: var(--fg-on-strong); border-radius: var(--radius-control); box-shadow: var(--shadow-toast);
}
.toast p { margin: 0; padding-top: 2px; max-width: none; }
.toast-icon {
  display: inline-grid; place-items: center; width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0;
  border-radius: 50%; background: var(--mint); color: var(--brand);
}
.toast-icon .icon { width: 12px; height: 12px; }
.toast-alert .toast-icon { background: var(--warn-bg); color: var(--warn); }
.toast button.toast-close {
  border: none; background: none; color: var(--nav-fg); min-width: var(--hit); min-height: var(--hit);
  margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) 0; padding: 0;
}
.toast button.toast-close:hover { color: var(--fg-on-strong); }
.toast :focus-visible { outline-color: var(--mint); }

/* Icons (Lucide, inline SVG): 1em square on the text's cap-height line; tone by role. */
.icon {
  width: 1em; height: 1em; flex-shrink: 0; vertical-align: -0.125em; /* optical: cap-height */
}
.icon-ok { color: var(--ok); }
.icon-danger { color: var(--danger); }
.icon-warn { color: var(--warn); }
.icon-muted { color: var(--fg-muted); }

/* Keyboard users skip the header: hidden until focused, then on top of it. */
.skip-link {
  position: absolute; left: var(--space-4); top: var(--space-2); z-index: 400; transform: translateY(-200%);
  background: var(--surface-l1); padding: var(--space-2) var(--space-4); border-radius: var(--radius-control);
  border: 1px solid var(--border-control);
}
.skip-link:focus { transform: none; }
main:focus { outline: none; } /* the skip target, not a control */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Narrow screens (below 768px) */
@media (max-width: 767.98px) {
  :root { --text-field: 1rem; } /* 16px: no zoom on focus in iOS Safari */
  main { padding: var(--space-5) var(--space-4) var(--space-12); }
  .shell { display: block; }
  .side {
    position: sticky; z-index: 200; height: auto; flex-direction: row; align-items: center;
    padding: 0 var(--space-2) 0 var(--space-4); gap: var(--space-2);
  }
  .side .brand { padding: 0; margin-right: auto; }
  .brand img { height: 20px; }
  .side-nav { flex-direction: row; gap: 0; }
  .side-new { margin: 0; padding: 0; min-width: var(--hit); font-size: var(--text-h2); }
  .side-new-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .side-nav a { padding: 0 var(--space-2); } /* brand, +, two links and logout fit in 375px */
  .side-foot { margin: 0; padding: 0; border: none; }
  .side button.logout { width: auto; padding: 0; justify-content: center; min-width: var(--hit); }
  .toast { position: sticky; top: var(--space-2); right: auto; max-width: none; margin-bottom: var(--space-4); }
  .head { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
  .card { padding: var(--space-4); }
  table.dossiers th:nth-child(4), table.dossiers td:nth-child(4) { display: none; }
  .table-card .toolbar { padding: var(--space-3); }
  .table-card th, .table-card td { padding-left: var(--space-3); padding-right: var(--space-2); }
  .logout-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .search { min-width: 0; width: 100%; }
  .search .hint { display: none; } /* no « / » key on a phone */
  .filters { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: var(--space-1); }
  .filters a { flex-shrink: 0; }
  /* The pieces: one card per piece, every column visible without scrolling. */
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  table.stack tr { border-bottom: 1px solid var(--border-subtle); padding: var(--space-2) 0; }
  table.stack td { border: none; padding: var(--space-1) 0; }
  table.stack td.stack-title { font-weight: var(--weight-semibold); }
  table.stack td[data-label]::before { content: attr(data-label) " : "; color: var(--fg-muted); }
  table.stack td.stack-empty { display: none; }
  .data-form .field { grid-template-columns: 1fr; }
  .data-form .field em, .data-form .badge-source, .data-form .hint { grid-column: 1; }
  .todo-line { grid-template-columns: minmax(0, 1fr); padding: var(--space-3) var(--space-4); }
  .todo-line > .button { justify-self: stretch; }
  .todo-head { padding: var(--space-3) var(--space-4); }
  .step-cell { flex-direction: column; align-items: flex-start; gap: var(--space-1); padding: var(--space-2); }
  .step-body, .step-foot { padding: var(--space-4); }
  .point { grid-template-columns: minmax(0, 1fr); padding: var(--space-4); }
  .step-actions > .button, .step-actions > form.inline, .step-actions > form.inline button { flex: 1 1 100%; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-steps { position: static; }
  .settings-steps ol { flex-direction: row; overflow-x: auto; }
  .settings-steps li { flex: 0 0 auto; }
  .settings-card-head, .settings-form { padding-left: var(--space-4); padding-right: var(--space-4); }
  .settings-foot { margin-left: calc(-1 * var(--space-4)); margin-right: calc(-1 * var(--space-4)); padding: var(--space-3) var(--space-4); }
  .settings-form .field > label { padding-top: 0; }
  .row-actions { white-space: normal; }
  .row-actions a:not(.button) { margin-left: 0; margin-right: var(--space-4); }
}

/* Deletion of a document (add-piece-deletion): next to « Télécharger », in the danger colour. */
.icon-link.danger-link {
  color: var(--danger);
}

.stack-action .icon-link + .icon-link {
  margin-left: var(--space-4);
}
