/*
 * Composants de la direction LEDGER (5 octobre 2026, docs/redesign-fintech/maquettes/01-ledger) : la banque calme —
 * cartes blanches à trait fin sur un fond gris très clair, aucune ombre, un seul bleu d'action, chiffres tabulaires.
 * Chargé après 2-workspace, 2b-trame et 2c-proprietaire : il réécrit l'aspect des composants partagés (panneaux,
 * boutons, étiquettes, tableaux, en-têtes) pour TOUT l'espace connecté, et porte les composants propres aux écrans
 * refaits — résumé de l'espace, tableau des dossiers, bandeau d'étape, indicateurs, barre empilée, verdicts, budget.
 * Les contrôles de droits restent côté serveur : rien ici n'autorise quoi que ce soit.
 */

/* ---- Composants partagés, réaccordés ---------------------------------------------------------------------- */

.body--app .panel, .body--app .ln-panel, .body--app .card:not(.project-list__item), .body--app .focus-panel {
  background: var(--ln-page); border: 1px solid var(--ln-line); border-radius: var(--ln-radius); box-shadow: none;
}
.body--app .ln-panel, .body--app .panel { padding: 18px 20px; }
.body--app .ln-subgrid { gap: 16px; }

.body--app .button {
  min-height: 36px; padding: 0 14px; border-radius: var(--ln-radius-sm); border: 1px solid var(--ln-line-strong); background: var(--ln-page);
  color: var(--ln-ink); font-size: 13px; font-weight: 600; letter-spacing: 0; box-shadow: none;
}
.body--app .button:hover { background: var(--ln-soft); border-color: var(--ln-line-strong); color: var(--ln-ink); }
.body--app .button--primary { background: var(--ln-accent); border-color: var(--ln-accent); color: #fff; }
.body--app .button--primary:hover { background: var(--ln-accent-strong); border-color: var(--ln-accent-strong); color: #fff; }
.body--app .button--ghost { border-color: transparent; background: transparent; color: var(--ln-accent); }
.body--app .button--ghost:hover { background: var(--ln-sky); }
.body--app .button--small { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
.body--app .button--danger { background: var(--ln-danger); border-color: var(--ln-danger); color: #fff; }

.body--app .ln-tag, .body--app .badge, .body--app .tag {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600; line-height: 1; letter-spacing: 0; text-transform: none; white-space: nowrap;
}
.body--app .ln-tag { background: var(--ln-sky); color: var(--ln-accent-strong); }
/* Six pastilles, une par sens (audit de présentation) : les mêmes six qu'avant, réaccordées. */
.body--app .ln-tag--warn, .body--app .badge--pending { background: var(--ln-warn-bg); color: var(--ln-warn); }
.body--app .ln-tag--good, .body--app .badge--good { background: var(--ln-good-bg); color: var(--ln-good); }
.body--app .ln-tag--danger, .body--app .badge--danger { background: var(--ln-danger-bg); color: var(--ln-danger); }
.body--app .ln-tag--neutral, .body--app .badge--retired { background: #f1f4f9; color: var(--ln-muted); }
.body--app .badge--info, .body--app .badge--simulated { background: var(--ln-info-bg); color: var(--ln-info); }
.body--app .ln-kicker { font-size: 11px; letter-spacing: 0.06em; color: var(--ln-faint); }

.body--app .pagehead h1, .body--app .dossier-header h1, .body--app .page-header h1 { font-size: var(--ln-text-xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 4px; }
.body--app .pagehead__sub { font-size: var(--ln-text-base); color: var(--ln-muted); max-width: 70ch; }
.body--app .page-header.pagehead { margin-bottom: 20px; align-items: flex-start; }
.body--app h2 { font-size: var(--ln-text-lg); }
.body--app .ln-panel h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
/* La tête d'un panneau est un FILET pleine largeur (socle, application.css) : cette règle n'en reprend que la graisse —
   en réécrivant la marge, elle laissait le titre en retrait de 20 px par rapport aux lignes (tableau de bord « croche »,
   5 octobre 2026). */
.body--app .panel > h2:first-child:not(.visually-hidden) { font-size: 14px; font-weight: 600; }

/* Tableaux : repères en petites capitales, filets horizontaux, chiffres alignés à droite. */
.body--app .table { width: 100%; border-collapse: collapse; font-size: var(--ln-text-sm); }
.body--app .table thead th { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ln-faint); text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--ln-line); background: #fbfcfe; }
.body--app .table td, .body--app .table tbody th { padding: 11px 14px; border-bottom: 1px solid var(--ln-line); vertical-align: top; text-align: left; }
/* Une cellule d'en-tête de LIGNE (le nom d'un espace, le code d'un poste) est un texte, pas un repère : jamais en capitales. */
.body--app .table tbody th { font-size: inherit; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ln-ink); background: transparent; }
.body--app .table tr:last-child td, .body--app .table tbody tr:last-child th { border-bottom: 0; }
.body--app .table .num, .body--app .table th.num { text-align: right; white-space: nowrap; }
.body--app .table .table__code { color: var(--ln-faint); font-size: 12px; white-space: nowrap; }
.body--app .table tfoot td { font-weight: 700; background: #fbfcfe; }

/* Repli natif : un titre de section cliquable, un chevron. */
.body--app .fold > summary, .body--app .ln-detail > summary { font-weight: 600; color: var(--ln-ink); }

/* En-tête du dossier. */
.dossier-header { margin-bottom: 20px; }
.dossier-header__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.dossier-header__title { min-width: 0; flex: 1 1 20rem; }
.dossier-header__sub { margin: 0; color: var(--ln-muted); font-size: var(--ln-text-base); }
.dossier-header__note { margin: 6px 0 0; max-width: 72ch; color: var(--ln-muted); font-size: var(--ln-text-sm); line-height: 1.6; }
.dossier-header__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0; color: var(--ln-muted); font-size: var(--ln-text-sm); }
.dossier-header__meta a { color: var(--ln-accent); }
.dossier-header--compact { margin-bottom: 14px; }
.dossier-header--compact .dossier-header__meta { margin-top: 0; }
.dossier-header__actions { flex: none; display: flex; gap: 8px; }

/* Cartes Ledger : tête (titre à icône, lien à droite) et corps. */
.ld-card { background: var(--ln-page); border: 1px solid var(--ln-line); border-radius: var(--ln-radius); overflow: hidden; }
.ld-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--ln-line); }
.ld-card__head h2, .ld-card__head h3 { font-size: 14px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.ld-card__head h2 .ln-icon, .ld-card__head h3 .ln-icon { width: 16px; height: 16px; color: var(--ln-muted); }
.ld-card__body { padding: 18px; }
.ld-card__body > :last-child { margin-bottom: 0; }
.ld-link { color: var(--ln-accent); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; white-space: nowrap; }
.ld-link:hover { color: var(--ln-accent-strong); text-decoration: underline; }
.ld-link .ln-icon { width: 14px; height: 14px; }
.ld-hint { margin: 0; color: var(--ln-muted); font-size: 12.5px; }

/* ---- Mes dossiers ------------------------------------------------------------------------------------------- */

.ld-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.ld-stat { display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-decoration: none; color: inherit; }
.ld-stat__icon { width: 36px; height: 36px; flex: none; border-radius: 9px; background: var(--ln-sky); color: var(--ln-accent); display: grid; place-items: center; }
.ld-stat__icon .ln-icon { width: 18px; height: 18px; }
.ld-stat__label { font-size: 12px; color: var(--ln-muted); }
.ld-stat__value { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; color: var(--ln-ink); }

.body--app .scope-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--ln-line); margin: 0 0 14px; }
.body--app .scope-tab { padding: 8px 12px; margin-bottom: -1px; font-size: 13px; font-weight: 500; color: var(--ln-muted); border-bottom: 2px solid transparent; text-decoration: none; }
.body--app .scope-tab:hover { color: var(--ln-ink); }
.body--app .scope-tab[aria-current="page"] { color: var(--ln-ink); border-bottom-color: var(--ln-ink); }
.ld-search-note { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; color: var(--ln-muted); font-size: 13px; }

.ld-table-wrap { overflow-x: auto; }
.ld-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.ld-table th { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ln-faint); text-align: left; padding: 10px 18px; border-bottom: 1px solid var(--ln-line); background: #fbfcfe; }
.ld-table td { padding: 13px 18px; border-bottom: 1px solid var(--ln-line); vertical-align: middle; }
.ld-table tbody tr:last-child td { border-bottom: 0; }
.ld-table .r { text-align: right; }
.ld-table .project-list__state { margin: 0; }
.ld-table .project-list__title { margin: 0 0 3px; font-size: 14px; font-weight: 600; letter-spacing: 0; line-height: 1.35; }
.ld-table .project-list__title a { color: var(--ln-ink); text-decoration: none; }
.ld-table .project-list__title a:hover { color: var(--ln-accent); }
.ld-table .project-list__meta { margin: 0; color: var(--ln-muted); font-size: 12.5px; line-height: 1.45; }
.ld-table .project-list__meta span + span::before { content: " · "; }
.ld-table .stage-strip { display: flex; gap: 3px; list-style: none; margin: 0 0 5px; padding: 0; }
.ld-table .stage-strip__step { margin: 0; flex: 1; height: 6px; border-radius: 3px; background: #e2e8f0; font-size: 0; color: transparent; }
.ld-table .stage-strip__step--done { background: var(--ln-accent); }
.ld-table .stage-strip__step--current { background: #93c5fd; }
.ld-table .stage-strip__mark { display: none; }
.ld-table .stage-strip__legend { display: flex; justify-content: space-between; gap: 4px; margin: 0; font-size: 10.5px; color: var(--ln-faint); white-space: nowrap; }
.ld-fig { font-size: 16px; font-weight: 600; white-space: nowrap; }
.ld-fig small { display: block; font-size: 11.5px; color: var(--ln-faint); font-weight: 400; margin-top: 2px; white-space: normal; }
.ld-upd { color: var(--ln-faint); font-size: 12px; }
.ld-table .project-list__side { white-space: nowrap; }
.ld-table .project-list__side .button { white-space: normal; text-align: center; line-height: 1.25; padding-top: 6px; padding-bottom: 6px; }
.ld-table .project-list__side { white-space: normal; }
.body--app .summary--compact .summary__headline { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin: 0 0 8px; padding: 0 0 8px; border-bottom: 1px solid var(--ln-line); }
.body--app .summary--compact .summary__headline .summary__label { font-size: 13px; color: var(--ln-muted); }
.body--app .summary--compact .summary__headline .summary__value { font-size: 14px; font-weight: 600; text-align: right; }
.body--app .summary--compact .summary__aside { font-size: 12.5px; color: var(--ln-muted); margin: 0 0 8px; }
.ld-table .project-list__side .dossier-action { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ld-newrow td { background: #fbfcfe; color: var(--ln-muted); font-size: 13px; }
.ld-newrow .ln-icon { color: var(--ln-muted); }
.ld-newrow .ld-link { margin-left: 4px; }

@media (max-width: 860px) {
  .ld-stats { grid-template-columns: 1fr; gap: 8px; }
  .ld-table, .ld-table tbody, .ld-table tr, .ld-table td { display: block; width: 100%; }
  .ld-table thead { display: none; }
  .ld-table tr { padding: 12px 16px; border-bottom: 1px solid var(--ln-line); }
  .ld-table td { padding: 4px 0; border: 0; }
  .ld-table .r { text-align: left; }
  .ld-table .project-list__side { padding-top: 8px; }
  .ld-table .ld-upd { padding-bottom: 0; }
}

/* ---- Vue d'ensemble ---------------------------------------------------------------------------------------- */

.ld-next { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 18px; margin-bottom: 16px; border-left: 3px solid var(--ln-accent); }
.ld-next__icon { width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--ln-sky); color: var(--ln-accent); display: grid; place-items: center; }
.ld-next__icon .ln-icon { width: 20px; height: 20px; }
.ld-next__text { flex: 1 1 20rem; min-width: 0; }
.ld-next__text .ln-kicker { margin-bottom: 2px; }
.ld-next h2 { margin: 0 0 2px; font-size: 16px; font-weight: 600; }
.ld-next p { margin: 0; color: var(--ln-muted); font-size: var(--ln-text-sm); }
.ld-next__action { flex: none; }

.ld-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; }
.ld-kpi { padding: 16px 18px; background: var(--ln-page); border: 1px solid var(--ln-line); border-radius: var(--ln-radius); min-width: 0; }
.ld-kpi dt, .ld-kpi__label { margin: 0 0 8px; font-size: 12px; color: var(--ln-muted); display: flex; align-items: center; gap: 6px; }
.ld-kpi dt .ln-icon, .ld-kpi__label .ln-icon { width: 15px; height: 15px; flex: none; }
.ld-kpi dd { margin: 0; }
.ld-kpi strong, .ld-kpi__value { display: block; font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; color: var(--ln-ink); white-space: nowrap; }
.ld-kpi strong small { display: inline; font-size: 14px; font-weight: 500; color: var(--ln-muted); margin: 0 0 0 2px; letter-spacing: 0; }
.ld-kpi small, .ld-kpi__note { display: block; font-size: 12px; color: var(--ln-muted); margin-top: 6px; white-space: normal; }
.ld-kpi--accent { background: var(--ln-ink); border-color: var(--ln-ink); color: #fff; }
.ld-kpi--accent dt, .ld-kpi--accent small, .ld-kpi--accent strong small, .ld-kpi--accent .ld-kpi__label { color: #cbd5e1; }
.ld-kpi--accent strong { color: #fff; }
.ld-kpi--pending strong { font-size: 18px; white-space: normal; }

.ld-grid2 { display: grid; grid-template-columns: 5fr 7fr; gap: 16px; margin-bottom: 16px; align-items: start; }
.ld-grid2 > div { display: grid; gap: 16px; }
.ld-stack { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 2px 0 12px; background: #e2e8f0; }
.ld-stack span { display: block; height: 100%; }
.ld-stack span:nth-child(1) { background: var(--ln-accent); }
.ld-stack span:nth-child(2) { background: #60a5fa; }
.ld-stack span:nth-child(3) { background: #bfdbfe; }
.ld-legend { display: grid; gap: 8px; margin: 0; font-size: 13px; }
.ld-legend div { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.ld-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.ld-legend div:nth-child(1) i { background: var(--ln-accent); }
.ld-legend div:nth-child(2) i { background: #60a5fa; }
.ld-legend div:nth-child(3) i { background: #bfdbfe; }
.ld-legend dt { flex: 1; } .ld-legend dd { margin: 0 0 0 auto; } .ld-legend b { font-weight: 600; }
.ld-verdicts { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.ld-verdicts li { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 8px; background: #f8fafc; }
.ld-verdicts li .ln-icon { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.ld-verdicts li.ok .ln-icon { color: var(--ln-good); }
.ld-verdicts li.warn { background: var(--ln-warn-bg); }
.ld-verdicts li.warn .ln-icon { color: var(--ln-warn); }
.ld-qrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border: 1px dashed var(--ln-line-strong); border-radius: 8px; font-size: 13px; margin-top: 12px; }
.ld-qrow .ln-icon { width: 16px; height: 16px; color: var(--ln-accent); flex: none; }
.ld-qrow > span { flex: 1 1 12rem; }
.ld-qrow .button { margin-left: auto; }
.ld-arch h3 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
.ld-arch .diagram-card { margin: 0; }
.ld-arch .diagram-card--bare { border: 0; padding: 0; }
.ld-note { display: flex; align-items: center; gap: 8px; margin: 16px 0 0; color: var(--ln-muted); font-size: 12.5px; }
.ld-note .ln-icon { width: 15px; height: 15px; color: var(--ln-good); }
.ld-empty { margin: 0; padding: 14px 16px; border: 1px dashed var(--ln-line-strong); border-radius: 8px; color: var(--ln-muted); font-size: 13px; }

@media (max-width: 1180px) { .ld-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .ld-grid2 { grid-template-columns: 1fr; } .ld-next .button { width: 100%; justify-content: center; } }
@media (max-width: 560px) { .ld-kpis { grid-template-columns: 1fr; } }

/* ---- Budget estimatif -------------------------------------------------------------------------------------- */

.ld-budget { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.ld-budget__main { min-width: 0; display: grid; gap: 16px; }
.ld-rail { display: grid; gap: 12px; }
.ld-rail .ld-card__body p { margin: 0 0 10px; }
.ld-rail .ld-card__body p:last-child { margin-bottom: 0; }
.ld-opts { display: grid; gap: 8px; }
.ld-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--ln-line); border-radius: 8px; font-size: 13px; }
.ld-opt b { font-weight: 600; }
.ld-opt span { color: var(--ln-muted); margin-left: auto; font-size: 12px; white-space: nowrap; }
.ld-opt--sel { border-color: var(--ln-accent); background: var(--ln-sky); }
.body--app .budget-detail { border: 0; padding: 0; }
.body--app .budget-detail > summary { padding: 0 0 10px; font-size: 14px; }
.body--app .budget-detail .estimate { padding: 0; border: 0; background: transparent; display: grid; gap: 16px; }
.body--app .budget-detail .estimate > .section { margin: 0; padding: 0 0 4px; background: var(--ln-page); border: 1px solid var(--ln-line); border-radius: var(--ln-radius); overflow: hidden; }
.body--app .budget-detail .estimate > .section > .page-header { padding: 14px 18px; margin: 0; border-bottom: 1px solid var(--ln-line); align-items: center; }
.body--app .budget-detail .estimate > .section > .page-header h2 { font-size: 14px; font-weight: 600; margin: 0; }
.body--app .budget-detail .estimate > .section > .page-header .help { margin: 2px 0 0; }
.body--app .budget-detail .estimate > .section > .fold > summary { padding: 10px 18px; }
.body--app .budget-detail .estimate > .section > .empty, .body--app .budget-detail .estimate > .section > .help, .body--app .budget-detail .estimate > .section > ul, .body--app .budget-detail .estimate > .section > .inline-forms, .body--app .budget-detail .estimate > .section > .hint, .body--app .budget-detail .estimate > .section > p { margin: 10px 18px; }
.body--app .budget-detail .estimate > .section > details > summary { padding: 12px 18px; }
.body--app .budget-detail .estimate .table-wrap { margin: 0; }
.body--app .budget-detail .estimate .table { font-size: 13px; }
.body--app .budget-detail .estimate .table td strong a { color: var(--ln-ink); text-decoration: none; font-weight: 600; }
.body--app .budget-detail .estimate .table td strong a:hover { color: var(--ln-accent); }
.body--app #budget-levers .ld-card__body .button { margin-top: 2px; }
.ld-summary-lines { display: grid; gap: 6px; margin: 0; font-size: 13px; }
.ld-summary-lines div { display: flex; justify-content: space-between; gap: 12px; }
.ld-summary-lines dt { color: var(--ln-muted); }
.ld-summary-lines dd { margin: 0; font-weight: 600; text-align: right; }

@media (max-width: 1180px) { .ld-budget { grid-template-columns: 1fr; } }

/* Titres hérités des directions Trame et Aurore (panneaux, blocs, « Poursuivre avec Linuen », en-tête de l'architecture,
   étapes d'un formulaire) : sous Ledger un titre pèse 600, un titre d'écran 700 — jamais 500 (lot 2, 5 octobre 2026). */
.body--app .ln-panel h3, .body--app .block-title, .body--app .ln-continue h2, .body--app .ln-continue h3,
.body--app .architecture-head h2, .body--app .form--steps .form-step > .ln-tag + h2 { font-weight: 600; letter-spacing: -0.01em; }
.body--app .block-title { font-size: 16px; margin: 28px 0 12px; }
.body--app .architecture-head h2, .body--app .form--steps .form-step > .ln-tag + h2,
.body--app .ln-continue h2, .body--app .ln-continue h3 { font-size: 18px; }
.body--app .ln-handoff h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }

/* Entrées du propriétaire dans un dossier (LB-41) et ligne d'une aide fermée. */
.body--app .dossier-side__owner { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--ln-line); }
.body--app .qhelp__closed, .body--app .qhelp__hint { margin: 6px 0 0; font-size: 12px; color: var(--ln-muted); }
