/* ============================================
   Margueritte Design System — Sleek & Flat
   ============================================ */

/* Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Slate palette */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Accent colors */
  --emerald-50: #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;

  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-500: #f59e0b;
  --amber-600: #d97706;

  --sky-50: #f0f9ff;
  --sky-100: #e0f2fe;
  --sky-200: #bae6fd;
  --sky-300: #7dd3fc;
  --sky-500: #0ea5e9;
  --sky-600: #0284c7;

  --violet-50: #f5f3ff;
  --violet-100: #ede9fe;
  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;

  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-500: #ef4444;
  --red-600: #dc2626;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 68px;
  --transition-speed: 200ms;
}

/* ============================================
   Global overrides
   ============================================ */

body {
  font-family: 'Inter', sans-serif !important;
  background-color: var(--slate-50);
  cursor: default;
}

/* UI labels: selectable but no "editable" illusion.
   The fix is caret-color, not user-select. */
h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
div,
td,
th,
label,
.mud-typography,
.badge,
.stat-card,
.stat-value,
.stat-label,
.section-title,
.page-header,
.list-card-title,
.list-card-subtitle,
.sidebar-contract-name,
.sidebar-contract-info,
.sidebar-section-label,
.empty-title,
.empty-text,
.readonly-banner,
.content-card {
  cursor: default;
  caret-color: transparent;
}

/* Pointer on interactive elements */
a,
button,
[role="button"],
.mud-button-root,
.mud-icon-button,
.mud-nav-link,
.mud-link,
.mud-list-item,
.mud-select,
.mud-checkbox,
.mud-radio,
.mud-switch,
.mud-tab,
.list-card,
.content-card-hover:hover,
.sidebar-nav-item,
.sidebar-toggle,
.sidebar-back-btn,
.sidebar-search-trigger {
  cursor: pointer;
}

/* Actual inputs: caret visible, text cursor */
input,
textarea,
[contenteditable="true"] {
  cursor: text;
  caret-color: auto;
}

/* Non-interactive elements should never show a focus ring */
h1,
h2,
h3,
h4,
h5,
h6,
p,
div,
span,
section,
main {
  outline: none;
}

/* Keyboard focus ring for interactive elements (accessibility) */
a.list-card:focus-visible,
.sidebar-nav-item:focus-visible,
.mud-button-root:focus-visible {
  outline: 2px solid var(--sky-500);
  outline-offset: 2px;
}

.mud-typography {
  font-family: 'Inter', sans-serif !important;
}

/* ============================================
   Content Card — flat card with border
   ============================================ */

.content-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--slate-200);
  padding: 20px;
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.content-card-hover:hover {
  border-color: var(--slate-300);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  cursor: pointer;
}

.content-card-sm {
  padding: 16px;
}

.content-card-flush {
  padding: 0;
}

.subtitle-secondary-card {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 10px 12px;
}

.subtitle-secondary-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-700);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============================================
   Sidebar
   ============================================ */

/* MudDrawer handles position, width, background, color, overflow, flex layout
   natively (via DrawerBackground / DrawerText palette). We only re-tint a
   handful of palette variables so MudPaper, MudDivider and MudNavLink active
   states render correctly on the dark drawer. */
.app-sidebar {
  --mud-palette-primary: #6393eb;
  --mud-palette-primary-rgb: 99, 147, 235;
  --mud-palette-action-default-hover: rgba(255, 255, 255, 0.06);
  --mud-palette-surface: rgba(255, 255, 255, 0.05);
  --mud-palette-lines-default: rgba(255, 255, 255, 0.1);
  --mud-palette-divider: rgba(255, 255, 255, 0.08);
  --mud-palette-text-primary: rgba(255, 255, 255, 0.88);
  --mud-palette-text-secondary: rgba(255, 255, 255, 0.52);
}

/* Mockup icon sizes: 18px for nav-link icons, 14px for niveau group chevron. */
.app-sidebar .mud-nav-link .mud-icon-root {
  font-size: 1.125rem;
  /* 18px */
}

.app-sidebar .mud-nav-link .mud-nav-link-expand-icon,
.app-sidebar .mud-nav-link .mud-nav-link-expand-icon .mud-icon-root {
  font-size: 0.875rem;
  /* 14px */
}

.app-sidebar .app-sidebar-hidden-nav-items {
  display: none !important;
}

.app-sidebar::-webkit-scrollbar {
  width: 4px;
}

.app-sidebar::-webkit-scrollbar-thumb {
  background: var(--slate-600);
  border-radius: 2px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  min-height: 56px;
  border-bottom: 1px solid var(--slate-700);
}

.sidebar-logo {
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: -0.5px;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--slate-400);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-speed), background var(--transition-speed);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  color: #ffffff;
  background: var(--slate-700);
}

/* Sidebar nav */
.sidebar-nav {
  flex: 0 0 auto;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.3);
  padding: 12px 16px 6px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-section-label.with-gap {
  margin-top: 8px;
}

.sidebar-item-group-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-400);
  padding: 8px 12px 2px 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav-item+.sidebar-item-group-label {
  margin-top: 8px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--slate-300);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: all var(--transition-speed);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-nav-item.indented {
  padding-left: 24px;
}

.app-sidebar.collapsed .sidebar-nav-item.indented {
  padding-left: 12px;
}

.sidebar-nav-item:hover {
  background: var(--slate-700);
  color: #ffffff;
}

.sidebar-nav-item.active {
  background: var(--slate-600);
  color: #ffffff;
}

.sidebar-nav-item .nav-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-400);
  transition: color var(--transition-speed);
}

.sidebar-nav-item:hover .nav-icon,
.sidebar-nav-item.active .nav-icon {
  color: var(--slate-200);
}

.sidebar-nav-item .nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar workspace header */
.sidebar-workspace-header {
  padding: 14px 16px 10px;
}

.sidebar-back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--slate-400);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 0;
  margin-bottom: 12px;
  transition: color var(--transition-speed);
}

.sidebar-back-btn .mud-icon-root {
  color: var(--slate-500);
  transition: color var(--transition-speed);
}

.sidebar-back-btn:hover {
  color: #ffffff;
}

.sidebar-back-btn:hover .mud-icon-root {
  color: var(--slate-200);
}

.sidebar-contract-name {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-contract-info {
  font-size: 12px;
  color: var(--slate-400);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-version-card {
  margin-top: 12px;
  padding: 10px;
  border-radius: 8px;
  background: var(--slate-700);
  font-size: 12px;
}

.sidebar-version-card .version-label {
  color: var(--slate-400);
  margin-bottom: 2px;
}

.sidebar-version-card .version-value {
  color: #ffffff;
  font-weight: 500;
}

/* MudDivider only needs margin tweaks; color comes from --mud-palette-divider
   scoped on .app-sidebar. */
.sidebar-divider {
  margin: 4px 8px;
  width: auto;
}

/* ============================================
   Main content area
   ============================================ */

.main-content {
  height: 100vh;
  background: var(--slate-50);
  padding: 32px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-content-inner {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.main-content-inner:has(.garanties-page) {
  max-width: none;
}

@media (max-width: 959.98px) {
  .mud-layout .app-sidebar.mud-drawer {
    display: none !important;
  }

  .main-content {
    padding: 16px;
  }

  .mud-layout.mud-drawer-open-mini-xs-left .mud-main-content,
  .mud-layout.mud-drawer-open-mini-sm-left .mud-main-content,
  .mud-layout.mud-drawer-open-mini-md-left .mud-main-content,
  .mud-layout.mud-drawer-open-mini-lg-left .mud-main-content,
  .mud-layout.mud-drawer-open-mini-xl-left .mud-main-content,
  .mud-layout.mud-drawer-open-mini-xxl-left .mud-main-content,
  .mud-layout.mud-drawer-open-mini-none-left .mud-main-content,
  .mud-layout.mud-drawer-open-mini-always-left .mud-main-content {
    margin-left: 0 !important;
  }
}

/* ============================================
   Badges
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
}

.badge-sante {
  background: var(--emerald-100);
  color: var(--emerald-700);
}

.badge-prevoyance {
  background: var(--violet-100);
  color: var(--violet-600);
}

.risk-action-button.mud-button-root {
  text-transform: none;
  font-weight: 600;
}

.risk-action-button-sante.mud-button-root.mud-button-outlined {
  color: var(--emerald-700);
  border-color: var(--emerald-500);
}

.risk-action-button-sante.mud-button-root.mud-button-outlined:hover {
  background: var(--emerald-50);
  border-color: var(--emerald-600);
}

.risk-action-button-prevoyance.mud-button-root.mud-button-outlined {
  color: var(--violet-600);
  border-color: var(--violet-500);
}

.risk-action-button-prevoyance.mud-button-root.mud-button-outlined:hover {
  background: var(--violet-50);
  border-color: var(--violet-600);
}

.badge-active,
.badge-validee {
  background: var(--emerald-100);
  color: var(--emerald-700);
}

.badge-brouillon {
  background: var(--amber-100);
  color: var(--amber-600);
}

.badge-obsolete {
  background: var(--slate-100);
  color: var(--slate-500);
}

.badge-info {
  background: var(--sky-100);
  color: var(--sky-600);
}

.badge-danger {
  background: var(--red-100);
  color: var(--red-600);
}

.badge-groupe {
  background: var(--sky-100);
  color: var(--sky-600);
}

.badge-prospect {
  background: var(--amber-100);
  color: var(--amber-600);
}

.badge-client-sante {
  background: var(--emerald-100);
  color: var(--emerald-700);
}

.badge-client-prevoyance {
  background: var(--violet-100);
  color: var(--violet-600);
}

.badge-client-prospect {
  background: var(--slate-100);
  color: var(--slate-600);
}

.badge-client-none {
  background: var(--slate-900);
  color: #ffffff;
}


/* ============================================
   Stat Card
   ============================================ */

.stat-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--slate-200);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.stat-card .stat-content .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--slate-800);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-content .stat-label {
  font-size: 13px;
  color: var(--slate-500);
  font-weight: 500;
}

.stat-card .stat-content .stat-subtitle {
  font-size: 12px;
  color: var(--slate-400);
  margin-top: 2px;
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-primary {
  background: var(--sky-50);
  color: var(--sky-600);
}

.stat-icon-success {
  background: var(--emerald-50);
  color: var(--emerald-600);
}

.stat-icon-warning {
  background: var(--amber-50);
  color: var(--amber-600);
}

.stat-icon-info {
  background: var(--violet-50);
  color: var(--violet-600);
}

/* ============================================
   ReadOnly Banner
   ============================================ */

.readonly-banner {
  background: var(--amber-50);
  border: 1px solid var(--amber-500);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--amber-600);
  font-weight: 500;
}

.readonly-banner .mud-icon-root {
  color: var(--amber-500);
}

/* ============================================
   Section Title
   ============================================ */

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.section-title h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--slate-800);
  margin: 0;
}

.section-title .section-action {
  margin-left: auto;
}

/* ============================================
   Clean Table (inside content-card)
   ============================================ */

.table-clean {
  width: 100%;
  border-collapse: collapse;
}

.table-clean th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  border-bottom: 1px solid var(--slate-200);
}

.table-clean td {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--slate-700);
  border-bottom: 1px solid var(--slate-100);
}

.table-clean tr:last-child td {
  border-bottom: none;
}

.table-clean tr:hover td {
  background: var(--slate-50);
}

.table-clean .td-label {
  font-weight: 500;
  color: var(--slate-500);
  width: 180px;
}

/* Tables de selection des plafonds (GarantiesPage, jumelles sante/prevoyance).
   Layout fixe obligatoire : en layout auto, les libelles de categorie longs
   (nowrap, cellules colspan) gonflent la colonne de selection. */
.prev-table.garanties-plafond-selection-table {
  table-layout: fixed;
  min-width: 100%;
}

.prev-table.garanties-plafond-selection-table .garanties-plafond-selection-cell {
  width: 105px;
  text-align: center;
  white-space: nowrap;
}

.prev-table.garanties-plafond-selection-table .prev-product-column,
.prev-table.garanties-plafond-selection-table .prev-product-cell {
  width: auto;
  min-width: 0;
}

.prev-table.garanties-plafond-selection-table tbody td.prev-product-cell {
  position: static;
  box-shadow: none;
}

.prev-table.garanties-plafond-selection-table .prev-group-label {
  position: static;
  white-space: normal;
}

/* Detail sub-rows for contract flux table */
.flux-detail-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: baseline;
  min-height: 24px;
}

.flux-detail-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--slate-400);
  padding-top: 2px;
  line-height: 1.6;
}

.flux-detail-value {
  font-size: 12.5px;
  color: var(--slate-600);
  line-height: 1.6;
}

.flux-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 9px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--slate-100);
  color: var(--slate-600);
  line-height: 1.5;
  white-space: nowrap;
}

/* Contract flux rows: full-row navigation with keyboard focus affordance. */
.flux-table tr.flux-row-link,
.flux-table tr.flux-row-link td,
.flux-table tr.flux-row-link .mud-link,
.flux-table tr.flux-row-link span {
  cursor: pointer;
}

.table-clean tbody tr.flux-row-link:hover td {
  background: var(--slate-50);
}

.table-clean tbody tr.flux-row-link:focus-visible td {
  background: var(--sky-50);
}

.flux-table tr.flux-row-link:focus-visible {
  outline: 2px solid var(--sky-500);
  outline-offset: -2px;
}

/* ============================================
   Grid layouts
   ============================================ */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.service-table-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.service-custom-section {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.service-custom-section__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.service-custom-section__subtitle,
.service-custom-section__empty {
  color: var(--slate-500);
}

@media (max-width: 960px) {

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .grid-2-1 {
    grid-template-columns: 1fr;
  }

  .service-custom-section__header {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ============================================
   Page header
   ============================================ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--slate-800);
  margin: 0;
}

.page-header .page-subtitle {
  font-size: 14px;
  color: var(--slate-500);
  margin: 2px 0 0 0;
}

/* Sidebar contract ambient tint */
.sidebar-workspace-header--reference {
  border-left: 3px solid var(--sky-500);
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.08) 0%, transparent 60%);
}

.sidebar-workspace-header--reference .sidebar-contract-name {
  color: var(--sky-100);
}

.sidebar-workspace-header--reference .sidebar-contract-info {
  color: var(--sky-300);
}

/* Page header contract ambient tint */
.page-header--reference {
  background: var(--sky-50);
  border-left: 3px solid var(--sky-500);
  border-radius: 10px;
  padding: 16px 20px;
}

.page-header--reference .page-subtitle {
  color: var(--sky-600);
}

.contract-icon-wrapper {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 165, 233, 0.08);
  border-radius: 10px;
}

.header-document-icon {
  font-size: 26px;
}

.page-header--reference .header-document-icon {
  color: var(--sky-600);
}

/* Contract meta line (inline metadata below subtitle) */
.contract-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--slate-500);
}

.badge-header-risk {
  padding: 1px 8px;
  line-height: 18px;
  font-size: 12px;
  font-weight: 600;
}

.meta-separator {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--slate-400);
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .contract-meta-line {
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .page-header--reference {
    padding: 12px 14px;
  }
}

/* ============================================
   List cards (societes, contrats)
   ============================================ */

.list-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--slate-200);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.list-card:hover {
  border-color: var(--slate-300);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.list-card .list-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.list-card .list-card-content {
  flex: 1;
  min-width: 0;
}

.list-card .list-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--slate-800);
  margin-bottom: 2px;
}

.list-card .list-card-subtitle {
  font-size: 13px;
  color: var(--slate-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-card .list-card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.list-card .list-card-right {
  flex-shrink: 0;
  text-align: right;
}

/* Clickable list card rows should keep pointer feedback on nested wrappers too,
   because global label cursor rules set many div/span nodes to default. */
.list-card-clickable,
.list-card-clickable .list-card-icon,
.list-card-clickable .list-card-content,
.list-card-clickable .list-card-title,
.list-card-clickable .list-card-subtitle,
.list-card-clickable .list-card-badges,
.list-card-clickable .list-card-right,
.list-card-clickable span {
  cursor: pointer;
}

.demographie-page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 2px;
}

.demographie-markdown {
  color: var(--slate-700);
  font-size: 14px;
  line-height: 1.65;
}

.demographie-markdown strong {
  color: var(--slate-900);
  font-weight: 600;
}

/* ============================================
   Empty state
   ============================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state .empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--slate-400);
}

.empty-state .empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 4px;
}

.empty-state .empty-text {
  font-size: 14px;
  color: var(--slate-500);
}

/* ============================================
   Workspace version highlight
   ============================================ */

.version-card-active {
  border-color: var(--emerald-500) !important;
  border-width: 2px;
}

/* ============================================
   Search bar
   ============================================ */

.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.search-bar .mud-input-control {
  flex: 1;
}

/* ============================================
   Scrollable list pages (societes, contrats)
   ============================================ */

.societe-page,
.contrat-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
  min-height: 360px;
}

.societe-filters,
.contrat-filters {
  flex-shrink: 0;
}

.societe-results-scroll,
.contrat-results-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.societe-group-option {
  width: 100%;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 400;
  color: var(--slate-700);
}

.societe-group-option-create {
  background: var(--sky-50);
  color: var(--sky-600);
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 900px) {

  .societe-page,
  .contrat-page {
    height: auto;
    min-height: 0;
  }

  .societe-results-scroll,
  .contrat-results-scroll {
    overflow: visible;
    padding-right: 0;
  }
}

/* ============================================
   OmniSearch
   ============================================ */

.global-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--slate-200);
  background: #ffffff;
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--slate-600);
  font-size: 13px;
  font-weight: 500;
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.global-search-trigger:hover {
  border-color: var(--slate-300);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.global-search-trigger kbd {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  border: 1px solid var(--slate-300);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 6px;
  background: var(--slate-50);
  color: var(--slate-500);
}

/* Sidebar search trigger — matches NouveauMenu.html `searchButton` */
.sidebar-search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 4px 15px 16px;
  width: calc(100% - 30px);
  border-radius: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.4);
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: background var(--transition-speed), color var(--transition-speed);
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
}

.sidebar-search-trigger .nav-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.5);
  transition: color var(--transition-speed);
}

.sidebar-search-trigger .nav-icon .mud-icon-root {
  font-size: 18px;
}

.sidebar-search-trigger .nav-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-search-trigger:hover {
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
}

.sidebar-search-trigger:hover .nav-icon {
  color: var(--slate-200);
}

.sidebar-search-trigger:hover .sidebar-search-kbd {
  border-color: var(--slate-500);
  color: var(--slate-300);
}

.sidebar-search-kbd {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  color: var(--slate-500);
  background: transparent;
  border: 1px solid var(--slate-600);
  border-radius: 5px;
  padding: 3px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar-account {
  padding: 12px 8px 16px;
  border-top: 1px solid var(--slate-700);
  margin-top: auto;
}

.sidebar-account-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--slate-200);
  text-align: left;
  transition: background var(--transition-speed), color var(--transition-speed);
}

.sidebar-account-trigger:hover {
  background: var(--slate-700);
  color: #ffffff;
}

.sidebar-account-avatar {
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--sky-500), var(--sky-600));
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.sidebar-account-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.sidebar-account-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-account-name,
.sidebar-account-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account-name {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
}

.sidebar-account-email {
  font-size: 11px;
  color: var(--slate-400);
}

.sidebar-account-menu-summary {
  padding: 12px 16px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
}

.sidebar-account-menu-subtitle {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--slate-500);
}

.sidebar-account-menu-section-label {
  padding: 10px 16px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate-400);
}

.sidebar-organisation-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 8px;
}

.sidebar-organisation-option.is-current .sidebar-organisation-switch {
  border-color: var(--sky-200);
  background: var(--sky-50);
}

.sidebar-organisation-switch {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  background: #ffffff;
  padding: 10px 12px;
  text-align: left;
  transition: border-color var(--transition-speed), background var(--transition-speed);
}

.sidebar-organisation-switch:hover {
  border-color: var(--slate-300);
  background: var(--slate-50);
}

.sidebar-organisation-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-organisation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.sidebar-organisation-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-organisation-badge--current {
  background: var(--sky-100);
  color: var(--sky-600);
}

.sidebar-organisation-badge--default {
  background: var(--amber-100);
  color: var(--amber-600);
}

.sidebar-organisation-default-action,
.sidebar-organisation-default-indicator {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-organisation-default-action {
  border: 1px solid var(--slate-200);
  background: #ffffff;
  color: var(--slate-500);
  transition: border-color var(--transition-speed), color var(--transition-speed), background var(--transition-speed);
}

.sidebar-organisation-default-action:hover {
  border-color: var(--amber-500);
  color: var(--amber-600);
  background: var(--amber-50);
}

.sidebar-organisation-default-indicator {
  color: var(--amber-500);
  background: var(--amber-50);
  border: 1px solid var(--amber-100);
}

.workspace-contract-card {
  padding: 12px 14px;
}

.workspace-contract-company {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 0;
  margin: 0 0 6px;
  border: 0;
  background: transparent;
  color: var(--slate-400);
  cursor: pointer;
}

.workspace-contract-company:disabled {
  cursor: default;
}

.workspace-contract-company-left {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
  cursor: inherit;
}

.workspace-contract-company-left span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-contract-title {
  margin-bottom: 2px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.workspace-contract-number {
  margin-bottom: 10px;
  color: var(--slate-500);
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
}

.workspace-contract-divider {
  margin: 0 0 10px !important;
}

.workspace-contract-version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.workspace-contract-version-trigger {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  color: #fff;
  cursor: pointer;
}

.workspace-contract-version-label {
  color: var(--slate-500);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.workspace-contract-version-number,
.workspace-version-menu-number,
.version-token {
  color: #fff;
  font-weight: 700;
}

.workspace-version-menu-item {
  display: grid;
  grid-template-columns: minmax(42px, auto) auto minmax(72px, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 220px;
}

.workspace-version-menu-date {
  color: var(--slate-500);
  font-size: 12px;
  text-align: right;
}


/* Niveau title (custom span inside MudNavGroup TitleContent slot) */
.workspace-niveau-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-sidebar .mud-nav-group>.mud-nav-link .workspace-niveau-title {
  color: var(--mud-palette-text-secondary);
  font-size: var(--mud-typography-caption-size, 12px);
  line-height: var(--mud-typography-caption-lineheight, 20px);
  text-transform: uppercase;
}

.app-sidebar .mud-nav-group>.mud-nav-link:hover .workspace-niveau-title,
.app-sidebar .mud-nav-group>.mud-nav-link.active .workspace-niveau-title {
  color: var(--mud-palette-text-primary);
}

.app-sidebar .mud-nav-group:has(.mud-collapse-container .mud-nav-link.active)>.mud-nav-link .workspace-niveau-title {
  color: var(--mud-palette-white, #fff);
}

/* Status badges on the dark sidebar — translucent fills + warm fg
   (the global .badge-* classes are tuned for light backgrounds) */
.app-sidebar .badge-validee,
.app-sidebar .badge-active {
  background: rgba(13, 148, 136, 0.2);
  color: #5eead4;
}

.app-sidebar .badge-brouillon {
  background: rgba(217, 169, 56, 0.18);
  color: #d4a230;
}

.app-sidebar .badge-obsolete {
  background: rgba(148, 163, 184, 0.18);
  color: rgba(255, 255, 255, 0.55);
}

/* The niveau version pill reuses the global .badge .badge-{statut} classes
   (same shape and color as the StatutVersionBadge in the contract card).
   We only add the chevron sizing and the cursor since the pill is clickable. */
.workspace-niveau-version-badge {
  gap: 4px;
  cursor: pointer;
}

.workspace-niveau-version-badge .mud-icon-root {
  font-size: 0.875rem;
  /* 14px chevron */
}

/* Push the niveau version badge to the right of the title (chevron stays
   at the extreme right of the nav-link, after .mud-nav-link-text). */
.app-sidebar .mud-nav-group>.mud-nav-link .mud-nav-link-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-sidebar .mud-nav-group>.mud-nav-link .workspace-niveau-title {
  flex: 1;
  min-width: 0;
}

/* MudMenu activator inside the contract card must take the row width
   so .workspace-contract-version-row's space-between aligns Brouillon right */
.workspace-contract-card .mud-menu {
  display: flex;
  flex: 1;
  min-width: 0;
}

.workspace-contract-card .mud-menu>button,
.workspace-contract-card .mud-menu>.mud-menu-activator {
  flex: 1;
  min-width: 0;
  width: 100%;
  display: flex;
  justify-content: flex-start;
  padding: 0;
  background: transparent;
  border: 0;
}

.workspace-contract-company-icon.mud-icon-root {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.workspace-versions-table tbody tr {
  cursor: pointer;
}

.omni-search-root {
  display: flex;
  flex-direction: column;
  height: min(760px, 88vh);
  min-height: 620px;
}

.omni-search-dialog .mud-dialog {
  width: min(1080px, 92vw);
  max-width: 1080px;
}

.omni-search-dialog .mud-dialog-content {
  padding: 16px 18px 12px;
}

.omni-search-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--slate-200);
  padding: 6px 4px 12px;
  color: var(--slate-500);
}

.omni-search-input {
  flex: 1;
}

.omni-search-input .mud-input {
  font-size: 15px;
}

.omni-search-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.omni-search-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  overflow-y: auto;
  padding: 12px 2px 4px 0;
}

.omni-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-400);
  margin: 4px 0 8px;
}

.omni-group-title::after {
  content: "";
  height: 1px;
  background: var(--slate-200);
  flex: 1;
}

.omni-result-item {
  width: 100%;
  border: 1px solid var(--slate-200);
  background: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px 12px;
  margin-bottom: 5px;
  transition: border-color var(--transition-speed), background var(--transition-speed), box-shadow var(--transition-speed);
}

.omni-result-item:hover,
.omni-result-item.active {
  border-color: var(--sky-500);
  background: var(--sky-50);
  box-shadow: 0 1px 3px rgba(14, 165, 233, 0.12);
}

.omni-result-leading {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.omni-result-leading.groupe {
  background: var(--slate-100);
  color: var(--slate-700);
}

.omni-result-leading.societe {
  background: var(--sky-100);
  color: var(--sky-600);
}

.omni-result-leading.contrat {
  background: var(--emerald-100);
  color: var(--emerald-700);
}

.omni-result-leading.version {
  background: var(--amber-100);
  color: var(--amber-600);
}

.omni-result-leading.contact {
  background: var(--violet-100);
  color: var(--violet-600);
}

.omni-result-leading.autre {
  background: var(--slate-100);
  color: var(--slate-500);
}

.omni-result-content {
  min-width: 0;
  flex: 1;
}

.omni-result-main {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-800);
}

.omni-result-sub {
  font-size: 12px;
  color: var(--slate-500);
  margin-top: 3px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.omni-group:last-child .omni-result-item:last-child {
  margin-bottom: 0;
}

.omni-search-results::-webkit-scrollbar {
  width: 8px;
}

.omni-search-results::-webkit-scrollbar-thumb {
  background: var(--slate-300);
  border-radius: 99px;
}

.omni-search-results::-webkit-scrollbar-track {
  background: transparent;
}

.omni-result-type {
  font-size: 11px;
  color: var(--slate-500);
  background: var(--slate-100);
  border-radius: 999px;
  padding: 3px 8px;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
}

.omni-search-state {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 4px;
  color: var(--slate-500);
  font-size: 14px;
}

.omni-search-loading {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  font-size: 11px;
  color: var(--slate-500);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--slate-200);
  border-radius: 999px;
  padding: 3px 8px;
}

.omni-search-hint {
  font-size: 11px;
  color: var(--slate-400);
  border-top: 1px solid var(--slate-200);
  padding-top: 10px;
  margin-top: 8px;
}

/* ============================================
   Spacing utilities
   ============================================ */

.mb-0 {
  margin-bottom: 0;
}

.mb-1 {
  margin-bottom: 4px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 12px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mb-6 {
  margin-bottom: 24px;
}

.mb-8 {
  margin-bottom: 32px;
}

.mt-4 {
  margin-top: 16px;
}

.mt-6 {
  margin-top: 24px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

.gap-6 {
  gap: 24px;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.flex-1 {
  flex: 1;
}

.text-center {
  text-align: center;
}

/* ============================================
   Workspace Layout — Sticky header + scrollable body
   ============================================ */

.workspace-sticky-header {
  flex-shrink: 0;
  z-index: 100;
  background: var(--slate-50);
  padding-bottom: 8px;
}

.workspace-scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.workspace-scroll-area:has(.siret-fixed-scope-page) {
  overflow-y: hidden;
}

.siret-fixed-scope-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.siret-fixed-scope-page > .siret-scope-layout,
.siret-fixed-scope-page > .chargements-sante-layout,
.siret-fixed-scope-page .chargements-sante-layout > .siret-scope-layout {
  flex: 1;
  min-height: 0;
}

.siret-fixed-scope-page > .chargements-sante-layout {
  grid-template-rows: minmax(0, 1fr);
}

.siret-fixed-scope-page .siret-scope-layout {
  min-height: 0;
  align-items: stretch;
  /* Bound the single grid row to the available height so the SIRET column and the
     content column become height-constrained — otherwise the row is `auto`
     (content-sized), nothing downstream can scroll, and the sticky header has no
     bounded scroller to pin against. This is the keystone of the whole behaviour. */
  grid-template-rows: minmax(0, 1fr);
}

.siret-fixed-scope-page .siret-scope-tabs {
  min-height: 0;
  align-self: stretch;
  align-content: start;
  align-items: start;
  grid-auto-rows: max-content;
}

.siret-fixed-scope-page .siret-scope-tab {
  width: 100%;
  height: auto;
  min-height: 34px;
  align-self: start;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.25;
  white-space: normal;
}

.siret-fixed-scope-page .siret-scope-content {
  min-height: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}

.siret-fixed-table-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.siret-fixed-table-scroll {
  --siret-thead-row-h: 38px;
  min-height: 0;
  max-height: min(58vh, 640px);
  overflow: auto;
}

.siret-fixed-scope-page .siret-scope-content > .siret-fixed-table-panel:only-child {
  flex: 1;
}

.siret-fixed-scope-page .siret-scope-content > .siret-fixed-table-panel:only-child > .siret-fixed-table-scroll {
  flex: 1;
  max-height: none;
}

/* Pin the column headers while only the tbody rows scroll underneath.
   `.table-clean` uses `border-collapse: collapse`, where `position: sticky`
   on the <thead>/<tr> element does not reliably pin in Chromium — the robust
   target is the <th> cells. The bottom divider is painted with an inset shadow
   so it travels with the pinned header instead of being lost to the collapsed
   border grid. */
.siret-fixed-table-scroll .table-clean thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #ffffff;
  box-shadow: inset 0 -1px 0 var(--slate-200);
}

/* Multi-line headers (cotisations prévoyance): the first header row stays at
   the top, the second header row pins immediately beneath it. */
.siret-fixed-table-scroll .table-clean thead tr:first-child th {
  top: 0;
  height: var(--siret-thead-row-h);
}

.siret-fixed-table-scroll .table-clean thead tr:nth-child(2) th {
  top: var(--siret-thead-row-h);
  z-index: 3;
}

@media (max-width: 900px) {
  .siret-fixed-scope-page .siret-scope-layout {
    grid-template-rows: auto minmax(0, 1fr);
  }
}

/* ============================================
   Environment Banner
   ============================================ */

.environment-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 16px;
  border: 1px solid var(--amber-500);
  background: var(--amber-50);
  color: var(--amber-600);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ============================================
   Aperçu Page — Hero Identity Card
   ============================================ */

/* Page header */
.page-header--contract {
  align-items: flex-start;
  border-left: 3px solid var(--contract-header-accent);
  border-radius: 10px;
  padding: 16px 20px;
  background: var(--contract-header-bg);
  margin-bottom: 28px;
}

.page-header--contract .page-header-left {
  align-items: flex-start;
}

.page-header--contract h1 {
  font-size: 22px;
  font-weight: 700;
  color: #1a1d23;
  margin: 0;
  line-height: 1.3;
}

.page-header--contract .contract-icon-wrapper {
  background: var(--contract-icon-bg);
}

.page-header--contract .header-document-icon {
  color: var(--contract-header-accent);
}

.page-header--contract-sante {
  --contract-header-bg: var(--emerald-50);
  --contract-header-accent: var(--emerald-500);
  --contract-icon-bg: rgba(16, 185, 129, 0.12);
}

.page-header--contract-prevoyance {
  --contract-header-bg: var(--violet-50);
  --contract-header-accent: var(--violet-500);
  --contract-icon-bg: rgba(139, 92, 246, 0.12);
}

.header-pill {
  display: inline-flex;
  align-items: center;
  background: #f0f0f5;
  color: #6b6f82;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  text-decoration: none;
}

.page-header--contract-sante .header-pill {
  background: var(--emerald-100);
  color: var(--emerald-700);
}

.page-header--contract-prevoyance .header-pill {
  background: var(--violet-100);
  color: var(--violet-700);
}

.header-pill--link:hover {
  background: #e4e4ec;
  color: #4a4d5e;
}

.page-header--contract-sante .header-pill--link:hover {
  background: var(--emerald-200);
  color: var(--emerald-800);
}

.page-header--contract-prevoyance .header-pill--link:hover {
  background: var(--violet-200);
  color: var(--violet-800);
}

/* Edit button refinement */
.apercu-edit-btn {
  border-color: #d1d5e0 !important;
  color: #3a3d4a !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

.apercu-edit-btn:hover {
  border-color: #6366f1 !important;
  color: #6366f1 !important;
}

/* Flux chips row inside a contract header band (sante apercu) */
.contract-header-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.sante-global-header {
  margin-bottom: 24px;
  border: 1px solid #dbe7e0;
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
}

.sante-global-header__hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 26px 20px;
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(236, 253, 245, 0.96) 52%, #f4fbf7 100%);
}

.sante-global-header__hero-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.sante-global-header__hero-copy {
  min-width: 0;
}

.sante-global-header__hero h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: #10261d;
}

.sante-global-header__icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(16, 185, 129, 0.16);
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.12);
}

.sante-global-header__icon .header-document-icon {
  color: var(--emerald-700);
}

.sante-global-header__meta-line {
  margin-top: 8px;
  color: #3f5d52;
}

.sante-global-header__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sante-global-header__action {
  background: rgba(255, 255, 255, 0.74) !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.sante-global-header__footer {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.04) 0%, #ffffff 22%);
  border-top: 1px solid rgba(16, 185, 129, 0.14);
}

.sante-global-header__details {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.45fr);
  margin-left: 92px;
  position: relative;
}

.sante-global-header__details::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--emerald-500) 0%, var(--emerald-300) 100%);
}

.sante-global-header__detail {
  padding: 18px 24px 22px;
}

.sante-global-header__detail:not(:last-child) {
  border-right: 1px solid #edf2ee;
}

.sante-global-header__detail--population {
  padding-left: 28px;
}

.sante-global-header__label {
  color: #5c6f66;
}

.sante-global-header__value {
  margin-top: 6px;
  font-size: 19px;
  font-weight: 700;
  color: #1a1d23;
  line-height: 1.4;
}

.flux-chip--empty {
  color: var(--slate-400);
}

/* Identity card */
.apercu-identity-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e4ec;
  overflow: hidden;
  min-height: fit-content;
  margin-bottom: 20px;
}

.apercu-identity-top {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid #eeeff4;
}

.apercu-identity-cell {
  padding: 22px 28px;
  position: relative;
}

/* Vertical separator between cells */
.apercu-identity-cell:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 16px;
  bottom: 16px;
  width: 1px;
  background: #eeeff4;
}

.apercu-cell-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8b8fa3;
  margin-bottom: 6px;
}

.apercu-cell-value {
  font-size: 18px;
  font-weight: 700;
  color: #1a1d23;
}

.apercu-cell-value--contract {
  font-size: 20px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.apercu-cell-helper {
  font-size: 12px;
  color: #8b8fa3;
  margin-top: 3px;
}

/* Assureur logo placeholder */
.apercu-assureur-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.apercu-assureur-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}

.apercu-assureur-name {
  font-size: 16px;
  font-weight: 600;
  color: #1a1d23;
}

/* Version row: V0 + Active inline */
.apercu-version-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.apercu-active-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: #22c55e;
}

.apercu-active-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

/* Bottom strip */
.apercu-identity-strip {
  display: flex;
  align-items: center;
  padding: 12px 28px;
  background: #fafafe;
}

.apercu-tag-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}



/* Details card */
.apercu-details-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e4ec;
  margin-bottom: 24px;
}

.apercu-details-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 28px;
  border-bottom: 1px solid #eeeff4;
  font-size: 14px;
  font-weight: 600;
  color: #3a3d4a;
}

.apercu-details-header .mud-icon-root {
  color: #8b8fa3;
  font-size: 20px;
}

.apercu-details-grid {
  display: flex;
  flex-direction: column;
}

.apercu-detail-item {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 6px;
  padding: 14px 28px;
  border-bottom: 1px solid #f5f5f8;
}

.apercu-detail-item--left-column {
  grid-column: auto;
  border-right: none;
}

.apercu-detail-item--affectations {
  align-items: flex-start;
}

.apercu-detail-item--population {
  grid-column: 1 / -1;
}

.apercu-detail-content {
  min-width: 0;
}

.apercu-detail-content--stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.apercu-population-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.apercu-population-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.apercu-population-line-label {
  min-width: 150px;
  font-size: 12px;
  font-weight: 600;
  color: #8b8fa3;
}

.apercu-population-line-value {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.apercu-detail-item:last-child {
  border-bottom: none;
}

.apercu-detail-label {
  font-size: 12.5px;
  font-weight: 500;
  color: #8b8fa3;
}

.apercu-detail-value {
  font-size: 13.5px;
  font-weight: 500;
  color: #1a1d23;
  min-width: 0;
  line-height: 1.5;
  word-break: break-word;
}

.apercu-detail-value--empty {
  font-style: italic;
  color: #8b8fa3;
}

/* Canonical "general information" grid — shared by the sante dispositif
   apercu and the prevoyance perimetre card so both screens read identically. */
.apercu-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
}

.apercu-info-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.apercu-info-field__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-500);
}

.apercu-info-field__value {
  font-size: 18px;
  font-weight: 600;
  color: var(--slate-900);
  word-break: break-word;
}

/* A field that must span the whole grid row (e.g. a wide table). */
.apercu-info-field--full {
  grid-column: 1 / -1;
}

.apercu-info-field__value--placeholder {
  font-size: 15px;
  font-weight: 500;
  font-style: italic;
  color: var(--slate-400);
}

.apercu-info-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Scalar-parameters zone inside a details card (padding wrapper for the grid) */
.apercu-details-params {
  padding: 20px 28px 24px;
}

.apercu-details-params--divided {
  border-top: 1px solid #eeeff4;
}

.apercu-affectations-table-wrapper {
  overflow-x: auto;
}

.apercu-affectations-table {
  width: 100%;
  border-collapse: separate;
  font-size: 12.5px;
}

.apercu-affectations-table td {
  text-align: left;
  padding: 0 22px 8px 0;
  white-space: nowrap;
  vertical-align: top;
}

.apercu-affectations-table tbody tr:last-child td {
  padding-bottom: 0;
}

.apercu-affectations-cell--first {
  padding-left: 0;
}

.sante-dispositif-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sante-dispositif-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.sante-dispositif-card__title-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.sante-dispositif-card__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sante-dispositif-card__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--slate-800);
}

.sante-dispositif-card__summary {
  font-size: 13px;
  color: var(--slate-500);
}

.sante-dispositif-card__actions,
.sante-dispositif-card__contrats-sante-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sante-dispositif-card__contrats-sante {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sante-dispositif-contrat-sante-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  background: #ffffff;
}

.sante-dispositif-contrat-sante-row--active {
  background: #ffffff;
  border-color: var(--sky-200);
}

.sante-dispositif-contrat-sante-row--interactive {
  cursor: pointer;
}

.sante-dispositif-contrat-sante-row--interactive .sante-dispositif-contrat-sante-row__main,
.sante-dispositif-contrat-sante-row--interactive .sante-dispositif-card__contrats-sante-chips,
.sante-dispositif-contrat-sante-row--interactive .sante-dispositif-contrat-sante-row__main div,
.sante-dispositif-contrat-sante-row--interactive .sante-dispositif-contrat-sante-row__main span {
  cursor: pointer;
}

.sante-dispositif-contrat-sante-row--interactive:hover {
  border-color: var(--sky-300);
  background: #ffffff;
}

.sante-dispositif-contrat-sante-row__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.sante-dispositif-card__contrats-sante-chips {
  align-items: center;
}

.sante-dispositif-contrat-sante-row__meta {
  font-size: 13px;
  color: var(--slate-500);
}

.sante-dispositif-contrat-sante-row__actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.sante-dispositif-contrat-sante-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--sky-300);
  border-radius: 8px;
  background: #ffffff;
  color: var(--sky-700);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.sante-dispositif-contrat-sante-action-btn:hover {
  background: var(--sky-50);
  border-color: var(--sky-400);
  color: var(--sky-800);
}

.sante-dispositif-contrat-sante-contract-tag {
  font-family: Consolas, "SFMono-Regular", Menlo, Monaco, "Liberation Mono", "Courier New", monospace;
}

.sante-dispositif-contrat-sante-contract-tag--missing {
  font-style: italic;
}

/* ============================================
   Niveaux santé — list of rich rows
   ============================================ */

.niveau-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.niveau-row {
  display: flex;
  align-items: stretch;
  gap: 24px;
  padding: 16px 20px;
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.niveau-row:hover {
  border-color: var(--slate-300);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.niveau-row--active {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.04);
  box-shadow: inset 3px 0 0 0 var(--mud-palette-primary);
  padding-left: 23px;
}

.niveau-row__identity {
  flex: 0 0 auto;
  min-width: 220px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 24px;
  border-right: 1px solid var(--slate-100);
}

.niveau-row__identity-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.niveau-row__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.niveau-row__contrat-number {
  font-family: Consolas, "SFMono-Regular", Menlo, Monaco, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-800);
}

.niveau-row__contrat-number--missing {
  font-family: inherit;
  font-style: italic;
  font-weight: 500;
  color: var(--slate-500);
}

.niveau-row__metadata {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  align-content: center;
  align-items: flex-start;
  min-width: 0;
}

.niveau-row__field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.niveau-row__field--full {
  flex: 1 1 100%;
  max-width: 100%;
}

.niveau-row__field-label {
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
  line-height: 1.4;
}

.niveau-row__field-value {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--slate-900);
  line-height: 1.35;
}

.niveau-row__field-value--icon {
  display: inline-flex;
  align-items: center;
  height: 19px;
}

.niveau-row__field-value--text {
  font-weight: 400;
  color: var(--slate-700);
  overflow-wrap: anywhere;
}

.niveau-row__actions {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-left: 24px;
  border-left: 1px solid var(--slate-100);
}

@media (max-width: 1100px) {
  .niveau-row {
    flex-wrap: wrap;
  }

  .niveau-row__identity {
    max-width: none;
    border-right: 0;
    padding-right: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--slate-100);
    min-width: 100%;
  }

  .niveau-row__actions {
    border-left: 0;
    padding-left: 0;
    padding-top: 12px;
    border-top: 1px solid var(--slate-100);
    min-width: 100%;
    justify-content: flex-end;
  }
}


/* Responsive: collapse at <=800px */
@media (max-width: 800px) {
  .apercu-identity-top {
    grid-template-columns: 1fr;
  }

  .apercu-identity-cell:not(:last-child)::after {
    display: none;
  }

  .apercu-identity-cell:not(:last-child) {
    border-bottom: 1px solid #eeeff4;
  }

  .apercu-detail-item--left-column {
    grid-column: auto;
    border-right: none;
  }

  .apercu-population-line {
    flex-direction: column;
    gap: 4px;
  }

  .apercu-population-line-label {
    min-width: 0;
  }

  .apercu-identity-strip {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .sante-global-header__hero {
    flex-direction: column;
    padding: 20px 20px 18px;
  }

  .sante-global-header__actions {
    width: 100%;
    justify-content: flex-start;
  }

  .sante-global-header__details {
    grid-template-columns: 1fr;
    margin-left: 0;
  }

  .sante-global-header__details::before {
    left: 20px;
    right: 20px;
    top: 0;
    bottom: auto;
    width: auto;
    height: 4px;
  }

  .sante-global-header__detail:not(:last-child) {
    border-right: none;
    border-bottom: 1px solid #eeeff4;
  }

  .sante-global-header__detail--population {
    padding-left: 24px;
  }

  .sante-dispositif-card__header,
  .sante-dispositif-contrat-sante-row {
    flex-direction: column;
  }

  .sante-dispositif-contrat-sante-row__version {
    text-align: left;
  }
}

.filldown-table td.prev-fill-cell {
  position: relative;
  transition: background-color 0.15s ease;
}

.filldown-table td.prev-fill-selected {
  background: rgba(37, 99, 235, 0.08) !important;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.42);
}

.filldown-table td.prev-fill-selected-single {
  background: transparent !important;
}

.filldown-table td.prev-fill-source {
  background: rgba(37, 99, 235, 0.08);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.42);
}

.filldown-table td.prev-fill-target {
  background: rgba(14, 165, 233, 0.12) !important;
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.48);
}

.filldown-table td.prev-fill-cell-copied {
  background: rgba(16, 185, 129, 0.08) !important;
}

.prev-fill-handle {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 6px;
  height: 6px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 1px;
  background: var(--mud-palette-primary);
  cursor: ns-resize;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.12s ease, transform 0.12s ease, background-color 0.12s ease;
  z-index: 2;
  touch-action: none;
}

.filldown-table td.prev-fill-cell:hover .prev-fill-handle,
.filldown-table td.prev-fill-selected-end .prev-fill-handle,
.filldown-table td.prev-fill-source .prev-fill-handle {
  opacity: 1;
  transform: scale(1);
}

.prev-fill-selection-active .filldown-table td.prev-fill-cell .prev-fill-handle {
  opacity: 0;
  transform: scale(0.85);
}

.prev-fill-selection-active .filldown-table td.prev-fill-selected-end .prev-fill-handle,
.prev-fill-selection-active .filldown-table td.prev-fill-source .prev-fill-handle {
  opacity: 1;
  transform: scale(1);
}

.filldown-table td.prev-fill-source .prev-fill-handle,
.filldown-table td.prev-fill-selected-end .prev-fill-handle,
.filldown-table td.prev-fill-target .prev-fill-handle {
  background: #0284c7;
}

.mandat-form-card {
  margin-bottom: 24px;
}

.mandat-selection-option {
  width: 100%;
  padding: 2px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mandat-selection-section-header {
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 0 4px;
}

.documents-juridiques-page {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.documents-juridiques-page__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 2px 2px;
}

.documents-juridiques-page .page-header {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.documents-juridiques-page .page-header,
.documents-juridiques-page .section-heading,
.documents-juridiques-page .row-actions {
  gap: 10px;
}

.documents-juridiques-page .section-heading,
.documents-juridiques-page .row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

/* Action buttons: keep label left-aligned with the icon pinned top-left
   so long labels (e.g. "Marquer comme à corriger") wrap tidily instead of
   rendering as a bulky, centered two-line block. */
.documents-juridiques-page .row-actions .mud-button-root {
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
}

.documents-juridiques-page .section-heading {
  justify-content: space-between;
  margin-bottom: 14px;
}

.documents-juridiques-page .section-heading h2,
.documents-juridiques-page .section-heading p {
  margin: 0;
}

.documents-juridiques-page .stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.documents-juridiques-page .mandats-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.documents-juridiques-page .pool-list {
  display: grid;
  gap: 8px;
}

.documents-juridiques-page .pool-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  padding: 10px 12px;
  text-align: left;
}

.documents-juridiques-page .pool-row.selected {
  border-color: #0284c7;
  background: #f0f9ff;
}

.documents-juridiques-page .pool-main,
.documents-juridiques-page .pool-counts {
  min-width: 0;
}

.documents-juridiques-page .pool-main {
  display: grid;
  gap: 2px;
}

.documents-juridiques-page .pool-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.documents-juridiques-page .pool-subtitle {
  color: #475569;
  font-size: 0.875rem;
}

.documents-juridiques-page .pool-counts {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px 8px;
  color: #475569;
  font-size: 0.8125rem;
}

.documents-juridiques-page .chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.documents-juridiques-page .mandat-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.documents-juridiques-page .mandat-detail-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #f8fafc;
}

.documents-juridiques-page .mandat-detail-item span {
  color: #64748b;
  font-size: 0.8125rem;
}

.documents-juridiques-page .mandat-detail-item strong {
  color: #0f172a;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.mandat-wizard {
  display: grid;
  gap: 16px;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.wizard-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 48px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  padding: 8px 10px;
  text-align: left;
}

.wizard-step:disabled {
  opacity: 0.68;
}

.wizard-step.active {
  border-color: #0284c7;
  background: #f0f9ff;
  color: #075985;
}

.wizard-step.completed {
  border-color: #16a34a;
  background: #f0fdf4;
  color: #166534;
}

.wizard-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 0.8125rem;
  font-weight: 700;
}

.wizard-step.active .wizard-step-index {
  background: #0284c7;
  color: #fff;
}

.wizard-step.completed .wizard-step-index {
  background: #16a34a;
  color: #fff;
}

.wizard-step-label {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.8125rem;
  font-weight: 700;
}

.wizard-panel {
  min-height: 220px;
}

.wizard-errors ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.choice-card {
  min-height: 44px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
}

.choice-card.selected {
  border-color: #0284c7;
  background: #f0f9ff;
  color: #075985;
}

.section-heading.compact {
  margin-bottom: 10px;
}

.section-heading.compact h3,
.section-heading.compact p {
  margin: 0;
}

.section-heading.compact h3 {
  font-size: 1rem;
}

.wizard-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wizard-summary > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.wizard-summary .label,
.wizard-summary .value {
  overflow-wrap: anywhere;
}

.wizard-summary .label {
  color: #64748b;
  font-size: 0.8125rem;
  font-weight: 700;
}

.wizard-summary .value {
  color: #0f172a;
}

.mandat-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.mandat-form-grid .wide {
  grid-column: 1 / -1;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-field label,
.form-label {
  color: #374151;
  font-size: 0.85rem;
  font-weight: 600;
}

.form-control {
  min-height: 40px;
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #111827;
  padding: 8px 10px;
}

.form-control:focus {
  outline: 2px solid rgba(2, 132, 199, 0.22);
  border-color: #0284c7;
}

.checkbox-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.checkbox-list.inline {
  grid-template-columns: repeat(4, minmax(0, max-content));
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  min-width: 0;
  color: #111827;
}

.checkbox-row span {
  overflow-wrap: anywhere;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

@media (max-width: 900px) {
  .documents-juridiques-page .page-header,
  .documents-juridiques-page .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .documents-juridiques-page .mandats-layout {
    grid-template-columns: 1fr;
  }

  .documents-juridiques-page .pool-row {
    flex-direction: column;
  }

  .documents-juridiques-page .pool-counts {
    justify-content: flex-start;
  }

  .mandat-form-grid,
  .checkbox-list {
    grid-template-columns: 1fr;
  }

  .checkbox-list.inline {
    grid-template-columns: 1fr 1fr;
  }

  .wizard-steps {
    grid-template-columns: 1fr;
  }

  .choice-grid,
  .wizard-summary {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Documents métier (contrat)
   ============================================ */

/* Toolbar: compact single row, filter left, action right */
.documents-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.documents-toolbar__filters {
  display: flex;
  align-items: center;
  margin-right: auto;
}

.documents-toolbar__actions {
  display: flex;
  align-items: center;
}

/* Table card */
.documents-table-card {
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

/* Main row actions: direct preview button next to the kebab menu */
.document-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

/* Document column cell: icon left, title over original file name */
.document-title-cell {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.document-title-cell__icon {
  display: inline-flex;
  flex: none;
  margin-top: 1px;
  color: var(--slate-500);
}

.document-title-cell__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.document-title-cell__title {
  color: var(--slate-800);
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.document-title-cell__file {
  color: var(--slate-500);
  font-size: 12px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* Expanded detail: description then versions table, directly on the row
   background. Left padding aligns content with the Document column (44px
   toggle column). No card/background — just spacing. */
.document-detail {
  display: grid;
  gap: 12px;
  padding: 12px 18px 16px 44px;
}

.document-detail__description {
  color: var(--slate-700);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.document-detail__description-empty {
  color: var(--slate-500);
  font-style: italic;
}

.document-detail__versions {
  display: grid;
  gap: 8px;
}

/* Versions sub-table: one shared grid template for header and rows */
.document-versions {
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.document-versions__head,
.document-versions__row {
  display: grid;
  grid-template-columns: 96px minmax(160px, 1fr) 90px 150px 80px;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
}

.document-versions__head {
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
  color: var(--slate-500);
  font-size: 11px;
  font-weight: 600;
}

.document-versions__row {
  min-height: 44px;
  border-bottom: 1px solid var(--slate-100);
  font-size: 13px;
}

.document-versions__row:last-child {
  border-bottom: none;
}

.document-versions__version {
  display: flex;
}

.document-versions__file {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.document-versions__file-name {
  color: var(--slate-700);
  overflow-wrap: anywhere;
}

.document-versions__comment {
  color: var(--slate-500);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.document-versions__meta {
  color: var(--slate-500);
  font-size: 12px;
}

.document-versions__actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.document-versions__empty {
  color: var(--slate-500);
  font-size: 13px;
  padding: 4px 2px;
}

/* Upload / replace dialogs */
.document-file-drop {
  display: grid;
  justify-items: center;
  gap: 6px;
  position: relative;
  width: 100%;
  padding: 20px;
  border: 1px dashed var(--slate-300);
  border-radius: 8px;
  color: var(--slate-600);
  cursor: pointer;
  background: var(--slate-50);
}

.document-file-drop__title {
  color: var(--slate-800);
  font-weight: 600;
}

.document-file-drop__meta {
  color: var(--slate-500);
  font-size: 12px;
}

.document-file-drop__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.document-dialog-file {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  color: var(--slate-600);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.document-dialog-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px);
  gap: 12px;
  margin: 12px 0;
}

/* Responsive: keep the real table on desktop, stack only on small screens */
@media (max-width: 900px) {
  .document-dialog-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .documents-toolbar {
    flex-wrap: wrap;
  }

  .documents-toolbar__actions {
    margin-left: auto;
  }

  .document-detail {
    padding-left: 14px;
  }

  .document-versions__head {
    display: none;
  }

  .document-versions__row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .document-versions__actions {
    justify-content: flex-start;
  }
}
