/* ── Recouvrement — interaction timeline ─────────────────────── */
.rec-timeline         { display: flex; flex-direction: column; gap: .1rem; }
.rec-timeline-item    { display: flex; gap: .75rem; padding: .625rem .5rem; border-bottom: 1px solid var(--border); }
.rec-timeline-icon    { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
                         background: var(--surface-2); display: flex; align-items: center;
                         justify-content: center; color: var(--text-secondary); margin-top: .1rem; }
.rec-timeline-body    { flex: 1; min-width: 0; }
.rec-timeline-meta    { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; }
.rec-timeline-main    { margin-top: .2rem; font-size: var(--text-sm); }
.rec-timeline-author  { margin-top: .15rem; font-size: var(--text-xs); color: var(--text-muted); }
.rec-timeline-time    { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
.rec-timeline-badge   { margin-left: .4rem; }
.rec-timeline-muted   { color: var(--text-secondary); }
.modal-footer--left   { justify-content: flex-start; }

/* ── Tenant / Organisation page ─────────────────────────────── */
.tenant-dashboard {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 900px) {
  .tenant-dashboard { grid-template-columns: 1fr; }
}
.tenant-left-column { display: flex; flex-direction: column; gap: var(--space-4); }
.tenant-right-column { min-width: 0; }

/* .logo-section / .logo-preview / .tenant-logo / .logo-placeholder /
   .logo-actions / .logo-recommendations rules live in
   app-core/public/assets/css/components/settings.css (Phase 5d, 2026-05-02). */

.search-section { background: var(--color-surface-2, #f8fafc); border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; margin-bottom: 1.5rem; }
.search-controls { display: flex; gap: .5rem; }

.contact-link { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--text-secondary); text-decoration: none; padding: .25rem .5rem; border-radius: 4px; }
.contact-link:hover { background: var(--color-surface-2, #f5f5f5); color: var(--text); }
.address-block { display: flex; align-items: flex-start; gap: .5rem; font-size: .85rem; color: var(--text-secondary); font-style: normal; }
.row-item { padding: var(--space-3); border: 1px solid var(--border); border-radius: 6px; margin-bottom: var(--space-2); }

/* Sidebar rules (.sidebar, .sidebar-nav, .sidebar-brand, .app-launcher)
   live in shared app-core/public/assets/css/components/navigation.css.
   Tenant identity + logout moved to the topbar avatar menu (no sidebar
   footer anymore). */

/* App-specific variables */
:root {
  --logo-color-1: #193153;
  --logo-color-2: #ffbd59;

  /* Semantic danger token. The design system ships --error (#ef4444) as the
     canonical "bad" colour but no --danger; a lot of code wrote
     var(--danger, #b91c1c|#991b1b) with divergent hex fallbacks. Aliasing
     --danger → --error makes every var(--danger) resolve to ONE source so the
     hex fallbacks can be dropped. */
  --danger: var(--error);
}

/* Micro-label type role (smaller than .text-xs). One canonical size for the
   sub-labels / meta hints that were scattered across .63–.7rem inline. */
.text-2xs { font-size: 0.6875rem; }

/* Group label inside a dropdown menu (e.g. the "Clôture" section of the
   affaire actions menu). Quiet, uppercase, non-clickable. */
.dropdown-section-label {
  padding: 0.25rem 1rem 0.15rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* ── Affaire detail — shared layout primitives ───────────────────────────────
   Replace the repeated inline display:grid/flex blocks in jobs/*.js + jobs.php
   so layout lives in CSS, not in string templates. */
/* Horizontal action toolbar (header button rows, section toolbars). */
.job-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  flex-wrap: wrap;
}
/* Two equal columns that stack on narrow screens (Récap masonry, settings). */
.job-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4, 1rem);
  align-items: start;
}
.job-two-col > .job-col-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4, 1rem);
  min-width: 0;
}
@media (max-width: 768px) {
  .job-two-col { grid-template-columns: 1fr; }
}
/* Rentabilité waterfall — 3 equal columns (Prévu / Commandé / Payé). */
.job-waterfall {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2, 0.5rem);
}
@media (max-width: 600px) {
  .job-waterfall { grid-template-columns: 1fr; }
}
/* Compact data tables inside Récap cards (achats par groupe, main d'œuvre,
   heures). One shared style instead of three near-identical inline blocks. */
.job-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}
.job-mini-table th {
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.2rem 0.4rem;
}
.job-mini-table td { padding: 0.3rem 0.4rem; }
.job-mini-table tfoot tr {
  font-weight: 700;
  border-top: 1px solid var(--border);
}
/* Avenant line editor row — template grid cloned by JS (jobs.php). */
.avenant-line-grid {
  display: grid;
  grid-template-columns: 1fr 70px 70px 100px 60px 100px 32px;
  gap: 0.4rem;
  align-items: start;
}

/* Line item row: hide entity-actions button border until hover */
.invoice-item-row .entity-actions-btn,
.quote-item-row .entity-actions-btn {
  border-color: transparent;
}
.invoice-item-row .entity-actions-btn:hover,
.quote-item-row .entity-actions-btn:hover {
  border-color: var(--gray-300);
}

/* ── Quote modal — full width ───────────────────────────────── */
.modal-full {
  width: 95vw;
  max-width: 1400px;
}
@media (max-width: 768px) {
  .modal-full {
    max-width: 95vw;
    margin: var(--space-4);
  }
}

/* ── Quote item cards ───────────────────────────────────────── */

.qi-cards {
  display: flex;
  flex-direction: column;
  gap: .625rem;
}

/* ── Quote header rows ── */
.quote-header-row {
  border-left: 4px solid var(--primary, #2563eb);
  background: #eff6ff;
  border-radius: 4px;
  padding: .375rem .75rem .375rem .5rem;
}
.quote-header-row.qi-header-depth-2 { margin-left: 1rem; background: #f3f4f6; border-left-color: #9ca3af; }
.quote-header-row.qi-header-depth-3 { margin-left: 2rem; background: transparent; border-left-color: #d1d5db; }

.quote-header-row .header-description { border: none; background: transparent; box-shadow: none; font-weight: 700; padding: .25rem .5rem; }
.quote-header-row .header-description:focus { outline: none; box-shadow: none; }

.quote-header-row .qi-col-actions { visibility: hidden; margin-top: 0; flex-direction: row; align-items: center; }
.quote-header-row:hover .qi-col-actions,
.quote-header-row:focus-within .qi-col-actions { visibility: visible; }

.qi-header-preamble { margin-top: .25rem; padding-top: .25rem; border-top: 1px dashed #e5e7eb; }
.qi-header-preamble textarea.form-input {
  field-sizing: content;
  resize: none;
  background: transparent;
  border: none;
  box-shadow: none;
  font-style: italic;
}

/* ── Card ── */
.qi-card {
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 8px;
  background: #fff;
  padding: .5rem .75rem .625rem;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.qi-card:hover {
  border-color: var(--gray-300, #d1d5db);
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.qi-card.qi-card-open {
  border-radius: 8px 8px 0 0;
  border-bottom-color: var(--gray-100, #f3f4f6);
}

/* Main row */
.qi-row {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.qi-line-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary, #2563eb);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1.55rem; /* align with input centers */
}

/* Columns */
.qi-col {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
}
.qi-col-desc  { flex: 1; }
.qi-col-qty   { width: 80px;  flex-shrink: 0; }
.qi-col-pu    { width: 120px; flex-shrink: 0; }
.qi-col-vat   { width: 100px; flex-shrink: 0; }
.qi-col-total { width: 120px; flex-shrink: 0; }
.qi-col-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .125rem;
  margin-top: 1.45rem; /* align with label+input on line rows */
}

/* Description cell */
.qi-f-desc {
  display: flex;
  align-items: flex-start;
  gap: .375rem;
  min-width: 0;
}
.qi-description-textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  overflow: hidden;
  line-height: 1.4;
}

/* Total display */
.qi-total-value {
  font-weight: 700;
  color: var(--primary, #2563eb);
  white-space: nowrap;
  text-align: right;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: var(--radius);
  background: var(--gray-50, #f9fafb);
  line-height: 1.4;
}

/* Toggle */
.qi-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius);
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: transform .15s ease, color .15s ease, background .1s ease;
  flex-shrink: 0;
}
.qi-toggle-btn:hover { background: var(--gray-100, #f3f4f6); color: var(--text); }
.qi-toggle-btn.qi-toggle-open { transform: rotate(180deg); color: var(--primary); }

/* ── Detail panel ── */
.qi-detail {
  border: 1px solid var(--gray-200, #e5e7eb);
  border-top: none;
  border-radius: 0 0 8px 8px;
  margin-top: -.625rem;
  background: var(--gray-50, #f9fafb);
}
.qi-detail-inner {
  padding: .75rem .875rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

/* Row 1: two groups side by side */
.qi-detail-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

/* Group (Identification / Rentabilité) */
.qi-detail-group {
  display: flex;
  flex-direction: column;
  gap: .375rem;
}
.qi-detail-group-title {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding-bottom: .25rem;
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
}
.qi-detail-group-title svg { opacity: .45; }

/* Pricing group accent */
.qi-detail-group-pricing .qi-detail-group-title {
  color: var(--primary-700, #1d4ed8);
  border-bottom-color: var(--primary-200, #bfdbfe);
}
.qi-detail-group-pricing .qi-detail-group-title svg { opacity: .6; color: var(--primary); }

/* Detail field grids */
.qi-dg-fields { display: grid; gap: .375rem; }
.qi-dg-3 { grid-template-columns: 80px 1fr 1fr; }
.qi-dg-pricing { grid-template-columns: 1fr 1fr 1fr; }

/* Detail fields */
.qi-df {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.qi-df-grow { flex: 1; min-width: 0; }
.qi-df input, .qi-df select {
  width: 100%;
}
.qi-df textarea {
  width: 100%;
  resize: vertical;
  min-height: 2.5rem;
}

/* Texts row */
.qi-detail-texts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

/* Variables list (read-only, typically from Build conversion) */
.qi-detail-vars { margin-top: .75rem; }
.qi-detail-vars .qi-detail-group-title {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
  margin-bottom: .4rem;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.item-variables-display {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.item-variables-display .qi-var-chip {
  background: var(--surface-2, #f1f5f9);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .15rem .5rem;
  font-size: .75rem;
  color: var(--text-primary);
}
.item-variables-display .qi-var-chip strong {
  color: var(--text-secondary);
  font-weight: 500;
  margin-right: .3rem;
}

/* Margin input with % suffix */
.qi-margin-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.qi-margin-input-wrap input { padding-right: 1.5rem; }
.qi-margin-suffix {
  position: absolute;
  right: .4rem;
  font-size: .7rem;
  color: var(--text-secondary);
  pointer-events: none;
}

/* Sell price read-only */
.qi-sell-price-display {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text);
  padding: .3rem .375rem;
  background: var(--gray-100, #f3f4f6);
  border-radius: var(--radius);
  line-height: 1.4;
}

/* Margin badge */
.qi-margin-indicator {
  margin-left: auto;
  font-size: .6rem;
  font-weight: 700;
  white-space: nowrap;
  padding: .1rem .35rem;
  border-radius: 3px;
  line-height: 1.2;
}
.qi-margin-indicator:empty { display: none; }
.qi-margin-indicator.positive { color: var(--success, #16a34a); background: #dcfce7; }
.qi-margin-indicator.negative { color: var(--error, #ef4444); background: #fef2f2; }

/* ── Deposit Picker ────────────────────────────────────────── */
.deposit-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-2, #f8fafc);
}
.deposit-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}
.deposit-picker-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: 0.875rem;
}
.deposit-picker-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.deposit-picker-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface, #fff);
}
.deposit-picker-info {
  flex: 1;
  min-width: 0;
}
.deposit-picker-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.8125rem;
  font-weight: 500;
}
.deposit-picker-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.deposit-picker-source {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
}
.deposit-picker-source--invoice { color: var(--primary); }
.deposit-picker-source--external { color: var(--text-secondary); }
.deposit-picker-amount {
  flex-shrink: 0;
  width: 7rem;
}
.deposit-picker-amount .form-input {
  font-size: 0.8125rem;
  padding: 0.25rem 0.5rem;
  text-align: right;
}
.deposit-picker-amount .form-input:disabled {
  opacity: 0.4;
}
.deposit-picker-empty {
  padding: var(--space-3);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}
.deposit-picker-footer {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.875rem;
}

/* ── Invoice Totals: deduction & net rows ──────────────────── */
.invoice-totals-deduction {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  font-size: 0.875rem;
  color: var(--danger, #dc2626);
}
.invoice-totals-net {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0 0.3rem;
  margin-top: 0.25rem;
  border-top: 2px solid var(--primary);
  font-weight: 700;
}
.invoice-totals-net-amount {
  color: var(--primary);
  font-size: 1.25rem;
}

/* Situation progress slider — custom track with locked zone */
.situation-percent-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  width: 100%;
  background: var(--gray-200);
}
.situation-percent-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.situation-percent-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

/* Airfact mark is landscape (~2:1) — cap its width in the sidebar brand box
   so it doesn't stretch edge-to-edge. */
.sidebar-brand-logo svg,
.sidebar-brand-logo img {
  max-width: 140px;
}

/* Quote totals summary card (Quotes view) — extracted verbatim from the inline
   styles in Quotes/Views/quotes.php (Tier-4 UX-debt migration). Byte-identical
   rules, so the rendering is unchanged; the markup just stops hard-coding them. */
.quote-totals {
  min-width: 18rem;
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.quote-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.quote-totals-row.is-total {
  padding: 0.6rem 0 0.3rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-weight: 600;
  color: var(--text);
}
.quote-totals-amount {
  color: var(--primary);
  font-size: 1.125rem;
}

/* ── Bandeau KPI affaire — cartes compactes (chiffres moins gros) ─────────── */
/* Scopé à #jobKpiBar : ne touche pas les stat-cards des autres pages. */
#jobKpiBar .dash-stat-card {
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  min-width: 180px;
}
#jobKpiBar .dash-stat-value,
#jobKpiBar .dash-stat-card--no-icon .dash-stat-value {
  font-size: 1.3rem;
}
#jobKpiBar .dash-stat-label {
  font-size: 0.7rem;
}

/* ── Cartes détail Récap affaire (#contractSummary) ──────────────────────────
   Motif répété : carte info « label + lignes clé/valeur ». Remplace l'ancien
   dict de styles inline `S` de recap.js (rendu visuellement identique). Scopé
   à #contractSummary pour ne pas fuiter ces noms génériques hors fiche affaire. */
#contractSummary .job-card,
.job-cockpit .job-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: var(--surface);
}
#contractSummary .job-card-label,
.job-cockpit .job-card-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
#contractSummary .job-card-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}
#contractSummary .job-row,
.job-cockpit .job-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  font-size: 0.85rem;
}
#contractSummary .job-sep,
.job-cockpit .job-sep {
  border-top: 1px solid var(--border);
  margin: 0.25rem 0;
}

/* ── Bannières d'alerte Récap (bord gauche teinté + titre à icône) ───────────
   Motif répété (ARC en retard, livraisons, marge sous cible, dépassement
   d'achats) — remplace les fonds/bordures hex en dur de recap.js. */
#contractSummary .job-banner,
.job-cockpit .job-banner {
  margin-bottom: 0.875rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid;
  border-radius: 6px;
}
#contractSummary .job-banner-head,
.job-cockpit .job-banner-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}
#contractSummary .job-banner--warning,
.job-cockpit .job-banner--warning {
  background: #fef3c7;
  border-left-color: #f59e0b;
  color: #854d0e;
}
#contractSummary .job-banner--danger,
.job-cockpit .job-banner--danger {
  background: #fef2f2;
  border-left-color: #ef4444;
  color: #991b1b;
}
#contractSummary .job-banner-link,
.job-cockpit .job-banner-link {
  font-size: 0.8rem;
  text-decoration: underline;
  white-space: nowrap;
  cursor: pointer;
  color: inherit;
}
#contractSummary .job-banner-chip,
.job-cockpit .job-banner-chip {
  display: inline-block;
  margin: 0.15rem 0.3rem 0.15rem 0;
  padding: 0.2rem 0.5rem;
  background: #fee2e2;
  color: #ef4444;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ── Groupe de boutons bascule €/% (modales acompte / avance) ────────────────
   Remplace les styles inline dupliqués des deux modales : conteneur bordé +
   boutons sans rayon avec séparateur. */
.btn-toggle-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}
.btn-toggle-group .btn {
  border-radius: 0;
  border: none;
}
.btn-toggle-group .btn + .btn {
  border-left: 1px solid var(--border);
}

/* Affaire « Client » tab — collapsible "Détail des postes du marché" section.
   The summary reads as a panel-title; the chevron rotates when open. */
.marche-postes > summary { user-select: none; }
.marche-postes > summary::-webkit-details-marker { display: none; }
.marche-postes > summary svg { transition: transform .15s ease; flex-shrink: 0; color: var(--text-secondary); }
.marche-postes[open] > summary svg { transform: rotate(90deg); }

/* Rentabilité card — collapsible detail (Récap). The summary reads as a quiet
   link; only the "Marge estimée" headline shows until expanded. */
.job-renta-detail > summary {
  cursor: pointer;
  color: var(--primary);
  user-select: none;
}
.job-renta-detail > summary:hover { text-decoration: underline; }

/* "Points d'attention" — fold extra banners beyond the first two. */
.job-attention-more > summary {
  cursor: pointer;
  color: var(--text-secondary);
  user-select: none;
  padding: 0.25rem 0;
}
.job-attention-more > summary:hover { color: var(--text); }

/* Danger-zone card (delete affaire, etc.) — red border + red title, no inline
   colour overrides in the JS. */
.card--danger { border-color: var(--danger); }
.card--danger .card-title,
.card--danger .card-danger-title { color: var(--danger); }

/* Affaire status picker popover — replaces the inline onmouseover/onmouseout
   hover hack with a real :hover rule. */
.status-picker-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.875rem;
  text-align: left;
}
.status-picker-item:hover,
.status-picker-item.is-current { background: var(--gray-100); }

/* @-mention highlight in the affaire discussion thread. */
.md-content .mention { color: var(--primary); font-weight: 600; }

/* ════════════════════════════════════════════════════════════════════════════
   Affaire — détail v2 (cockpit). Behind ?v=2. Reuses the .job-card / .job-banner
   primitives (selectors broadened above) + the cockpit-specific layout below.
   Design tokens only (var(--…)) — no hardcoded colours in the v2 layer.
   ════════════════════════════════════════════════════════════════════════════ */

.job-cockpit { margin-bottom: 0.25rem; }

/* Topline — status badge (changeable) + reference + Build link */
.job-cockpit-topline {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: 0.9rem;
}
.job-cockpit-status { cursor: pointer; }

/* Funnel — 4 money cards, slightly denser than the default stat-card */
.job-cockpit-funnel { margin-bottom: 1rem; }
.job-cockpit-funnel .dash-stat-card { min-width: 190px; }
.job-cockpit-funnel .dash-stat-value { font-size: 1.3rem; }
.job-cockpit-funnel .dash-stat-label { font-size: 0.7rem; }
.job-amount-warning { color: var(--warning); font-weight: 600; }
.job-amount-success { color: var(--success); font-weight: 600; }

/* Points d'attention */
.job-cockpit-attention { margin-bottom: 1rem; }
.job-attention-more-body { margin-top: 0.5rem; }
.job-banner-list { list-style: none; margin: 0.35rem 0 0; padding: 0; font-size: 0.8rem; }
.job-banner-list li { margin: 0.15rem 0; }
.job-banner-itemlink { color: inherit; text-decoration: underline; }
.job-banner-chips { margin-top: 0.4rem; }

/* Rentabilité — collapsible (masqué par défaut) */
.job-cockpit-renta { margin-top: 0.25rem; }
.job-cockpit-renta-summary {
  cursor: pointer; user-select: none; color: var(--primary);
  font-size: 0.875rem; display: flex; align-items: center; gap: 0.4rem;
  list-style: none; padding: 0.4rem 0;
}
.job-cockpit-renta-summary::-webkit-details-marker { display: none; }
.job-cockpit-renta-summary svg { transition: transform 0.15s ease; flex-shrink: 0; }
.job-cockpit-renta[open] > .job-cockpit-renta-summary svg { transform: rotate(90deg); }
.job-cockpit-renta-body {
  display: grid; grid-template-columns: 3fr 2fr; gap: 1rem;
  align-items: start; padding-top: 0.6rem;
}
.job-cockpit-renta-body > .job-card:first-child { grid-row: span 2; }
@media (max-width: 900px) { .job-cockpit-renta-body { grid-template-columns: 1fr; } }

.job-renta-header { margin-bottom: 0.6rem; }

/* Waterfall columns (Prévu / Commandé / Payé) */
.job-renta-col {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.65rem 0.8rem; background: var(--surface); min-width: 0;
}
.job-renta-col-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.3rem; }
.job-renta-col-label { font-size: 0.63rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.job-renta-achats { margin: 0.1rem 0; }
.job-renta-modline { margin: 0.1rem 0; color: var(--text-secondary); }
.job-renta-col-sep { border-top: 1px solid var(--border); margin: 0.35rem 0; }
.job-renta-col-marge { font-size: 1rem; font-weight: 700; white-space: nowrap; }
.job-renta-nomod { margin-bottom: 0.5rem; }
.job-renta-cascade-sep { margin-top: 0.75rem; }

/* Mini-table blocks (achats par groupe, main d'œuvre) */
.job-renta-block { margin-top: 0.75rem; padding-top: 0.6rem; border-top: 1px dashed var(--border); }
.job-renta-block-title { font-size: 0.63rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.35rem; }
.job-th-left { text-align: left; font-weight: 500; }
.job-th-right { text-align: right; font-weight: 500; }
.job-num-cell { text-align: right; white-space: nowrap; }
.job-num-bold { font-weight: 700; }
.job-num-muted { color: var(--text-secondary); }
.job-num-danger { color: var(--danger); font-weight: 600; }
.job-num-warning { color: var(--warning); font-weight: 600; }
.job-renta-foot { font-weight: 700; border-top: 1px solid var(--border); }
.job-row-muted { color: var(--text-muted); font-style: italic; }
.job-group-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 0.35rem; vertical-align: middle; flex-shrink: 0; }

/* Heures card */
.job-hours-table { margin-top: 0.25rem; }
.job-hours-other { margin-top: 0.4rem; }
.job-hours-foot { margin-top: 0.5rem; }

/* Projets Build liés (cockpit summary) */
.job-build-list { list-style: none; margin: 0; padding: 0; }
.job-build-li { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.5rem 0; border-top: 1px solid var(--border); }
.job-build-main { flex: 1; min-width: 0; }
.job-build-link { color: var(--primary); text-decoration: none; font-weight: 600; font-size: 0.875rem; }

/* Détail des postes — collapsible (v2 Facturation tab) */
.job-postes > summary { user-select: none; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.4rem; }
.job-postes > summary::-webkit-details-marker { display: none; }
.job-postes-summary svg { transition: transform 0.15s ease; flex-shrink: 0; color: var(--text-secondary); }
.job-postes[open] > .job-postes-summary svg { transform: rotate(90deg); }
.job-postes-body { padding-top: 0.6rem; }
.job-postes-head { margin-bottom: 0.6rem; gap: 1rem; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════════════════════
   Affaire — détail V3 (refonte). Behind ?v=3.
   100 % composants CANONIQUES (dash-stats-row, dash-stat-card, dash-card /
   dash-alert-card, .dash-table, badge). Ici uniquement le strict nécessaire qui
   n'existe pas déjà dans le design system.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Réglages : onglet présent mais nav-button masqué (piloté par l'engrenage). */
#progressDetailTabs .nav-tab[data-tab="parametres"] { display: none; }

/* Ligne d'identité — badge statut cliquable + référence + pastille Build. */
.job3-idrow {
  display: flex; align-items: center; gap: var(--space-3);
  flex-wrap: wrap; margin-bottom: var(--space-4);
}
.job3-idrow .badge[role="button"] { cursor: pointer; }
.job3-ref { font-size: 0.8125rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 0.25rem; }

/* Marge en carte : la valeur secondaire (%) discrète à côté du montant. */
.dash-stat-value .job3-rate { font-size: 0.95rem; font-weight: 600; opacity: 0.75; margin-left: 0.25rem; }

/* Tableau Rentabilité 3 colonnes (Prévu/Commandé/Payé) — réutilise dash-stats-row. */
.job3-renta-cols { margin-bottom: var(--space-4); }
.job3-renta-foot { font-weight: 600; }

/* Titres de section pour la profondeur du Suivi (listes réutilisées). */
.job3-depth-title { margin-top: var(--space-8); margin-bottom: var(--space-3); }

/* « À faire » — tableau d'actions à colonnes ancrées.
   La carte n'est pas dans un .dash-grid, donc la dash-table garde le
   table-layout: auto : la colonne d'action n'est pas fixée et le bouton
   (btn = white-space:nowrap) finit collé au bord droit du tableau — il
   déborde de la carte en vue contrainte et se disperse en vue large.
   On reproduit ici le table-layout: fixed du .dash-grid : le libellé prend
   la place restante (tronqué + title), montant et bouton sont ancrés à
   droite, dans la carte, quelle que soit la largeur. */
.dash-table--todo { table-layout: fixed; }
.dash-table--todo td.todo-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-table--todo td.todo-amount  { width: 130px; }
.dash-table--todo td.todo-action  { width: 120px; white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════════════════════
   Maquettes de direction « job-vnext » — RAIL (?v=rail) & FLOW (?v=flow).
   Ossatures neuves bâties sur les tokens + composants canoniques.
   ═══════════════════════════════════════════════════════════════════════════ */
.jv-ref { font-size: 0.78rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 0.2rem; }
.jv-rate { font-size: 0.9rem; font-weight: 600; opacity: 0.7; margin-left: 0.25rem; }

/* ── Mode FOCUS pleine page (?v=rail) : masque la sidebar de l'appli ───────── */
body.jv-focus .sidebar { display: none; }
body.jv-focus .main-content { margin-left: 0; width: 100%; }
body.jv-focus .app-topbar { left: 0; }
body.jv-focus .app-topbar-hamburger { display: none; }

/* « À faire » (job-vnext) — liste empilée, pas un tableau.
   La carte vit dans un rail étroit (320px) : chaque action s'empile en
   colonne — libellé sur sa ligne, puis montant + bouton dessous — au lieu
   d'écraser les trois colonnes d'une dash-table (bouton qui sort du cadre). */
.jv-todo-list { display: flex; flex-direction: column; margin-top: var(--space-2); }
.jv-todo-item { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) 0; }
.jv-todo-item:first-child { padding-top: 0; }
.jv-todo-item:not(:last-child) { border-bottom: 1px solid var(--border); }
.jv-todo-label { font-size: 0.85rem; line-height: 1.35; }
.jv-todo-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.jv-todo-amount { font-weight: 500; font-size: 0.9rem; }

/* ── RAIL : nav | contenu | résumé fixe ──────────────────────────────────── */
/* Une seule colonne latérale : contenu (avec onglets en haut) + résumé à droite. */
.jv-rail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-6); align-items: start; }
.jv-rail-main { min-width: 0; }
.jv-rail-content { min-width: 0; }

/* Navigation = composant central .nav-tabs / .nav-tab (réutilisé, pas dupliqué). */
.jv-rail-main .nav-tabs { flex-wrap: wrap; }

.jv-rail-sticky { position: sticky; top: calc(var(--topbar-height) + var(--space-4)); }
/* Le résumé réutilise le composant central .card (plus de jv-rail-card dupliqué). */
.jv-rail-top { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: var(--space-3); }
.jv-rail-client { font-weight: 700; font-size: 1rem; }
.jv-rail-resp { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.jv-rail-marge { text-align: center; padding: var(--space-4) 0; margin: var(--space-4) 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.jv-rail-marge-rate { font-size: 2rem; font-weight: 800; line-height: 1; }
.jv-rail-marge-meta { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }
.jv-rail-marge--success .jv-rail-marge-rate { color: var(--success); }
.jv-rail-marge--warning .jv-rail-marge-rate { color: var(--warning); }
.jv-rail-marge--danger  .jv-rail-marge-rate { color: var(--error); }
.jv-rail-marge--neutral .jv-rail-marge-rate { color: var(--text-secondary); }
.jv-rail-money { display: flex; flex-direction: column; gap: 0.4rem; }
.jv-rail-line { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.85rem; }
.jv-rail-label { color: var(--text-secondary); }
.jv-rail-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.jv-rail-line--strong .jv-rail-val { font-weight: 700; }
#jvRailSummary .dash-card { margin-top: var(--space-4); }

@media (max-width: 1100px) {
  .jv-rail { grid-template-columns: 1fr; }
  .jv-rail-summary-col { order: -1; }
  .jv-rail-sticky { position: static; }
}

/* ── FLOW : page unique qui défile ───────────────────────────────────────── */
.jv-flow { max-width: 960px; }
.jv-flow-summary { margin-bottom: var(--space-8); }
.jv-flow-idrow { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: var(--space-4); }
.jv-flow-section { margin-bottom: var(--space-10); scroll-margin-top: calc(var(--topbar-height) + var(--space-4)); }
.jv-flow-h2 {
  display: flex; align-items: center; gap: 0.5rem; margin: 0 0 var(--space-4);
  font-size: 1.05rem; font-weight: 700; padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.jv-flow-h2 svg { color: var(--text-secondary); }

/* ── Invoice list: late-row highlight ─────────────────────────────────────────
   Overdue, still-owed invoices (rows JS tags with .invoice-row-late). Plain
   background-color on every cell of the row — the most robust approach: it
   renders under `border-collapse`, and `> td` + !important beats the sticky
   actions cell's white background and the row :hover. Left red bar via an
   inset box-shadow on the first cell as an extra cue (no layout shift). */
.table tbody tr.invoice-row-late > td {
  background-color: #fee2e2 !important;
}
.table tbody tr.invoice-row-late:hover > td {
  background-color: #fdd5d5 !important;
}
.table tbody tr.invoice-row-late > td:first-child {
  border-left: 4px solid #dc2626;
}
