/* App de gestion — Les Clés de la Gestion (socle repris de app-gwstudio) */
:root {
  --app-accent: #123C5C;
  --app-accent-rgb: 18, 60, 92;
  --app-side: #ffffff;
  --app-bg: #f4f6f8;
  --app-line: #e1e7ed;
  --bs-primary: var(--app-accent);
  --bs-primary-rgb: var(--app-accent-rgb);
  --bs-link-color: #1d5582;
  --bs-link-color-rgb: 29, 85, 130;
  --bs-link-hover-color: #0c2b43;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-border-radius: .55rem;
}
[data-bs-theme="dark"] {
  --app-side: #111a22;
  --app-bg: #0b1218;
  --app-line: #22303c;
  --bs-body-bg: #0b1218;
  --bs-link-color: #9cc3e6;
  --bs-link-color-rgb: 156, 195, 230;
  --bs-link-hover-color: #c7def2;
}
body { background: var(--app-bg); }
.btn-primary { --bs-btn-bg: #123C5C; --bs-btn-border-color: #123C5C; --bs-btn-hover-bg: #1d5582; --bs-btn-hover-border-color: #1d5582; --bs-btn-active-bg: #0e3049; --bs-btn-active-border-color: #0e3049; --bs-btn-disabled-bg: #123C5C; --bs-btn-disabled-border-color: #123C5C; }
.btn-outline-primary { --bs-btn-color: #1d5582; --bs-btn-border-color: #9db6cc; --bs-btn-hover-bg: #123C5C; --bs-btn-hover-border-color: #123C5C; --bs-btn-active-bg: #1d5582; --bs-btn-active-border-color: #1d5582; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #a9cbe8; --bs-btn-border-color: #35526b; }
.form-control:focus, .form-select:focus { border-color: #9db6cc; box-shadow: 0 0 0 .2rem rgba(18, 60, 92, .18); }
.card { border-color: var(--app-line); box-shadow: 0 1px 2px rgba(20, 10, 40, .04); }
.card-header { background: transparent; border-color: var(--app-line); }

/* ---------- squelette ---------- */
.app { display: flex; min-height: 100vh; }
.app-side { width: 250px; flex: 0 0 250px; background: var(--app-side); border-right: 1px solid var(--app-line); padding: 20px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
@media (max-width: 991.98px) { .app-side { position: fixed; height: 100%; } }
.app-main { flex: 1; min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 60px; }
.app-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -12px 0 18px; }
.app-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 20px; line-height: 1.15; }
.app-brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--bs-secondary-color); }
.app-brand__mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; background: linear-gradient(135deg, #9C60A4, #1d5582); flex: 0 0 36px; }
.app-nav { display: flex; flex-direction: column; gap: 2px; }
.app-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--bs-body-color); text-decoration: none; font-size: .93rem; }
.app-nav a i { font-size: 1.05rem; color: var(--bs-secondary-color); }
.app-nav a:hover { background: rgba(var(--app-accent-rgb), .07); }
.app-nav a.active { background: rgba(var(--app-accent-rgb), .12); color: #0e3049; font-weight: 600; }
.app-nav a.active i { color: #123C5C; }
[data-bs-theme="dark"] .app-nav a.active { color: #c7def2; }
.app-user { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--app-line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 20px; margin-bottom: 22px; }
.page-head h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; margin: 0; }

/* ---------- connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1000px 500px at 10% -10%, rgba(156, 96, 164, .18), transparent 60%), radial-gradient(800px 500px at 110% 110%, rgba(29, 85, 130, .18), transparent 60%), var(--app-bg); }
.login__card { width: 100%; max-width: 380px; background: var(--bs-body-bg); border: 1px solid var(--app-line); border-radius: 16px; padding: 32px; box-shadow: 0 20px 50px rgba(30, 20, 60, .08); }

/* ---------- listes ---------- */
.filtres { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filtres .form-select { width: auto; }
.filtres__q { flex: 1 1 260px; max-width: 420px; }
.table-docs tbody tr[data-href] { cursor: pointer; }
.table > :not(caption) > * > * { padding: .7rem .75rem; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); font-weight: 600; background: transparent; }
.pastille { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; white-space: nowrap; }
.pastille::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

/* ---------- tableau de bord ---------- */
.kpi { padding: 18px 20px; }
.kpi__lib { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); font-weight: 600; }
.kpi__val { font-size: 1.65rem; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; }
.kpi__sous { font-size: .82rem; color: var(--bs-secondary-color); }
.barre-prog { height: 8px; border-radius: 99px; background: var(--app-line); overflow: hidden; }
.barre-prog > span { display: block; height: 100%; background: linear-gradient(90deg, #9C60A4, #1d5582); border-radius: 99px; }
.barre-prog.alerte > span { background: linear-gradient(90deg, #f0a24b, #dc3545); }

/* ---------- formulaire document ---------- */
.marques-choix { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-marque { border: 1px solid var(--app-line); background: var(--bs-body-bg); display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.btn-marque::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.btn-check:checked + .btn-marque { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); background: color-mix(in srgb, var(--c) 9%, var(--bs-body-bg)); color: var(--bs-body-color); }
.client-pick { position: relative; }
.client-pick__liste { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow: auto; }
.client-pick__liste .list-group-item { cursor: pointer; }
.client-pick__liste small { color: var(--bs-secondary-color); }
.ligne { display: grid; grid-template-columns: 30px minmax(0, 1fr) 230px 32px; gap: 10px; padding: 14px 14px 14px 6px; border-bottom: 1px solid var(--app-line); align-items: start; }
.ligne:last-child { border-bottom: 0; }
.ligne__poignee { display: flex; flex-direction: column; }
.ligne__poignee .btn { padding: 0; line-height: 1; color: var(--bs-secondary-color); }
.ligne__chiffres { display: grid; grid-template-columns: 70px 1fr; gap: 8px; }
.ligne__chiffres label { font-size: .72rem; color: var(--bs-secondary-color); }
.ligne__total { grid-column: 1 / -1; text-align: right; font-weight: 700; }
.ligne-det { resize: vertical; }
/* ecran moyen : les chiffres passent sous la designation, sur une rangee */
@media (max-width: 1399.98px) {
  .ligne { grid-template-columns: 30px minmax(0, 1fr) 32px; }
  .ligne__chiffres { grid-column: 2; grid-row: 2; grid-template-columns: 80px 140px 1fr; align-items: end; }
  .ligne__total { grid-column: auto; align-self: center; padding-top: 16px; }
  .ligne-suppr { grid-column: 3; grid-row: 1; }
}
@media (max-width: 767.98px) {
  .ligne { grid-template-columns: minmax(0, 1fr) 32px; }
  .ligne-suppr { grid-column: 2; }
  .ligne__poignee { display: none; }
  .ligne__chiffres { grid-column: 1 / 2; grid-template-columns: 70px 1fr; }
  .ligne__total { grid-column: 1 / -1; }
}
.doc-total { position: sticky; top: 16px; z-index: 5; }
.doc-total__val { font-size: 2.1rem; font-weight: 700; letter-spacing: -.02em; }
.suggestions { position: absolute; z-index: 30; min-width: 320px; max-width: 520px; }

/* ---------- fiche document ---------- */
.apercu { overflow: hidden; }
.apercu iframe { width: 100%; height: min(1100px, 130vw); border: 0; display: block; background: #e9e7ee; }
.etape { border-left: 4px solid #123C5C; }
.etape--brouillon { border-left-color: #f0a24b; }
.etape--regler { border-left-color: #198754; }
.montants { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; align-items: baseline; }
.montants dt { font-weight: 500; color: var(--bs-secondary-color); font-size: .88rem; }
.montants dd { margin: 0; text-align: right; }
.liens-docs li { padding: 4px 0; }
.journal li { padding: 2px 0; }

/* ---------- URSSAF ---------- */
.trim { border-radius: 12px; border: 1px solid var(--app-line); padding: 16px; height: 100%; background: var(--bs-body-bg); }
.trim--courant { border-color: #123C5C; box-shadow: 0 0 0 1px #123C5C inset; }
.trim__val { font-size: 1.5rem; font-weight: 700; }
.code-saisie { font-size: 1.8rem; letter-spacing: .5em; font-weight: 700; }
.login__logo { width: 170px; height: auto; color: var(--bs-body-color); display: inline-block; }
/* noms longs (« Mr X agissant pour le compte de… ») : tronques au lieu d'elargir la page */
.min-w-0 { min-width: 0; }
.cell-tronquee { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-main .list-group-item { overflow: hidden; }

/* ---------- Les Clés de la Gestion ---------- */
:root { --app-orange: #f7a600; }
.app-brand svg { width: 34px; height: 34px; flex: 0 0 34px; }
.login .login__logo { width: 100%; display: block; }
.login .login__logo svg { width: 240px; height: auto; max-width: 100%; }
.app-nav a.active { box-shadow: inset 3px 0 0 var(--app-orange); }
.kpi { border-left: 3px solid var(--app-orange); }

/* ---------- Kanban suivi commercial ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; min-height: calc(100vh - 190px); }
.kanban__col { background: color-mix(in srgb, var(--app-line) 45%, transparent); border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 170px); min-width: 0; }
.kanban__tete { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; position: sticky; top: 0; }
.kanban__titre { font-weight: 600; font-size: .9rem; line-height: 1.2; }
.kanban__nb { font-weight: 600; }
.kanban__somme { margin-left: auto; font-size: .78rem; color: var(--bs-secondary-color); white-space: nowrap; }
.kanban__cartes { flex: 1; overflow-y: auto; padding: 2px 10px 6px; min-height: 60px; display: flex; flex-direction: column; gap: 8px; }
.kanban__ajout { border: 0; background: transparent; color: var(--bs-secondary-color); text-align: left; padding: 8px 14px 12px; font-size: .85rem; }
.kanban__ajout:hover { color: var(--bs-body-color); }
.kcarte { background: var(--bs-body-bg); border: 1px solid var(--app-line); border-radius: 10px; padding: 10px 12px; cursor: grab; box-shadow: 0 1px 2px rgba(10, 30, 50, .05); transition: box-shadow .15s, border-color .15s; }
.kcarte:hover, .kcarte:focus-visible { border-color: #9db6cc; box-shadow: 0 4px 14px rgba(10, 30, 50, .09); outline: none; }
.kcarte__ent { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--bs-link-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcarte__sujet { font-weight: 600; font-size: .9rem; margin: 2px 0 4px; line-height: 1.3; }
.kcarte__desc { font-size: .8rem; color: var(--bs-secondary-color); line-height: 1.35; margin-bottom: 6px; overflow-wrap: anywhere; }
.kcarte__pied { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: .75rem; }
.kcarte__montant { font-weight: 600; }
.kcarte__relance { border-radius: 999px; padding: 1px 8px; background: var(--app-line); white-space: nowrap; }
.kcarte__relance--retard { background: #fde2e1; color: #a1251b; font-weight: 600; }
.kcarte__relance--jour { background: #fff1cc; color: #8a5a00; font-weight: 600; }
.kcarte__relance--proche { background: #e3eef8; color: #1d5582; }
[data-bs-theme="dark"] .kcarte__relance--retard { background: #4a1d1a; color: #ffb4ab; }
[data-bs-theme="dark"] .kcarte__relance--jour { background: #4a3a10; color: #ffd98a; }
[data-bs-theme="dark"] .kcarte__relance--proche { background: #1c3348; color: #a9cbe8; }
.kcarte__resp { width: 24px; height: 24px; border-radius: 50%; background: #123C5C; color: #fff; display: inline-grid; place-items: center; font-size: .65rem; font-weight: 700; }
.kcarte--fantome { opacity: .35; }
.kcarte--choisie { box-shadow: 0 10px 24px rgba(10, 30, 50, .18); transform: rotate(1.5deg); }
.kpanneau { --bs-offcanvas-width: min(460px, 100vw); }
.kauto { position: absolute; z-index: 10; left: 0; right: 0; top: 100%; max-height: 260px; overflow-y: auto; box-shadow: 0 8px 24px rgba(10, 30, 50, .12); }
.knotes li { border-left: 2px solid var(--app-line); padding: 0 0 10px 10px; }
.knotes li.systeme { color: var(--bs-secondary-color); }
@media (max-width: 991.98px) { .kanban { grid-auto-columns: 82vw; scroll-snap-type: x mandatory; } .kanban__col { scroll-snap-align: start; } }

/* ---------- Catalogue ---------- */
.texte-formation { line-height: 1.55; overflow-wrap: anywhere; }
