/* MyRapport - design system. Jetons clairs et sombres, grille de 8 px, aucune dependance. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e8ecf1;
  --border: #e1e5ea;
  --border-strong: #cbd2db;
  --text: #0f1b2d;
  --text-2: #475467;
  --text-3: #5d6879;
  --navy: #0d2148;
  --accent: #2a78d6;
  --link: #1d65bd;
  --primary: #2370c8;
  --primary-hover: #1d62b3;
  --primary-text: #ffffff;
  --ring: rgba(42, 120, 214, .45);
  --shadow-1: 0 1px 2px rgba(15, 27, 45, .06);
  --shadow-2: 0 1px 3px rgba(15, 27, 45, .08), 0 8px 24px rgba(15, 27, 45, .08);
  --shadow-3: 0 12px 40px rgba(15, 27, 45, .18);
  --canvas: #e6e9ee;
  --st-brouillon-bg: #eef1f5; --st-brouillon-fg: #3d4a5c; --st-brouillon-bd: #d8dee6;
  --st-envoye-bg: #e6f0fc;    --st-envoye-fg: #1b5aa8;    --st-envoye-bd: #c4daf6;
  --st-approuve-bg: #e3f4ea;  --st-approuve-fg: #17703f;  --st-approuve-bd: #bfe3cd;
  --st-refuse-bg: #fdeceb;    --st-refuse-fg: #b42318;    --st-refuse-bd: #f6c9c5;
  --st-warn-bg: #fff4e0;      --st-warn-fg: #8a5200;      --st-warn-bd: #f1d9a8;
  --ok: #17703f; --erreur: #b42318; --avert: #8a5200;
  --radius: 8px;
  --radius-lg: 12px;
  --nav-h: 56px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #111a2c;
  --surface-2: #16213a;
  --surface-3: #1d2a47;
  --border: #22304d;
  --border-strong: #2f4166;
  --text: #e8edf5;
  --text-2: #b0bccf;
  --text-3: #8f9cb3;
  --accent: #5b9bea;
  --link: #6aa8f0;
  --primary: #2b6cc4;
  --primary-hover: #3578d2;
  --ring: rgba(106, 168, 240, .5);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-3: 0 12px 40px rgba(0, 0, 0, .55);
  --canvas: #0e1626;
  --st-brouillon-bg: #1b2742; --st-brouillon-fg: #bac5d9; --st-brouillon-bd: #2a3a5c;
  --st-envoye-bg: #14304f;    --st-envoye-fg: #8cc0ff;    --st-envoye-bd: #1f4673;
  --st-approuve-bg: #123524;  --st-approuve-fg: #72dca2;  --st-approuve-bd: #1b5338;
  --st-refuse-bg: #3b1717;    --st-refuse-fg: #ff9a92;    --st-refuse-bd: #5e2525;
  --st-warn-bg: #3a2a0d;      --st-warn-fg: #f2c26b;      --st-warn-bd: #5a4215;
  --ok: #72dca2; --erreur: #ff9a92; --avert: #f2c26b;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.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; }
.skip { position: absolute; left: 8px; top: -48px; background: var(--surface); color: var(--text); padding: 8px 16px; border-radius: var(--radius); box-shadow: var(--shadow-2); z-index: 100; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }
kbd { font: 500 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 2px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); color: var(--text-2); }

.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ic-lg { width: 24px; height: 24px; }
.ic-xl { width: 32px; height: 32px; }

/* ------------------------------------------------------------------ navigation */
.nav { position: sticky; top: 0; z-index: 30; height: var(--nav-h); display: flex; align-items: center; gap: 24px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 650; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand img { height: 20px; width: auto; display: block; }
.brand .sep { width: 1px; height: 20px; background: var(--border-strong); }
:root[data-theme="dark"] .brand img, :root[data-theme="dark"] .logo-card img { filter: brightness(0) invert(1); }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius); color: var(--text-2); font-weight: 500; }
.nav-links a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-links a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.nav-end { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.theme-sun { display: none; }
:root[data-theme="dark"] .theme-sun { display: inline; }
:root[data-theme="dark"] .theme-moon { display: none; }

.menu, .dropdown { position: relative; }
.menu > summary, .dropdown > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker, .dropdown > summary::-webkit-details-marker { display: none; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
:root[data-theme="dark"] .avatar { background: #2a4a85; }
.menu-panel, .dropdown-panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); padding: 8px; z-index: 40; }
.menu-head { padding: 8px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.menu-head strong { display: block; font-weight: 600; }
.menu-panel a, .dropdown-panel a, .dropdown-panel button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 0; background: none; border-radius: var(--radius); color: var(--text); text-align: left; cursor: pointer; }
.menu-panel a:hover, .dropdown-panel a:hover, .dropdown-panel button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-panel small { display: block; color: var(--text-3); font-size: 12px; }

/* ------------------------------------------------------------------ mise en page */
.container { max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
.card-pad { padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--border); }

/* ------------------------------------------------------------------ boutons et champs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-1); transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-primary { background: var(--primary); border-color: transparent; color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--erreur); }
.btn-danger-solid { background: #b42318; border-color: transparent; color: #fff; }
.btn-danger-solid:hover { background: #912018; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn.is-busy { position: relative; color: transparent; pointer-events: none; }
.btn.is-busy::after, .spin { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.is-busy::after { position: absolute; inset: 0; margin: auto; color: var(--text-2); }
.btn-primary.is-busy::after { color: #fff; }
.spin { display: inline-block; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.input, .select, .textarea { width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); transition: border-color .12s, box-shadow .12s; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f9cb3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.select-sm { height: 32px; font-size: 13px; width: auto; }
.textarea { height: auto; min-height: 36px; padding: 8px 12px; line-height: 1.5; resize: none; overflow: hidden; }
.input[readonly], .textarea[readonly] { background: var(--surface-2); color: var(--text-2); }
.label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.field-hint { margin-top: 4px; font-size: 12px; color: var(--text-3); }
.search { position: relative; }
.search .ic { position: absolute; left: 12px; top: 10px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 36px; }
.search kbd { position: absolute; right: 8px; top: 8px; pointer-events: none; }

/* ------------------------------------------------------------------ pastilles de statut */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border: 1px solid var(--st-brouillon-bd); border-radius: 999px; background: var(--st-brouillon-bg); color: var(--st-brouillon-fg); font-size: 12px; font-weight: 550; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-envoye { background: var(--st-envoye-bg); color: var(--st-envoye-fg); border-color: var(--st-envoye-bd); }
.pill-approuve { background: var(--st-approuve-bg); color: var(--st-approuve-fg); border-color: var(--st-approuve-bd); }
.pill-refuse { background: var(--st-refuse-bg); color: var(--st-refuse-fg); border-color: var(--st-refuse-bd); }
.pill-warn { background: var(--st-warn-bg); color: var(--st-warn-fg); border-color: var(--st-warn-bd); }
.pill-plain::before { display: none; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.tag-admin { background: var(--st-envoye-bg); color: var(--st-envoye-fg); }
.tag-manager { background: var(--st-warn-bg); color: var(--st-warn-fg); }

/* ------------------------------------------------------------------ messages */
.flash { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; margin-bottom: 24px; border: 1px solid var(--st-approuve-bd); border-radius: var(--radius); background: var(--st-approuve-bg); color: var(--st-approuve-fg); font-weight: 500; }
.flash-erreur { border-color: var(--st-refuse-bd); background: var(--st-refuse-bg); color: var(--st-refuse-fg); }
.flash .ic { margin-top: 2px; }
.flash button { margin-left: auto; border: 0; background: none; color: inherit; cursor: pointer; padding: 0 4px; }
.banner { display: flex; align-items: center; gap: 12px; padding: 8px 24px; background: var(--st-warn-bg); color: var(--st-warn-fg); border-bottom: 1px solid var(--st-warn-bd); font-size: 13px; }
.banner a { color: inherit; font-weight: 600; text-decoration: underline; }

.toasts { position: fixed; right: 24px; bottom: 24px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; min-width: 260px; max-width: 420px; padding: 12px 16px; background: var(--navy); color: #fff; border-radius: var(--radius); box-shadow: var(--shadow-3); font-weight: 500; pointer-events: auto; animation: toast-in .18s ease-out; }
:root[data-theme="dark"] .toast { background: #223255; }
.toast-ok .ic:first-child { color: #72dca2; }
.toast-erreur { background: #8f1d14; }
:root[data-theme="dark"] .toast-erreur { background: #6b1c17; }
.toast button { margin-left: auto; border: 0; background: rgba(255, 255, 255, .14); color: #fff; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.toast.is-out { opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------------ connexion et erreurs */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 500px at 50% -10%, rgba(42, 120, 214, .10), transparent 60%), var(--bg); }
.login { width: 100%; max-width: 420px; }
.login-card { padding: 40px 32px 32px; text-align: center; }
.logo-card img { height: 32px; width: auto; display: block; margin: 0 auto 24px; }
.login-card h1 { font-size: 22px; }
.login-card .lead { margin: 8px 0 24px; color: var(--text-2); }
.btn-ms { height: 44px; gap: 12px; font-size: 15px; }
.ms-logo { width: 18px; height: 18px; flex: none; }
.divider { display: flex; align-items: center; gap: 12px; margin: 24px 0 16px; color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.dev-list { display: grid; gap: 8px; text-align: left; }
.dev-user { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; }
.dev-user:hover { border-color: var(--accent); background: var(--surface-2); }
.dev-user .who { flex: 1; min-width: 0; }
.dev-user .who strong, .dev-user .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-user .who span { color: var(--text-3); font-size: 12px; }
.login-foot { margin-top: 24px; text-align: center; color: var(--text-3); font-size: 12px; }
.alert { display: flex; gap: 8px; align-items: flex-start; text-align: left; padding: 12px; margin-bottom: 16px; border-radius: var(--radius); background: var(--st-refuse-bg); color: var(--st-refuse-fg); border: 1px solid var(--st-refuse-bd); font-size: 13px; }
.error-page { text-align: center; max-width: 440px; }
.error-code { font-size: 64px; font-weight: 700; letter-spacing: -.04em; line-height: 1; color: var(--navy); }
:root[data-theme="dark"] .error-code { color: var(--accent); }
.error-page h1 { margin: 16px 0 8px; }
.error-page p { color: var(--text-2); margin-bottom: 24px; }

/* ------------------------------------------------------------------ tableau de bord */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi { display: flex; align-items: center; gap: 16px; padding: 16px 20px; text-align: left; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-1); cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.kpi[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.kpi-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); }
.kpi-valeur { font-size: 28px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--text-2); font-size: 13px; }

.dropzone { display: grid; place-items: center; gap: 8px; padding: 32px 24px; margin-bottom: 24px; text-align: center; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--surface-2); }
.dropzone.is-over { box-shadow: 0 0 0 3px var(--ring); }
.dropzone .dz-ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--surface-2); color: var(--accent); }
.dropzone strong { font-size: 15px; }
.dropzone .hint { color: var(--text-3); font-size: 13px; }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.progress { width: min(360px, 100%); height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .15s; }
.progress.indet > i { width: 40%; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.import-result { margin-bottom: 24px; padding: 16px 20px; }
.import-result ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.import-result li { display: flex; gap: 8px; align-items: flex-start; }
.ok-ico { color: var(--ok); } .err-ico { color: var(--erreur); } .warn-ico { color: var(--avert); }

.toolbar { display: flex; align-items: center; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 220px; max-width: 420px; }
.toolbar .select { width: auto; min-width: 180px; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 16px; text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.link { cursor: pointer; }
.table tr.link:hover td { background: var(--surface-2); }
.table tr.link:focus-visible { outline-offset: -2px; }
.table .cell-main { display: block; font-weight: 550; color: var(--text); }
.table .cell-main:hover { text-decoration: none; }
.table .cell-sub { display: block; color: var(--text-3); font-size: 12px; }
.table .right { text-align: right; }
.table .actions { width: 1%; white-space: nowrap; }
.table-foot { padding: 12px 24px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }

.empty { display: grid; place-items: center; gap: 8px; padding: 56px 24px; text-align: center; }
.empty .empty-ico { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: var(--surface-2); color: var(--text-3); margin-bottom: 8px; }
.empty h3 { font-size: 16px; }
.empty p { color: var(--text-2); max-width: 420px; margin-bottom: 8px; }

/* ------------------------------------------------------------------ administration */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.form-grid { display: grid; grid-template-columns: 1.4fr 1fr 160px auto; gap: 12px; align-items: end; padding: 24px; }
.user-cell { display: flex; align-items: center; gap: 12px; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.pager { display: flex; gap: 8px; align-items: center; }

/* ------------------------------------------------------------------ espace de travail */
body.ws-body { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.wsbar { display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); flex: none; }
.wsbar .back { display: inline-flex; align-items: center; gap: 4px; padding: 6px 8px 6px 4px; margin-left: -4px; border-radius: var(--radius); color: var(--text-2); font-weight: 500; }
.wsbar .back:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.ws-title { min-width: 0; }
.ws-title h1 { font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-title .sub { color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ws-version { display: flex; align-items: center; gap: 4px; }
.ws-version .select { width: auto; height: 32px; font-size: 13px; padding-left: 10px; }
.save-state { font-size: 12.5px; color: var(--text-3); margin-right: 4px; white-space: nowrap; }
.save-state.is-dirty { color: var(--avert); font-weight: 550; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 2px; }

.ws { flex: 1; min-height: 0; display: grid; grid-template-columns: 420px 1fr; }
.panel { overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); scroll-behavior: smooth; }
.panel-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 24px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--text-3); }
.sect { border-bottom: 1px solid var(--border); }
.sect > summary { display: flex; align-items: center; gap: 8px; padding: 16px 24px; cursor: pointer; list-style: none; font-weight: 600; user-select: none; }
.sect > summary::-webkit-details-marker { display: none; }
.sect > summary:hover { background: var(--surface-2); }
.sect > summary .chev { color: var(--text-3); transition: transform .15s; }
.sect[open] > summary .chev { transform: rotate(90deg); }
.sect > summary .count { margin-left: auto; font-weight: 500; font-size: 12px; color: var(--text-3); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; }
.sect-body { padding: 0 24px 24px; display: grid; gap: 16px; }
.sect-help { color: var(--text-3); font-size: 12.5px; margin-top: -8px; }
.fld label { display: block; font-size: 12.5px; font-weight: 550; color: var(--text-2); margin-bottom: 4px; }
.fld.is-changed .textarea, .fld.is-changed .input { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.fld .meta { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11.5px; color: var(--text-3); min-height: 16px; }
.fld .meta .reset { border: 0; background: none; color: var(--link); cursor: pointer; padding: 0; font-size: 11.5px; }
.chiffres { width: 100%; border-collapse: collapse; font-size: 13px; }
.chiffres th { text-align: right; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); padding: 0 0 8px 8px; }
.chiffres th:first-child { text-align: left; padding-left: 0; }
.chiffres td { padding: 8px 0 8px 8px; border-top: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; }
.chiffres td:first-child { text-align: left; padding-left: 0; color: var(--text-2); }
.lock { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: 12px; font-weight: 500; cursor: help; position: relative; }
.lock::after { content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); width: max-content; max-width: 240px; padding: 6px 10px; border-radius: 6px; background: var(--navy); color: #fff; font-size: 12px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 10; }
.lock:hover::after, .lock:focus::after { opacity: 1; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.check { display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: start; }
.check .ic { margin-top: 2px; }
.check-ok .ic { color: var(--ok); } .check-erreur .ic { color: var(--erreur); } .check-avert .ic { color: var(--avert); }
.check ul { margin: 4px 0 0; padding-left: 16px; color: var(--text-2); font-size: 12.5px; }

.canvas { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--canvas); }
.canvas-bar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--surface); flex: none; }
.seg { display: inline-flex; padding: 2px; border-radius: var(--radius); background: var(--surface-3); }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.draft-chip { display: none; }
.canvas.is-draft .draft-chip { display: inline-flex; }
.scroller { position: relative; flex: 1; overflow: auto; padding: 24px; }
.sheet { position: relative; margin: 0 auto; transform-origin: top left; }
.sheet iframe { display: block; border: 0; width: 860px; background: transparent; transform-origin: top left; opacity: 0; transition: opacity .18s; }
.sheet.is-ready iframe { opacity: 1; }
.skel { position: absolute; inset: 24px; display: grid; gap: 16px; align-content: start; max-width: 860px; margin: 0 auto; pointer-events: none; }
.skel i { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
.skel .p1 { height: 56px; width: 60%; } .skel .p2 { height: 220px; } .skel .p3 { height: 20px; width: 80%; } .skel .p4 { height: 20px; width: 70%; } .skel .p5 { height: 180px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.canvas.is-ready .skel { display: none; }
.ws-tabs { display: none; }

/* tiroirs et boites de dialogue */
dialog { padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-3); max-width: calc(100vw - 32px); }
dialog::backdrop { background: rgba(8, 14, 28, .5); backdrop-filter: blur(2px); }
.modal { width: 520px; }
.modal-sm { width: 440px; }
.modal-head h2 { font-size: 18px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px 0; }
.modal-body { padding: 16px 24px; display: grid; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 24px; }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: 400px; border-radius: 0; border-width: 0 0 0 1px; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.versions { list-style: none; margin: 0; padding: 8px 0; }
.versions li { display: grid; gap: 4px; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.versions li.is-current { background: var(--surface-2); }
.versions .v-top { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.versions .v-meta { color: var(--text-3); font-size: 12.5px; }
.versions .v-note { color: var(--text-2); font-size: 13px; }
.versions .v-actions { display: flex; gap: 8px; margin-top: 4px; }
.result { display: grid; gap: 8px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--st-approuve-bd); background: var(--st-approuve-bg); color: var(--st-approuve-fg); }
.result.is-sim { border-color: var(--st-warn-bd); background: var(--st-warn-bg); color: var(--st-warn-fg); }
.result.is-err { border-color: var(--st-refuse-bd); background: var(--st-refuse-bg); color: var(--st-refuse-fg); }
.checkbox { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.checkbox input { margin-top: 3px; accent-color: var(--primary); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .ws { grid-template-columns: 380px 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 1023px) {
  .ws { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .ws-tabs { display: flex; gap: 4px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .ws[data-pane="edit"] .canvas, .ws[data-pane="view"] .panel { display: none; }
  .panel { border-right: 0; }
  .wsbar { height: auto; min-height: 64px; padding: 8px 16px; flex-wrap: wrap; }
  .save-state { display: none; }
}
@media (max-width: 720px) {
  .nav { padding: 0 16px; gap: 8px; }
  .nav-links a span { display: none; }
  .brand .sep, .brand .app-name { display: none; }
  .container { padding: 24px 16px 48px; }
  h1 { font-size: 20px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 12px; gap: 12px; } .kpi-ico { display: none; } .kpi-valeur { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .table th, .table td { padding: 12px 8px; }
  .toolbar { padding: 12px 16px; }
  .toasts { left: 16px; right: 16px; bottom: 16px; align-items: stretch; }
  .modal { width: auto; }
  dialog.drawer { width: 100vw; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
@media print { .nav, .toasts { display: none; } }
