/* Interface institutionnelle — Registre d'état civil */
.date-assistee { display: flex; gap: .5rem; align-items: center; min-width: 0; }
.date-assistee > input { flex: 1; min-width: 0; width: 0; }
.date-assistee > button { flex: 0 0 auto; min-height: 44px; }
.date-assistee > input, .date-assistee > button { scroll-margin-block: 100px; }
.date-calendrier[hidden] { display: none; }
.date-calendrier { position: fixed; z-index: 1000; width: min(22rem, calc(100vw - 16px)); max-height: calc(100dvh - 16px); overflow-y: auto; box-sizing: border-box; padding: .5rem; border: 2px solid #123e35; border-radius: .5rem; background: #fff; color: #183e35; box-shadow: 0 6px 24px #0003; }
.date-calendrier-choix, .date-calendrier-navigation { display: flex; gap: .5rem; }
.date-calendrier-choix > label { flex: 1; min-width: 0; }
.date-calendrier select { width: 100%; min-width: 0; min-height: 44px; }
.date-calendrier-navigation button { flex: 1; min-height: 44px; padding-inline: .25rem; }
.date-calendrier-titre { text-align: center; font-weight: 700; margin: .5rem 0; }
.date-calendrier-jours { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; text-align: center; }
.date-calendrier-jours button { min-width: 0; min-height: 44px; padding: .2rem; }
.date-calendrier-jours button[aria-pressed="true"] { background: #123e35; color: #fff; }
.date-calendrier-aide { font-size: .8rem; margin: .5rem 0; }
.detail-grid dd { margin: 0 0 .7rem; overflow-wrap: anywhere; }
.detail-grid dt { font-weight: 600; }

:root {
  --color-brand-deep: #0b3d2e;
  --color-brand: #176447;
  --color-brand-hover: #0e5039;
  --color-brand-soft: #e8f1ed;
  --color-gold: #c89b2b;
  --color-gold-soft: #fbf3dc;
  --color-red: #a9342b;
  --color-red-soft: #fbecea;
  --color-ink: #17211c;
  --color-muted: #5f6d65;
  --color-border: #d5ddd8;
  --color-border-strong: #adbab2;
  --color-canvas: #f3f5f2;
  --color-surface: #ffffff;
  --color-surface-alt: #f8faf8;
  --color-success: #257a52;
  --color-warning: #956b08;
  --color-danger: #a9342b;
  --shadow-float: 0 14px 34px rgba(11, 61, 46, 0.12);
  --radius-sm: 3px;
  --radius-md: 7px;
  --content-max: 1320px;
  --sidebar-width: 284px;
  --topbar-height: 72px;
  --font-sans: "Aptos", "Segoe UI Variable", "Segoe UI", "Noto Sans", Arial, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-canvas);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}
main { flex: 1 0 auto; }
img { max-width: 100%; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
hr { margin: 22px 0; border: 0; border-top: 1px solid var(--color-border); }
a { color: var(--color-brand); text-underline-offset: 0.18em; }
a:hover { color: var(--color-brand-hover); }
button, input, select, textarea { font: inherit; }
button, .button, input[type="submit"] { min-height: 44px; }
:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--color-brand-deep);
}
::selection { background: #f5df9f; color: var(--color-ink); }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  transform: translateY(-160%);
  background: var(--color-surface);
  color: var(--color-ink);
  border: 2px solid var(--color-gold);
  padding: 10px 14px;
  font-weight: 700;
}
.skip-link:focus { transform: translateY(0); }

.masthead {
  position: relative;
  z-index: 10;
  color: #fff;
  background: var(--color-brand-deep);
  border-top: 4px solid var(--color-gold);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12);
}
.masthead-inner {
  max-width: var(--content-max);
  min-height: 76px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  min-width: 280px;
  min-height: 44px;
}
.brand:hover { color: #fff; }
.brand-emblem {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  object-fit: cover;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(255, 255, 255, 0.88);
}
.brand-copy { display: grid; gap: 1px; }
.brand-kicker {
  color: #d8e5df;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  line-height: 1.2;
  text-transform: uppercase;
}
.brand-title {
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.brand-subtitle { color: #d8e5df; font-size: 12px; line-height: 1.3; }


.primary-nav { margin-left: auto; }
.primary-nav-list {
  display: flex;
  align-items: stretch;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.primary-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  color: #dce8e2;
  border-bottom: 3px solid transparent;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}
.primary-nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.primary-nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--color-gold); }

.account-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}
.account-copy { max-width: 190px; line-height: 1.25; }
.mobile-password-link {
  display: none;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-sm);
}
.mobile-password-link:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.account-name { min-height: 44px; display: flex; align-items: center; color: #fff; font-size: 13px; font-weight: 700; overflow: hidden; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.account-name:hover { color: #fff; text-decoration: underline; }
.account-role { display: block; color: #bed0c7; font-size: 11px; }
.logout-form { margin: 0; }
.logout-form .button-quiet-dark { min-height: 44px;
  padding: 8px 11px;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.logout-form .button-quiet-dark:hover { background: #fff; color: var(--color-brand-deep); }
.logout-short { display: none; }

/* Shell applicatif v2 — navigation stable et surfaces de travail */
.authenticated-layout { display: block; background: #eef2ef; }
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}
.app-sidebar {
  position: sticky;
  z-index: 30;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  color: #fff;
  background: #083d2d;
  border-top: 4px solid var(--color-gold);
  box-shadow: 1px 0 0 rgba(5, 33, 24, .18);
}
.sidebar-brand { padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.11); }
.sidebar-brand .brand { min-width: 0; }
.sidebar-brand .brand-emblem { width: 44px; height: 44px; flex-basis: 44px; }
.sidebar-brand .brand-title { font-size: 18px; }
.sidebar-nav { flex: 1 1 auto; padding: 18px 12px; }
.sidebar-section-label {
  display: block;
  padding: 12px 12px 7px;
  color: #9fbbb0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.sidebar-nav ul { display: grid; gap: 4px; margin: 0 0 16px; padding: 0; list-style: none; }
.sidebar-nav a {
  position: relative;
  min-height: 48px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 10px 12px;
  color: #dce9e3;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  text-decoration: none;
}
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.sidebar-nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.12); }
.sidebar-nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: -12px;
  width: 4px;
  background: var(--color-gold);
}
.sidebar-nav svg, .sidebar-logout svg, .sidebar-toggle svg { width: 21px; height: 21px; fill: currentColor; }
.sidebar-nav .notif-count { justify-self: end; }
.sidebar-account { padding: 14px 12px; background: rgba(0,0,0,.13); border-top: 1px solid rgba(255,255,255,.11); }
.account-identity {
  min-height: 54px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 7px 8px;
  color: #fff;
  border-radius: var(--radius-md);
  text-decoration: none;
}
.account-identity:hover { color: #fff; background: rgba(255,255,255,.08); }
.account-avatar {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
  color: #17392d;
  background: #f1d27a;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
}
.sidebar-account-copy { min-width: 0; display: grid; line-height: 1.25; }
.sidebar-account-copy strong { overflow: hidden; color: #fff; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account-copy small { overflow: hidden; color: #abc2b8; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-logout {
  width: 100%;
  min-height: 44px;
  justify-content: flex-start;
  margin-top: 4px;
  padding: 8px;
  color: #dce9e3;
  background: transparent;
  border-color: transparent;
  font-size: 13px;
}
.sidebar-logout:hover { color: #fff; background: rgba(255,255,255,.08); border-color: transparent; }
.app-workspace { min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.app-topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 28px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(10px);
}
.topbar-context { min-width: 0; display: grid; line-height: 1.25; }
.topbar-context strong { color: var(--color-brand-deep); font-size: 15px; }
.topbar-kicker { color: var(--color-muted); font-size: 11px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.topbar-account {
  min-height: 46px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 10px;
  color: var(--color-ink);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.topbar-account:hover { color: var(--color-brand-deep); background: var(--color-brand-soft); }
.topbar-account .account-avatar { width: 34px; height: 34px; flex-basis: 34px; }
.sidebar-toggle { display: none; width: 44px; min-height: 44px; padding: 0; color: var(--color-brand-deep); background: transparent; border-color: transparent; }
.sidebar-toggle:hover { color: var(--color-brand-deep); background: var(--color-brand-soft); border-color: transparent; }
.sidebar-backdrop { display: none; }
.app-workspace > main { flex: 1 0 auto; }

.page-shell {
  width: min(calc(100% - 32px), var(--content-max));
  margin: 0 auto;
  padding: 34px 0 56px;
}
.page-shell-narrow { max-width: 880px; }
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.page-heading { min-width: 0; }
.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--color-brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
h1, h2, h3 { margin-top: 0; text-wrap: pretty; }
h1 {
  margin-bottom: 8px;
  color: var(--color-brand-deep);
  font-family: var(--font-display);
  font-size: clamp(30px, 3.2vw, 44px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.025em;
}
h2 { margin-bottom: 14px; color: var(--color-brand-deep); font-size: 21px; line-height: 1.3; }
h3 { margin-bottom: 10px; font-size: 17px; line-height: 1.35; }
p { margin-top: 0; }
.lead { max-width: 760px; margin-bottom: 0; color: var(--color-muted); font-size: 17px; }
.muted { color: var(--color-muted); }
.small { font-size: 13px; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 16px 0; }
.button, button, input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  color: #fff;
  background: var(--color-brand);
  border: 1px solid var(--color-brand);
  border-radius: var(--radius-sm);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.button:hover, button:hover, input[type="submit"]:hover { color: #fff; background: var(--color-brand-hover); border-color: var(--color-brand-hover); }
.button.secondary, button.secondary {
  color: var(--color-brand-deep);
  background: var(--color-surface);
  border-color: var(--color-border-strong);
}
.button.secondary:hover, button.secondary:hover { background: var(--color-brand-soft); border-color: var(--color-brand); }
.button.tertiary { color: var(--color-brand); background: transparent; border-color: transparent; }
.button.tertiary:hover { color: var(--color-brand-deep); background: var(--color-brand-soft); }
.button.danger, button.danger { background: var(--color-danger); border-color: var(--color-danger); }
.button-sm { min-height: 44px; padding: 7px 11px; font-size: 13px; }
.inline-form { display: inline-flex; margin: 0; }

.message-stack { display: grid; gap: 8px; margin-bottom: 20px; }
.notice, .alert {
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-left-width: 4px;
  background: var(--color-surface);
}
.notice { border-left-color: var(--color-brand); }
.notice.success { border-left-color: var(--color-success); background: #edf7f1; }
.notice.error { border-left-color: var(--color-danger); background: var(--color-red-soft); }
.notice.warning, .alert { border-left-color: var(--color-gold); background: var(--color-gold-soft); }
.alert h2 { color: #6d4d06; font-size: 18px; }
.alert > :last-child, .notice > :last-child { margin-bottom: 0; }

.dashboard-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 20px;
  padding: clamp(24px, 3vw, 38px);
  color: #fff;
  background: linear-gradient(120deg, #0b4634 0%, #083d2d 64%, #062f23 100%);
  border-bottom: 4px solid var(--color-gold);
  border-radius: var(--radius-md);
}
.dashboard-hero::after {
  content: "";
  position: absolute;
  right: -56px;
  bottom: -86px;
  width: 250px;
  height: 250px;
  border: 46px solid rgba(255,255,255,.045);
  border-radius: 50%;
}
.dashboard-hero-copy, .dashboard-actions { position: relative; z-index: 1; }
.dashboard-hero h1 { margin-bottom: 9px; color: #fff; font-size: clamp(30px, 3.1vw, 43px); }
.dashboard-hero .eyebrow { color: #f0d88e; }
.dashboard-hero .lead { max-width: 700px; color: #d6e4dd; }
.dashboard-actions { flex: 0 0 auto; }
.dashboard-actions .button { color: var(--color-brand-deep); background: #fff; border-color: #fff; }
.dashboard-actions .button:hover { color: var(--color-brand-deep); background: var(--color-gold-soft); border-color: var(--color-gold-soft); }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 20px 0 26px; }
.metric-grid-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-card {
  display: block;
  min-height: 148px;
  padding: 20px;
  color: inherit;
  text-decoration: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 4px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.metric-card:hover { color: inherit; transform: translateY(-2px); border-color: var(--color-brand); box-shadow: var(--shadow-sm); }
.metric-card .metric-value { display: block; margin: 4px 0 6px; font-size: 39px; font-variant-numeric: tabular-nums; font-weight: 750; line-height: 1; }
.metric-label { color: var(--color-ink); font-weight: 700; }
.metric-help { margin-top: 8px; color: var(--color-muted); font-size: 13px; }
.metric-action { display: inline-block; margin-top: 8px; color: var(--color-brand); font-size: 12px; font-weight: 800; }
.metric-draft { border-top-color: #60766a; }
.metric-incomplete { border-top-color: var(--color-gold); }
.metric-control { border-top-color: #3f6fa8; }
.metric-ready { border-top-color: var(--color-success); }
.activity-panel { min-height: 100%; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.75fr); gap: 18px; }
.section-card {
  margin-bottom: 18px;
  padding: 22px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.section-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-card-header h2 { margin-bottom: 4px; }
.section-card-header p { margin: 0; color: var(--color-muted); font-size: 14px; }

.recent-list, .document-list, .timeline-list, .plain-list { margin: 0; padding: 0; list-style: none; }
.recent-item, .document-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--color-border);
}
.recent-item:first-child, .document-row:first-child { padding-top: 0; border-top: 0; }
.recent-reference { display: block; color: var(--color-brand-deep); font-weight: 800; }
.recent-person { color: var(--color-muted); font-size: 14px; }
.recent-item .status-badge { justify-self: end; }
.quick-panel { padding: 22px; color: #fff; background: var(--color-brand-deep); border-radius: var(--radius-md); }
.quick-panel h2 { color: #fff; }
.quick-panel .eyebrow { color: #f0d88e; }
.quick-panel p { color: #d1e0d8; }
.quick-panel .button { width: 100%; margin-top: 8px; color: var(--color-brand-deep); background: #fff; border-color: #fff; }
.quick-panel .button:hover { background: var(--color-gold-soft); }

.filter-panel {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(120px, 0.7fr) minmax(180px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
  padding: 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.field-group { min-width: 0; }
label, .field-label { display: block; margin-bottom: 6px; color: #35433b; font-size: 13px; font-weight: 750; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  color: var(--color-ink);
  background: #fff;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
}
textarea { min-height: 96px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #7f9187; }
input:focus, select:focus, textarea:focus { border-color: var(--color-brand); box-shadow: 0 0 0 1px var(--color-brand); outline: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--color-brand-deep);
}
input[type="checkbox"], input[type="radio"] { width: 19px; height: 19px; accent-color: var(--color-brand); vertical-align: middle; }
.account-management input[type="checkbox"] { width: 24px; height: 24px; }
.checkbox-target {
  width: 44px;
  min-height: 44px;
  margin: -9px 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.checkbox-target input { margin: 0; }
.validation-confirmation {
  width: auto;
  min-height: 44px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}
.validation-confirmation input { flex: 0 0 auto; }
.same-address-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  cursor: pointer;
}
.same-address-option input { flex: 0 0 auto; margin: 0; }
.help-text, .field-group small { display: block; margin-top: 5px; color: var(--color-muted); font-size: 12px; }
.errorlist { margin: 6px 0 0; padding-left: 18px; color: var(--color-danger); font-size: 13px; }
.non-field-errors { margin-bottom: 16px; }

.panel {
  margin-bottom: 18px;
  padding: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.panel > h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.panel > .table-shell { margin-inline: -20px; border-right: 0; border-left: 0; border-radius: 0; }
.data-table { min-width: 680px; }
.data-table td:last-child { width: 1%; white-space: nowrap; }

.table-shell { overflow-x: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--color-border); text-align: left; vertical-align: middle; }
th { color: #3d4c44; background: var(--color-surface-alt); font-size: 12px; font-weight: 800; letter-spacing: 0.035em; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f5f9f6; }
.table-primary { color: var(--color-brand-deep); font-weight: 800; white-space: nowrap; }
.table-secondary { color: var(--color-muted); }
.empty-state { padding: 42px 20px !important; color: var(--color-muted); text-align: center; }
.status-badge, .badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
}
.status-brouillon { color: #405148; background: #edf1ee; border-color: #d2dbd5; }
.status-a_completer { color: #704f06; background: var(--color-gold-soft); border-color: #ead698; }
.status-en_controle { color: #1e4066; background: #e7eff8; border-color: #bed3ea; }
.notif-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  color: #fff; background: var(--color-danger);
  border-radius: 999px; font-size: 12px; font-weight: 750; line-height: 1;
}
.status-pret_a_valider { color: #0b5b3d; background: #e5f5ec; border-color: #b7ddc8; }
.status-valide { color: #fff; background: var(--color-success); }
.status-rejete { color: #7d2b26; background: var(--color-red-soft); border-color: #efc4c0; }
.status-annule { color: #7d2b26; background: var(--color-red-soft); border-color: #efc4c0; }
.pagination { justify-content: center; margin-top: 20px; }
.page-indicator { color: var(--color-muted); font-size: 14px; }

.form-intro { margin-bottom: 22px; padding: 14px 16px; background: var(--color-brand-soft); border-left: 4px solid var(--color-brand); }
.form-intro p { margin: 0; }
.form-section {
  margin: 0 0 16px;
  padding: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.form-section legend {
  width: 100%;
  padding: 16px 20px;
  color: var(--color-brand-deep);
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
}
.form-section-body { padding: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 17px 18px; }
.form-grid > .field-group { grid-column: span 4; }
.form-grid > .field-wide { grid-column: span 6; }
.form-grid > .field-full { grid-column: 1 / -1; }
.address-panel {
  padding: 16px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
[data-address-international] textarea { min-height: 64px; }
[hidden] { display: none !important; }
.form-section-note { margin: -4px 0 16px; color: var(--color-muted); font-size: 13px; }
.form-actions {
  position: sticky;
  z-index: 5;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  padding: 14px 0;
  background: rgba(243, 245, 242, 0.96);
  border-top: 1px solid var(--color-border);
}

.record-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 18px;
  padding: 24px;
  color: #fff;
  background: var(--color-brand-deep);
  border-bottom: 4px solid var(--color-gold);
  border-radius: var(--radius-md);
}
.record-hero h1 { margin: 0; color: #fff; }
.record-hero .eyebrow { color: #d4e1da; }
.record-subtitle { margin: 8px 0 0; color: #d8e5df; }
.record-hero .actions { margin: 0; justify-content: flex-end; }
.record-hero .button.secondary { color: #fff; background: transparent; border-color: rgba(255,255,255,.48); }
.record-hero .button.secondary:hover { color: var(--color-brand-deep); background: #fff; }
.record-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-bottom: 18px; background: var(--color-border); border: 1px solid var(--color-border); }
.summary-item { min-height: 104px; padding: 17px; background: var(--color-surface); }
.summary-label { display: block; margin-bottom: 6px; color: var(--color-muted); font-size: 12px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.summary-value { color: var(--color-ink); font-weight: 700; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--color-border); border: 1px solid var(--color-border); }
.detail-item { min-height: 96px; padding: 16px; background: var(--color-surface); }
.detail-item-full { grid-column: 1 / -1; }

.disclosure { margin-top: 14px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.disclosure > summary { min-height: 44px; padding: 13px 15px; color: var(--color-brand-deep); background: var(--color-surface-alt); font-weight: 750; cursor: pointer; }
.disclosure-body { padding: 16px; }
.timeline { margin: 12px 0 0; padding-left: 18px; display: grid; gap: 10px; }
.timeline li { line-height: 1.45; }
.document-row .row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.document-meta { color: var(--color-muted); font-size: 13px; }
.empty-inline { padding: 18px; color: var(--color-muted); background: var(--color-surface-alt); border: 1px dashed var(--color-border-strong); }
.ocr-table input[type="checkbox"] { display: block; margin: auto; }
.timeline-item { position: relative; padding: 0 0 18px 22px; color: var(--color-muted); border-left: 2px solid var(--color-border); }
.timeline-item::before { content: ""; position: absolute; top: 3px; left: -6px; width: 10px; height: 10px; background: var(--color-brand); border: 2px solid #fff; border-radius: 50%; }
.timeline-item:last-child { padding-bottom: 0; }

.login-main { width: 100%; min-height: calc(100vh - 145px); min-height: calc(100svh - 145px); padding: 0; }
.login-shell { display: grid; grid-template-columns: minmax(320px, 0.9fr) minmax(480px, 1.1fr); min-height: calc(100vh - 145px); min-height: calc(100svh - 145px); background: var(--color-surface); }
.login-intro { position: relative; display: flex; align-items: flex-end; min-height: 520px; padding: clamp(36px, 6vw, 82px); overflow: hidden; color: #fff; background: var(--color-brand-deep); }
.login-intro::after { content: "SN"; position: absolute; top: -70px; right: -24px; color: rgba(255,255,255,.045); font-family: var(--font-display); font-size: 280px; font-weight: 700; line-height: 1; }
.login-intro-content { position: relative; z-index: 1; max-width: 520px; }
.login-intro .eyebrow { color: #f0d88e; }
.login-intro h1 { color: #fff; font-size: clamp(38px, 5vw, 62px); }
.login-intro p { color: #cfddd6; font-size: 17px; }
.security-note { margin-top: 30px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.2); color: #b9ccc2 !important; font-size: 13px !important; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 44px; }
.login-card { width: min(100%, 440px); }
.login-card h2 { margin-bottom: 8px; font-family: var(--font-display); font-size: 31px; }
.login-card > p { margin-bottom: 26px; color: var(--color-muted); }
.login-card .field-group { margin-bottom: 18px; }
.login-card button { width: 100%; margin-top: 8px; }
.login-error { margin-bottom: 20px; padding: 12px 14px; color: #76231e; background: var(--color-red-soft); border-left: 4px solid var(--color-danger); }

.site-footer { color: #cbd9d2; background: #082d22; }
.footer-inner { width: min(calc(100% - 32px), var(--content-max)); min-height: 64px; margin: 0 auto; padding: 18px 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 12px; }
.footer-inner p { margin: 0; }
.footer-official-link { color: #fff; font-weight: 700; text-underline-offset: 3px; }
.footer-official-link:hover { color: #f0d88e; }
.footer-security { color: #9eb7aa; }

@media (max-width: 1080px) {
  .masthead-inner { flex-wrap: wrap; gap: 8px 18px; }
  .brand { flex: 1 1 360px; }
  .primary-nav { order: 3; width: 100%; margin-left: 0; border-top: 1px solid rgba(255,255,255,.12); }
  .primary-nav-list { justify-content: flex-start; }
  .account-menu { margin-left: auto; }
  .content-grid { grid-template-columns: 1fr; }
  .quick-panel { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; }
  .quick-panel .button { width: auto; margin: 0; }
  .record-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .app-shell { display: block; }
  .app-sidebar {
    position: static;
    width: 100%;
    height: auto;
  }
  .js .app-sidebar {
    position: fixed;
    left: 0;
    width: min(var(--sidebar-width), calc(100vw - 48px));
    height: 100vh;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }
  .js .sidebar-toggle { display: inline-flex; }
  body.sidebar-open { overflow: hidden; }
  .js body.sidebar-open .app-sidebar { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    z-index: 25;
    inset: 0;
    width: 100%;
    min-height: 100%;
    padding: 0;
    background: rgba(7, 24, 18, .54);
    border: 0;
    border-radius: 0;
  }
  body.sidebar-open .sidebar-backdrop { display: block; }
}

@media (max-width: 760px) {
  .app-topbar { min-height: 64px; padding: 8px 12px; gap: 9px; }
  .topbar-kicker { display: none; }
  .topbar-context strong { font-size: 13px; line-height: 1.25; }
  .topbar-account { display: none; }
  .app-topbar > .mobile-password-link { margin-left: auto; padding: 3px; border: 0; }
  .topbar-account-name { display: none; }
  .masthead-inner { padding: 10px 16px; }

  .brand { min-width: 0; }
  .brand-emblem { width: 42px; height: 42px; flex-basis: 42px; }
  .brand-title { font-size: 17px; }
  .brand-subtitle { display: none; }
  .mobile-password-link { display: inline-flex; }
  .account-copy { display: none; }
  .account-menu { padding-left: 0; border-left: 0; }
  .primary-nav-list { width: 100%; }
  .primary-nav-list li { flex: 1; }
  .primary-nav a { justify-content: center; width: 100%; padding-inline: 8px; }
  .page-shell { width: min(calc(100% - 24px), var(--content-max)); padding-top: 24px; }
  .page-header, .section-card-header, .dashboard-hero { align-items: stretch; flex-direction: column; }
  .page-header .actions { margin: 0; }
  .metric-grid, .metric-grid-four, .record-summary, .detail-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 118px; }
  .filter-panel { grid-template-columns: 1fr; }
  .filter-panel button { width: 100%; }
  .button-sm { min-height: 44px; }
  .user-table { overflow: visible; background: transparent; border: 0; }
  .user-table table, .user-table tbody, .user-table tr, .user-table td { display: block; width: 100%; }
  .user-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  .user-table tbody { display: grid; gap: 12px; }
  .user-table tr {
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
  }
  .user-table td { padding: 12px 14px; border-bottom: 1px solid var(--color-border); }
  .user-table td:last-child { border-bottom: 0; }
  .user-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--color-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
  .user-table .user-actions .button { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid > .field-group, .form-grid > .field-wide, .form-grid > .field-full { grid-column: 1; }
  .form-section legend { padding: 14px 16px; }
  .form-section-body { padding: 16px; }
  .form-actions { position: static; }
  .form-actions .button, .form-actions button { flex: 1 1 100%; }
  .record-hero { grid-template-columns: 1fr; padding: 20px; }
  .record-hero .actions { justify-content: flex-start; }
  .document-row, .recent-item { grid-template-columns: 1fr; }
  .recent-item .status-badge { justify-self: start; }
  .document-row .row-actions { justify-content: flex-start; }
  .quick-panel { display: block; }
  .quick-panel .button { width: 100%; margin-top: 12px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-intro { min-height: 280px; align-items: center; padding: 34px 24px; }
  .login-intro h1 { font-size: 36px; }
  .login-intro::after { font-size: 180px; }
  .login-panel { padding: 36px 20px 48px; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 460px) {
  .brand-kicker { font-size: 9px; }
  .brand-title { font-size: 15px; }
  .logout-full { display: none; }
  .logout-short { display: inline; }
  .logout-form .button-quiet-dark { min-width: 62px; padding-inline: 9px; font-size: 12px; }
  th, td { padding: 11px 10px; }
}

/* Fiche d’acte : en-tête, étapes, onglets, rail et historique unifié */
.fil-ariane { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; color: var(--color-muted); font-size: 13px; }
.fil-ariane a { color: var(--color-brand); font-weight: 700; text-underline-offset: 3px; }
.record-hero.dossier-entete {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 24px;
  margin-bottom: 0;
  padding: 22px 24px 0;
  color: var(--color-ink);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 4px solid var(--color-gold);
  border-bottom: 0;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.dossier-entete h1 { margin: 2px 0 0; color: var(--color-brand-deep); font-family: var(--font-display); font-size: clamp(26px, 3vw, 34px); line-height: 1.15; text-wrap: balance; }
.dossier-entete .eyebrow { color: var(--color-muted); }
.dossier-reference { color: var(--color-brand); font-variant-numeric: tabular-nums; }
.dossier-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 10px 0 0; padding: 0; list-style: none; color: var(--color-muted); font-size: 14px; }
.dossier-meta strong { color: var(--color-ink); font-variant-numeric: tabular-nums; }
.dossier-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }
.dossier-actions .inline-form button { min-height: 44px; }
.dossier-entete .button.secondary { color: var(--color-brand-deep); background: var(--color-surface); border-color: var(--color-border-strong); }
.dossier-entete .button.secondary:hover { color: var(--color-brand-deep); background: var(--color-brand-soft); border-color: var(--color-brand); }
.dossier-entete .button.bouton-renvoi { color: var(--color-danger); border-color: #e3b1ac; }
.dossier-entete .button.bouton-renvoi:hover { color: #fff; background: var(--color-danger); border-color: var(--color-danger); }
.dossier-actions button:disabled, .dossier-actions button:disabled:hover { color: var(--color-muted); background: var(--color-surface-alt); border-color: var(--color-border-strong); cursor: not-allowed; }
.dossier-attente { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; color: var(--color-muted); background: var(--color-surface-alt); border: 1px dashed var(--color-border-strong); border-radius: var(--radius-sm); font-size: 14px; }
.dossier-attente::before { content: ""; width: 8px; height: 8px; background: var(--color-gold); border-radius: 50%; }
.dossier-raison { grid-column: 1 / -1; justify-self: end; margin: -6px 0 0; color: #704f06; font-size: 13px; text-align: right; }
.dossier-raison a { color: inherit; font-weight: 700; text-underline-offset: 3px; }
.dossier-etapes { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 4px 0 0; padding: 0 0 16px; list-style: none; }
.dossier-etape { position: relative; display: grid; align-content: start; gap: 2px; padding-top: 14px; color: var(--color-muted); font-size: 13px; line-height: 1.35; }
.dossier-etape::before { content: ""; position: absolute; top: 0; right: 0; left: 0; height: 4px; background: var(--color-border); border-radius: 2px; }
.dossier-etape strong { color: var(--color-ink); font-size: 14px; }
.etape-faite::before { background: var(--color-brand); }
.etape-courante::before { background: linear-gradient(90deg, var(--color-gold) 50%, var(--color-border) 50%); }
.etape-alerte::before { background: linear-gradient(90deg, var(--color-danger) 50%, var(--color-border) 50%); }
.etape-alerte > span { color: var(--color-danger); font-weight: 700; }
.etape-a_venir strong { color: var(--color-muted); font-weight: 600; }

.dossier-onglets {
  position: sticky;
  z-index: 15;
  top: var(--topbar-height);
  display: flex;
  gap: 2px;
  margin: 0 0 20px;
  padding: 0 12px;
  overflow-x: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: 0 6px 14px rgba(11, 61, 46, 0.06);
}
.dossier-onglets a { position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 48px; padding: 0 12px; color: var(--color-muted); font-weight: 750; text-decoration: none; white-space: nowrap; }
.dossier-onglets a:hover, .dossier-onglets a[aria-selected="true"] { color: var(--color-brand-deep); }
.dossier-onglets a[aria-selected="true"]::after { content: ""; position: absolute; right: 10px; bottom: 0; left: 10px; height: 3px; background: var(--color-brand); border-radius: 3px 3px 0 0; }
.onglet-compteur { min-width: 22px; padding: 1px 6px; color: var(--color-muted); background: var(--color-surface-alt); border: 1px solid var(--color-border); border-radius: 999px; font-size: 12px; font-variant-numeric: tabular-nums; text-align: center; }

.dossier-corps { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: auto 1fr; gap: 14px 22px; align-items: start; }
.dossier-panneaux, .dossier-rail, .dossier-a-verifier { min-width: 0; }
.dossier-panneaux { grid-column: 1; grid-row: 1 / span 2; }
.dossier-a-verifier { grid-column: 2; grid-row: 1; }
.dossier-rail { grid-column: 2; grid-row: 2; }
.dossier-panneau { scroll-margin-top: calc(var(--topbar-height) + 64px); }
.dossier-panneau:focus { outline: none; }
.dossier-rail { display: grid; gap: 14px; }
.rail-carte { padding: 16px 18px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.rail-carte h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; font-size: 17px; }
.rail-carte .field-group { margin-bottom: 10px; }
.rail-point { display: grid; gap: 6px; margin-top: 10px; padding: 11px 12px; border: 1px solid var(--color-border); border-left-width: 4px; border-radius: var(--radius-sm); font-size: 14px; }
.rail-point p, .rail-point ul { margin: 0; }
.rail-point ul { padding-left: 18px; }
.rail-point small { color: var(--color-muted); }
.rail-point .button { justify-self: start; }
.rail-renvoi { background: var(--color-red-soft); border-left-color: var(--color-danger); }
.rail-manquant { background: var(--color-gold-soft); border-left-color: var(--color-gold); }
.rail-anomalie { background: #e7eff8; border-left-color: #1e4066; }
.rail-etiquette { color: var(--color-muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.rail-ok { margin: 0; color: var(--color-success); font-weight: 700; }
.rail-personne { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.rail-personne > span:last-child { display: grid; line-height: 1.3; }
.rail-personne small { color: var(--color-muted); font-size: 12px; }
.rail-notes { display: grid; gap: 10px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 14px; }
.rail-notes small { display: block; color: var(--color-muted); font-size: 12px; }
.rail-lien { display: inline-block; margin-top: 10px; color: var(--color-brand); font-size: 13px; font-weight: 700; }
.badge-attention { color: #7d2b26; background: var(--color-red-soft); border-color: #efc4c0; }
.badge-neutre { color: var(--color-muted); background: var(--color-surface-alt); border-color: var(--color-border); font-variant-numeric: tabular-nums; }
.rail-manquant li small { color: var(--color-muted); font-size: 12px; }
.badge-a-completer { color: #704f06; background: var(--color-gold-soft); border-color: #ead698; }

.donnees-grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 32px; }
.donnees-groupe h3 { margin: 0 0 4px; padding: 8px 0 6px; color: var(--color-muted); border-bottom: 1px solid var(--color-border); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.donnees-groupe dl { margin: 0 0 12px; }
.donnee { display: grid; grid-template-columns: minmax(110px, 40%) minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--color-border); }
.donnee:last-child { border-bottom: 0; }
.donnee dt { color: var(--color-muted); font-size: 14px; }
.donnee dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.donnee-vide { color: var(--color-muted); font-weight: 400; }

.historique-filtres { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 18px; }
.historique-filtres[hidden] { display: none; }
.historique-filtres button[aria-pressed="true"] { color: #fff; background: var(--color-brand-deep); border-color: var(--color-brand-deep); }
.historique { margin: 0; padding: 0; list-style: none; }
.historique-evenement { position: relative; padding: 0 0 18px 30px; }
.historique-evenement::before { content: ""; position: absolute; top: 4px; left: 3px; width: 14px; height: 14px; background: var(--color-surface); border: 3px solid var(--color-border-strong); border-radius: 50%; }
.historique-evenement::after { content: ""; position: absolute; top: 22px; bottom: 0; left: 9px; width: 2px; background: var(--color-border); }
.historique-evenement:last-child::after { display: none; }
.evenement-creation::before, .evenement-modification::before { border-color: var(--color-brand); }
.evenement-transmission::before, .evenement-approbation::before, .evenement-reprise::before, .evenement-assignation::before { border-color: #1e4066; }
.evenement-renvoi::before { border-color: var(--color-danger); }
.evenement-validation::before { background: var(--color-success); border-color: var(--color-success); }
.evenement-note::before { border-color: var(--color-gold); }
.historique-entete { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.historique-entete span { color: var(--color-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.historique-motif { margin: 6px 0 0; padding: 8px 12px; background: var(--color-surface-alt); border-left: 3px solid var(--color-border-strong); font-size: 14px; }
.evenement-renvoi .historique-motif { border-left-color: var(--color-danger); }
.evenement-note .historique-motif { border-left-color: var(--color-gold); }
.historique-changements { display: grid; gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 14px; }
.historique-changements li { display: grid; grid-template-columns: minmax(140px, 32%) minmax(0, 1fr); gap: 10px; padding: 5px 10px; background: var(--color-surface-alt); border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.changement-champ { color: var(--color-muted); }
.historique-changements del { color: #7d2b26; }
.historique-changements ins { color: #0b5b3d; font-weight: 700; text-decoration: none; }

.dossier-dialogue { width: min(560px, calc(100vw - 24px)); padding: 0; border: 0; border-radius: var(--radius-md); box-shadow: var(--shadow-float); }
.dossier-dialogue::backdrop { background: rgba(7, 24, 18, .55); }
.dossier-dialogue > form, .dossier-dialogue > .validation-action { margin: 0; padding: 22px; }
.dossier-dialogue h2 { margin: 0 0 6px; font-family: var(--font-display); font-size: 24px; }
.dossier-dialogue .actions { justify-content: flex-end; margin-bottom: 0; }
.dossier-dialogue:not([open]):target { display: block; position: static; width: auto; margin: 18px 0; border: 1px solid var(--color-border); }

@media (max-width: 1080px) {
  .dossier-corps { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .dossier-panneaux, .dossier-a-verifier, .dossier-rail { grid-column: 1; grid-row: auto; }
  .dossier-a-verifier.a-verifier-vide { display: none; }
  .dossier-rail { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
}

@media (max-width: 760px) {
  .record-hero.dossier-entete { grid-template-columns: minmax(0, 1fr); padding: 18px 16px 0; }
  .dossier-actions { justify-content: flex-start; }
  .dossier-raison { justify-self: start; text-align: left; }
  .dossier-etapes { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
  .dossier-onglets { top: 64px; }
  .donnees-grille { grid-template-columns: minmax(0, 1fr); }
  .donnee, .historique-changements li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

@media print {
  .dossier-onglets, .dossier-rail, .dossier-actions, .historique-filtres, .fil-ariane { display: none !important; }
  .dossier-panneau[hidden] { display: block !important; }
  .dossier-corps { display: block; }
}

/* Recherche du registre, extrait guidé, contrôle documentaire et OCR côte à côte */
.topbar-recherche { position: relative; display: flex; align-items: center; width: min(420px, 38vw); margin-left: auto; }
.topbar-recherche input { width: 100%; min-height: 44px; padding: 8px 42px 8px 12px; background: var(--color-surface-alt); border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); }
.topbar-recherche input:focus { background: var(--color-surface); }
.topbar-recherche kbd { position: absolute; right: 10px; padding: 1px 7px; color: var(--color-muted); background: var(--color-surface); border: 1px solid var(--color-border-strong); border-bottom-width: 2px; border-radius: 4px; font-size: 12px; pointer-events: none; }
.topbar-recherche + .topbar-account { margin-left: 0; }
.dossier-etape-suivante { color: var(--color-brand); font-weight: 700; }

.controle-cote-a-cote { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 22px; align-items: start; margin-top: 18px; }
.controle-apercu { position: sticky; top: calc(var(--topbar-height) + 16px); display: grid; gap: 12px; max-height: calc(100vh - var(--topbar-height) - 32px); overflow: auto; padding: 16px; background: #e4e9e5; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.controle-apercu h2 { margin: 0; font-size: 16px; }
.controle-apercu img, .ocr-apercu img { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--color-border); box-shadow: 0 6px 18px rgba(11, 61, 46, 0.12); }
.controle-donnees { min-width: 0; }
.controle-donnees .detail-grid { grid-template-columns: minmax(0, 1fr); }
.controle-decision { border-top: 4px solid var(--color-gold); }

.ocr-cote-a-cote { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.ocr-apercu { display: grid; gap: 10px; margin: 0; max-height: 640px; overflow: auto; padding: 12px; background: #e4e9e5; border-radius: var(--radius-sm); }
.ocr-apercu figcaption { font-size: 13px; }
.ocr-suggestions { min-width: 0; }
.ocr-identique td { color: var(--color-muted); }
.ocr-apercu a { display: block; }
/* La règle globale th impose nowrap et majuscules : ici, le tableau doit tenir dans sa colonne. */
.ocr-table-compacte { table-layout: fixed; }
.ocr-table-compacte td, .ocr-table-compacte th { padding: 10px; vertical-align: top; white-space: normal; overflow-wrap: anywhere; }
.ocr-table-compacte td:first-child, .ocr-table-compacte th:first-child { width: 52px; padding-right: 0; }
.ocr-table-compacte thead th:nth-child(2) { width: 38%; }
.ocr-table-compacte tbody th { color: var(--color-ink); background: transparent; font-size: 14px; font-weight: 650; letter-spacing: normal; text-align: left; text-transform: none; }
.ocr-table-compacte tbody th small { display: block; color: var(--color-muted); font-size: 12px; font-weight: 400; }
.ocr-actuelle { color: var(--color-muted); overflow-wrap: anywhere; }
.ocr-fleche { margin: 0 4px; color: var(--color-muted); }
.ocr-proposee { overflow-wrap: anywhere; }

@media (max-width: 960px) {
  .controle-cote-a-cote, .ocr-cote-a-cote { grid-template-columns: minmax(0, 1fr); }
  .controle-apercu { position: static; max-height: none; }
}

@media (max-width: 760px) {
  .topbar-recherche { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
  .masthead, .site-footer, .actions, .filter-panel, .form-actions { display: none !important; }
  body { background: #fff; }
  .page-shell { width: 100%; padding: 0; }
  .section-card, .table-shell { break-inside: avoid; border-color: #999; }
}
