/* Devis & factures — GW Studio · Site Protect · Orealys */
:root {
  --app-accent: #684E9B;
  --app-accent-rgb: 104, 78, 155;
  --app-side: #ffffff;
  --app-bg: #f6f5f9;
  --app-line: #e7e3ee;
  --bs-primary: var(--app-accent);
  --bs-primary-rgb: var(--app-accent-rgb);
  --bs-link-color: #5A4A99;
  --bs-link-color-rgb: 90, 74, 153;
  --bs-link-hover-color: #3f3378;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-border-radius: .55rem;
}
[data-bs-theme="dark"] {
  --app-side: #16131d;
  --app-bg: #0f0d14;
  --app-line: #2a2534;
  --bs-body-bg: #0f0d14;
  --bs-link-color: #b9a6e4;
  --bs-link-color-rgb: 185, 166, 228;
  --bs-link-hover-color: #d6cbf2;
}
body { background: var(--app-bg); }
.btn-primary { --bs-btn-bg: #684E9B; --bs-btn-border-color: #684E9B; --bs-btn-hover-bg: #5A4A99; --bs-btn-hover-border-color: #5A4A99; --bs-btn-active-bg: #4d3f86; --bs-btn-active-border-color: #4d3f86; --bs-btn-disabled-bg: #684E9B; --bs-btn-disabled-border-color: #684E9B; }
.btn-outline-primary { --bs-btn-color: #5A4A99; --bs-btn-border-color: #b9aadb; --bs-btn-hover-bg: #684E9B; --bs-btn-hover-border-color: #684E9B; --bs-btn-active-bg: #5A4A99; --bs-btn-active-border-color: #5A4A99; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #c9b9ef; --bs-btn-border-color: #5b4d7c; }
.form-control:focus, .form-select:focus { border-color: #b9aadb; box-shadow: 0 0 0 .2rem rgba(104, 78, 155, .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, #5A4A99); 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: #4d3f86; font-weight: 600; }
.app-nav a.active i { color: #684E9B; }
[data-bs-theme="dark"] .app-nav a.active { color: #d6cbf2; }
.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(90, 74, 153, .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, #5A4A99); 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 #684E9B; }
.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: #684E9B; box-shadow: 0 0 0 1px #684E9B 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; }
