/*
 * SEXTANT — Outil Métier
 * Design tokens : identité visuelle du site sextant-expertises-maritimes.com
 * Palette exacte extraite de sextant_styles.css
 */

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --color-teal:       #058b8c;
  --color-teal-dark:  #046e6f;
  --color-navy:       #1a2d4e;
  --color-navy-light: #243d65;
  --color-cream:      #e8dfc0;
  --color-gold:       #b8924a;
  --color-gold-light: #cca96a;
  --color-white:      #ffffff;
  --color-offwhite:   #f7f8f9;
  --color-text:       #1e1e1e;
  --color-muted:      #6b7280;
  --color-border:     #e5e7eb;
  --color-success:    #16a34a;
  --color-warning:    #d97706;
  --color-danger:     #dc2626;
  --color-info:       #0891b2;

  /* Alias sémantiques — garantissent la compat des anciens templates
     qui référencent surface/text-secondary/accent. */
  --color-surface:        var(--color-white);
  --color-text-secondary: var(--color-muted);
  --color-accent:         var(--color-gold);
  --color-accent-rgb:     184, 146, 74;

  --font-serif:    'Cormorant Garamond', Georgia, serif;
  --font-sans:     'Inter', system-ui, sans-serif;
  --font-display:  var(--font-serif);

  --radius:     4px;
  --radius-lg:  8px;
  --transition: 0.2s ease;

  --sidebar-w:           260px;
  --sidebar-w-collapsed: 68px;
  --topbar-h:            58px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; font-size: 15px; }

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-offwhite);
  -webkit-font-smoothing: antialiased;
  display: flex;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { display: block; max-width: 100%; }

/* ---- Overlay mobile ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 199;
  cursor: pointer;
}
@media (max-width: 900px) {
  .sidebar-overlay { display: block; }
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width 0.22s ease, transform 0.25s ease;
  overflow: hidden;
  border-right: 1px solid #e5e7eb;
  box-shadow: 0 0 24px rgba(15, 23, 42, 0.04);
}

/* ---- Brand ---- */
.sidebar__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 68px;
  border-bottom: 1px solid #eef0f3;
  flex-shrink: 0;
}

.sidebar__logo-link {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar__logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar--collapsed .sidebar__logo-img {
  width: 40px;
  height: 40px;
}
.sidebar--collapsed .sidebar__logo-text { display: none; }

.sidebar__logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.sidebar__logo-sextant {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--color-navy);
}

.sidebar__logo-sub {
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-gold);
  font-weight: 600;
  margin-top: 2px;
}

.sidebar__toggle {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
  display: flex;
  align-items: center;
}

.sidebar__toggle:hover {
  color: var(--color-teal);
  background: #f1f5f5;
}

/* ---- Navigation ---- */
.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 0 8px;
  scrollbar-width: thin;
  scrollbar-color: #e5e7eb transparent;
}

.sidebar__section {
  margin-bottom: 6px;
  padding: 0 10px;
}

.sidebar__section-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 700;
  padding: 14px 10px 6px;
}

.sidebar__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #475569;
  font-size: 0.86rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.sidebar__link:hover {
  background: #f1f5f9;
  color: var(--color-navy);
}

.sidebar__link.active {
  background: linear-gradient(90deg, rgba(5, 139, 140, 0.12), rgba(5, 139, 140, 0.04));
  color: var(--color-teal);
  font-weight: 600;
}
.sidebar__link.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--color-teal);
}
.sidebar__link.active .sidebar__icon {
  color: var(--color-teal);
}

.sidebar__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  color: #64748b;
}

/* ---- Mode réduit (desktop) ---- */
.sidebar--collapsed {
  width: var(--sidebar-w-collapsed);
}

/* Cacher les textes quand collapsed */
.sidebar--collapsed .sidebar__logo-sextant,
.sidebar--collapsed .sidebar__logo-sub,
.sidebar--collapsed .sidebar__section-label,
.sidebar--collapsed .sidebar__link span,
.sidebar--collapsed .sidebar__user-info,
.sidebar--collapsed .sidebar__logout {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
  transition: opacity 0.15s ease;
}

/* Transition normale (état ouvert) */
.sidebar__logo-sextant,
.sidebar__logo-sub,
.sidebar__section-label,
.sidebar__link span,
.sidebar__user-info,
.sidebar__logout {
  transition: opacity 0.15s ease, width 0.15s ease;
}

/* Recentrer les icônes */
.sidebar--collapsed .sidebar__link {
  justify-content: center;
  padding: 10px 0;
}

/* Recentrer le brand */
.sidebar--collapsed .sidebar__brand {
  justify-content: center;
  padding: 0 10px;
}

/* Recentrer l'avatar utilisateur */
.sidebar--collapsed .sidebar__user {
  justify-content: center;
  padding: 12px 0;
}

/* Rotation de la flèche toggle */
.sidebar--collapsed .sidebar__toggle svg {
  transform: rotate(180deg);
}

/* ---- Utilisateur ---- */
.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid #eef0f3;
  flex-shrink: 0;
  background: #fafbfc;
}

.sidebar__user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-teal), #046f70);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar__user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar__user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-navy);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__user-role {
  font-size: 0.68rem;
  color: #94a3b8;
}

.sidebar__logout {
  color: #94a3b8;
  transition: color var(--transition);
  padding: 6px;
  border-radius: 6px;
}

.sidebar__logout:hover {
  color: var(--color-teal);
  background: #f1f5f5;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
  overflow-x: hidden;  /* empêche tout débordement horizontal */
  min-width: 0;
}

.main-content--expanded {
  margin-left: var(--sidebar-w-collapsed);
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  min-height: var(--topbar-h);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 24px;
  z-index: 100;
  flex-shrink: 0;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.topbar__right .btn {
  min-width: 0;
}

.topbar__menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-muted);
  padding: 6px;
  border-radius: var(--radius);
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--color-muted);
  min-width: 0;
  overflow: hidden;
}

.breadcrumb__item {
  color: var(--color-muted);
  transition: color var(--transition);
  min-width: 0;
}

.breadcrumb__item:hover { color: var(--color-teal); }

.breadcrumb__sep::before {
  content: "/";
  margin: 0 2px;
  color: var(--color-border);
}

.breadcrumb__current {
  color: var(--color-text);
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
  flex: 1;
  padding: 28px 28px 40px;
  max-width: 1400px;
  width: 100%;
}

/* ---- Page header ---- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header > div {
  min-width: 0;
}

.page-header__title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--color-navy);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.page-header__subtitle {
  font-size: 0.82rem;
  color: var(--color-muted);
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.page-header__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card--navy {
  background: var(--color-navy);
  border-color: var(--color-navy);
  color: var(--color-white);
}

.card--teal {
  background: var(--color-teal);
  border-color: var(--color-teal);
  color: var(--color-white);
}

.card__header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card--navy .card__header,
.card--teal .card__header {
  border-bottom-color: rgba(255,255,255,0.12);
}

.card__title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-navy);
}

.card--navy .card__title,
.card--teal .card__title {
  color: var(--color-white);
}

.card__body {
  padding: 20px 22px;
}

/* ============================================================
   STATS (dashboard)
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
}

.stat-card--teal::before   { background: var(--color-teal); }
.stat-card--gold::before   { background: var(--color-gold); }
.stat-card--navy::before   { background: var(--color-navy); }
.stat-card--danger::before { background: var(--color-danger); }
.stat-card--green::before  { background: #10b981; }

.stat-card__icon {
  width: 32px;
  height: 32px;
  margin-bottom: 10px;
  opacity: 0.25;
  color: var(--color-navy);
}
.stat-card--teal .stat-card__icon  { color: var(--color-teal); }
.stat-card--gold .stat-card__icon  { color: var(--color-gold); }
.stat-card--green .stat-card__icon { color: #10b981; }

.stat-card__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-card__value {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--color-navy);
  line-height: 1;
}

.stat-card__sub {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: 6px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.table-wrapper .table {
  min-width: 760px;
}

.table-wrapper--compact .table {
  min-width: 640px;
}

.table th {
  text-align: left;
  padding: 11px 14px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-muted);
  background: var(--color-offwhite);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  overflow-wrap: anywhere;
}

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

.table tbody tr:hover td { background: #f9fafb; }

.table a { color: var(--color-teal); font-weight: 500; }
.table a:hover { color: var(--color-teal-dark); }

/* ============================================================
   BADGES STATUT
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge--attente-pieces  { background: #fef3c7; color: #92400e; }
.badge--attente-rdv     { background: #dbeafe; color: #1e40af; }
.badge--complet         { background: #dcfce7; color: #166534; }
.badge--clos            { background: #f3f4f6; color: #374151; }

.badge--sinistre     { background: #fee2e2; color: #991b1b; }
.badge--judiciaire   { background: #ede9fe; color: #5b21b6; }
.badge--pre-achat    { background: #e0f2fe; color: #075985; }
.badge--pre-assurance { background: #f0fdf4; color: #14532d; }

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.btn--primary {
  background: var(--color-teal);
  color: var(--color-white);
  border-color: var(--color-teal);
}

.btn--primary:hover {
  background: var(--color-teal-dark);
  border-color: var(--color-teal-dark);
}

.btn--navy {
  background: var(--color-navy);
  color: var(--color-white);
  border-color: var(--color-navy);
}

.btn--navy:hover {
  background: var(--color-navy-light);
  border-color: var(--color-navy-light);
}

.btn--outline {
  background: transparent;
  color: var(--color-teal);
  border-color: var(--color-teal);
}

.btn--outline:hover {
  background: var(--color-teal);
  color: var(--color-white);
}

.btn--ghost {
  background: transparent;
  color: var(--color-muted);
  border-color: var(--color-border);
}

.btn--ghost:hover {
  background: var(--color-offwhite);
  color: var(--color-text);
}

.btn--danger {
  background: var(--color-danger);
  color: var(--color-white);
  border-color: var(--color-danger);
}

.btn--sm {
  padding: 5px 12px;
  font-size: 0.78rem;
}

.btn svg { width: 15px; height: 15px; }

/* ============================================================
   FORMULAIRES
   ============================================================ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-navy);
  margin-bottom: 6px;
}

.form-label .required { color: var(--color-danger); margin-left: 3px; }

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  color: var(--color-text);
  background: var(--color-white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(5, 139, 140, 0.12);
}

.form-control::placeholder { color: var(--color-muted); }

textarea.form-control { resize: vertical; min-height: 90px; }

select.form-control { cursor: pointer; }

.form-select {
  width: 100%;
  padding: 9px 36px 9px 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  color: var(--color-text);
  background-color: var(--color-white);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  line-height: 1.4;
}

.form-select:hover:not(:disabled) {
  border-color: #cbd5e1;
}

.form-select:focus {
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(5, 139, 140, 0.12);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23058b8c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.form-select:disabled {
  background-color: #f9fafb;
  color: var(--color-muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.form-select option {
  padding: 8px;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-white);
}

.form-select[multiple] {
  padding-right: 13px;
  background-image: none;
  min-height: 120px;
}

.form-select[multiple] option:checked {
  background: var(--color-teal) linear-gradient(0deg, var(--color-teal), var(--color-teal));
  color: #fff;
}

.form-hint {
  font-size: 0.73rem;
  color: var(--color-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.75rem;
  color: var(--color-danger);
  margin-top: 4px;
}

/* --- Masque les flèches natives des inputs number pour un rendu propre --- */
input[type="number"].form-control {
  -moz-appearance: textfield;
  text-align: right;
}
input[type="number"].form-control::-webkit-outer-spin-button,
input[type="number"].form-control::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* --- Icône calendrier stylée sur input[type=date] --- */
input[type="date"].form-control {
  font-family: var(--font-sans);
  position: relative;
}
input[type="date"].form-control::-webkit-calendar-picker-indicator {
  opacity: 0.55;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  transition: opacity .15s, background .15s;
}
input[type="date"].form-control::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  background: var(--color-offwhite);
}
input[type="date"].form-control:focus::-webkit-calendar-picker-indicator {
  opacity: 1;
}

/* --- Textarea : grip discret et min-height cohérent --- */
textarea.form-control {
  resize: vertical;
  min-height: 92px;
  line-height: 1.55;
}

/* --- Champ à suffixe (ex: €, m, nd) --- */
.form-input-suffix {
  position: relative;
  display: block;
}
.form-input-suffix .form-control { padding-right: 32px; }
.form-input-suffix__unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  color: var(--color-muted);
  pointer-events: none;
  font-weight: 500;
}

/* ============================================================
   TRI-STATE (Oui / Non / NC) — segmented control
   ============================================================ */
.tri-state {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 4px;
  background: var(--color-offwhite);
  gap: 4px;
  width: fit-content;
  max-width: 100%;
}
.tri-state__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}
.tri-state__opt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-muted);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
  user-select: none;
  white-space: nowrap;
  line-height: 1.2;
  min-width: 64px;
}
.tri-state__opt svg { flex-shrink: 0; opacity: 0.7; }
.tri-state__opt:hover { color: var(--color-navy); background: rgba(255,255,255,0.6); }
.tri-state__opt:hover svg { opacity: 1; }

/* Focus ring accessible */
.tri-state__input:focus-visible + .tri-state__opt {
  box-shadow: 0 0 0 2px rgba(5, 139, 140, 0.35);
}

/* États actifs — couleurs sémantiques */
.tri-state__input:checked + .tri-state__opt--yes {
  background: var(--color-white);
  color: #065f46;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.tri-state__input:checked + .tri-state__opt--yes svg {
  color: #10b981;
  opacity: 1;
}
.tri-state__input:checked + .tri-state__opt--no {
  background: var(--color-white);
  color: #991b1b;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.tri-state__input:checked + .tri-state__opt--no svg {
  color: var(--color-danger);
  opacity: 1;
}
.tri-state__input:checked + .tri-state__opt--nc {
  background: var(--color-white);
  color: var(--color-navy);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.tri-state__input:checked + .tri-state__opt--nc svg {
  color: var(--color-navy);
  opacity: 1;
}

/* ============================================================
   ALERTS / MESSAGES
   ============================================================ */
.messages-container {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: 0.84rem;
  border: 1px solid transparent;
}

.alert--success  { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert--warning  { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert--error    { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert--info     { background: #f0f9ff; color: #075985; border-color: #bae6fd; }

.alert__close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0 4px;
}

.alert__close:hover { opacity: 1; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 56px 32px;
  color: var(--color-muted);
}

.empty-state__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  opacity: 0.3;
  stroke: var(--color-navy);
}

.empty-state__title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--color-navy);
  margin-bottom: 6px;
}

.empty-state__text {
  font-size: 0.85rem;
  margin-bottom: 20px;
}

/* ============================================================
   DIVIDER
   ============================================================ */
.divider {
  height: 1px;
  background: var(--color-border);
  margin: 24px 0;
}

/* ============================================================
   SECTION TITLE
   ============================================================ */
.section-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-navy);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--color-teal);
  display: inline-block;
}

/* ============================================================
   UTILS
   ============================================================ */
.text-teal   { color: var(--color-teal); }
.text-navy   { color: var(--color-navy); }
.text-gold   { color: var(--color-gold); }
.text-muted  { color: var(--color-muted); }
.text-serif  { font-family: var(--font-serif); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

.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; }

.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

/* Texte utilitaires */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-sm     { font-size: 0.82rem; }
.text-warning{ color: var(--color-warning); }
.d-inline    { display: inline; }

/* Formulaire — layout lignes */
.form-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  align-items: flex-start;
}
.form-row + .form-row { margin-top: 0; }
.form-row > * { min-width: 0; }
.form-row .form-group,
.form-row > div > .form-group {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
.form-row .form-group .form-label,
.form-row > div .form-label {
  min-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.form-row .flex-1 { flex: 1; min-width: 100px; }
.form-row .flex-2 { flex: 2; min-width: 150px; }
.form-row .flex-3 { flex: 3; min-width: 200px; }
.form-row .flex-4 { flex: 4; min-width: 240px; }

/* Les tri-state se plient correctement dans les form-row */
.form-row .tri-state-group .tri-state { width: 100%; justify-content: stretch; }
.form-row .tri-state-group .tri-state__opt { flex: 1; }

@media (max-width: 600px) {
  .form-row .flex-1,
  .form-row .flex-2,
  .form-row .flex-3,
  .form-row .flex-4 { flex: 1 1 100%; min-width: 0; }
}

/* Section heading — épuré, barre latérale discrète */
.section-heading {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-navy);
  letter-spacing: 0.01em;
  margin: 24px 0 14px;
  padding-left: 10px;
  border-left: 3px solid var(--color-teal);
  line-height: 1.2;
}
.section-heading:first-child { margin-top: 4px; }

/* Form actions (barre bouton en bas de formulaire) */
.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
  margin-top: 20px;
  flex-wrap: wrap;
}
.form-actions .cell-sub { margin-left: auto; }
.form-actions .alert { margin: 0; }

/* ============================================================
   ONGLETS (tabs)
   ============================================================ */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--color-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 10px 18px;
  font-size: 0.84rem;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--color-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover {
  color: var(--color-navy);
}
.tab-btn--active {
  color: var(--color-teal) !important;
  border-bottom-color: var(--color-teal) !important;
}

/* ============================================================
   TABLEAU QUANTUM
   ============================================================ */

.table--quantum {
  font-size: 0.82rem;
  border-collapse: collapse;
  width: 100%;
}

.table--quantum th {
  background: var(--color-navy);
  color: var(--color-cream);
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 9px 12px;
  white-space: nowrap;
}

.table--quantum td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.table--quantum .col-ordre    { width: 36px; }
.table--quantum .col-nature   { min-width: 200px; }
.table--quantum .col-type     { min-width: 140px; }
.table--quantum .col-compte   { width: 70px; }
.table--quantum .col-annee    { width: 60px; }
.table--quantum .col-money    { width: 110px; }
.table--quantum .col-tva      { width: 55px; }
.table--quantum .col-abatt    { width: 80px; }
.table--quantum .col-decision { width: 120px; }
.table--quantum .col-actions  { width: 64px; white-space: nowrap; }

.ligne-quantum:hover td { background: var(--color-offwhite); }

.ligne-quantum.ligne-decision--refuse td {
  background: #fff8f8;
  color: #888;
  text-decoration: line-through;
}

.ligne-quantum.ligne-decision--accepte td { background: #f6fffa; }

.table--quantum tfoot .sous-total td {
  background: #f3f4f6;
  padding: 6px 12px;
  font-size: 0.8rem;
}

.table--quantum tfoot .total-general td {
  background: var(--color-navy);
  color: #fff;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.table--quantum tfoot .total-general .text-teal { color: var(--color-cream); }

/* Badges compte */
.badge-compte {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
}
.badge-compte--RRS { background: #dbeafe; color: #1e40af; }
.badge-compte--MC  { background: #fef9c3; color: #854d0e; }
.badge-compte--DAE { background: #f3e8ff; color: #7e22ce; }
.badge-compte--REP { background: #dcfce7; color: #166534; }

/* Badges décision */
.badge-decision--accepte   { background: #dcfce7; color: #166534; font-size: 0.75rem; padding: 2px 8px; border-radius: 3px; }
.badge-decision--abattement{ background: #fef3c7; color: #92400e; font-size: 0.75rem; padding: 2px 8px; border-radius: 3px; }
.badge-decision--refuse    { background: #fee2e2; color: #991b1b; font-size: 0.75rem; padding: 2px 8px; border-radius: 3px; }
.badge-decision--attente   { background: #f3f4f6; color: #6b7280; font-size: 0.75rem; padding: 2px 8px; border-radius: 3px; }

/* Badge statut devis */
.badge--en_cours        { background: #f3f4f6; color: #6b7280; }
.badge--accepte_partiel { background: #fef3c7; color: #92400e; }
.badge--accepte_total   { background: #dcfce7; color: #166534; }
.badge--refuse          { background: #fee2e2; color: #991b1b; }

/* Input auto (calculé) */
.input-with-badge { position: relative; }
.input-badge {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  pointer-events: none;
}
.input-badge--auto { background: var(--color-teal); color: #fff; }
.input-auto { padding-right: 48px; }

/* Boutons icônes dans le tableau */
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--color-muted);
  padding: 2px 4px;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}
.btn-icon:hover { color: var(--color-navy); background: var(--color-offwhite); }
.btn-icon--danger:hover { color: var(--color-danger); background: #fee2e2; }

/* ============================================================
   DASHBOARD
   ============================================================ */

/* Grilles */
.dashboard-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.dashboard-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1.6fr;
  gap: 14px;
  margin-bottom: 20px;
}
.dashboard-grid-2-wide {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.dashboard-grid-2 {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
}

/* Mini-card (blocs stat secondaires) */
.mini-card {
  background: var(--color-offwhite);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}
.mini-card__label {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 6px;
}
.mini-card__value {
  font-size: 2rem;
  font-family: var(--font-display);
  color: var(--color-navy);
  line-height: 1;
}
.mini-card__sub {
  font-size: 0.78rem;
  color: var(--color-muted);
  margin-top: 4px;
}

/* Barres de progression */
.progress-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}
.progress-bar--sm {
  height: 5px;
}
.progress-bar__fill {
  height: 100%;
  border-radius: 99px;
  background: var(--color-teal);
}
.progress-bar__fill--navy  { background: var(--color-navy); }
.progress-bar__fill--muted { background: var(--color-teal); opacity: 0.75; }

/* Ligne cliquable "Sans RDV" */
.dossier-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  transition: background var(--transition);
  color: inherit;
}
.dossier-row:hover { background: var(--color-offwhite); }
.dossier-row__numero {
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--color-navy);
}
.dossier-row__navire {
  font-size: 0.76rem;
  color: var(--color-muted);
  margin-top: 1px;
}
.dossier-row__date {
  font-size: 0.76rem;
  color: var(--color-muted);
  text-align: right;
}

/* Répartition type mission */
.mission-type-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mission-type-row__header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.mission-type-row__label {
  font-size: 0.78rem;
  color: var(--color-navy);
}
.mission-type-row__count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-muted);
}

/* Répartition bureau */
.bureau-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bureau-row__header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.bureau-row__name  { font-size: 0.82rem; }
.bureau-row__count { font-size: 0.82rem; font-weight: 600; color: var(--color-teal); }
.bureau-row__count--navy { color: var(--color-navy); }

/* RDV table — cellule date */
.rdv-date-main { font-weight: 600; font-size: 0.84rem; color: var(--color-teal); }
.rdv-date-sub  { font-size: 0.76rem; color: var(--color-muted); }

/* ============================================================
   DASHBOARD — Messagerie & badges
   ============================================================ */

/* Badge count sur titre de card */
.db-badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  margin-left: 6px;
  vertical-align: middle;
}

/* Rangée mail */
.db-mail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.db-mail-row:last-child { border-bottom: none; }
.db-mail-row:hover { background: var(--color-offwhite); }
.db-mail-row--unread { background: #f0f7ff; }
.db-mail-row--unread:hover { background: #e3f0fd; }

.db-mail-row__left  { min-width: 0; flex: 1; }
.db-mail-row__right { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.db-mail-row__from {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-mail-row__subject {
  font-size: 0.76rem;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dot non lu */
.db-mail-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-danger);
  flex-shrink: 0;
}

/* ============================================================
   DÉTAIL DOSSIER — composants spécifiques
   ============================================================ */

/* Dropdown statut */
.status-dropdown {
  position: relative;
}
.status-dropdown__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  z-index: 50;
  min-width: 280px;
  overflow: hidden;
}
.status-dropdown__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 0.84rem;
  transition: background var(--transition);
  width: 100%;
}
.status-dropdown__item:hover { background: var(--color-offwhite); }

/* Icône statut email (check / pending) */
.mail-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mail-status-icon--sent    { background: #e6f7f4; }
.mail-status-icon--pending { background: #f3f4f6; }

/* Résumé expertise (statut / date / lieu / progression) */
.expertise-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.expertise-summary__item { min-width: 0; }
.expertise-summary__label {
  font-size: 0.78rem;
  color: var(--color-muted);
}
.expertise-summary__value {
  font-size: 0.84rem;
  font-weight: 500;
  margin-top: 2px;
}
.expertise-summary__progress {
  flex: 1;
  min-width: 160px;
}
.expertise-summary__progress-track {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

/* Document item */
.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--color-offwhite);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}
.doc-item__left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.doc-item__name {
  font-weight: 500;
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-item__meta { font-size: 0.72rem; color: var(--color-muted); }

/* Formulaire ajout intervenant */
.intervenant-add {
  border-top: 1px solid var(--color-border);
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}

.intervenant-add__toggle {
  padding: 14px 20px;
}

.intervenant-add__panel {
  padding: 0 20px 20px;
}

.intervenant-add__form {
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(10, 26, 47, 0.06);
}

.intervenant-form-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) minmax(220px, 1fr) minmax(210px, 0.8fr);
  gap: 14px;
  align-items: stretch;
}

.intervenant-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: flex-end;
  gap: 7px;
}

.intervenant-field__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.intervenant-field .form-control {
  width: 100%;
  min-height: 42px;
}

.intervenant-new-contact {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--color-teal);
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.intervenant-new-contact:hover {
  color: var(--color-navy);
}

.intervenant-new-contact svg {
  width: 13px;
  height: 13px;
}

.intervenant-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
}

.intervenant-check__input,
.intervenant-check input {
  appearance: auto;
  min-height: 0;
  width: 17px;
  height: 17px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  accent-color: var(--color-teal);
  border-radius: 4px;
}

.intervenant-check span {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.intervenant-check strong {
  color: var(--color-navy);
  font-size: 0.82rem;
  font-weight: 700;
}

.intervenant-check small {
  color: var(--color-muted);
  font-size: 0.72rem;
}

.intervenant-field--submit {
  grid-column: 1 / -1;
  align-items: flex-end;
  justify-content: flex-end;
}

.intervenant-field--submit .btn {
  min-height: 42px;
  white-space: nowrap;
}
@media (max-width: 700px) {
  .intervenant-form-grid { grid-template-columns: 1fr; }
  .intervenant-field__head {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
  .intervenant-field--submit .btn {
    width: 100%;
    justify-content: center;
  }
  .status-dropdown__menu { right: auto; left: 0; min-width: 240px; }
}

/* ============================================================
   PAGE SIMULER MAIL — layout & composants
   ============================================================ */

.sim-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  align-items: start;
}
.sim-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Bouton exemple (texte aligné à gauche) */
.btn--example {
  text-align: left;
  justify-content: flex-start;
  width: 100%;
}

/* Étapes pipeline IA */
.pipeline-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pipeline-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.pipeline-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--color-teal);
  color: white;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
}
.pipeline-step__title {
  font-size: 0.84rem;
  font-weight: 500;
}
.pipeline-step__desc {
  font-size: 0.76rem;
  color: var(--color-muted);
}

@media (max-width: 700px) {
  .sim-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   EXPERTISES — IA, modales, sections, photos
   ============================================================ */

/* ---- Spinner IA ------------------------------------------ */
@keyframes spin { to { transform: rotate(360deg); } }
.ia-spinner {
  width: 48px; height: 48px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--color-teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

/* ---- Bouton teal ----------------------------------------- */
.btn--teal { background: var(--color-teal); color: #fff; border: none; }
.btn--teal:hover { background: #0f766e; }
.btn--teal:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---- Overlay modale IA ----------------------------------- */
.ia-overlay {
  position: fixed; inset: 0; z-index: 9999;
}
.ia-overlay__backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 26, 47, 0.72);
}
.ia-overlay__content {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 90%; max-width: 520px;
  padding: 20px;
}
.ia-modal {
  background: #fff;
  border-radius: 16px;
  width: 90%; max-width: 480px;
  text-align: center;
  padding: 40px 48px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}
.ia-modal--wide { max-width: 640px; text-align: left; padding: 0; }
.ia-modal__header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
}
.ia-modal__title { font-weight: 700; font-size: 1rem; color: var(--color-navy); margin-bottom: 2px; }
.ia-modal__body  { padding: 20px 28px; }
.ia-modal__close {
  background: none; border: none; cursor: pointer;
  color: var(--color-muted); font-size: 1.4rem; line-height: 1;
}
.ia-modal__footer {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 20px;
}

/* Sources / warning / hint dans modale */
.ia-sources-title {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: #8B6914; margin-bottom: 6px;
}
.ia-sources-list { font-size: 0.82rem; color: #374151; line-height: 1.7; padding-left: 16px; }
.ia-warning {
  background: #fffbeb; border: 1px solid #fcd34d;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 16px;
}
.ia-warning__title { font-size: 0.78rem; font-weight: 600; color: #92400e; margin-bottom: 4px; }
.ia-warning__text  { font-size: 0.8rem; color: #92400e; }
.ia-hint {
  font-size: 0.8rem; color: #374151; background: #f0fdf4;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 20px;
}
.ia-fields-title {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--color-muted); margin-bottom: 10px;
}
.ia-field-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.ia-field-row {
  display: flex; gap: 10px; padding: 6px 10px;
  background: #f9fafb; border-radius: 6px; font-size: 0.82rem;
}
.ia-field-key   { color: #8B6914; font-weight: 600; min-width: 220px; flex-shrink: 0; }
.ia-field-value { color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }

/* ---- Toast ------------------------------------------------ */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 10000;
  padding: 14px 20px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  font-size: .88rem; font-weight: 500; max-width: 420px;
}
.toast--ok  { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.toast--err { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ---- En-tête page avec actions IA + PDF ------------------ */
/* ============================================================
   EXPERTISE HEADER — identité, statut, actions
   ============================================================ */
.xp-header {
  margin-bottom: 24px;
}

.xp-header__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.xp-header__identity { min-width: 0; flex: 1; }

.xp-header__title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--color-navy);
  line-height: 1.2;
  margin: 0;
}
.xp-header__subtitle {
  font-size: 0.86rem;
  color: var(--color-muted);
  margin: 6px 0 0;
  line-height: 1.4;
}
.xp-header__sep {
  display: inline-block;
  margin: 0 2px;
  color: #d1d5db;
}

.xp-header__strip {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  margin-top: 16px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(10, 26, 47, 0.04);
  flex-wrap: wrap;
}

/* --- Status chip animé --- */
.xp-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 10px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.xp-status__dot {
  width: 8px; height: 8px;
  border-radius: 99px;
  background: currentColor;
  position: relative;
  flex-shrink: 0;
}
.xp-status--brouillon  { background: #f3f4f6; color: #6b7280; }
.xp-status--en_cours   { background: #e0f2f1; color: #0e7f6e; }
.xp-status--finalisee  { background: #dcfce7; color: #166534; }

/* Pulse uniquement en cours */
.xp-status--en_cours .xp-status__dot::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: currentColor;
  opacity: 0.6;
  animation: xp-pulse 2s ease-out infinite;
}
@keyframes xp-pulse {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* --- Progress bar ample --- */
.xp-progress {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.xp-progress__track {
  flex: 1;
  height: 8px;
  background: var(--color-border);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}
.xp-progress__fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--color-teal) 0%, #0fa5a5 100%);
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.xp-progress__pct {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-navy);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: right;
}

/* --- Tools zone (boutons groupés à droite) --- */
.xp-header__tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============================================================
   BTN-GROUP — boutons connectés visuellement
   ============================================================ */
.btn-group {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-white);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(10, 26, 47, 0.03);
}
.btn-group .btn {
  border: none !important;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  font-weight: 500;
  color: var(--color-text);
}
.btn-group .btn + .btn {
  border-left: 1px solid var(--color-border) !important;
}
.btn-group .btn:hover:not(:disabled) {
  background: var(--color-offwhite) !important;
  color: var(--color-navy);
}
.btn-group .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-group .btn svg {
  color: var(--color-muted);
  transition: color .15s;
}
.btn-group .btn:hover:not(:disabled) svg { color: var(--color-teal); }

/* Bouton accentué teal (famille judiciaire) */
.btn--teal-accent {
  color: var(--color-teal) !important;
  font-weight: 600 !important;
}
.btn--teal-accent svg { color: var(--color-teal) !important; }

@media (max-width: 900px) {
  .xp-header__strip { flex-direction: column; align-items: stretch; }
  .xp-progress { width: 100%; }
  .xp-header__tools { width: 100%; justify-content: flex-start; }
}
@media (max-width: 520px) {
  .xp-header__top { flex-direction: column; }
  .xp-header__top .btn--primary { width: 100%; justify-content: center; }
  .xp-header__tools { flex-direction: column; align-items: stretch; }
  .btn-group { width: 100%; }
  .btn-group .btn { flex: 1; justify-content: center; }
}

/* ---- Grilles spécifiques expertise ----------------------- */
.conformite-docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px 14px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--color-offwhite);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.conformite-docs-grid .form-group { margin-bottom: 0; }
.conformite-docs-grid .tri-state { width: 100%; justify-content: stretch; }
.conformite-docs-grid .tri-state__opt { flex: 1; }
.conformite-docs-grid .form-label {
  font-size: 0.78rem;
  margin-bottom: 4px;
  color: var(--color-navy);
}

/* Grille des 7 critères : 2 colonnes, chaque critère en mini-card */
.criteres-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.criteres-grid .form-group {
  margin-bottom: 0;
  padding: 10px 12px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.criteres-grid .form-group:hover { border-color: #cbd5e1; }
.criteres-grid .form-label {
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.3;
}
.criteres-grid .tri-state { width: 100%; justify-content: stretch; }
.criteres-grid .tri-state__opt { flex: 1; }

/* ---- Photos ---------------------------------------------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  padding: 20px;
}
.photo-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-offwhite);
}
.photo-card__img {
  width: 100%; height: 150px;
  object-fit: cover; display: block;
}
.photo-card__info { padding: 10px 12px; }
.photo-card__title { font-size: 0.82rem; font-weight: 500; margin-bottom: 2px; }
.photo-card__caption { font-size: 0.78rem; color: var(--color-muted); }

/* ---- Tableau essais / points — header inline ------------- */
.table-section-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 10px;
}

@media (max-width: 700px) {
  .criteres-grid    { grid-template-columns: 1fr; }
  .ia-field-key     { min-width: 140px; }
  .ia-modal--wide   { max-width: 96vw; }
}

/* ============================================================
   FORMULAIRES — grilles et actions
   ============================================================ */

/* Layout principal : 2 colonnes (infos gauche / navire droite) */
.form-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* Grilles internes */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

/* Boutons d'action (bas de formulaire) */
@media (max-width: 700px) {
  .form-cols   { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { flex: 1; justify-content: center; text-align: center; }
}

/* Groupe de boutons alignés à droite dans une cellule de tableau */
.table-row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

/* ---- Tooltip survol numéro de dossier -------------------- */
.dossier-ref__link {
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-navy);
  text-decoration: none;
  border-bottom: 1px dashed var(--color-border);
  transition: border-color var(--transition), color var(--transition);
}
.dossier-ref__link:hover { color: var(--color-teal); border-bottom-color: var(--color-teal); }

.dossier-tooltip {
  position: fixed;
  z-index: 9999;
  background: var(--color-navy);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  min-width: 240px;
  max-width: 300px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  font-size: 0.78rem;
  line-height: 1.6;
  pointer-events: none;
}
.dossier-tooltip::before {
  content: '';
  position: absolute;
  top: -5px; left: 14px;
  width: 10px; height: 10px;
  background: var(--color-navy);
  transform: rotate(45deg);
  border-radius: 2px;
}
.dossier-tooltip__row {
  display: flex;
  gap: 8px;
  padding: 2px 0;
}
.dossier-tooltip__label {
  color: rgba(255,255,255,0.55);
  flex-shrink: 0;
  min-width: 70px;
}
.dossier-tooltip__value { color: #fff; }
.dossier-tooltip__warning {
  margin-top: 6px;
  padding: 5px 8px;
  background: rgba(251,191,36,0.15);
  border-left: 2px solid #fbbf24;
  border-radius: 3px;
  color: #fde68a;
  font-size: 0.74rem;
  line-height: 1.5;
}

/* ============================================================
   LISTES — filtres, recherche, tableaux mobiles
   ============================================================ */

/* Barre de filtres + recherche */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  padding: 14px 18px;
}
.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.search-form {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 1 1 260px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}
.search-input {
  width: min(100%, 260px);
  padding: 7px 12px;
}
.contact-search-form {
  justify-content: flex-start;
}
.contact-search-form .search-input {
  width: min(100%, 340px);
}

/* Barre de filtres séparée (messagerie) */
.filter-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-pills__sep {
  width: 1px;
  height: 20px;
  background: var(--color-border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* Point de statut (lu/non-lu/erreur) */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot--unread  { background: var(--color-teal); }
.status-dot--error   { background: var(--color-danger); }

/* Barre de confiance IA */
.confidence-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}
.confidence-bar__track {
  width: 48px;
  height: 5px;
  background: var(--color-border);
  border-radius: 99px;
  overflow: hidden;
  flex-shrink: 0;
}
.confidence-bar__fill         { height: 100%; border-radius: 99px; background: var(--color-teal); }
.confidence-bar__fill--medium { background: var(--color-warning); }
.confidence-bar__fill--low    { background: var(--color-danger); }
.confidence-bar__label        { font-size: 0.74rem; color: var(--color-muted); }

/* Sous-texte muted dans cellule */
.cell-sub { font-size: 0.73rem; color: var(--color-muted); }

/* Colonnes à masquer sur petit écran */
@media (max-width: 700px) {
  .hide-mobile { display: none !important; }
  .filter-bar {
    align-items: stretch;
    gap: 10px;
  }
  .filter-tabs,
  .search-form {
    width: 100%;
    justify-content: flex-start;
  }
  .search-input {
    flex: 1 1 160px;
    width: auto;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  /* Sidebar : off-canvas par défaut, glisse avec transform */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    /* annuler le collapse desktop sur mobile */
    width: var(--sidebar-w) !important;
  }
  .sidebar--mobile-open { transform: translateX(0); }

  .main-content { margin-left: 0 !important; }
  .topbar__menu-btn { display: flex; }
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 10px 16px;
  }
  .topbar__right {
    width: 100%;
    justify-content: flex-start;
  }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  /* dashboard */
  .dashboard-grid-4     { grid-template-columns: 1fr 1fr; }
  .dashboard-grid-3     { grid-template-columns: 1fr 1fr; }
  .dashboard-grid-2-wide { grid-template-columns: 1fr; }
  .dashboard-grid-2     { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .page-content { padding: 18px 16px 32px; }
  .stats-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar__right .btn {
    flex: 1 1 auto;
    justify-content: center;
    line-height: 1.2;
    white-space: normal;
  }
  .card__header {
    padding: 16px;
  }
  .card__body {
    padding: 16px;
  }
  /* dashboard */
  .dashboard-grid-4 { grid-template-columns: 1fr; }
  .dashboard-grid-3 { grid-template-columns: 1fr; }
}

/* ==============================================================
   FACTURATION — workflow statut
   ============================================================== */
.fac-workflow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 20px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(10, 26, 47, 0.05);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* Stepper */
.fac-steps {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  min-width: 280px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}
.fac-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.fac-step__dot {
  width: 34px; height: 34px;
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-offwhite);
  border: 2px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all .2s;
}
.fac-step__dot svg { width: 14px; height: 14px; }
.fac-step__label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-muted);
  white-space: nowrap;
}
.fac-step.is-done .fac-step__dot {
  background: #dcfce7;
  border-color: #16a34a;
  color: #16a34a;
}
.fac-step.is-done .fac-step__label { color: #16a34a; }
.fac-step.is-current .fac-step__dot {
  background: var(--color-navy);
  border-color: var(--color-navy);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(26, 45, 78, 0.1);
}
.fac-step.is-current .fac-step__label {
  color: var(--color-navy);
  font-weight: 700;
}
.fac-step.is-paid.is-current .fac-step__dot {
  background: #16a34a;
  border-color: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}
.fac-step.is-paid.is-current .fac-step__label { color: #16a34a; }

.fac-step__line {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  margin: 0 6px;
  margin-bottom: 22px;
  border-radius: 2px;
  transition: background .2s;
}
.fac-step__line.is-done { background: #16a34a; }

/* Actions */
.fac-workflow__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
  min-width: 0;
}

.fac-paid-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #dcfce7;
  color: #166534;
  border-radius: 99px;
  font-size: 0.88rem;
  font-weight: 600;
}
.fac-paid-badge svg { width: 16px; height: 16px; }

.fac-annulee-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #f3f4f6;
  color: var(--color-muted);
  border-radius: 99px;
  font-size: 0.88rem;
  font-weight: 600;
}
.fac-annulee-badge svg { width: 16px; height: 16px; }

.fac-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.fac-lines-table {
  min-width: 760px;
}

.fac-side-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fac-info-card,
.fac-dossier-card {
  overflow: hidden;
}

.fac-side-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.fac-side-card__eyebrow {
  margin: 0 0 4px;
  color: var(--color-muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.fac-side-card__title {
  margin: 0;
  color: var(--color-navy);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
}

.fac-side-card__icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 12px;
  background: rgba(26, 45, 78, .08);
  color: var(--color-navy);
}

.fac-side-card__icon svg {
  width: 18px;
  height: 18px;
}

.fac-side-card__icon--teal {
  background: rgba(15, 118, 110, .1);
  color: var(--color-teal);
}

.fac-form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fac-form-field {
  min-width: 0;
}

.fac-form-field .form-label {
  margin-bottom: 6px;
  color: var(--color-text);
  font-size: .78rem;
  font-weight: 700;
}

.fac-form-field input,
.fac-form-field select,
.fac-form-field textarea {
  width: 100%;
  min-height: 42px;
  border-radius: 10px;
}

.fac-form-field textarea {
  min-height: 86px;
  resize: vertical;
}

.fac-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.fac-save-btn {
  width: 100%;
  justify-content: center;
  margin-top: 2px;
}

.fac-linked-dossier {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.fac-linked-dossier > div {
  padding: 11px 12px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-offwhite);
}

.fac-linked-dossier__label {
  display: block;
  margin-bottom: 3px;
  color: var(--color-muted);
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.fac-linked-dossier strong {
  display: block;
  color: var(--color-navy);
  font-size: .92rem;
  line-height: 1.35;
}

.fac-open-dossier {
  width: 100%;
  justify-content: center;
  gap: 8px;
}

.fac-danger-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid #fecaca;
  border-radius: 14px;
  background: #fff7f7;
}

.fac-danger-card strong {
  display: block;
  color: #991b1b;
  font-size: .86rem;
  margin-bottom: 2px;
}

.fac-danger-card span {
  display: block;
  color: #b91c1c;
  font-size: .76rem;
  line-height: 1.35;
}

.fac-danger-link {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 9px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: .8rem;
  font-weight: 700;
  text-decoration: none;
}

.fac-danger-link:hover {
  background: #dc2626;
  color: #fff;
}

@media (max-width: 700px) {
  .fac-workflow {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
  }
  .fac-steps {
    min-width: 0;
    width: 100%;
  }
  .fac-workflow__actions {
    justify-content: flex-start;
  }
  .fac-workflow__actions form,
  .fac-workflow__actions .btn,
  .fac-paid-badge,
  .fac-annulee-badge {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 980px) {
  .fac-detail-grid {
    grid-template-columns: 1fr;
  }

  .fac-side-panel {
    order: -1;
  }
}

@media (max-width: 520px) {
  .fac-form-grid {
    grid-template-columns: 1fr;
  }

  .fac-danger-card {
    align-items: stretch;
    flex-direction: column;
  }

  .fac-danger-link {
    text-align: center;
  }
}

/* ==============================================================
   DASHBOARD — redesign "poste de travail"
   ============================================================== */

/* ---- Card générique ------------------------------------------ */
.db-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(10, 26, 47, 0.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.db-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.db-card__title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-navy);
  margin: 0;
}
.db-card__sub {
  font-size: 0.74rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.db-card__link {
  font-size: 0.82rem;
  color: var(--color-teal);
  font-weight: 500;
  text-decoration: none;
  transition: color .15s;
}
.db-card__link:hover { color: var(--color-teal-dark); }

/* ---- HERO : salutation + pulse --------------------------------- */
.db-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.db-hero__greeting { min-width: 0; }
.db-hero__title {
  font-family: var(--font-serif);
  font-size: 2.1rem;
  font-weight: 500;
  color: var(--color-navy);
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.01em;
}
.db-hero__comma { color: var(--color-gold); margin: 0 2px; }
.db-hero__date {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin: 6px 0 0;
  text-transform: capitalize;
}

/* Pulse (4 cartes stats cliquables) */
.db-pulse {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  flex: 1;
  max-width: 720px;
}
.db-pulse__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--color-text);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  box-shadow: 0 1px 2px rgba(10, 26, 47, 0.03);
}
.db-pulse__item:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(10, 26, 47, 0.08);
  border-color: var(--color-teal);
}
.db-pulse__icon {
  flex-shrink: 0;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-offwhite);
  color: var(--color-muted);
  border-radius: 10px;
}
.db-pulse__icon svg { width: 18px; height: 18px; }
.db-pulse__value {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-navy);
  line-height: 1;
}
.db-pulse__label {
  font-size: 0.74rem;
  color: var(--color-muted);
  margin-top: 4px;
}
.db-pulse__item.is-highlight .db-pulse__icon { background: rgba(5, 139, 140, 0.12); color: var(--color-teal); }
.db-pulse__item.is-highlight .db-pulse__value { color: var(--color-teal); }
.db-pulse__item.is-accent .db-pulse__icon { background: rgba(184, 146, 74, 0.14); color: var(--color-gold); }
.db-pulse__item.is-warning .db-pulse__icon { background: #fee2e2; color: #dc2626; }
.db-pulse__item.is-warning .db-pulse__value { color: #dc2626; }

/* ---- FOCUS : TODO + Agenda ------------------------------------ */
.db-focus {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

/* --- TODO card (tabs) --- */
.db-todo { min-height: 380px; }
.db-todo__tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--color-offwhite);
  border-radius: 8px;
}
.db-todo__tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: var(--font-sans);
}
.db-todo__tab:hover { color: var(--color-text); }
.db-todo__tab.is-active {
  background: var(--color-white);
  color: var(--color-navy);
  box-shadow: 0 1px 2px rgba(10, 26, 47, 0.08);
}
.db-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--color-teal);
  color: var(--color-white);
  border-radius: 10px;
  line-height: 1;
}
.db-chip--warn { background: #dc2626; }

.db-todo__panel { padding: 6px 8px 8px; }
.db-todo__list {
  list-style: none;
  margin: 0; padding: 0;
}
.db-todo__item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  transition: background .15s;
}
.db-todo__item + .db-todo__item { border-top: 1px solid var(--color-border); }
.db-todo__item:hover { background: var(--color-offwhite); }
.db-todo__item--warn { background: #fff8f5; }
.db-todo__item--warn:hover { background: #fff0e8; }

.db-todo__time {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 60px;
  padding: 6px 4px;
  background: var(--color-offwhite);
  border-radius: 8px;
  line-height: 1;
}
.db-todo__time--warn {
  background: #fee2e2;
  color: #991b1b;
}
.db-todo__hour {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-navy);
}
.db-todo__dur {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-top: 3px;
}
.db-todo__time--warn .db-todo__dur { color: inherit; font-weight: 600; }

/* Gauge ring pour expertises */
.db-todo__gauge {
  position: relative;
  width: 42px; height: 42px;
  flex-shrink: 0;
}
.db-todo__ring { width: 100%; height: 100%; }
.db-todo__gauge-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-navy);
}

.db-todo__body { min-width: 0; }
.db-todo__ref {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-teal);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.db-todo__ref:hover { color: var(--color-teal-dark); }
.db-todo__title {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-navy);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.db-todo__meta {
  display: flex;
  gap: 4px;
  font-size: 0.76rem;
  color: var(--color-muted);
  margin-top: 3px;
  flex-wrap: wrap;
}

.db-todo__action {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  color: var(--color-muted);
  background: transparent;
  transition: all .15s;
  text-decoration: none;
}
.db-todo__action:hover {
  background: var(--color-teal);
  color: var(--color-white);
}
.db-todo__action svg { width: 14px; height: 14px; }

/* --- Agenda semaine --- */
.db-agenda__days {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
}
.db-agenda__day {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--color-border);
  transition: background .15s;
}
.db-agenda__day:last-child { border-bottom: none; }
.db-agenda__day.is-weekend { background: #fafafa; }
.db-agenda__day.is-today {
  background: linear-gradient(90deg, rgba(5, 139, 140, 0.08) 0%, transparent 50%);
}
.db-agenda__date {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding-right: 12px;
  border-right: 2px solid var(--color-border);
}
.db-agenda__day.is-today .db-agenda__date {
  border-right-color: var(--color-teal);
}
.db-agenda__dow {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  font-weight: 500;
}
.db-agenda__day.is-today .db-agenda__dow { color: var(--color-teal); font-weight: 600; }
.db-agenda__num {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--color-navy);
  line-height: 1;
}
.db-agenda__events {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  justify-content: center;
}
.db-agenda__event {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--color-text);
  text-decoration: none;
  transition: all .15s;
}
.db-agenda__day.is-today .db-agenda__event { border-color: rgba(5, 139, 140, 0.3); }
.db-agenda__event:hover {
  border-color: var(--color-teal);
  background: rgba(5, 139, 140, 0.04);
}
.db-agenda__time {
  font-weight: 600;
  color: var(--color-teal);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.db-agenda__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.db-agenda__empty {
  color: #d1d5db;
  font-size: 1rem;
}

/* ---- KPI (4 cartes) -------------------------------------------- */
.db-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.db-kpi {
  display: block;
  padding: 18px 20px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  text-decoration: none;
  color: var(--color-text);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  box-shadow: 0 1px 2px rgba(10, 26, 47, 0.03);
}
.db-kpi:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(10, 26, 47, 0.08);
}
.db-kpi__label {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.db-kpi__value {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
  color: var(--color-navy);
  margin: 10px 0 8px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.db-kpi__sep { color: var(--color-border); margin: 0 2px; font-weight: 400; }
.db-kpi__v-muted { color: var(--color-muted); }
.db-kpi__trend {
  font-size: 0.76rem;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.db-kpi__bar {
  display: block;
  width: 100%;
  height: 4px;
  background: var(--color-border);
  border-radius: 99px;
  overflow: hidden;
}
.db-kpi__bar-fill {
  display: block;
  height: 100%;
  background: var(--color-teal);
  border-radius: 99px;
  transition: width .4s cubic-bezier(0.16, 1, 0.3, 1);
}

.db-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 0.74rem;
}
.db-trend--up   { color: #166534; background: #dcfce7; }
.db-trend--down { color: #991b1b; background: #fee2e2; }
.db-trend--flat { color: var(--color-muted); background: var(--color-offwhite); }

/* ---- INSIGHT : Pipeline + Activity ----------------------------- */
.db-insight {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

/* --- Pipeline financier --- */
.db-ca {
  padding: 20px;
  background: linear-gradient(135deg, #f0f9fa 0%, #ffffff 60%);
  border-bottom: 1px solid var(--color-border);
}
.db-ca__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.db-ca__row--sub {
  font-size: 0.78rem;
  color: var(--color-muted);
  margin-top: 6px;
}
.db-ca__label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.db-ca__value {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 600;
  color: var(--color-navy);
  line-height: 1;
}
.db-ca__bar {
  height: 8px;
  background: var(--color-border);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 10px;
}
.db-ca__bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-teal) 0%, #0fa5a5 100%);
  border-radius: 99px;
  transition: width .5s cubic-bezier(0.16, 1, 0.3, 1);
}
.db-ca__pct {
  font-weight: 600;
  color: var(--color-navy);
  font-variant-numeric: tabular-nums;
}
.db-ca__trend {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--color-muted);
}

.db-pipeline__rows {
  display: flex;
  flex-direction: column;
  padding: 6px 8px 8px;
}
.db-pipe-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--color-text);
  transition: background .15s;
}
.db-pipe-row:hover { background: var(--color-offwhite); }
.db-pipe-row + .db-pipe-row { border-top: 1px solid var(--color-border); }
.db-pipe-row__icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  flex-shrink: 0;
}
.db-pipe-row__icon svg { width: 16px; height: 16px; }
.db-pipe-row__label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-navy);
}
.db-pipe-row__meta {
  font-size: 0.74rem;
  color: var(--color-muted);
  margin-top: 2px;
}
.db-pipe-row__count {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-navy);
  font-variant-numeric: tabular-nums;
}
.db-pipe-row--warn .db-pipe-row__count { color: #dc2626; }
.db-pipe-row--warn .db-pipe-row__label { color: #991b1b; }

/* --- Activité (timeline) --- */
.db-timeline {
  list-style: none;
  margin: 0; padding: 14px 20px 18px;
}
.db-timeline__item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 14px;
  padding: 10px 0;
  align-items: flex-start;
}
.db-timeline__item + .db-timeline__item {
  border-top: 1px solid var(--color-border);
}
.db-timeline__icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--color-offwhite);
  color: var(--color-muted);
  flex-shrink: 0;
  margin-top: 1px;
}
.db-timeline__icon svg { width: 15px; height: 15px; }
.db-timeline__item--paiement .db-timeline__icon { background: #f0f7f7; color: var(--color-teal); }
.db-timeline__item--cloture  .db-timeline__icon { background: #eef2f7; color: var(--color-navy); }
.db-timeline__item--rapport  .db-timeline__icon { background: #f0f7f7; color: var(--color-teal); }
.db-timeline__item--mail     .db-timeline__icon { background: #faf4e8; color: var(--color-gold); }

.db-timeline__title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-navy);
  text-decoration: none;
  line-height: 1.35;
}
.db-timeline__title:hover { color: var(--color-teal); }
.db-timeline__meta {
  font-size: 0.74rem;
  color: var(--color-muted);
  margin-top: 3px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* --- Empty state --- */
.db-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
  color: var(--color-muted);
}
.db-empty svg {
  width: 40px; height: 40px;
  color: #d1d5db;
}
.db-empty p {
  font-size: 0.88rem;
  margin: 0;
}

/* ==============================================================
   RESPONSIVE
   ============================================================== */
@media (max-width: 1100px) {
  .db-focus { grid-template-columns: 1fr; }
  .db-insight { grid-template-columns: 1fr; }
  .db-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .db-hero { flex-direction: column; align-items: stretch; }
  .db-hero__greeting { text-align: left; }
  .db-pulse { max-width: none; }
}
@media (max-width: 640px) {
  .db-pulse { grid-template-columns: repeat(2, 1fr); }
  .db-kpi-grid { grid-template-columns: 1fr 1fr; }
  .db-hero__title { font-size: 1.7rem; }
  .db-agenda__day { padding: 10px 14px; }
  .db-todo__item { grid-template-columns: auto 1fr auto; gap: 10px; padding: 10px; }
  .db-todo__time { width: 52px; }
  .db-todo__tabs { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .db-kpi-grid { grid-template-columns: 1fr; }
}


/* ============================================================
   ADMIN MÉTIER
============================================================ */

.admin-feed {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #eef0f3;
}
.admin-feed:last-child { border-bottom: 0; padding-bottom: 0; }
.admin-feed:first-child { padding-top: 0; }
.admin-feed > div {
  min-width: 0;
}
.admin-feed .cell-sub {
  overflow-wrap: anywhere;
}

.admin-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fafbfc;
  cursor: pointer;
}
.admin-check input {
  margin-top: 2px;
}
.admin-check span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-navy);
}
.admin-check small {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-muted);
}

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #eef0f3;
  font-size: 0.86rem;
}
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--color-muted); }
.info-row strong { color: var(--color-navy); font-weight: 600; text-align: right; }

@media (max-width: 560px) {
  .admin-feed {
    flex-direction: column;
    gap: 4px;
  }
  .info-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .info-row strong {
    text-align: left;
    overflow-wrap: anywhere;
  }
}

.admin-role-help {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  background: #f0f9ff;
}
.admin-role-help__title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #075985;
  margin-bottom: 12px;
}
.admin-role-help__grid {
  display: grid;
  gap: 10px;
}
.admin-role-help__grid div {
  display: grid;
  gap: 2px;
}
.admin-role-help__grid strong {
  color: var(--color-navy);
  font-size: 0.86rem;
}
.admin-role-help__grid span {
  color: #475569;
  font-size: 0.8rem;
  line-height: 1.45;
}

.admin-dossier-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(5, 139, 140, 0.18);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(5, 139, 140, 0.05), rgba(255, 255, 255, 0.9));
}

.admin-dossier-panel__head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.admin-dossier-panel__title {
  color: var(--color-navy);
  font-weight: 700;
  margin-bottom: 3px;
}

.admin-dossier-panel__head p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.admin-dossier-panel__badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(5, 139, 140, 0.1);
  color: var(--color-teal);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-dossier-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 10px;
}

.admin-dossier-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 11px;
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  background: #fff;
}

.admin-dossier-search svg {
  width: 15px;
  height: 15px;
  color: #94a3b8;
  flex-shrink: 0;
}

.admin-dossier-search input {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-navy);
  font: inherit;
  font-size: 0.84rem;
}

.admin-dossier-toggle {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  background: #fff;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.admin-dossier-toggle--active {
  border-color: rgba(5, 139, 140, 0.24);
  background: rgba(5, 139, 140, 0.1);
  color: var(--color-teal);
}

.admin-dossier-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--color-muted);
  font-size: 0.76rem;
}

.admin-dossier-meta strong {
  color: var(--color-navy);
}

.admin-dossier-panel__list {
  max-height: 320px;
  overflow: auto;
  padding: 6px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.admin-dossier-panel__list ul {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-dossier-panel__list label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 10px;
  color: #334155;
  font-size: 0.82rem;
  line-height: 1.35;
  cursor: pointer;
}

.admin-dossier-panel__list label:hover {
  background: #f8fafc;
}

.admin-dossier-panel__list input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-teal);
}

.admin-dossier-empty {
  padding: 22px 12px;
  color: var(--color-muted);
  font-size: 0.82rem;
  text-align: center;
}

@media (max-width: 720px) {
  .admin-dossier-toolbar {
    grid-template-columns: 1fr;
  }
  .admin-dossier-toggle {
    width: 100%;
  }
}

.readonly-pill,
.readonly-banner {
  border: 1px solid rgba(5, 139, 140, 0.18);
  background: rgba(5, 139, 140, 0.08);
  color: var(--color-teal);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-top: 1px solid var(--color-border);
  background: #fff;
}

.pagination-bar--single {
  justify-content: flex-start;
}

.pagination-bar__meta {
  color: var(--color-muted);
  font-size: 0.78rem;
}

.pagination-bar__nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: #fff;
  color: var(--color-navy);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.pagination-btn:hover,
.pagination-btn--active {
  border-color: var(--color-navy);
  background: var(--color-navy);
  color: #fff;
}

.pagination-btn--disabled {
  color: #cbd5e1;
  pointer-events: none;
}

.pagination-ellipsis {
  color: var(--color-muted);
  font-size: 0.82rem;
  padding: 0 2px;
}

@media (max-width: 720px) {
  .pagination-bar {
    align-items: flex-start;
    flex-direction: column;
  }
  .pagination-bar__nav {
    justify-content: flex-start;
  }
}

.readonly-pill {
  margin: 6px 12px 0;
  padding: 9px 12px;
  border-radius: 999px;
  text-align: center;
}

.readonly-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  text-transform: none;
  letter-spacing: 0;
}

.readonly-scope form .form-actions button[type="submit"],
.readonly-scope form button[type="submit"],
.readonly-scope [data-admin-action] {
  display: none !important;
}

.readonly-scope input,
.readonly-scope select,
.readonly-scope textarea {
  pointer-events: none;
  background: #f8fafc;
  color: #64748b;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.metier-card {
  margin-bottom: 18px;
}
.metier-card .card__header {
  align-items: flex-start;
}
.metier-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.metier-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px;
  background: linear-gradient(180deg, #fbfdff 0%, #f6f9fd 100%);
  border: 1px solid rgba(10, 26, 47, 0.06);
  border-radius: 12px;
}
.metier-block__head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid rgba(10, 26, 47, 0.06);
  padding-bottom: 12px;
}
.metier-block__title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.01em;
}
.metier-block__sub {
  margin: 0;
  color: var(--color-muted, #64748b);
  font-size: 0.82rem;
  line-height: 1.45;
}
.metier-block__sub code {
  background: rgba(5, 139, 140, 0.08);
  border: 1px solid rgba(5, 139, 140, 0.18);
  color: #0a1a2f;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.78rem;
}
.metier-form .form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.metier-form .form-error {
  margin: 4px 0 0;
  color: #b91c1c;
  font-size: 0.78rem;
  font-weight: 600;
}
.metier-form__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px dashed rgba(10, 26, 47, 0.12);
  flex-wrap: wrap;
}
.metier-form__meta {
  margin: 0;
  color: var(--color-muted, #64748b);
  font-size: 0.78rem;
}
@media (max-width: 720px) {
  .metier-block {
    padding: 14px;
  }
  .metier-form__footer {
    flex-direction: column;
    align-items: stretch;
  }
  .metier-form__footer .btn {
    width: 100%;
  }
}

.purge-card {
  margin-bottom: 18px;
}
.purge-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.purge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.purge-bucket {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  background: linear-gradient(180deg, #fff8ec 0%, #fdf1d6 100%);
  border: 1px solid rgba(180, 120, 30, 0.18);
  border-radius: 12px;
}
.purge-bucket--empty {
  background: linear-gradient(180deg, #f5fbf6 0%, #ecf6ee 100%);
  border-color: rgba(56, 142, 60, 0.18);
}
.purge-bucket__count {
  font-family: var(--font-sans);
  font-size: 1.65rem;
  font-weight: 700;
  color: #92400e;
  line-height: 1;
}
.purge-bucket--empty .purge-bucket__count {
  color: #2f6f37;
}
.purge-bucket__label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
}
.purge-bucket__threshold {
  font-size: 0.76rem;
  color: var(--color-muted, #64748b);
}
.purge-note {
  background: #f8fafc;
  border: 1px solid rgba(10, 26, 47, 0.06);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.84rem;
  color: var(--color-muted, #475569);
  line-height: 1.5;
}
.purge-note p {
  margin: 0;
}
.purge-note p + p {
  margin-top: 6px;
}
.purge-actions {
  display: flex;
  justify-content: flex-end;
  margin: 0;
}
@media (max-width: 720px) {
  .purge-grid {
    grid-template-columns: 1fr;
  }
  .purge-actions {
    justify-content: stretch;
  }
  .purge-actions .btn {
    width: 100%;
  }
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.settings-badge--draft {
  background: #f8fafc;
  color: #64748b;
}

.settings-badge--secure {
  background: #eef2ff;
  color: #4338ca;
}

.settings-badge--live {
  background: rgba(5, 139, 140, 0.1);
  color: var(--color-teal);
}

.settings-kv {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid #eef2f7;
  font-size: 0.84rem;
}

.settings-kv:last-child {
  border-bottom: 0;
}

.settings-kv span {
  color: var(--color-muted);
}

.settings-kv strong {
  color: var(--color-navy);
  text-align: right;
  word-break: break-word;
}

.signature-card {
  position: sticky;
  top: calc(var(--topbar-h) + 18px);
}

.signature-current {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  color: var(--color-muted);
  font-size: 0.82rem;
}

.signature-current img {
  max-width: 190px;
  max-height: 70px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.signature-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.signature-text-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
}

.signature-upload-panel {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
}

.signature-text-panel .form-label {
  grid-column: 1 / -1;
  margin-bottom: -2px;
}

.signature-canvas-wrap {
  padding: 10px;
  border: 1px solid #dbe4ee;
  border-radius: 16px;
  background:
    linear-gradient(45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(-45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f8fafc 75%),
    linear-gradient(-45deg, transparent 75%, #f8fafc 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.signature-canvas {
  display: block;
  width: 100%;
  min-height: 220px;
  border-radius: 12px;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

@media (max-width: 1100px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .signature-card {
    position: static;
  }
}

@media (max-width: 640px) {
  .signature-text-panel {
    grid-template-columns: 1fr;
  }
}


/* ============================================================
   GUIDE · Bouton flottant + modale workflow (dashboard)
============================================================ */

/* ---- Bouton flottant ---- */
.guide-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px 12px 14px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(180deg, #0b6e6f, #055657);
  color: #fff;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow:
    0 4px 14px rgba(5, 139, 140, 0.32),
    0 1px 2px rgba(0,0,0,0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.guide-fab:hover {
  transform: translateY(-1px);
  box-shadow:
    0 8px 22px rgba(5, 139, 140, 0.42),
    0 2px 4px rgba(0,0,0,0.08);
  background: linear-gradient(180deg, #0d7e7f, #066868);
}
.guide-fab:active { transform: translateY(0); }
.guide-fab svg { width: 18px; height: 18px; flex-shrink: 0; }

.guide-fab--pulse::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 10px; height: 10px;
  background: var(--color-gold);
  border-radius: 50%;
  border: 2px solid #fff;
  animation: guide-fab-ping 1.8s ease-out infinite;
}
@keyframes guide-fab-ping {
  0%   { transform: scale(1);   opacity: 1; }
  70%  { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* ---- Modale ---- */
.guide-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.guide-modal__shell {
  width: 100%;
  max-width: 920px;
  background: #fff;
  border-radius: 18px;
  box-shadow:
    0 20px 60px rgba(15, 23, 42, 0.25),
    0 4px 10px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 92vh;
}

.guide-modal__head {
  position: relative;
  padding: 22px 28px 18px;
  border-bottom: 1px solid #eef0f3;
  flex-shrink: 0;
}
.guide-modal__eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-teal);
  font-weight: 700;
  margin-bottom: 4px;
}
.guide-modal__title {
  font-family: var(--font-serif), 'Cormorant Garamond', serif;
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--color-navy);
  margin: 0;
  letter-spacing: 0.005em;
}
.guide-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: transparent;
  border: 0;
  padding: 8px;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}
.guide-modal__close:hover { color: var(--color-navy); background: #f1f5f9; }
.guide-modal__close svg { width: 18px; height: 18px; }

/* ---- Barre de progression ---- */
.guide-progress {
  height: 3px;
  background: #eef0f3;
  position: relative;
  flex-shrink: 0;
}
.guide-progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-teal), #0aa3a4);
  transition: width 0.35s ease;
}

/* ---- Corps ---- */
.guide-body {
  flex: 1;
  overflow-y: auto;
  padding: 34px 36px;
}

.guide-step {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 36px;
  align-items: center;
  min-height: 340px;
}

.guide-step__num {
  font-family: var(--font-serif), 'Cormorant Garamond', serif;
  font-size: 2.1rem;
  font-weight: 600;
  color: var(--color-teal);
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}
.guide-step__num-total {
  font-size: 0.9rem;
  color: #94a3b8;
  font-weight: 400;
  margin-left: 2px;
}

.guide-step__title {
  font-family: var(--font-serif), 'Cormorant Garamond', serif;
  font-size: 1.85rem;
  font-weight: 600;
  color: var(--color-navy);
  line-height: 1.15;
  margin: 0 0 14px;
  letter-spacing: -0.005em;
}

.guide-step__lede {
  font-size: 0.98rem;
  line-height: 1.6;
  color: #475569;
  margin: 0 0 18px;
  max-width: 480px;
}

.guide-step__points {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  display: grid;
  gap: 10px;
}
.guide-step__points li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.89rem;
  color: #334155;
  line-height: 1.5;
}
.guide-step__points svg {
  width: 16px; height: 16px;
  color: var(--color-teal);
  flex-shrink: 0;
  margin-top: 3px;
}

.guide-step__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-teal);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(5, 139, 140, 0.08);
  transition: background 0.15s;
}
.guide-step__cta:hover { background: rgba(5, 139, 140, 0.14); }

/* ---- Illustration droite ---- */
.guide-step__right {
  display: flex;
  align-items: center;
  justify-content: center;
}
.guide-illus {
  position: relative;
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 24px;
  background: linear-gradient(180deg, #fafbfc, #f1f5f5);
  border: 1px solid #eef0f3;
}
.guide-illus__glow {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: radial-gradient(circle at 50% 40%, rgba(5,139,140,0.18), transparent 65%);
  pointer-events: none;
}
.guide-illus__icon svg {
  width: 90px;
  height: 90px;
  color: var(--color-teal);
  position: relative;
  z-index: 1;
}
.guide-illus--ia    .guide-illus__glow { background: radial-gradient(circle at 50% 40%, rgba(184,146,74,0.22), transparent 65%); }
.guide-illus--ia    .guide-illus__icon svg { color: var(--color-gold); }
.guide-illus--mail  .guide-illus__icon svg { color: var(--color-teal); }
.guide-illus--rdv   .guide-illus__glow { background: radial-gradient(circle at 50% 40%, rgba(26,45,78,0.16), transparent 65%); }
.guide-illus--rdv   .guide-illus__icon svg { color: var(--color-navy); }
.guide-illus--rapport .guide-illus__glow { background: radial-gradient(circle at 50% 40%, rgba(26,45,78,0.16), transparent 65%); }
.guide-illus--rapport .guide-illus__icon svg { color: var(--color-navy); }
.guide-illus--facture .guide-illus__glow { background: radial-gradient(circle at 50% 40%, rgba(184,146,74,0.22), transparent 65%); }
.guide-illus--facture .guide-illus__icon svg { color: var(--color-gold); }

/* ---- Footer ---- */
.guide-foot {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  border-top: 1px solid #eef0f3;
  background: #fafbfc;
  flex-shrink: 0;
}
.guide-foot__left { justify-self: start; }
.guide-foot__right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}
.guide-check input {
  appearance: none;
  width: 16px; height: 16px;
  border: 1.5px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.guide-check input:checked {
  background: var(--color-teal);
  border-color: var(--color-teal);
}
.guide-check input:checked::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 4px; height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.guide-foot__dots {
  display: flex;
  gap: 7px;
}
.guide-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 0;
  background: #cbd5e1;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s, width 0.2s;
}
.guide-dot:hover { background: #94a3b8; }
.guide-dot.is-done { background: var(--color-teal); opacity: 0.5; }
.guide-dot.is-active {
  background: var(--color-teal);
  width: 22px;
  border-radius: 4px;
}

/* ---- Responsive ---- */
@media (max-width: 820px) {
  .guide-step { grid-template-columns: 1fr; gap: 20px; min-height: 0; }
  .guide-step__right { order: -1; }
  .guide-illus { width: 140px; height: 140px; }
  .guide-illus__icon svg { width: 60px; height: 60px; }
  .guide-step__title { font-size: 1.45rem; }
  .guide-body { padding: 24px 22px; }
}
@media (max-width: 620px) {
  .guide-fab__label { display: none; }
  .guide-fab { padding: 14px; }
  .guide-foot { grid-template-columns: 1fr; }
  .guide-foot__left { justify-self: center; }
  .guide-foot__right { justify-self: center; }
  .guide-foot__dots { justify-self: center; }
  .guide-modal__title { font-size: 1.25rem; }
  .guide-modal__head { padding: 18px 22px 14px; }
}
