/* Styles de l'application de gestion des affaires HTB.
   Charte alignée sur les maquettes vues par HTB (constitution, principe VIII ; décision T-09) :
   fond gris clair, panneaux blancs à filet, bleu ciel, police Inter servie localement (OFL).
   Feuille écrite par B2 INFO. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../vendor/fonts/inter-latin-wght-normal.woff2") format("woff2");
}

/* --- Jetons ------------------------------------------------------------------------------ */
:root {
  --ink: #0f172a;
  --text: #1e293b;
  --body: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e6e8eb;
  --line-soft: #eef0f3;
  --line-strong: #d5d9df;
  --bg: #f5f6f8;
  --card: #ffffff;
  --well: #f8f9fb;
  --sky: #14a5e1;
  --sky-dark: #0b8bc2;
  --sky-deep: #0c6e9f;
  --sky-soft: #e8f6fd;
  --sky-line: #b7e3f6;
  --navy: #0f1827;
  --violet: #6d28d9;
  --green: #15803d;
  --red: #b91c1c;
  --amber: #b45309;
  --font: "Inter", "Segoe UI", Arial, sans-serif;
  --sidebar: 15rem;
  --topbar: 4rem;

  /* Bootstrap 5.3 repris sur les jetons */
  --bs-body-font-family: var(--font);
  --bs-body-font-size: 0.875rem;
  --bs-body-line-height: 1.5;
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-emphasis-color: var(--ink);
  --bs-secondary-color: var(--muted);
  --bs-heading-color: var(--ink);
  --bs-primary: var(--sky);
  --bs-primary-rgb: 20, 165, 225;
  --bs-link-color: var(--sky-dark);
  --bs-link-color-rgb: 11, 139, 194;
  --bs-link-hover-color: var(--sky-deep);
  --bs-link-hover-color-rgb: 12, 110, 159;
  --bs-border-color: var(--line);
  --bs-border-radius: 0.5rem;
  --bs-border-radius-sm: 0.375rem;
  --bs-border-radius-lg: 0.75rem;
  --bs-primary-bg-subtle: var(--sky-soft);
  --bs-primary-border-subtle: var(--sky-line);
  --bs-primary-text-emphasis: var(--sky-deep);
  --bs-success-bg-subtle: #f0fdf4;
  --bs-success-border-subtle: #bbf7d0;
  --bs-success-text-emphasis: #166534;
  --bs-info-bg-subtle: #eaf6fd;
  --bs-info-border-subtle: #c3e6f8;
  --bs-info-text-emphasis: #0c5a83;
  --bs-warning-bg-subtle: #fef6dc;
  --bs-warning-border-subtle: #f5d77a;
  --bs-warning-text-emphasis: #8a4b06;
  --bs-danger-bg-subtle: #fef2f2;
  --bs-danger-border-subtle: #fecaca;
  --bs-danger-text-emphasis: #991b1b;
  --bs-focus-ring-color: rgba(20, 165, 225, 0.22);
}

body {
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}

/* Icônes du gabarit partials/icon.html : taille du texte par défaut */
svg:not([width]) {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.h6, h6 {
  font-size: 0.875rem;
  font-weight: 600;
}

code, .code {
  font-family: var(--font);
  font-size: inherit;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.text-muted {
  color: var(--muted) !important;
}

.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

a {
  text-underline-offset: 0.15em;
}

/* --- Coquille : barre latérale, barre du haut, contenu -------------------------------------- */
.app {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  flex: 0 0 var(--sidebar);
  background: var(--bg);
  border-right: 1px solid var(--line);
}

.app-sidebar .offcanvas-lg {
  --bs-offcanvas-bg: var(--bg);
  --bs-offcanvas-width: 16rem;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
}

@media (min-width: 992px) {
  .app-sidebar .offcanvas-lg {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
  .sidebar-inner {
    min-height: 100vh;
  }
}

@media (max-width: 991.98px) {
  .app-sidebar {
    flex-basis: 0;
    border-right: 0;
  }
  .sidebar-inner {
    min-height: 100%;
  }
}

.sidebar-brand {
  height: var(--topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-decoration: none;
}

.brand-logo {
  display: block;
  height: 3rem;
  width: auto;
  max-width: 100%;
}

.brand-logo-lg {
  height: 4.5rem;
  margin: 0 auto;
}

.brand-sub {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-align: center;
}

.entity-logos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}

.entity-logos img {
  height: 2.25rem;
  width: auto;
  opacity: 0.85;
}

.nav-side {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.5rem;
}

.nav-side a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.625rem;
  border-radius: 0.5rem;
  color: var(--body);
  font-size: 0.875rem;
  font-weight: 450;
  text-decoration: none;
}

.nav-side a svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  color: var(--muted);
}

.nav-side a:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.nav-side a.active {
  background: var(--card);
  color: var(--ink);
  font-weight: 550;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.nav-side a.active svg {
  color: var(--sky);
}

.nav-group {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0.85rem 0.625rem 0.25rem;
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--ink);
}

.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.6);
}

.sidebar-user .who {
  min-width: 0;
  line-height: 1.25;
}

.sidebar-user .who b {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .who small {
  display: block;
  font-size: 0.6875rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #f6f7f9;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  font-size: 0.875rem;
  color: var(--body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.topbar-spacer {
  flex: 1 1 auto;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 0.5rem;
  padding: 0 0.5rem 0 0.7rem;
  height: 2.25rem;
  width: 15rem;
  min-width: 0;
  margin: 0;
  color: var(--muted);
}

.topbar-search:focus-within {
  border-color: var(--sky);
  box-shadow: 0 0 0 0.2rem var(--bs-focus-ring-color);
}

.topbar-search input {
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 0.8125rem;
  min-width: 0;
  width: 100%;
  color: var(--text);
}

.topbar-search input::placeholder {
  color: var(--muted);
}

kbd.key {
  font-family: var(--font);
  font-size: 0.625rem;
  color: var(--muted);
  background: var(--well);
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  padding: 0.1rem 0.35rem;
  box-shadow: none;
  white-space: nowrap;
}

.env-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px dashed #f0c96a;
  border-radius: 0.5rem;
  background: #fef6dc;
  color: #8a4b06;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.icon-button {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 0.5rem;
  background: var(--card);
  color: var(--ink);
  flex-shrink: 0;
}

.app-content {
  padding: 1.75rem 1.5rem 3rem;
  width: 100%;
}

@media (max-width: 767.98px) {
  .app-topbar {
    padding: 0 1rem;
  }
  .topbar-search {
    width: auto;
    flex: 1 1 auto;
  }
  .topbar-title {
    display: none;
  }
  .app-content {
    padding: 1.25rem 1rem 2.5rem;
  }
}

/* Écran sans menu : connexion */
.app-plain {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  gap: 1.5rem;
  background: var(--bg);
}

.plain-card {
  width: 100%;
  max-width: 26rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 2rem;
}

/* --- Composants Bootstrap repris au style ---------------------------------------------------- */
.btn {
  --bs-btn-font-weight: 600;
  --bs-btn-font-size: 0.8125rem;
  --bs-btn-padding-y: 0.5rem;
  --bs-btn-padding-x: 0.875rem;
  --bs-btn-border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.btn svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.btn-sm {
  --bs-btn-padding-y: 0.3rem;
  --bs-btn-padding-x: 0.65rem;
  --bs-btn-font-size: 0.78rem;
}

.btn-lg {
  --bs-btn-padding-y: 0.7rem;
  --bs-btn-font-size: 0.95rem;
}

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--sky);
  --bs-btn-border-color: var(--sky);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--sky-dark);
  --bs-btn-hover-border-color: var(--sky-dark);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--sky-deep);
  --bs-btn-active-border-color: var(--sky-deep);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: #8fd0ee;
  --bs-btn-disabled-border-color: #8fd0ee;
  --bs-btn-focus-shadow-rgb: 20, 165, 225;
}

.btn-outline-primary,
.btn-outline-secondary {
  --bs-btn-color: var(--ink);
  --bs-btn-bg: var(--card);
  --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-bg: var(--well);
  --bs-btn-hover-border-color: #c5cbd3;
  --bs-btn-active-color: var(--ink);
  --bs-btn-active-bg: var(--line-soft);
  --bs-btn-active-border-color: #c5cbd3;
  --bs-btn-disabled-color: var(--muted);
  --bs-btn-disabled-bg: var(--card);
  --bs-btn-disabled-border-color: var(--line);
  --bs-btn-focus-shadow-rgb: 20, 165, 225;
  --bs-btn-font-weight: 500;
}

.btn-success {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--sky);
  --bs-btn-border-color: var(--sky);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--sky-dark);
  --bs-btn-hover-border-color: var(--sky-dark);
  --bs-btn-active-bg: var(--sky-deep);
  --bs-btn-disabled-bg: #8fd0ee;
  --bs-btn-disabled-border-color: #8fd0ee;
}

.btn-outline-success {
  --bs-btn-color: var(--green);
  --bs-btn-bg: var(--card);
  --bs-btn-border-color: #bbf7d0;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--green);
  --bs-btn-hover-border-color: var(--green);
  --bs-btn-font-weight: 500;
}

.btn-danger {
  --bs-btn-bg: var(--red);
  --bs-btn-border-color: var(--red);
  --bs-btn-hover-bg: #991b1b;
  --bs-btn-hover-border-color: #991b1b;
}

.btn-outline-danger {
  --bs-btn-color: var(--red);
  --bs-btn-bg: var(--card);
  --bs-btn-border-color: #fecaca;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--red);
  --bs-btn-hover-border-color: var(--red);
  --bs-btn-font-weight: 500;
}

.btn-warning {
  --bs-btn-bg: #f59e0b;
  --bs-btn-border-color: #f59e0b;
  --bs-btn-color: #3d2a00;
  --bs-btn-hover-color: #3d2a00;
  --bs-btn-hover-bg: #d97706;
  --bs-btn-hover-border-color: #d97706;
}

.card {
  --bs-card-border-color: var(--line);
  --bs-card-border-radius: 0.75rem;
  --bs-card-inner-border-radius: calc(0.75rem - 1px);
  --bs-card-cap-bg: var(--card);
  --bs-card-cap-padding-y: 1.1rem;
  --bs-card-cap-padding-x: 1.25rem;
  --bs-card-spacer-x: 1.25rem;
  --bs-card-spacer-y: 1.25rem;
  --bs-card-bg: var(--card);
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  border-bottom-color: var(--line);
}

.card-header > strong,
.card-header .card-title,
.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
  margin: 0;
}

.card-header > small {
  flex-basis: 100%;
  order: 3;
  margin: -0.4rem 0 0 !important;
  font-size: 0.78rem;
  color: var(--muted) !important;
}

.card-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.15rem 0 0;
}

.card-head-text {
  flex: 1 1 14rem;
  min-width: 0;
}

.card-title .state {
  margin-right: 0.5rem;
  vertical-align: middle;
}

.section-head {
  margin-bottom: 0.9rem;
}

.section-head h2 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
}

.section-head p {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0;
}

.card.border-primary {
  border-color: var(--sky-line) !important;
}

.card.border-warning {
  border-color: #f5d77a !important;
}

.card.border-success {
  border-color: #bbf7d0 !important;
}

.card-footer {
  background: var(--well);
  border-top-color: var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
}

.card-footer.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.table {
  --bs-table-color: var(--text);
  --bs-table-bg: var(--card);
  --bs-table-border-color: var(--line-soft);
  --bs-table-striped-bg: var(--well);
  --bs-table-hover-bg: #f7fbfe;
  margin-bottom: 0;
}

.table > thead th {
  background: var(--card);
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: bottom;
}

.table > :not(caption) > * > * {
  padding: 0.8rem 0.75rem;
}

.table > :not(caption) > * > *:first-child {
  padding-left: 1rem;
}

.table > :not(caption) > * > *:last-child {
  padding-right: 1rem;
}

.table-sm > :not(caption) > * > * {
  padding: 0.6rem 0.65rem;
}

.table td {
  vertical-align: middle;
}

.table tbody tr:last-child > * {
  border-bottom: 0;
}

.table .sub {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.table-link {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.table-link:hover {
  color: var(--sky-dark);
}

.list-group {
  --bs-list-group-border-color: var(--line-soft);
  --bs-list-group-item-padding-x: 1.25rem;
  --bs-list-group-item-padding-y: 0.75rem;
  --bs-list-group-active-bg: var(--sky);
  --bs-list-group-active-border-color: var(--sky);
}

.form-control,
.form-select {
  border-color: var(--line-strong);
  border-radius: 0.5rem;
  min-height: 2.5rem;
  font-size: 0.875rem;
  color: var(--text);
}

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

.form-control:disabled,
.form-select:disabled {
  background-color: var(--well);
  color: var(--muted);
}

textarea.form-control {
  min-height: 5rem;
}

.form-control-sm,
.form-select-sm {
  min-height: 2.125rem;
  font-size: 0.8125rem;
}

.form-control-lg {
  min-height: 3rem;
  font-size: 1rem;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 0.2rem var(--bs-focus-ring-color);
}

.form-check-input {
  border-color: #b8c0ca;
}

.form-check-input:checked {
  background-color: var(--sky);
  border-color: var(--sky);
}

.form-label {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--body);
  margin-bottom: 0.35rem;
}

.form-text {
  color: var(--muted);
  font-size: 0.75rem;
}

.alert {
  --bs-alert-border-radius: 0.625rem;
  --bs-alert-padding-y: 0.75rem;
  --bs-alert-padding-x: 1rem;
  --bs-alert-border-color: transparent;
  font-size: 0.8125rem;
  border: 1px solid var(--bs-alert-border-color);
}

.alert-info {
  --bs-alert-bg: #eaf6fd;
  --bs-alert-color: #0c5a83;
  --bs-alert-border-color: #c3e6f8;
}

.alert-success {
  --bs-alert-bg: #f0fdf4;
  --bs-alert-color: #166534;
  --bs-alert-border-color: #bbf7d0;
}

.alert-warning {
  --bs-alert-bg: #fef6dc;
  --bs-alert-color: #7c4a03;
  --bs-alert-border-color: #f0c96a;
  border-style: dashed;
}

.alert-danger {
  --bs-alert-bg: #fef2f2;
  --bs-alert-color: #991b1b;
  --bs-alert-border-color: #fecaca;
}

.alert a {
  color: inherit;
  font-weight: 600;
}

.badge {
  font-weight: 600;
  border-radius: 999px;
  padding: 0.3em 0.65em;
  font-size: 0.6875rem;
}

.badge.text-bg-primary { background: var(--sky-soft) !important; color: var(--sky-deep) !important; }
.badge.text-bg-success { background: #dcfce7 !important; color: #166534 !important; }
.badge.text-bg-info { background: #e0f2fe !important; color: #075985 !important; }
.badge.text-bg-warning { background: #fef3c7 !important; color: #92400e !important; }
.badge.text-bg-danger { background: #fee2e2 !important; color: #991b1b !important; }
.badge.text-bg-secondary { background: #eef0f3 !important; color: #475569 !important; }
.badge.text-bg-light { background: #eef0f3 !important; color: #475569 !important; }

.dropdown-menu {
  --bs-dropdown-border-color: var(--line);
  --bs-dropdown-border-radius: 0.75rem;
  --bs-dropdown-link-active-bg: var(--sky);
  --bs-dropdown-font-size: 0.875rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

details > summary {
  cursor: pointer;
  color: var(--sky-dark);
  font-weight: 600;
}

/* --- En-tête de page ------------------------------------------------------------------------ */
.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}

.page-head > div:first-child {
  min-width: 0;
  max-width: 46rem;
}

.page-title,
h1.h3 {
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin: 0 0 0.4rem;
  color: var(--ink);
}

.page-meta,
.page-sub {
  color: var(--muted);
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
}

.page-meta strong,
.page-sub strong {
  color: var(--body);
  font-weight: 600;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 1.1rem;
}

.back-link:hover {
  color: var(--ink);
}

.back-link svg {
  width: 0.875rem;
  height: 0.875rem;
}

.eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

/* Tête d'une fiche (affaire, sous-affaire) */
.record-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem 1.5rem;
  margin-bottom: 1.25rem;
}

.record-code {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--ink);
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.record-label {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0.4rem 0 0;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* Carré de l'entité : H HTB Industrie, I SERIMETAL, S HTB Structure */
.entity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 0.3rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #fff;
  background: var(--sky);
  flex-shrink: 0;
  line-height: 1;
}

.entity-I { background: var(--navy); }
.entity-S { background: var(--violet); }

.entity-lg {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.4rem;
  font-size: 0.875rem;
}

.code-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  white-space: nowrap;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

a.code-cell:hover {
  color: var(--sky-dark);
}

.code-cell .suffix {
  color: var(--sky-dark);
}

/* --- Couleurs des statuts : une par étape, de la demande à la facture ------------------------ */
.tone-teal { --tone: #0f766e; --tone-bg: #ccfbf1; }
.tone-sky { --tone: #0369a1; --tone-bg: #e0f2fe; }
.tone-orange { --tone: #c2410c; --tone-bg: #ffedd5; }
.tone-blue { --tone: #1d4ed8; --tone-bg: #dbeafe; }
.tone-indigo { --tone: #4338ca; --tone-bg: #e0e7ff; }
.tone-slate { --tone: #334155; --tone-bg: #e2e8f0; }
.tone-amber { --tone: #b45309; --tone-bg: #fef3c7; }
.tone-cyan { --tone: #0e7490; --tone-bg: #cffafe; }
.tone-violet { --tone: #6d28d9; --tone-bg: #ede9fe; }
.tone-emerald { --tone: #047857; --tone-bg: #d1fae5; }
.tone-pink { --tone: #be185d; --tone-bg: #fce7f3; }
.tone-green { --tone: #15803d; --tone-bg: #dcfce7; }
.tone-red { --tone: #b91c1c; --tone-bg: #fee2e2; }
.tone-grey { --tone: #475569; --tone-bg: #eef0f3; }

/* État dans un tableau : point de couleur et libellé */
.state {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  color: var(--body);
  white-space: nowrap;
}

.state::before {
  content: "";
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--tone, var(--faint));
  flex-shrink: 0;
}

/* Pastille de statut (tête de fiche, cartes) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--tone, var(--body));
  background: var(--tone-bg, #eef0f3);
  border: 1px solid color-mix(in srgb, var(--tone, #94a3b8) 18%, transparent);
}

.pill::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.pill-sm {
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
}

/* Étiquette en capitales (BROUILLON, FAIT, À VALIDER…) */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--body);
  background: var(--card);
  border: 1px solid var(--line-strong);
}

.tag-sky { color: var(--sky-deep); background: var(--sky-soft); border-color: var(--sky-line); }
.tag-green { color: #166534; background: #dcfce7; border-color: #bbf7d0; }
.tag-amber { color: #92400e; background: #fef3c7; border-color: #fde68a; }
.tag-red { color: #991b1b; background: #fee2e2; border-color: #fecaca; }
.tag-violet { color: #5b21b6; background: #ede9fe; border-color: #ddd6fe; }
.tag-grey { color: #475569; background: #eef0f3; border-color: #e2e8f0; }

/* Priorité */
.prio {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #9a3412;
  background: #ffedd5;
}

.prio-high {
  color: #9f1239;
  background: #ffe4e6;
}

.late {
  color: var(--red);
  font-weight: 600;
}

/* --- Compteurs en bandeau (haut des listes) --------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1rem 1.25rem;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

a.stat:hover .stat-value {
  color: var(--sky-dark);
}

.stat-icon {
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.4rem;
  background: var(--card);
  color: var(--body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 0.95rem;
  height: 0.95rem;
}

.stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.3;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  font-size: 0.72rem;
  color: var(--faint);
  line-height: 1.35;
}

.stat-sub.late {
  color: var(--red);
  font-weight: 500;
}

/* « Ma journée » : compteurs du tableau de bord */
.day {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  overflow: hidden;
  border-radius: 0 0 0.75rem 0.75rem;
}

.day-item {
  display: block;
  padding: 1.1rem 1.25rem 1.2rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 0 -1px -1px 0;
  color: inherit;
  text-decoration: none;
}

a.day-item:hover {
  background: var(--well);
  color: inherit;
}

.day-value {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--tone, var(--ink));
  font-variant-numeric: tabular-nums;
}

.day-item.is-empty .day-value {
  color: var(--faint);
}

.day-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  margin-top: 0.35rem;
}

.day-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

/* Sélecteur de profil (tableau de bord) et sous-onglets */
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: 0.625rem;
}

.segmented a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  border-radius: 0.45rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--body);
  text-decoration: none;
  white-space: nowrap;
}

.segmented a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
}

.segmented a.active {
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.segmented svg {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--muted);
}

.segmented .tag {
  border: 0;
  padding: 0.05rem 0.4rem;
  font-size: 0.6rem;
}

/* Onglets d'une fiche */
.tabs {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.75rem;
  scrollbar-width: thin;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 0.85rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.tabs a:hover {
  color: var(--ink);
}

.tabs a.active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--sky);
}

.tabs svg {
  width: 0.95rem;
  height: 0.95rem;
}

.tabs .count {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

/* Barre des sous-affaires d'une affaire */
.siblings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  margin-bottom: 1.25rem;
}

.siblings-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.35rem;
}

.siblings a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  font-weight: 600;
  color: var(--body);
  text-decoration: none;
}

.siblings a:hover {
  background: var(--well);
}

.siblings a.active {
  border-color: var(--line-strong);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.siblings .state {
  font-size: 0.75rem;
  font-weight: 400;
}

.siblings-note {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted);
}

/* --- Fiche : libellés et valeurs ------------------------------------------------------------ */
.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem 1.5rem;
  margin: 0;
}

.fields-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fields .wide {
  grid-column: 1 / -1;
}

.fields dt,
.facts dt,
.facts-inline dt {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.fields dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.fields dd.is-empty,
.facts dd.is-empty {
  color: var(--muted);
}

@media (max-width: 575.98px) {
  .fields,
  .fields-3 {
    grid-template-columns: 1fr;
  }
}

.facts {
  margin: 0;
  display: grid;
  gap: 1rem;
}

.facts dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.facts-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  margin: 0;
}

.facts-inline dd {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Panneau latéral : client, contact */
.side-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.2rem;
}

.side-line {
  color: var(--muted);
  font-size: 0.8125rem;
  margin: 0 0 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.side-line svg {
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
}

/* Bandeau de faits avec icône (prise en charge, transport…) */
.facts-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1rem 1.5rem;
}

.fact {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
}

.fact .stat-icon {
  border-radius: 50%;
}

.fact dt {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.fact dd {
  margin: 0.1rem 0 0;
  color: var(--ink);
  font-weight: 500;
}

/* --- Filtres d'une liste ------------------------------------------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.filters .search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 16rem;
  max-width: 22rem;
  height: 2.5rem;
  padding: 0 0.75rem;
  background: var(--line-soft);
  border: 1px solid transparent;
  border-radius: 0.5rem;
  color: var(--muted);
}

.filters .search:focus-within {
  background: var(--card);
  border-color: var(--sky);
  box-shadow: 0 0 0 0.2rem var(--bs-focus-ring-color);
}

.filters .search input {
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  width: 100%;
  min-width: 0;
  color: var(--text);
}

.filters .form-select {
  width: auto;
  min-width: 10rem;
  max-width: 15rem;
}

.filters-icon {
  color: var(--muted);
}

.filters .count {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted);
}

/* --- Frise d'avancement d'une affaire (12 statuts) ------------------------------------------- */
.steps-scroll {
  overflow-x: auto;
}

.steps {
  min-width: 46rem;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  row-gap: 0.65rem;
}

.steps-phase {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.4rem;
  margin-right: 0.75rem;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-right: 0.4rem;
  min-width: 0;
}

.step-track {
  display: flex;
  align-items: center;
}

.step-dot {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--card);
  color: var(--faint);
  border: 1.5px solid var(--line-strong);
}

.step-line {
  height: 2px;
  flex: 1 1 auto;
  margin-left: 0.35rem;
  background: var(--line);
  border-radius: 2px;
}

.step-label {
  font-size: 0.75rem;
  line-height: 1.25;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.step.is-passed .step-line {
  background: var(--sky);
}

.step.is-done .step-dot {
  background: var(--sky);
  border-color: var(--sky);
  color: #fff;
}

.step.is-done .step-label,
.step.is-partial .step-label {
  color: var(--body);
}

.step.is-partial .step-dot {
  background: var(--sky-soft);
  border-color: var(--sky-line);
  color: var(--sky-deep);
}

/* Étape où se trouve une livraison : couleur de son statut */
.step.is-current .step-dot {
  border: 2px solid var(--tone);
  background: var(--tone-bg);
  color: var(--tone);
}

.step.is-current .step-label {
  color: var(--tone);
  font-weight: 700;
}

.step:last-child .step-line {
  visibility: hidden;
}

.step-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.step-chip {
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 0.3rem;
  padding: 0.05rem 0.4rem;
  color: var(--tone);
  background: var(--tone-bg);
}

/* --- Frise des faits d'une sous-affaire (prévu / réel) --------------------------------------- */
.facts-frise {
  display: grid;
  grid-template-columns: minmax(9rem, auto) 1fr;
  gap: 1rem 1.5rem;
  align-items: start;
}

@media (max-width: 991.98px) {
  .facts-frise {
    grid-template-columns: 1fr;
  }
}

.frise-where .eyebrow {
  margin-bottom: 0.5rem;
}

.frise {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(6.25rem, 1fr);
  overflow-x: auto;
  list-style: none;
  margin: 0;
  padding: 0.15rem 0 0.25rem;
}

.frise li {
  min-width: 0;
}

.frise-track {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.frise-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  flex-shrink: 0;
}

.frise-line {
  flex: 1 1 auto;
  height: 2px;
  margin-right: 0.4rem;
  border-radius: 2px;
  background: var(--line);
}

.frise li:last-child .frise-line {
  visibility: hidden;
}

.frise-head {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.25;
  color: var(--muted);
  padding-right: 0.5rem;
}

.frise li.is-done .frise-head,
.frise li.is-current .frise-head {
  color: var(--ink);
  font-weight: 500;
}

.frise li.is-done .frise-dot,
.frise li.is-current .frise-dot {
  background: var(--sky);
  border-color: var(--sky);
}

.frise li.is-done .frise-line {
  background: var(--sky);
}

.frise li.is-current .frise-dot {
  box-shadow: 0 0 0 3px var(--sky-soft);
}

.frise-date {
  display: block;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--ink);
  margin-top: 0.2rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.frise-date.planned {
  color: var(--faint);
  margin-top: 0;
}

.frise-date .gap-late {
  color: var(--red);
  font-weight: 600;
}

.frise-date .gap-early {
  color: var(--green);
  font-weight: 600;
}

/* Mini-frise d'une ligne de tableau (production) */
.mini-bar {
  display: flex;
  gap: 3px;
  margin-top: 0.35rem;
  width: 8.5rem;
}

.mini-bar span {
  flex: 1 1 0;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
}

.mini-bar span.on {
  background: var(--sky);
}

/* Petite frise d'étapes d'une carte (galva, transport) */
.mini-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  counter-reset: mini;
}

.mini-steps li {
  counter-increment: mini;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.mini-steps li::before {
  content: counter(mini);
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
}

.mini-steps li.is-done {
  color: var(--body);
}

.mini-steps li.is-done::before {
  content: "✓";
  background: var(--sky);
  border-color: var(--sky);
  color: #fff;
}

.mini-steps li.is-current {
  color: var(--ink);
  font-weight: 600;
}

.mini-steps li.is-current::before {
  border-color: var(--sky);
  color: var(--sky-dark);
  box-shadow: 0 0 0 3px var(--sky-soft);
}

.mini-steps li.is-warning {
  color: #92400e;
}

.mini-steps li.is-warning::before {
  content: "!";
  background: #fef3c7;
  border-color: #f0c96a;
  color: #92400e;
}

/* Liste à cocher (contrôles, pièces) */
.checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.checks li {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
}

.checks .box {
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 0.3rem;
  border: 1.5px solid #b8c0ca;
  background: var(--card);
  flex-shrink: 0;
  margin-top: 0.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.checks li.is-done .box {
  background: var(--sky);
  border-color: var(--sky);
}

.checks li.is-done .box::after {
  content: "";
  width: 0.55rem;
  height: 0.3rem;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}

.checks b {
  display: block;
  font-weight: 500;
  color: var(--ink);
}

.checks small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

/* --- Bureau d'études : colonnes par dessinateur ---------------------------------------------- */
.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(16rem, 1fr);
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.lane {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--lane, var(--navy));
  border-radius: 0.75rem;
  display: flex;
  flex-direction: column;
  min-height: 12rem;
}

.lane-head {
  padding: 0.85rem 0.9rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
}

.lane-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--ink);
}

.lane-title .count {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--line-soft);
  border-radius: 0.3rem;
  padding: 0.05rem 0.4rem;
}

.lane-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.lane-body {
  padding: 0.75rem;
  display: grid;
  gap: 0.6rem;
  align-content: start;
}

.lane-empty {
  font-size: 0.78rem;
  color: var(--faint);
  padding: 0.25rem;
}

.ticket {
  border: 1px solid var(--line);
  border-left: 3px solid var(--ticket, var(--line));
  border-radius: 0.5rem;
  padding: 0.7rem 0.8rem;
  background: var(--card);
}

.ticket-code {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.ticket-client {
  margin-top: 0.4rem;
  color: var(--ink);
  font-size: 0.8125rem;
}

.ticket-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.ticket-foot {
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

/* --- Documents ------------------------------------------------------------------------------ */
.doc-group + .doc-group {
  margin-top: 1rem;
}

.doc-group-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.doc-group-head svg {
  width: 1rem;
  height: 1rem;
  color: var(--sky);
}

.doc-group-head .count {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--line-soft);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}

.doc-list {
  display: grid;
  gap: 0.5rem;
  padding-left: 1rem;
  margin-left: 0.45rem;
  border-left: 1px solid var(--line);
}

.doc-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.625rem;
  background: var(--card);
}

.doc-row .name {
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.doc-row .name:hover {
  color: var(--sky-dark);
}

.doc-row .meta {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}

.file-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  background: var(--sky-soft);
  color: var(--sky-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-icon svg {
  width: 1.05rem;
  height: 1.05rem;
}

.file-icon.is-pdf { background: #fee2e2; color: #b91c1c; }
.file-icon.is-sheet { background: #dcfce7; color: #15803d; }
.file-icon.is-image { background: #ede9fe; color: #6d28d9; }
.file-icon.is-mail { background: #fef3c7; color: #b45309; }

/* Arborescence du dossier serveur */
.tree {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8125rem;
}

.tree li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0;
}

.tree svg {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
}

/* Historique en frise verticale */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  display: flex;
  gap: 0.75rem;
}

.timeline .tl-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.timeline .tl-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  margin-top: 0.35rem;
  background: var(--tone, var(--faint));
}

.timeline .tl-bar {
  width: 1px;
  flex: 1 1 auto;
  background: var(--line);
  margin: 0.25rem 0;
}

.timeline li:last-child .tl-bar {
  visibility: hidden;
}

.timeline .tl-body {
  padding-bottom: 0.9rem;
  min-width: 0;
}

.timeline .tl-meta {
  font-size: 0.72rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* Journal en lignes (historique d'un dossier) */
.log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.log li {
  display: grid;
  grid-template-columns: 9rem 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--line-soft);
}

.log li:first-child {
  border-top: 0;
}

.log time {
  font-size: 0.78rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 575.98px) {
  .log li {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

/* --- Zones de dépôt ------------------------------------------------------------------------- */
.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: 0.75rem;
  background: var(--well);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
}

.dropzone .drop-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.6rem;
}

.dropzone .drop-title {
  color: var(--ink);
  font-weight: 500;
  font-size: 0.9375rem;
}

.dropzone:focus,
.dropzone-over {
  border-color: var(--sky);
  background: var(--sky-soft);
  outline: none;
}

.upload {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.upload input[type="file"] {
  flex: 1 1 16rem;
  min-width: 0;
}

.mail-body {
  white-space: pre-wrap;
  max-height: 18rem;
  overflow-y: auto;
  font-size: 0.8125rem;
  background: var(--well) !important;
  border-color: var(--line) !important;
}

/* PDF affiché à côté des valeurs lues */
.pdf-frame {
  width: 100%;
  height: 78vh;
  min-height: 24rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--card);
  display: block;
}

.card > .pdf-frame {
  border: 0;
  border-radius: 0 0 0.75rem 0.75rem;
}

.quote-lines td:nth-child(1) { min-width: 9rem; }
.quote-lines td:nth-child(2) { min-width: 16rem; }
.quote-lines td:nth-child(n+3):nth-child(-n+5) { width: 6rem; }
.quote-lines td:nth-child(7) { width: 8rem; }

.photo-thumb {
  width: 6.5rem;
  height: 6.5rem;
  object-fit: cover;
  border-radius: 0.5rem !important;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.75rem;
}

.package-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 0.625rem;
  overflow: hidden;
  background: var(--card);
}

.package-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--line-soft);
}

.package-card figcaption {
  padding: 0.6rem 0.75rem;
  font-size: 0.8125rem;
}

/* Valeurs lues dans un document : à vérifier (jaune) ou non trouvées (rouge) */
.value-uncertain {
  background-color: #fef6dc;
  border-color: #f0c96a !important;
}

.value-missing {
  background-color: #fef2f2;
  border-color: #f87171 !important;
}

/* Bandeau d'information dans un panneau */
.callout {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: 0.625rem;
  font-size: 0.8125rem;
  background: #eaf6fd;
  color: #0c5a83;
  border: 1px solid #c3e6f8;
}

.callout svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.callout-ok {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

.callout-warn {
  background: #fef6dc;
  color: #7c4a03;
  border: 1px dashed #f0c96a;
}

/* Grille des listes du tableau de bord */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr));
  gap: 1rem;
  align-items: start;
}

.home-grid .card {
  margin-bottom: 0 !important;
}

.count-badge {
  font-variant-numeric: tabular-nums;
  background: var(--line-soft);
  color: var(--body);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-weight: 600;
  font-size: 0.72rem;
}

.home-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.6rem;
}

/* --- Écrans d'atelier : téléphone, gros boutons, un geste par écran (principe VII) ------------ */
.m-body {
  background: #e9eaee;
}

.m-shell {
  max-width: 27rem;
  min-height: 100vh;
  margin: 0 auto;
  background: #eef1f6;
  display: flex;
  flex-direction: column;
}

.m-head {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border-bottom: 1px solid #dfe3ea;
}

.m-back {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.75rem;
  border: 1.5px solid #64748b;
  background: #fff;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.m-back:hover {
  color: var(--ink);
  background: #f8fafc;
}

.m-back svg {
  width: 1.5rem;
  height: 1.5rem;
}

.m-heading {
  flex: 1 1 auto;
  min-width: 0;
}

.m-heading b {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.m-heading small {
  display: block;
  font-size: 0.875rem;
  color: var(--body);
}

.m-account {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #334155;
  text-align: center;
  line-height: 1.15;
  border: 1.5px solid #cbd5e1;
  border-radius: 0.6rem;
  padding: 0.35rem 0.6rem;
  background: #f8fafc;
}

.m-logo {
  height: 2rem;
  width: auto;
}

.atelier {
  flex: 1 1 auto;
  padding: 1.25rem 1rem 7rem;
}

.atelier h1,
.m-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 1rem;
}

.m-question {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 1.25rem 0 0.75rem;
}

.m-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.m-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 6rem;
  padding: 0.75rem 0.5rem;
  border: 1.5px solid #64748b;
  border-radius: 0.75rem;
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  text-decoration: none;
}

.m-tile svg {
  width: 1.75rem;
  height: 1.75rem;
  color: var(--sky-deep);
}

.m-tile small {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.m-tile:hover,
.m-tile.is-selected {
  color: var(--ink);
  border-color: var(--sky-deep);
  background: #e6f3fb;
}

.m-tile.is-selected {
  border-width: 2px;
}

.m-tile.is-selected::after {
  content: "✓";
  position: absolute;
  top: -0.55rem;
  right: -0.55rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--sky-deep);
  color: #fff;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.m-progress {
  display: flex;
  gap: 0.4rem;
  margin: 1.25rem 0 0;
}

.m-progress span {
  flex: 1 1 0;
  height: 0.35rem;
  border-radius: 999px;
  background: #cbd5e1;
}

.m-progress span.on {
  background: var(--sky-deep);
}

.m-step {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--sky-deep);
  margin: 1.25rem 0 0.4rem;
}

.m-card {
  border: 1.5px solid #cbd5e1;
  border-radius: 0.75rem;
  background: #fff;
  padding: 1rem;
  margin-bottom: 1rem;
}

.m-card.is-ok {
  border: 2px solid #15803d;
  background: #f0fdf4;
}

.m-label {
  display: block;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 0.5rem;
}

.atelier .form-select,
.atelier .form-control {
  min-height: 3.5rem;
  font-size: 1.05rem;
  border: 1.5px solid #64748b;
  border-radius: 0.75rem;
  background-color: #fff;
}

.atelier textarea.form-control {
  min-height: 6rem;
}

.atelier .form-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.m-shot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 4.5rem;
  margin-bottom: 0.75rem;
  border: 2px dashed #64748b;
  border-radius: 0.75rem;
  background: #fff;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
}

.m-shot svg {
  width: 1.75rem;
  height: 1.75rem;
  color: var(--sky-deep);
}

.m-shot:hover {
  border-color: var(--sky-deep);
  background: #e6f3fb;
}

.m-cta {
  position: sticky;
  bottom: 0;
  margin: 1.5rem -1rem -7rem;
  padding: 1rem;
  background: #fff;
  border-top: 1px solid #dfe3ea;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
}

.btn-atelier {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 4rem;
  border-radius: 0.75rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  background: var(--sky-deep);
  border: 0;
}

.btn-atelier:hover,
.btn-atelier:focus {
  color: #fff;
  background: #0a5c86;
}

.btn-atelier:disabled {
  background: #94b8cc;
  color: #fff;
}

.btn-atelier-outline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 3.5rem;
  border-radius: 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid #64748b;
}

.btn-atelier-outline:hover {
  background: #f8fafc;
  color: var(--ink);
}

.m-dims {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
