/* =====================================================================
   ORBA Plus — styles applicatifs
   Style « logiciel de gestion » : dense, bordures fines, peu d'ombres.
   Mobile : listes en lignes compactes (type application native), contenu bord à bord.
   ===================================================================== */
:root {
  --night: #04234D;
  --night-2: #0A3266;
  --primary: #0062CC;
  --primary-2: #0093E6;
  --primary-dark: #004FA6;
  --primary-rgb: 0, 98, 204;
  --menu-bg: #04234D;
  --menu-bg-2: #082D60;
  --bg: #F3F5F8;
  --card: #FFFFFF;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6B7280;
  --line: #E3E7ED;
  --line-2: #EEF1F5;
  --head: #F8FAFC;
  --success: #16A34A;
  --warning: #D97706;
  --danger: #DC2626;
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar-w: 232px;
  --topbar-h: 52px;
  --bottom-h: 60px;
  --shadow: none;
  --shadow-pop: 0 10px 30px -8px rgba(15, 23, 42, .25);

  --bs-primary: #0062CC;
  --bs-primary-rgb: 0, 98, 204;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--ink);
  --bs-border-color: var(--line);
  --bs-link-color: #0062CC;
  --bs-link-color-rgb: 0, 98, 204;
  --bs-link-hover-color: #004FA6;
  --bs-font-sans-serif: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --bs-body-font-size: .8125rem;
  --bs-border-radius: 6px;
}

@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../vendor/inter/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../vendor/inter/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font-size: .8125rem; line-height: 1.45; font-family: var(--bs-font-sans-serif);
  font-feature-settings: "cv11", "tnum"; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { text-decoration: none; }
.min-w-0 { min-width: 0; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-muted { color: var(--muted) !important; }
.small, small { font-size: .75rem; }
h1, h2, h3, h4, h5, h6 { letter-spacing: -.01em; }

/* ---------- Boutons & champs (compacts) ---------- */
.btn { --bs-btn-padding-y: .32rem; --bs-btn-padding-x: .7rem; --bs-btn-font-size: .8125rem; --bs-btn-font-weight: 500;
  --bs-btn-border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
.btn-sm { --bs-btn-padding-y: .2rem; --bs-btn-padding-x: .55rem; --bs-btn-font-size: .75rem; }
.btn-lg { --bs-btn-padding-y: .6rem; --bs-btn-font-size: .95rem; }
.btn .bi { line-height: 1; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark); --bs-btn-active-bg: var(--primary-dark); --bs-btn-active-border-color: var(--primary-dark);
  --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); }
.btn-outline-primary { --bs-btn-color: var(--primary); --bs-btn-border-color: rgba(var(--primary-rgb), .35); --bs-btn-hover-bg: rgba(var(--primary-rgb), .08);
  --bs-btn-hover-color: var(--primary); --bs-btn-hover-border-color: var(--primary); --bs-btn-active-bg: rgba(var(--primary-rgb), .14);
  --bs-btn-active-color: var(--primary); --bs-btn-active-border-color: var(--primary); }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--line); --bs-btn-color: var(--ink-2); --bs-btn-hover-bg: #F3F5F8;
  --bs-btn-hover-border-color: #D5DBE3; --bs-btn-active-bg: #EBEEF2; }
.btn-icon { border: 0; background: transparent; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm); padding: 0; }
.btn-icon:hover { background: #EEF1F5; }
.form-control, .form-select { font-size: .8125rem; border-radius: var(--radius-sm); border-color: #D5DBE3; background-color: #fff; padding: .36rem .6rem; min-height: 32px; }
.form-select { padding-right: 2rem; }
.form-control-sm, .form-select-sm { font-size: .78rem; min-height: 28px; padding: .2rem .45rem; }
.form-select-sm { padding-right: 1.7rem; }
.form-control:disabled { background-color: #F3F5F8; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .14); }
.form-label { font-size: .75rem; font-weight: 600; color: var(--ink-2); margin-bottom: .25rem; }
.form-text { font-size: .72rem; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.input-group-text { font-size: .8125rem; background: #fff; border-color: #D5DBE3; }
.badge { font-weight: 600; }
.badge-statut { font-weight: 600; font-size: .6875rem; padding: .3em .6em; border-radius: 4px; }
.text-bg-secondary.badge-statut { background: #EEF1F5 !important; color: #4B5563 !important; }
.text-bg-info.badge-statut { background: #E0F2FE !important; color: #0369A1 !important; }
.text-bg-primary.badge-statut { background: #DBEAFE !important; color: #1D4ED8 !important; }
.text-bg-success.badge-statut { background: #DCFCE7 !important; color: #15803D !important; }
.text-bg-warning.badge-statut { background: #FEF3C7 !important; color: #B45309 !important; }
.text-bg-danger.badge-statut { background: #FEE2E2 !important; color: #B91C1C !important; }
.dropdown-menu { --bs-dropdown-font-size: .8125rem; border-radius: var(--radius); padding: .3rem; border: 1px solid var(--line) !important; box-shadow: var(--shadow-pop) !important; }
.dropdown-item { border-radius: 4px; padding: .38rem .6rem; }
.dropdown-menu form { margin: 0; }

/* ---------- Structure ---------- */
.app-shell { min-height: 100vh; }
.app-main { min-width: 0; padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom) + 8px); }
.app-content { padding: 0; max-width: 1600px; margin: 0 auto; }
@media (min-width: 768px) { .app-content { padding: 1rem 1.25rem 2rem; } }

.app-topbar {
  position: sticky; top: 0; z-index: 1020; height: calc(var(--topbar-h) + env(safe-area-inset-top));
  display: flex; align-items: center; gap: .35rem; padding: env(safe-area-inset-top) .5rem 0;
  background: #fff; border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: .95rem; font-weight: 650; margin: 0 0 0 .25rem; min-width: 0; }
.btn-avatar { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--night); color: #fff; font-weight: 700; font-size: .7rem; }
@media (min-width: 992px) { .app-topbar { padding: 0 1.25rem 0 .75rem; } .topbar-title { font-size: 1rem; } }

/* ---------- Sidebar (tiroir sur mobile, fixe et réductible sur PC) ---------- */
.app-sidebar {
  --bs-offcanvas-width: 272px;
  background: var(--menu-bg) !important;
  color: #CBD5E1; border-right: 0 !important;
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 0 .85rem; height: var(--topbar-h); border-bottom: 1px solid rgba(255, 255, 255, .06); }
.brand-link { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.brand-mark { flex-shrink: 0; width: 30px; height: 30px; border-radius: 7px; display: inline-grid; place-items: center; background: #fff; }
.brand-mark img { width: 24px; height: 24px; object-fit: contain; }
.sidebar-mini .brand-mark { width: 34px; height: 34px; }
.login-logo { display: inline-block; background: #fff; border-radius: 14px; padding: 16px 22px; }
.login-logo img { width: 260px; max-width: 100%; display: block; }
.login-logo-sm { width: 180px; max-width: 70%; }
.brand-mark-lg { width: 56px; height: 56px; border-radius: 16px; font-size: 1.6rem; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-name { color: #fff; font-weight: 750; font-size: .95rem; letter-spacing: -.01em; }
.brand-accent { color: #33B4FF; font-style: italic; }
.brand-sub { color: #7F8FA8; font-size: .6875rem; font-weight: 500; max-width: 160px; }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: .4rem .5rem 1rem; scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, .18) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, .18); border-radius: 6px; }

.nav-group + .nav-group { margin-top: .15rem; }
.nav-section { display: flex; align-items: center; width: 100%; border: 0; background: transparent; padding: .7rem .6rem .3rem;
  font-size: .625rem; text-transform: uppercase; letter-spacing: .09em; color: #6F80A0; font-weight: 700; }
.nav-section:hover { color: #A7B4C8; }
.nav-caret { margin-left: auto; font-size: .62rem; transition: transform .15s ease; }
.nav-group.collapsed .nav-caret { transform: rotate(-90deg); }
.nav-items { display: grid; gap: 1px; overflow: hidden; }
.nav-group.collapsed .nav-items { display: none; }

.nav-link-item { position: relative; display: flex; align-items: center; gap: .6rem; height: 32px; padding: 0 .6rem; border-radius: var(--radius-sm);
  color: #B8C3D4; font-weight: 500; font-size: .8125rem; white-space: nowrap; }
.nav-link-item i { font-size: .95rem; width: 1.1rem; text-align: center; color: #7F8FA8; }
.nav-link-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link-item:hover i { color: #CBD5E1; }
.nav-link-item.active { background: rgba(255, 255, 255, .1); color: #fff; }
.nav-link-item.active i { color: #5CC2FF; }
.nav-link-item.active::before { content: ""; position: absolute; left: -.5rem; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary-2); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: .625rem; font-weight: 700;
  display: inline-grid; place-items: center; line-height: 1; }
.nav-badge.tone-info { background: rgba(92, 194, 255, .16); color: #8FD3FF; }
.nav-badge.tone-warning { background: rgba(245, 158, 11, .2); color: #FCD34D; }
.nav-badge.tone-danger { background: rgba(239, 68, 68, .22); color: #FCA5A5; }

.sidebar-footer { padding: .5rem; border-top: 1px solid rgba(255, 255, 255, .06); display: grid; gap: .4rem; }
.btn-install { display: flex; align-items: center; gap: .5rem; width: 100%; height: 32px; padding: 0 .6rem; border-radius: var(--radius-sm); font-size: .78rem; font-weight: 600;
  background: rgba(92, 194, 255, .1); color: #BFE6FF; border: 1px solid rgba(92, 194, 255, .25); }
.btn-install:hover { background: var(--primary); color: #fff; }
.user-card { display: flex; align-items: center; gap: .55rem; padding: .35rem .4rem; border-radius: var(--radius-sm); }
.user-card:hover { background: rgba(255, 255, 255, .05); }
.user-avatar { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .65rem; color: #fff; background: #23406E; }
.user-meta { min-width: 0; flex: 1; line-height: 1.2; }
.user-name { color: #F1F5F9; font-weight: 600; font-size: .78rem; }
.user-role { color: #7F8FA8; font-size: .6875rem; }
.user-action { color: #7F8FA8; padding: .25rem; border-radius: 4px; }
.user-action:hover { color: #fff; }

@media (min-width: 992px) {
  .app-shell { display: flex; }
  .app-sidebar { position: fixed !important; inset: 0 auto 0 0; width: var(--sidebar-w); display: flex; flex-direction: column; z-index: 1030; }
  .app-main { margin-left: var(--sidebar-w); flex: 1; padding-bottom: 0; }
  .sidebar-mini { --sidebar-w: 60px; }
  .sidebar-mini .brand-text, .sidebar-mini .nav-label, .sidebar-mini .nav-section, .sidebar-mini .user-meta, .sidebar-mini .user-action { display: none; }
  .sidebar-mini .sidebar-brand { justify-content: center; padding-inline: 0; }
  .sidebar-mini .sidebar-nav { padding-inline: .45rem; overflow: visible; }
  .sidebar-mini .nav-items, .sidebar-mini .nav-group.collapsed .nav-items { display: grid; overflow: visible; }
  .sidebar-mini .nav-group + .nav-group { margin-top: .35rem; padding-top: .35rem; border-top: 1px solid rgba(255, 255, 255, .06); }
  .sidebar-mini .nav-link-item { justify-content: center; padding: 0; height: 36px; }
  .sidebar-mini .nav-link-item.active::before { left: -.45rem; }
  .sidebar-mini .nav-badge { position: absolute; top: 1px; right: 1px; min-width: 15px; height: 15px; font-size: .55rem; padding: 0 3px; }
  .sidebar-mini [data-tip]:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    background: #111827; color: #fff; font-size: .75rem; font-weight: 500; padding: .3rem .55rem; border-radius: 4px; white-space: nowrap; z-index: 2000; pointer-events: none; }
  .sidebar-mini .btn-install { justify-content: center; padding: 0; }
  .sidebar-mini .btn-install .nav-label { display: none; }
  .sidebar-mini .user-card { justify-content: center; }
}
@media (max-width: 991.98px) { .app-sidebar.offcanvas-lg { display: flex; flex-direction: column; } }

/* ---------- Barre supérieure : recherche & « Nouveau » ---------- */
.topbar-search { position: relative; align-items: center; flex: 0 1 380px; margin-left: 1rem; }
.topbar-search > i { position: absolute; left: .65rem; color: var(--muted); font-size: .8rem; pointer-events: none; }
.topbar-search input { width: 100%; height: 32px; border: 1px solid var(--line); background: #F6F8FA; border-radius: var(--radius-sm); padding: 0 2.2rem 0 1.9rem; font-size: .8125rem; }
.topbar-search input:focus { outline: 0; background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .14); }
.topbar-search kbd { position: absolute; right: .5rem; background: #fff; color: var(--muted); border: 1px solid var(--line); font-size: .65rem; padding: 0 .35rem; border-radius: 4px; box-shadow: none; }
.btn-new { white-space: nowrap; flex-shrink: 0; height: 32px; }
.menu-new { padding: .4rem; width: 260px; }
.menu-new-grid { display: grid; grid-template-columns: 1fr; gap: 1px; }
.menu-new-item { display: flex; align-items: center; gap: .6rem; padding: .45rem .55rem; border-radius: 4px; color: var(--ink); font-size: .8125rem; }
.menu-new-item i { font-size: .95rem; color: var(--primary); width: 1.1rem; text-align: center; }
.menu-new-item:hover { background: #F1F5FB; color: var(--primary); }

/* ---------- Icônes de type de document ---------- */
.doc-ico { flex-shrink: 0; width: 28px; height: 28px; border-radius: 6px; display: inline-grid; place-items: center; font-size: .85rem; }
.doc-devis .doc-ico, .doc-ico.doc-devis { background: #EFF6FF; color: #2563EB; }
.doc-facture .doc-ico, .doc-ico.doc-facture { background: #EEF2FF; color: #4F46E5; }
.doc-bl .doc-ico, .doc-ico.doc-bl { background: #ECFDF5; color: #059669; }
.doc-bc .doc-ico, .doc-ico.doc-bc { background: #FFFBEB; color: #D97706; }
.doc-avoir .doc-ico, .doc-ico.doc-avoir { background: #FEF2F2; color: #DC2626; }

.empty-state { text-align: center; color: var(--muted); padding: 1.75rem 1rem; }
.empty-state > i { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: #F1F5FB; color: var(--primary); font-size: 1.2rem; margin-bottom: .6rem; }

/* ---------- Recherche globale ---------- */
.search-hero { position: relative; display: flex; gap: .5rem; margin-bottom: 1rem; padding: .75rem; background: #fff; border-bottom: 1px solid var(--line); }
.search-hero > i { position: absolute; left: 1.5rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-hero input { flex: 1; min-width: 0; height: 40px; border: 1px solid #D5DBE3; border-radius: var(--radius-sm); padding: 0 .9rem 0 2.2rem; font-size: 16px; background: #fff; }
.search-hero input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .14); }
@media (min-width: 768px) { .search-hero { padding: 0; background: transparent; border: 0; } .search-hero > i { left: .9rem; } .search-hero input { font-size: .9rem; } }

/* ---------- Navigation basse (mobile) ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1025;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: stretch;
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .97); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: #6B7280;
  font-size: .625rem; font-weight: 600; border: 0; background: transparent; padding: 0; }
.bottom-nav a i, .bottom-nav button i { font-size: 1.25rem; line-height: 1.2; }
.bottom-nav a.active { color: var(--primary); }
.bottom-nav .fab { position: relative; }
.bottom-nav .fab span.fab-btn { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff;
  margin-top: -18px; box-shadow: 0 6px 16px -4px rgba(var(--primary-rgb), .6); border: 3px solid #fff; }
.bottom-nav .fab span.fab-btn i { font-size: 1.35rem; color: #fff; }

/* Feuille d'actions (mobile) */
.action-sheet { --bs-offcanvas-height: auto; border-radius: 14px 14px 0 0; padding-bottom: env(safe-area-inset-bottom); }
.action-sheet .sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: #D5DBE3; margin: 8px auto 4px; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .25rem; padding: .5rem .75rem 1rem; }
.sheet-item { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .7rem .25rem; border-radius: 10px; color: var(--ink); font-size: .72rem; font-weight: 600; text-align: center; }
.sheet-item:active { background: #F1F5FB; }
.sheet-item .doc-ico { width: 42px; height: 42px; border-radius: 12px; font-size: 1.15rem; }

/* ---------- Panneaux (remplacent les « cartes ») ---------- */
.card-soft, .panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.card-soft > .card-header, .panel-head { background: transparent; border-bottom: 1px solid var(--line) !important; padding: .55rem .85rem !important; min-height: 40px;
  display: flex; align-items: center; gap: .5rem; }
.card-soft > .card-header h2, .panel-head h2, .panel-title { font-size: .8125rem !important; font-weight: 650 !important; margin: 0; color: var(--ink); }
.card-soft > .card-body { padding: .85rem; }
.card-soft > .card-footer { background: transparent; border-top: 1px solid var(--line); padding: .55rem .85rem; }
.card-soft.border-0-top > .card-header { border: 0 !important; }
@media (max-width: 767.98px) {
  .card-soft, .panel { border-radius: 0; border-left: 0; border-right: 0; }
  .card-soft > .card-body { padding: .85rem .9rem; }
  .row.g-3 { --bs-gutter-x: 0; --bs-gutter-y: .5rem; }
  .row.g-3 > [class*="col"] { padding-left: 0; padding-right: 0; }
  .app-content > .alert { margin: .5rem .75rem; }
}

/* Indicateurs (KPI) : tuiles sobres */
.kpi-card { position: relative; display: block; height: 100%; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .85rem; color: var(--ink); }
.kpi-link:hover { border-color: rgba(var(--primary-rgb), .45); color: var(--ink); }
.kpi-icon { display: none; }
.kpi-label { font-size: .7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 1.15rem; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .72rem; color: var(--muted); margin-top: .1rem; }
.kpi-sm { padding: .55rem .75rem; }
.kpi-sm .kpi-value { font-size: 1rem; }
@media (min-width: 1200px) { .kpi-value { font-size: 1.3rem; } }

/* ---------- Barre d'outils, onglets & filtres ---------- */
.page-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.search-form { display: flex; flex-wrap: wrap; gap: .4rem; flex: 1 1 320px; min-width: 0; }
.search-form .input-group { flex: 1 1 220px; min-width: 0; }
.search-form .input-group-text { border-right: 0; color: var(--muted); padding-right: .2rem; }
.search-form .input-group .form-control { border-left: 0; }
.status-tabs { display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: .75rem !important; background: transparent; }
.status-tabs::-webkit-scrollbar { display: none; }
.status-tabs a { white-space: nowrap; padding: .5rem .8rem; color: var(--muted); font-size: .8125rem; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.status-tabs a:hover { color: var(--ink); }
.status-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.list-summary { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; justify-content: flex-end; font-size: .75rem; color: var(--muted); margin-top: .5rem; }
@media (max-width: 767.98px) {
  .page-toolbar { padding: .6rem .75rem; margin: 0; background: #fff; border-bottom: 1px solid var(--line); }
  .page-toolbar > .btn-primary, .page-toolbar > a.btn-primary { display: none; }      /* le bouton « + » de la barre basse le remplace */
  .status-tabs { background: #fff; margin: 0 !important; padding: 0 .35rem; }
  .list-summary { padding: .5rem .9rem; justify-content: space-between; }
  .search-form .form-control, .search-form .form-select { font-size: 16px; }
}

/* ---------- Tableaux denses ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; font-size: .8125rem; }
.table > thead th { font-size: .6875rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600;
  background: var(--head); border-bottom: 1px solid var(--line); padding: .45rem .75rem; white-space: nowrap; }
.table > tbody td { padding: .5rem .75rem; border-color: var(--line-2); vertical-align: middle; }
.table > tbody tr:last-child td { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #F6F9FE; }
tr.row-link { cursor: pointer; }
.avatar-sm, .avatar-lg { flex-shrink: 0; display: inline-grid; place-items: center; border-radius: 50%; font-weight: 700; color: var(--primary); background: #EAF1FC; }
.avatar-sm { width: 28px; height: 28px; font-size: .65rem; }
.avatar-lg { width: 44px; height: 44px; font-size: .9rem; }
.m-meta { display: none; }

/* Mobile : chaque ligne devient une ligne de liste compacte (titre / montant, sous-titre / statut) */
@media (max-width: 767.98px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody { display: block; width: 100%; }
  .table-cards > tbody > tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .75rem; row-gap: 2px;
    padding: .65rem .9rem; border-bottom: 1px solid var(--line-2); align-items: center; }
  .table-cards > tbody > tr:last-child { border-bottom: 0; }
  .table-cards > tbody > tr:active { background: #F6F9FE; }
  .table-cards > tbody > tr > td { display: none; padding: 0; border: 0; }
  .table-cards > tbody > tr > td:first-child { display: block; grid-column: 1; grid-row: 1 / span 2; font-size: .875rem; }
  .table-cards > tbody > tr > td.m-end { display: block; grid-column: 2; grid-row: 1; text-align: right !important; font-weight: 650; font-size: .875rem; }
  .table-cards > tbody > tr > td.m-badge { display: block; grid-column: 2; grid-row: 2; text-align: right !important; }
  .table-cards > tbody > tr > td[colspan] { display: block; grid-column: 1 / -1; grid-row: auto; text-align: center !important; }
  .table-cards .m-meta { display: block; font-size: .75rem; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .table-cards td:first-child .small.text-muted:not(.m-meta), .table-cards td:first-child > .text-muted.small { display: none; }
  .table-cards td:first-child .d-flex .avatar-sm { width: 34px; height: 34px; font-size: .72rem; }
}

/* ---------- Formulaires ---------- */
.form-page { max-width: 1100px; }
.form-section-title { font-size: .8125rem; font-weight: 650; margin-bottom: .75rem; color: var(--ink); }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; align-items: center; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; padding: .55rem .75rem; margin: 0;
  background: rgba(255, 255, 255, .97); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
@media (min-width: 768px) { .sticky-actions { bottom: .75rem; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); } }
@media (max-width: 767.98px) {
  .sticky-actions { position: fixed; left: 0; right: 0; bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom)); z-index: 1024; }
  .sticky-actions .btn { flex: 1; height: 40px; }
  .has-sticky { padding-bottom: 64px; }
  .form-control, .form-select { font-size: 16px; min-height: 40px; }        /* 16 px : évite le zoom automatique d'iOS */
  .form-control-sm, .form-select-sm { font-size: 16px; min-height: 36px; }
  .form-page > .card-soft, form > .card-soft { margin-bottom: .5rem !important; }
}
@media (min-width: 576px) { .w-sm-auto { width: auto !important; } }

.info-list { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; font-size: .8125rem; margin-bottom: .75rem; }
.info-list dt { color: var(--muted); font-weight: 500; }
.info-list dd { margin: 0; word-break: break-word; }
.stat-box { background: var(--head); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: .45rem; }
.stock-big { margin-top: .6rem; border-radius: var(--radius-sm); padding: .75rem; background: #F0FDF4; color: #166534; text-align: center; border: 1px solid #DCFCE7; }
.stock-big.is-low { background: #FFFBEB; color: #92400E; border-color: #FEF3C7; }

/* ---------- Éditeur de lignes de document ---------- */
.lines-wrap { overflow: visible; }
.lines-table > thead th { padding: .4rem .45rem; }
.lines-table td { padding: .4rem .45rem !important; vertical-align: top; }
.line-row.is-stock .l-desig > .position-relative > input { border-left: 3px solid var(--primary); }
.line-meta { display: flex; align-items: center; gap: .35rem; margin-top: .25rem; flex-wrap: wrap; }
.line-kind { font-weight: 600; font-size: .625rem; display: inline-flex; align-items: center; gap: .25rem; border-radius: 4px; }
.line-kind .unlink { border: 0; background: rgba(255, 255, 255, .25); color: inherit; border-radius: 50%; width: 14px; height: 14px; line-height: 12px; padding: 0; font-size: .75rem; }
.line-ref { width: 100px !important; font-size: .72rem !important; padding: .05rem .35rem !important; min-height: 22px !important; }
.line-stock { color: var(--muted); font-size: .72rem; }
.l-total { padding-top: .7rem !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.l-actions .btn { padding: .15rem .35rem; }
.ac-menu { position: absolute; left: 0; right: 0; top: calc(100% + 3px); z-index: 1050; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); max-height: 300px; overflow-y: auto; padding: .25rem; min-width: 280px; }
.ac-item { display: flex; align-items: center; gap: .6rem; width: 100%; border: 0; background: transparent; text-align: left; padding: .4rem .5rem; border-radius: 4px; }
.ac-item:hover, .ac-item.active { background: #F1F5FB; }
.ac-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ac-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-main small { color: var(--muted); font-size: .7rem; }
.ac-price { font-weight: 650; color: var(--primary); white-space: nowrap; font-size: .8rem; }
.ac-empty { padding: .6rem; color: var(--muted); font-size: .78rem; }
.totals-box { background: var(--head); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: .65rem .8rem; display: grid; gap: .2rem; font-size: .8125rem; font-variant-numeric: tabular-nums; }
.totals-box .total-ttc { margin-top: .3rem; padding-top: .45rem; border-top: 1px solid var(--ink); font-weight: 750; font-size: 1rem; }

@media (max-width: 767.98px) {
  .lines-table thead { display: none; }
  .lines-table, .lines-table tbody { display: block; }
  .lines-table tr.line-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: .4rem; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
  .lines-table tr.line-row > td { display: block; padding: 0 !important; border: 0; }
  .lines-table tr.line-row > td::before { content: attr(data-label); display: block; font-size: .625rem; font-weight: 600; color: var(--muted); margin-bottom: 1px; text-transform: uppercase; letter-spacing: .03em; }
  .lines-table tr.line-row > td.l-desig { grid-column: 1 / -1; }
  .lines-table tr.line-row > td.l-desig::before { display: none; }
  .lines-table tr.line-row > td:nth-child(2), .lines-table tr.line-row > td:nth-child(3), .lines-table tr.line-row > td:nth-child(4),
  .lines-table tr.line-row > td:nth-child(5), .lines-table tr.line-row > td:nth-child(6) { grid-column: span 2; }
  .lines-table tr.line-row > td.l-total { grid-column: span 2; padding-top: 0 !important; text-align: right; align-self: end; font-size: .95rem; font-weight: 700; }
  .lines-table tr.line-row > td.l-actions { grid-column: 1 / -1; }
  .lines-table tr.line-row > td.l-actions::before { display: none; }
  .ac-menu { min-width: 0; }
}

/* ---------- Fiche document ---------- */
.doc-toolbar .btn { white-space: nowrap; }
.doc-lines > thead th { background: var(--head); }

/* ---------- Paramètres : logo & modèles ---------- */
.logo-drop { width: 100%; aspect-ratio: 16 / 9; max-width: 240px; margin: 0 auto; border: 2px dashed #CBD5E1; border-radius: 14px; display: grid; place-items: center; overflow: hidden; background: #fff; }
.logo-drop img { max-width: 90%; max-height: 90%; object-fit: contain; }
.tpl-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
.tpl-choice { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .45rem; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; font-size: .78rem; font-weight: 600; }
.btn-check:checked + .tpl-choice { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: #F1F5FB; color: var(--primary); }
.tpl-thumb { width: 100%; aspect-ratio: 3 / 4; border-radius: 6px; background: #fff; border: 1px solid var(--line); position: relative; overflow: hidden; }
.tpl-thumb::before, .tpl-thumb::after { content: ""; position: absolute; left: 12%; right: 12%; }
.tpl-moderne::before { left: 0; right: 0; top: 0; height: 22%; background: #DBEAFE; border-bottom: 2px solid var(--primary); }
.tpl-moderne::after { top: 40%; height: 8%; background: var(--primary); border-radius: 2px; }
.tpl-classique::before { top: 10%; height: 18%; border: 1.5px solid #94A3B8; }
.tpl-classique::after { top: 40%; height: 35%; border: 1.5px solid #94A3B8; background: repeating-linear-gradient(#fff 0 6px, #CBD5E1 6px 7px); }
.tpl-minimal::before { top: 12%; height: 3%; background: #0F172A; right: 50%; }
.tpl-minimal::after { top: 40%; height: 1.5px; background: #0F172A; }
.tpl-corporate::before { left: 0; right: 0; top: 0; height: 26%; background: var(--primary); }
.tpl-corporate::after { top: 20%; height: 14%; left: 10%; right: 10%; background: #fff; border: 1px solid #CBD5E1; border-radius: 3px; box-shadow: 0 2px 4px rgba(0,0,0,.12); }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatch:hover { transform: scale(1.1); }
.preview-card { position: sticky; top: calc(var(--topbar-h) + .75rem); overflow: hidden; }
.preview-card iframe { width: 100%; height: 78vh; border: 0; background: #E5E7EB; display: block; }

/* ---------- Connexion ---------- */
.login-page { background: var(--bg); }
.login-wrap { min-height: 100vh; display: flex; }
.login-side { flex: 1; align-items: center; padding: 4rem; color: #CBD5E1;
  background: radial-gradient(1200px 600px at 10% 10%, rgba(var(--primary-rgb), .35), transparent 60%), var(--night); }
.login-side h1 { color: #fff; font-weight: 800; }
.login-points { list-style: none; padding: 0; margin-top: 2rem; display: grid; gap: .8rem; }
.login-points i { color: var(--primary-2); margin-right: .5rem; }
.login-form-col { flex: 1; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 380px; background: #fff; padding: 1.75rem 1.5rem; border-radius: 12px; border: 1px solid var(--line); }
.login-card .form-control { font-size: 16px; }
.btn-toggle-pass { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); color: var(--muted); z-index: 5; }
@media (min-width: 992px) { .login-form-col { max-width: 560px; } }

/* ---------- Divers ---------- */
.confirm-icon { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; background: #EFF4FF; color: var(--primary); display: grid; place-items: center; font-size: 1.6rem; }
.alert { border-radius: var(--radius-sm); border: 1px solid transparent; padding: .55rem .8rem; font-size: .8125rem; }
.pagination .page-link { border-radius: 4px !important; margin: 0 1px; border: 0; color: var(--ink); font-size: .78rem; }
.pagination .active .page-link { background: var(--primary); }
.modal-content { border-radius: 10px; border: 0; }
@media (max-width: 575.98px) { .modal-fullscreen-sm-down .modal-content { border-radius: 0; } }

/* ---------- Page Paramètres ---------- */
.settings-layout { display: grid; gap: 1rem; }
.settings-nav { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.settings-nav::-webkit-scrollbar { display: none; }
.settings-link { display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; border-radius: var(--radius-sm); color: #334155; background: #fff;
  border: 1px solid var(--line); white-space: nowrap; font-weight: 500; font-size: .8125rem; }
.settings-link i { font-size: 1.05rem; color: var(--muted); }
.settings-link-desc { display: none; }
.settings-link:hover { border-color: #C7D2FE; color: var(--primary); }
.settings-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.settings-link.active i { color: #fff; }
@media (min-width: 992px) {
  .settings-layout { grid-template-columns: 290px 1fr; align-items: start; gap: 1.5rem; }
  .settings-nav { flex-direction: column; position: sticky; top: calc(var(--topbar-h) + 1rem); overflow: visible; background: #fff;
    border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem; }
  .settings-link { border: 0; white-space: normal; padding: .6rem .7rem; }
  .settings-link > span { display: flex; flex-direction: column; line-height: 1.25; }
  .settings-link-desc { display: block; font-size: .72rem; font-weight: 500; color: var(--muted); }
  .settings-link.active { background: rgba(var(--primary-rgb), .09); color: var(--primary); }
  .settings-link.active i { color: var(--primary); }
  .settings-link.active .settings-link-desc { color: var(--primary); opacity: .75; }
  .settings-link:nth-last-child(2) { margin-top: .5rem; border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; padding-top: .9rem; }
}
.settings-head { display: flex; align-items: center; gap: .8rem; padding-bottom: 1rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.settings-head-icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 1.25rem;
  background: rgba(var(--primary-rgb), .1); color: var(--primary); }
.hint-box { display: flex; gap: .5rem; align-items: flex-start; padding: .55rem .75rem; border-radius: var(--radius-sm); background: #F8FAFC; border: 1px dashed #CBD5E1; color: #475569; font-size: .84rem; }
.hint-box i { color: var(--primary); margin-top: 1px; }
.preview-money { height: 38px; display: flex; align-items: center; padding: 0 .9rem; border-radius: 10px; background: rgba(var(--primary-rgb), .08); color: var(--primary); font-weight: 800; }

.le-items { display: flex; flex-wrap: wrap; gap: .4rem; }
.le-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .3rem .3rem .75rem; border-radius: 999px; background: #fff;
  border: 1px solid var(--line); font-weight: 600; font-size: .85rem; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.le-del { width: 22px; height: 22px; border-radius: 50%; border: 0; background: #F1F5F9; color: #64748B; line-height: 1; font-size: 1rem; padding: 0; }
.le-del:hover { background: #FEE2E2; color: #DC2626; }

.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .6rem; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; }
.choice-card { display: flex; flex-direction: column; gap: .15rem; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: #fff; height: 100%; }
.choice-card i { font-size: 1.3rem; color: var(--muted); margin-bottom: .2rem; }
.choice-card small { color: var(--muted); }
.btn-check:checked + .choice-card { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: rgba(var(--primary-rgb), .05); }
.btn-check:checked + .choice-card i { color: var(--primary); }
.btn-check:focus-visible + .choice-card { box-shadow: 0 0 0 .2rem rgba(var(--primary-rgb), .2); }

.doc-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.doc-color-card { border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem; background: #fff; }
.doc-color-top { display: flex; align-items: center; gap: .5rem; margin-bottom: .7rem; font-size: .9rem; }
.doc-color-sample { height: 54px; border-radius: 10px; margin-bottom: .7rem; display: flex; align-items: center; justify-content: flex-end; padding: 0 .9rem;
  background: color-mix(in srgb, var(--dc) 10%, #fff); border-bottom: 3px solid var(--dc); }
.doc-color-sample span { color: var(--dc); font-weight: 800; letter-spacing: .5px; font-size: .95rem; }
.swatch-sm { width: 22px; height: 22px; }

.theme-preview { --tp-primary: var(--primary); --tp-menu: var(--menu-bg); display: flex; height: 150px; max-width: 460px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.tp-menu { width: 110px; background: var(--tp-menu); padding: .7rem; display: flex; flex-direction: column; gap: .4rem; }
.tp-logo { width: 26px; height: 26px; border-radius: 8px; background: var(--tp-primary); margin-bottom: .3rem; }
.tp-item { height: 12px; border-radius: 6px; background: rgba(255, 255, 255, .12); }
.tp-item.active { background: var(--tp-primary); }
.tp-body { flex: 1; padding: .9rem; display: flex; flex-direction: column; gap: .55rem; align-items: flex-start; }
.tp-line { height: 10px; border-radius: 5px; background: #CBD5E1; }
.tp-card { width: 100%; height: 34px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.tp-btn { background: var(--tp-primary); color: #fff; padding: .25rem .8rem; border-radius: 8px; font-size: .8rem; font-weight: 600; }
.tp-link { color: var(--tp-primary); font-size: .8rem; font-weight: 600; }
.num-preview { font-size: .85rem; color: var(--primary); background: rgba(var(--primary-rgb), .07); padding: .2rem .5rem; border-radius: 6px; }

/* =====================================================================
   Tableau de bord
   ===================================================================== */
.dash-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: .75rem; }
.period-switch { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 2px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.period-switch::-webkit-scrollbar { display: none; }
.period-switch a { white-space: nowrap; padding: .28rem .65rem; border-radius: 4px; color: var(--ink-2); font-size: .78rem; font-weight: 500; }
.period-switch a:hover { background: #F3F5F8; }
.period-switch a.active { background: var(--night); color: #fff; }
.dash-range { flex: 1 1 auto; }
.dash-actions { gap: .35rem; }

/* Indicateurs : une seule surface découpée en cellules (pas de cartes séparées) */
.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin-bottom: .75rem; }
.kpi-grid .kpi { background: #fff; padding: .7rem .85rem; color: var(--ink); display: block; min-width: 0; }
.kpi-grid a.kpi:hover { background: #F8FAFE; }
.kpi-grid .kpi-value { font-size: 1.05rem; }
.kpi-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .5rem; margin-top: .2rem; font-size: .7rem; color: var(--muted); min-height: 1rem; }
.delta { display: inline-flex; align-items: center; gap: 1px; font-weight: 650; border-radius: 3px; padding: 0 .3rem; font-size: .68rem; }
.delta.up { color: #15803D; background: #DCFCE7; }
.delta.down { color: #B91C1C; background: #FEE2E2; }
.delta.neutral { color: #1D4ED8; background: #DBEAFE; }
@media (min-width: 768px) { .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .kpi-grid .kpi { padding: .8rem 1rem; } }
@media (min-width: 1200px) { .kpi-grid .kpi-value { font-size: 1.3rem; } }

/* Grille de panneaux sur 12 colonnes */
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .75rem; }
.dash-grid > .panel { grid-column: span 12; min-width: 0; display: flex; flex-direction: column; }
@media (min-width: 992px) { .dash-grid > .span-6 { grid-column: span 6; } }
@media (min-width: 1200px) { .dash-grid > .span-4 { grid-column: span 4; } .dash-grid > .span-8 { grid-column: span 8; } }
@media (min-width: 768px) and (max-width: 1199.98px) { .dash-grid > .span-4 { grid-column: span 6; } }
.panel-body { padding: .75rem .85rem; flex: 1; }
.legend { display: flex; align-items: center; gap: .35rem; font-size: .7rem; color: var(--muted); }
.legend .lg-bar { width: 10px; height: 10px; border-radius: 2px; background: var(--primary); margin-left: .5rem; }
.legend .lg-line { width: 14px; height: 2px; background: #F59E0B; margin-left: .6rem; }
.chart-wrap { overflow-x: auto; margin: 0 -.25rem; }
.chart-svg { display: block; width: 100%; min-width: 560px; height: auto; }
.chart-svg .grid { stroke: var(--line-2); stroke-width: 1; }
.chart-svg .axis { fill: #9CA3AF; font-size: 10px; font-family: var(--bs-font-sans-serif); }
.chart-svg .bar { fill: rgba(var(--primary-rgb), .55); }
.chart-svg .bar-current { fill: var(--primary); }
.chart-svg .bar:hover { fill: var(--primary-dark); }
.chart-svg .line { fill: none; stroke: #F59E0B; stroke-width: 2; stroke-linejoin: round; }
.chart-svg .dot { fill: #fff; stroke: #F59E0B; stroke-width: 2; }
.chart-foot { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; font-size: .75rem; color: var(--muted); margin-top: .35rem; }
.chart-foot b { color: var(--ink); }

/* Balance âgée */
.aging-total { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: .4rem; }
.aging-total b { font-size: 1.1rem; }
.aging-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line-2); margin-bottom: .6rem; }
.ag-0 { background: #22C55E; } .ag-1 { background: #FACC15; } .ag-2 { background: #FB923C; } .ag-3 { background: #F87171; } .ag-4 { background: #B91C1C; }
.aging-table td { padding: .32rem 0 !important; border-color: var(--line-2); }
.aging-table .dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: .45rem; }

/* Barres horizontales (tops) */
.hbar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.hbar-top { display: flex; justify-content: space-between; gap: .75rem; font-size: .78rem; margin-bottom: 3px; }
.hbar-label { min-width: 0; }
.hbar-label a { color: var(--ink); font-weight: 500; }
.hbar-label a:hover { color: var(--primary); }
.hbar-val { font-weight: 600; }
.hbar-track { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 3px; }
.hbar-fill.tone-primary { background: var(--primary); }
.hbar-fill.tone-success { background: #16A34A; }

/* Listes compactes d'actions */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li + li { border-top: 1px solid var(--line-2); }
.mini-list a { display: flex; align-items: center; gap: .75rem; padding: .5rem .85rem; color: var(--ink); }
.mini-list a:hover { background: #F8FAFE; }
.ml-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ml-main b { font-weight: 550; font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-main small { color: var(--muted); font-size: .7rem; }
.ml-side { display: flex; flex-direction: column; align-items: flex-end; }
.ml-val { font-weight: 650; font-size: .8125rem; }
.late { font-size: .68rem; color: #B91C1C; font-weight: 600; }
.empty-mini { padding: 1rem .85rem; color: var(--muted); font-size: .78rem; text-align: center; }

@media (max-width: 767.98px) {
  .dash-head { padding: .6rem .75rem .2rem; margin: 0; background: #fff; }
  .dash-range { font-size: .68rem; width: 100%; }
  .kpi-grid { border-radius: 0; border-left: 0; border-right: 0; margin-bottom: .5rem; }
  .dash-grid { gap: .5rem; }
  .mini-list a { padding: .6rem .9rem; }
}

/* ---------- Divers (mobile) ---------- */
@media (max-width: 767.98px) {
  .page-toolbar > a.btn-light:has(> .bi-arrow-left) { display: none; }       /* « Retour » : déjà dans la barre du haut */
  .doc-toolbar { position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top)); z-index: 6; }
  .card-soft .card-footer { padding: .6rem .9rem; }
  .form-actions:not(.sticky-actions) { padding: .6rem .75rem; }
}

/* ---------- Système : diagnostic ---------- */
.diag-list .list-group-item { padding: .5rem .85rem; }

/* =====================================================================
   Couleurs & animations (1.8)
   Palette des tons : utilisée par les indicateurs, les icônes de panneaux et les états.
   ===================================================================== */
.tone-blue   { --t: #2563EB; --t-bg: #DBEAFE; }
.tone-green  { --t: #16A34A; --t-bg: #DCFCE7; }
.tone-amber  { --t: #D97706; --t-bg: #FEF3C7; }
.tone-violet { --t: #7C3AED; --t-bg: #EDE9FE; }
.tone-indigo { --t: #4F46E5; --t-bg: #E0E7FF; }
.tone-sky    { --t: #0284C7; --t-bg: #E0F2FE; }
.tone-orange { --t: #EA580C; --t-bg: #FFEDD5; }
.tone-teal   { --t: #0D9488; --t-bg: #CCFBF1; }
.tone-red    { --t: #DC2626; --t-bg: #FEE2E2; }

/* ---------- Bandeau d'accueil ---------- */
.dash-hero { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem;
  padding: 1.1rem 1.35rem; margin-bottom: .75rem; border-radius: var(--radius); color: #fff;
  background: linear-gradient(120deg, var(--night) 0%, var(--primary) 62%, var(--primary-2) 100%);
  background-size: 160% 160%; animation: heroShift 14s ease-in-out infinite alternate; }
.dash-hero > * { position: relative; z-index: 1; }
.hero-text { flex: 1 1 320px; min-width: 0; }
.hero-date { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.hero-title { font-size: 1.35rem; font-weight: 700; margin: .1rem 0 .55rem; color: #fff; }
.hero-title .wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.2s ease-in-out .6s 2; }
.hero-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.hero-chips > * { display: inline-flex; align-items: center; gap: .35rem; font-size: .74rem; font-weight: 500; color: #fff;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); padding: .22rem .6rem; border-radius: 999px;
  backdrop-filter: blur(4px); transition: background .2s; }
.hero-chips a:hover { background: rgba(255,255,255,.26); color: #fff; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.hero-btn { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .8rem; border-radius: 8px; font-size: .78rem; font-weight: 600;
  color: var(--night); background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.14); transition: transform .18s, box-shadow .18s; }
.hero-btn i { color: var(--primary); font-size: .95rem; }
.hero-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.2); color: var(--night); }
.hero-orb { position: absolute; border-radius: 50%; pointer-events: none; z-index: 0; background: radial-gradient(circle, rgba(255,255,255,.22), transparent 70%); }
.hero-orb.o1 { width: 260px; height: 260px; right: -60px; top: -120px; animation: float 9s ease-in-out infinite; }
.hero-orb.o2 { width: 180px; height: 180px; right: 28%; bottom: -110px; animation: float 11s ease-in-out -3s infinite reverse; }
@keyframes heroShift { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-18px, 14px); } }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); } }
@media (max-width: 767.98px) {
  .dash-hero { border-radius: 0; margin: 0; padding: 1rem .9rem; }
  .hero-title { font-size: 1.15rem; }
  .hero-actions { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; }
  .hero-btn { flex-direction: column; gap: .2rem; padding: .5rem .2rem; font-size: .68rem; justify-content: center; }
  .hero-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
}

/* ---------- Indicateurs colorés ---------- */
.kpi-grid .kpi[class*="tone-"] { position: relative; transition: background .2s, transform .2s; }
.kpi-grid .kpi[class*="tone-"]::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--t);
  transform: scaleX(0); transform-origin: left; animation: barIn .7s cubic-bezier(.2,.8,.2,1) forwards; animation-delay: calc(var(--k, 0) * 70ms + .15s); }
.kpi-grid .kpi[class*="tone-"]::after { content: ""; position: absolute; right: -24px; bottom: -24px; width: 80px; height: 80px; border-radius: 50%;
  background: var(--t-bg); opacity: .55; pointer-events: none; transition: transform .35s; }
.kpi-grid .kpi[class*="tone-"]:hover::after { transform: scale(1.35); }
.kpi-grid .kpi > * { position: relative; z-index: 1; }
.kpi-ico { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; margin-right: .4rem; vertical-align: -6px;
  background: var(--t-bg, #EEF2F7); color: var(--t, var(--ink-2)); font-size: .74rem; }
.kpi-grid .kpi.tone-amber .kpi-value { color: #B45309; }
.kpi-grid .kpi:nth-child(1) { --k: 0; } .kpi-grid .kpi:nth-child(2) { --k: 1; } .kpi-grid .kpi:nth-child(3) { --k: 2; } .kpi-grid .kpi:nth-child(4) { --k: 3; }
.kpi-grid .kpi:nth-child(5) { --k: 4; } .kpi-grid .kpi:nth-child(6) { --k: 5; } .kpi-grid .kpi:nth-child(7) { --k: 6; } .kpi-grid .kpi:nth-child(8) { --k: 7; }
@keyframes barIn { to { transform: scaleX(1); } }

/* ---------- Panneaux : icônes de titre + apparition en cascade ---------- */
.panel-title { display: inline-flex; align-items: center; gap: .45rem; }
.p-ico { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--t-bg); color: var(--t); font-size: .8rem; flex: none; }
.dash-grid > .panel, .kpi-grid, .dash-hero { animation: riseIn .55s cubic-bezier(.2,.8,.2,1) both; }
.kpi-grid { animation-delay: .05s; }
.dash-grid > .panel:nth-child(1) { animation-delay: .12s; } .dash-grid > .panel:nth-child(2) { animation-delay: .18s; }
.dash-grid > .panel:nth-child(3) { animation-delay: .24s; } .dash-grid > .panel:nth-child(4) { animation-delay: .3s; }
.dash-grid > .panel:nth-child(5) { animation-delay: .36s; } .dash-grid > .panel:nth-child(6) { animation-delay: .42s; }
.dash-grid > .panel:nth-child(7) { animation-delay: .48s; } .dash-grid > .panel:nth-child(8) { animation-delay: .54s; }
.dash-grid > .panel:nth-child(n+9) { animation-delay: .6s; }
.dash-grid > .panel { transition: box-shadow .25s, border-color .25s; }
.dash-grid > .panel:hover { box-shadow: 0 6px 22px rgba(15, 23, 42, .07); border-color: #D5DCE6; }
@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Graphique : barres qui montent, courbe tracée ---------- */
.chart-svg .gb-top { stop-color: var(--primary-2); }
.chart-svg .gb-bot { stop-color: var(--primary); }
.chart-svg .bar { fill: url(#gBar); opacity: .55; transform-box: fill-box; transform-origin: 50% 100%;
  animation: growUp .8s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 45ms + .25s); transition: opacity .2s; }
.chart-svg .bar-current { opacity: 1; }
.chart-svg .bar:hover { opacity: .9; fill: url(#gBar); }
.chart-svg .area { fill: url(#gArea); opacity: 0; animation: fadeIn .8s ease 1.1s forwards; }
.chart-svg .line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.4s cubic-bezier(.4,0,.2,1) .5s forwards; stroke-width: 2.25; }
.chart-svg .dot { opacity: 0; transform-box: fill-box; transform-origin: center; animation: pop .35s ease both; animation-delay: calc(var(--i, 0) * 90ms + .7s); }
.chart-svg .dot:hover { r: 5; }
@keyframes growUp { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }

/* ---------- Barres horizontales, balance âgée ---------- */
.hbar-fill { transform-origin: left; animation: barIn .9s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 80ms + .35s); transform: scaleX(0); }
.hbar-fill.tone-primary { background: linear-gradient(90deg, var(--primary), var(--primary-2)); }
.hbar-fill.tone-success { background: linear-gradient(90deg, #16A34A, #4ADE80); }
.hbar-list li { transition: transform .2s; }
.hbar-list li:hover { transform: translateX(3px); }
.aging-bar { height: 12px; }
.aging-bar span { transform-origin: left; animation: barIn .9s cubic-bezier(.2,.8,.2,1) .3s both; transform: scaleX(0); }
.mini-list a { transition: background .15s, padding-left .2s; }
.mini-list a:hover { padding-left: 1.1rem; }

/* ---------- Pages : petites touches de vie ---------- */
.app-content > * { animation: riseIn .4s cubic-bezier(.2,.8,.2,1) both; }
.app-content > *:nth-child(2) { animation-delay: .04s; } .app-content > *:nth-child(3) { animation-delay: .08s; } .app-content > *:nth-child(n+4) { animation-delay: .12s; }
.btn { transition: transform .12s, box-shadow .18s, background-color .15s, border-color .15s, color .15s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn-primary:hover { box-shadow: 0 4px 14px rgba(var(--primary-rgb), .3); }
.card-soft { transition: box-shadow .25s, border-color .25s; }
.table-hover > tbody > tr { transition: background-color .15s; }
.nav-link-item { transition: background .15s, color .15s, padding-left .2s; }
html:not(.sidebar-mini) .nav-link-item:not(.active):hover { padding-left: calc(.6rem + 3px); }
.badge { transition: transform .15s; }
.alert { animation: slideDown .35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.doc-ico { transition: transform .2s; }
tr:hover .doc-ico { transform: rotate(-6deg) scale(1.08); }

/* Accessibilité : aucune animation si l'utilisateur l'a demandé dans son système */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
/* Impression : tout est affiché immédiatement */
@media print { *, *::before, *::after { animation: none !important; } .hbar-fill, .aging-bar span, .chart-svg .bar { transform: none !important; } .chart-svg .line { stroke-dashoffset: 0 !important; } }

/* ---------- Invitation à installer l'application ---------- */
.install-pop { position: fixed; inset: 0; z-index: 2100; display: flex; align-items: flex-end; justify-content: flex-end; padding: 1.25rem;
  pointer-events: none; background: rgba(4, 18, 40, 0); transition: background .3s; }
.install-pop .ip-card { pointer-events: auto; position: relative; width: 360px; max-width: 100%; background: #fff; border-radius: 16px; padding: 1.1rem 1.1rem 1rem;
  box-shadow: 0 24px 60px -12px rgba(4, 18, 40, .35), 0 0 0 1px rgba(4, 18, 40, .06);
  transform: translateY(24px) scale(.97); opacity: 0; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .3s; }
.install-pop.show .ip-card { transform: none; opacity: 1; }
.install-pop .ip-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, var(--night), var(--primary), var(--primary-2)); }
.ip-close { position: absolute; top: .55rem; right: .55rem; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.ip-close:hover { background: #F1F4F8; color: var(--ink); }
.ip-head { display: flex; align-items: center; gap: .8rem; margin: .2rem 1.6rem .8rem 0; }
.ip-icon { width: 52px; height: 52px; border-radius: 13px; box-shadow: 0 6px 16px rgba(4, 18, 40, .18); flex: none; animation: ipBounce 1.6s ease .5s 2; }
.ip-title { font-weight: 700; font-size: 1.02rem; color: var(--ink); line-height: 1.25; }
.ip-sub { font-size: .76rem; color: var(--muted); margin-top: .1rem; }
.ip-benefits, .ip-steps { margin: 0 0 1rem; padding: 0; font-size: .84rem; color: var(--ink-2); }
.ip-benefits { list-style: none; display: grid; gap: .35rem; }
.ip-benefits i { color: #16A34A; margin-right: .45rem; }
.ip-steps { padding-left: 1.2rem; display: grid; gap: .4rem; }
.ip-steps i { color: var(--primary); }
.ip-actions { display: flex; gap: .5rem; justify-content: flex-end; }
.ip-actions .btn { min-width: 110px; }
@keyframes ipBounce { 0%, 100% { transform: none; } 30% { transform: translateY(-6px) rotate(-4deg); } 60% { transform: translateY(0) rotate(2deg); } }
/* Téléphone : feuille qui monte du bas, au-dessus de la barre de navigation */
.install-pop.is-mobile { align-items: flex-end; justify-content: center; padding: 0; }
.install-pop.is-mobile.show { background: rgba(4, 18, 40, .45); pointer-events: auto; }
.install-pop.is-mobile .ip-card { width: 100%; border-radius: 20px 20px 0 0; padding: 1.3rem 1.1rem calc(1rem + env(safe-area-inset-bottom)); transform: translateY(100%); opacity: 1; }
.install-pop.is-mobile.show .ip-card { transform: none; }
.install-pop.is-mobile .ip-card::before { left: 50%; right: auto; top: .5rem; width: 40px; height: 4px; border-radius: 2px; transform: translateX(-50%); background: #D5DBE3; }
.install-pop.is-mobile .ip-actions .btn { flex: 1; min-height: 44px; }
@media print { .install-pop { display: none !important; } }
