/* ==========================================================================
   BELISA EVENT MANAGER — Interface
   Palette issue du logo : vert (feuilles), orange & rouge (arcs)
   ========================================================================== */
:root {
  --green-dark: #145A2C;
  --green: #1E8A3E;
  --green-light: #4CBF5C;
  --green-soft: #E8F5EB;
  --orange: #F47C20;
  --orange-dark: #D9660F;
  --orange-soft: #FEF1E6;
  --red: #C41230;
  --red-soft: #FBE7EA;
  --ink: #1B1D1B;
  --ink-soft: #4A524C;
  --muted: #7A847C;
  --paper: #FFFFFF;
  --paper-alt: #F4F7F3;
  --border: #E4E9E2;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px -14px rgba(20, 40, 25, .28);
  --shadow-sm: 0 2px 10px -4px rgba(20, 40, 25, .16);
  --sidebar-w: 262px;
  --font-display: 'Poppins', 'Segoe UI', sans-serif;
  --font-body: 'Work Sans', 'Segoe UI', sans-serif;

  --bs-primary: var(--green);
  --bs-primary-rgb: 30, 138, 62;
  --bs-link-color: var(--green);
  --bs-link-color-rgb: 30, 138, 62;
  --bs-link-hover-color: var(--green-dark);
  --bs-body-font-family: var(--font-body);
  --bs-body-color: var(--ink);
  --bs-border-color: var(--border);
}

html, body { height: 100%; }
body { background: var(--paper-alt); font-family: var(--font-body); color: var(--ink); font-size: .94rem; }
h1, h2, h3, h4, h5, h6, .font-display { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; }
a { text-decoration: none; }
.text-muted { color: var(--muted) !important; }
.text-green { color: var(--green) !important; }
.text-orange { color: var(--orange) !important; }
.text-red { color: var(--red) !important; }
.bg-green-soft { background: var(--green-soft) !important; }
.bg-orange-soft { background: var(--orange-soft) !important; }
.bg-red-soft { background: var(--red-soft) !important; }
.small-caps { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- Boutons ---------- */
.btn { border-radius: 10px; font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--green); --bs-btn-border-color: var(--green); --bs-btn-hover-bg: var(--green-dark); --bs-btn-hover-border-color: var(--green-dark); --bs-btn-active-bg: var(--green-dark); --bs-btn-active-border-color: var(--green-dark); --bs-btn-disabled-bg: var(--green); --bs-btn-disabled-border-color: var(--green); }
.btn-accent { --bs-btn-color: #fff; --bs-btn-bg: var(--orange); --bs-btn-border-color: var(--orange); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--orange-dark); --bs-btn-hover-border-color: var(--orange-dark); --bs-btn-active-bg: var(--orange-dark); --bs-btn-active-color: #fff; }
.btn-outline-primary { --bs-btn-color: var(--green); --bs-btn-border-color: var(--green); --bs-btn-hover-bg: var(--green); --bs-btn-hover-border-color: var(--green); --bs-btn-active-bg: var(--green-dark); }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--border); --bs-btn-hover-bg: var(--paper-alt); --bs-btn-hover-border-color: #d3dbd1; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--green-light); box-shadow: 0 0 0 .2rem rgba(76, 191, 92, .2); }
.form-check-input:checked { background-color: var(--green); border-color: var(--green); }
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: .3rem; color: var(--ink-soft); }
.form-control, .form-select { border-radius: 9px; }
.required::after { content: ' *'; color: var(--red); }
.nav-pills .nav-link.active { background: var(--green); }
.nav-tabs .nav-link { color: var(--ink-soft); font-weight: 500; }
.nav-tabs .nav-link.active { color: var(--green-dark); border-bottom-color: #fff; font-weight: 600; }
.progress-bar { background-color: var(--green); }
.dropdown-item.active, .dropdown-item:active { background: var(--green); }
.page-link { color: var(--green); }
.active > .page-link, .page-link.active { background: var(--green); border-color: var(--green); }

/* ---------- Écrans d'accès ---------- */
.auth-screen { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--paper); }
.auth-visual { position: relative; overflow: hidden; background: linear-gradient(150deg, var(--green-dark) 0%, #0F4522 55%, #0b3519 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-visual::before { content: ''; position: absolute; width: 620px; height: 620px; border-radius: 50%; border: 38px solid rgba(244, 124, 32, .9); border-left-color: transparent; border-bottom-color: transparent; right: -330px; top: -170px; transform: rotate(18deg); }
.auth-visual::after { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 30px solid rgba(196, 18, 48, .85); border-right-color: transparent; border-top-color: transparent; left: -300px; bottom: -260px; transform: rotate(-10deg); }
.auth-visual > * { position: relative; z-index: 1; }
.auth-visual h1 { font-size: clamp(2rem, 3.4vw, 3rem); font-weight: 700; line-height: 1.1; }
.auth-visual .motto { font-family: var(--font-display); letter-spacing: .02em; font-size: 1.05rem; opacity: .92; }
.auth-visual .motto span { color: var(--orange); }
.auth-features { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; max-width: 420px; }
.auth-features li { display: flex; gap: 12px; align-items: center; opacity: .92; }
.auth-features i { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.12); display: inline-flex; align-items: center; justify-content: center; }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .logo { width: 190px; display: block; margin: 0 auto 18px; }
@media (max-width: 900px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}

/* ---------- Structure ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--green-dark); background-image: linear-gradient(180deg, #17632F 0%, var(--green-dark) 40%, #0E4220 100%); color: #DCEBDD; display: flex; flex-direction: column; z-index: 1040; transition: transform .25s ease; }
.sidebar-brand { padding: 16px 16px 12px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand img { width: 50px; height: 36px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px 5px; }
.sidebar-brand .t1 { font-family: var(--font-display); font-weight: 700; color: #fff; font-size: 1.02rem; line-height: 1.05; letter-spacing: .02em; }
.sidebar-brand .t2 { font-size: .68rem; color: var(--orange); letter-spacing: .12em; text-transform: uppercase; font-weight: 600; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.nav-section { font-size: .66rem; text-transform: uppercase; letter-spacing: .12em; color: rgba(220, 235, 221, .55); font-weight: 600; margin: 16px 10px 6px; }
.sidebar-nav a { display: flex; align-items: center; gap: 11px; color: #DCEBDD; padding: 8px 12px; border-radius: 10px; font-size: .9rem; margin-bottom: 1px; transition: background .15s, color .15s; }
.sidebar-nav a i { font-size: 1.05rem; width: 20px; text-align: center; opacity: .9; }
.sidebar-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav a.active { background: #fff; color: var(--green-dark); font-weight: 600; box-shadow: var(--shadow-sm); }
.sidebar-nav a.active i { color: var(--orange); }
.sidebar-nav .count { margin-left: auto; background: var(--orange); color: #fff; font-size: .68rem; border-radius: 20px; padding: 1px 7px; font-weight: 600; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: .72rem; color: rgba(220,235,221,.6); }
.sidebar-foot .motto { color: #fff; font-family: var(--font-display); font-size: .74rem; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1030; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); padding: 10px 24px; display: flex; align-items: center; gap: 14px; }
.topbar .search { position: relative; flex: 1; max-width: 520px; }
.topbar .search input { padding-left: 38px; background: var(--paper-alt); border-color: transparent; border-radius: 12px; }
.topbar .search input:focus { background: #fff; }
.topbar .search > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); max-height: 60vh; overflow-y: auto; z-index: 1050; }
.search-results a { display: flex; gap: 10px; align-items: center; padding: 9px 14px; color: var(--ink); border-bottom: 1px solid var(--paper-alt); }
.search-results a:hover, .search-results a.focus { background: var(--green-soft); }
.search-results .type { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.topbar .icon-btn { position: relative; width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft); background: transparent; border: 0; font-size: 1.2rem; }
.topbar .icon-btn:hover { background: var(--paper-alt); color: var(--green-dark); }
.topbar .dot { position: absolute; top: 5px; right: 4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: .64rem; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid #fff; }
.user-chip { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 4px 8px; border-radius: 12px; }
.user-chip:hover { background: var(--paper-alt); }
.avatar { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg, var(--green) 0%, var(--green-light) 100%); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-family: var(--font-display); font-size: .85rem; flex-shrink: 0; }
.avatar.sm { width: 28px; height: 28px; border-radius: 8px; font-size: .7rem; }
.user-chip .n { font-weight: 600; font-size: .86rem; line-height: 1.1; text-align: left; }
.user-chip .r { font-size: .72rem; color: var(--muted); text-align: left; }
.content { padding: 24px; flex: 1; max-width: 1560px; width: 100%; }
.menu-toggle { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(10, 30, 15, .45); z-index: 1035; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 8px 14px; gap: 8px; }
  .user-chip .who { display: none; }
  .content { padding: 16px; }
}

/* ---------- En-têtes de page ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.55rem; margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 3px; font-size: .9rem; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb-lite { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.breadcrumb-lite a { color: var(--muted); }
.breadcrumb-lite a:hover { color: var(--green); }

/* ---------- Cartes ---------- */
.card-bem { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-bem > .card-h { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-bem > .card-h h2, .card-bem > .card-h h3 { font-size: 1rem; margin: 0; }
.card-bem > .card-b { padding: 18px; }
.card-bem > .card-b.p0 { padding: 0; }

.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--shadow-sm); height: 100%; position: relative; overflow: hidden; }
.kpi .ic { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; background: var(--green-soft); color: var(--green); }
.kpi.orange .ic { background: var(--orange-soft); color: var(--orange-dark); }
.kpi.red .ic { background: var(--red-soft); color: var(--red); }
.kpi.dark .ic { background: #E9EEEA; color: var(--green-dark); }
.kpi .lbl { font-size: .78rem; color: var(--muted); font-weight: 500; }
.kpi .val { font-family: var(--font-display); font-size: clamp(1.05rem, 1.25vw, 1.3rem); font-weight: 700; line-height: 1.2; white-space: nowrap; }
.kpi > .min-w-0 { flex: 1; overflow: hidden; }
.kpi .hint { font-size: .74rem; color: var(--muted); }
.kpi.link { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.kpi.link:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-line { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.stat-line:last-child { border-bottom: 0; }
.stat-line .v { font-weight: 600; }

/* ---------- Tableaux ---------- */
.table-bem { margin: 0; }
.table-bem thead th { background: #FAFBFA; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; padding: 10px 12px; cursor: default; }
.table-bem thead th.sortable { cursor: pointer; user-select: none; }
.table-bem thead th.sortable:hover { color: var(--green-dark); }
.table-bem td { padding: 10px 12px; vertical-align: middle; border-color: #EEF2ED; }
.table-bem tbody tr.clickable { cursor: pointer; }
.table-bem tbody tr:hover { background: #FAFCFA; }
.table-bem .actions-col { width: 1%; white-space: nowrap; text-align: right; }
.table-bem tfoot td { font-weight: 700; background: #FAFBFA; }
.table-wrap { overflow-x: auto; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .82rem; }
.id-chip { font-family: ui-monospace, Consolas, monospace; font-size: .76rem; background: var(--paper-alt); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; color: var(--ink-soft); white-space: nowrap; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state i { font-size: 2.4rem; color: #C8D3C9; display: block; margin-bottom: 8px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.toolbar .form-control, .toolbar .form-select { width: auto; min-width: 140px; }
.toolbar .q { flex: 1; min-width: 200px; max-width: 340px; }
@media (max-width: 575.98px) { .toolbar .form-control, .toolbar .form-select, .toolbar .q { min-width: 0; width: 100%; max-width: none; flex: 1 1 100%; } }

/* ---------- Statuts ---------- */
.st { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; background: #EEF1EE; color: #56605A; }
.st::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.st.s-success { background: var(--green-soft); color: #17703A; }
.st.s-info { background: #E6F0FB; color: #1F5F9E; }
.st.s-warning { background: var(--orange-soft); color: #B4520A; }
.st.s-danger { background: var(--red-soft); color: var(--red); }
.st.s-dark { background: #E7E9E7; color: #3B423D; }
.prio-Urgente { color: var(--red); }
.prio-Haute { color: var(--orange-dark); }
.prio-Normale { color: var(--ink-soft); }
.prio-Basse { color: var(--muted); }

/* ---------- Alertes ---------- */
.alert-item { display: flex; gap: 12px; padding: 11px 16px; border-bottom: 1px solid #F0F3EF; color: var(--ink); align-items: flex-start; }
.alert-item:last-child { border-bottom: 0; }
.alert-item:hover { background: #FAFCFA; }
.alert-item .ai { width: 32px; height: 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.alert-item.danger .ai { background: var(--red-soft); color: var(--red); }
.alert-item.warning .ai { background: var(--orange-soft); color: var(--orange-dark); }
.alert-item.info .ai { background: #E6F0FB; color: #1F5F9E; }
.alert-item .t { font-weight: 600; font-size: .88rem; }
.alert-item .m { font-size: .8rem; color: var(--muted); }
.alert-item .c { font-size: .66rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--muted); }

/* ---------- Événement ---------- */
.event-hero { background: linear-gradient(120deg, var(--green-dark), #1B7236); color: #fff; border-radius: var(--radius); padding: 22px 24px; position: relative; overflow: hidden; }
.event-hero::after { content: ''; position: absolute; right: -80px; top: -120px; width: 300px; height: 300px; border-radius: 50%; border: 22px solid rgba(244, 124, 32, .75); border-left-color: transparent; border-bottom-color: transparent; }
.event-hero h1 { font-size: 1.6rem; margin: 4px 0 8px; position: relative; z-index: 1; }
.event-hero .meta { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: .88rem; opacity: .95; position: relative; z-index: 1; }
.event-hero .meta i { color: var(--orange); margin-right: 5px; }
.event-hero .st { background: rgba(255,255,255,.95); }
.event-hero .hero-actions { position: relative; z-index: 1; }
.countdown { font-family: var(--font-display); font-size: .8rem; background: var(--orange); color: #fff; padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.checklist .item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid #F0F3EF; }
.checklist .item:last-child { border-bottom: 0; }
.checklist .item.done .ttl { text-decoration: line-through; color: var(--muted); }
.checklist .item .form-check-input { width: 1.2em; height: 1.2em; margin: 0; cursor: pointer; flex-shrink: 0; }
.checklist .ttl { font-weight: 500; }
.checklist .meta { font-size: .76rem; color: var(--muted); }
.checklist .late { color: var(--red); font-weight: 600; }
.budget-bar { height: 10px; border-radius: 10px; background: #EDF1EC; overflow: hidden; }
.budget-bar > div { height: 100%; background: var(--green); border-radius: 10px; }
.budget-bar > div.over { background: var(--red); }
.budget-bar > div.warn { background: var(--orange); }
.person-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid #F0F3EF; }
.person-row:last-child { border-bottom: 0; }

/* ---------- Kanban prospects ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kanban-col { background: #EDF2EC; border-radius: var(--radius); padding: 10px; min-height: 160px; }
.kanban-col.drop { outline: 2px dashed var(--green-light); background: var(--green-soft); }
.kanban-col h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; display: flex; justify-content: space-between; margin: 2px 4px 10px; color: var(--ink-soft); }
.kanban-card { background: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow-sm); cursor: grab; border-left: 3px solid var(--green-light); }
.kanban-card:active { cursor: grabbing; }
.kanban-card .n { font-weight: 600; font-size: .88rem; }
.kanban-card .s { font-size: .76rem; color: var(--muted); }

/* ---------- Calendrier ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal-grid .dow { background: #FAFBFA; font-size: .72rem; font-weight: 600; text-transform: uppercase; color: var(--muted); padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; }
.cal-grid .day { min-height: 108px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 5px; background: #fff; overflow: hidden; }
.cal-grid .day.out { background: #FAFBFA; }
.cal-grid .day.out .d { color: #B8C2BA; }
.cal-grid .day .d { font-size: .78rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 3px; }
.cal-grid .day.today .d { background: var(--orange); color: #fff; border-radius: 20px; display: inline-block; padding: 0 7px; }
.cal-ev { display: block; font-size: .72rem; padding: 2px 6px; border-radius: 5px; margin-bottom: 2px; background: var(--green-soft); color: var(--green-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.cal-ev.task { background: var(--orange-soft); color: #9A4708; }
.cal-ev.done { opacity: .55; text-decoration: line-through; }
@media (max-width: 767.98px) { .cal-grid .day { min-height: 64px; } .cal-ev { font-size: .62rem; padding: 1px 3px; } }

/* ---------- Formulaires ---------- */
.modal-content { border-radius: 16px; border: 0; }
.modal-header { border-bottom-color: var(--border); }
.modal-header .modal-title { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.modal-footer { border-top-color: var(--border); }
.form-section { font-family: var(--font-display); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--green); font-weight: 600; margin: 8px 0 -4px; padding-top: 6px; border-top: 1px solid var(--border); }
.lines-editor table { font-size: .88rem; }
.lines-editor td { padding: 4px; vertical-align: top; }
.lines-editor th { font-size: .72rem; color: var(--muted); text-transform: uppercase; padding: 4px; font-weight: 600; }
.lines-editor .form-control { padding: .35rem .5rem; font-size: .88rem; }
.lines-editor .tot { text-align: right; padding-top: 10px; font-weight: 600; white-space: nowrap; }
.totals-box { background: var(--paper-alt); border-radius: 10px; padding: 10px 14px; min-width: 260px; }
.totals-box .stat-line { padding: 4px 0; }
.totals-box .grand { font-family: var(--font-display); font-size: 1.1rem; color: var(--green-dark); }
.multi-box { border: 1px solid var(--border); border-radius: 9px; max-height: 210px; overflow-y: auto; padding: 6px 10px; background: #fff; }
.multi-box .form-check { margin: 3px 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; background: var(--paper-alt); border: 1px solid var(--border); border-radius: 20px; padding: 1px 8px; margin: 1px 2px 1px 0; }
.invalid-feedback { display: block; }

/* ---------- Toasts ---------- */
.toast-zone { position: fixed; bottom: 18px; right: 18px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast-bem { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; animation: toastIn .25s ease; font-size: .9rem; }
.toast-bem.success i { color: var(--green-light); }
.toast-bem.error { background: var(--red); }
.toast-bem.warning i { color: var(--orange); }
.toast-bem ul { margin: 4px 0 0; padding-left: 18px; font-size: .82rem; opacity: .95; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.loading { display: flex; justify-content: center; padding: 60px 0; color: var(--green); }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 230px; }

/* ---------- Documents (devis, facture, contrat, reçu, rapport) ---------- */
.doc-toolbar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.doc-paper { background: #fff; max-width: 820px; margin: 0 auto; padding: 42px 48px; box-shadow: var(--shadow); border-radius: 6px; color: #1d1d1d; font-size: 13px; line-height: 1.5; position: relative; }
.doc-paper.wide { max-width: 1060px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding-bottom: 16px; border-bottom: 3px solid var(--green); position: relative; }
.doc-head::after { content: ''; position: absolute; left: 0; bottom: -3px; width: 90px; height: 3px; background: var(--orange); }
.doc-head .logo { width: 150px; }
.doc-head .company { font-size: 11.5px; color: #555; margin-top: 4px; }
.doc-title { text-align: right; }
.doc-title h2 { font-family: var(--font-display); color: var(--green-dark); font-size: 26px; margin: 0; letter-spacing: .04em; text-transform: uppercase; }
.doc-title .ref { font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: .02em; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 22px 0; }
.doc-parties .box { border: 1px solid #E3E7E2; border-radius: 8px; padding: 12px 14px; }
.doc-parties .box h4 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--green); margin: 0 0 6px; font-weight: 700; }
.doc-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.doc-table th { background: var(--green-dark); color: #fff; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; text-align: left; font-weight: 600; }
.doc-table td { padding: 8px 10px; border-bottom: 1px solid #ECEFEB; vertical-align: top; }
.doc-table tr:nth-child(even) td { background: #FAFBFA; }
.doc-table .r { text-align: right; white-space: nowrap; }
.doc-totals { margin-left: auto; width: 300px; margin-top: 8px; }
.doc-totals .l { display: flex; justify-content: space-between; padding: 5px 10px; }
.doc-totals .g { background: var(--green-dark); color: #fff; font-weight: 700; font-size: 15px; border-radius: 6px; margin-top: 4px; }
.doc-totals .o { background: var(--orange-soft); color: #9A4708; font-weight: 600; border-radius: 6px; }
.doc-section { margin-top: 18px; }
.doc-section h3 { font-family: var(--font-display); font-size: 13px; color: var(--green-dark); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 6px; border-bottom: 1px solid #E3E7E2; padding-bottom: 4px; }
.doc-section p { margin: 0 0 6px; white-space: pre-line; }
.doc-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 34px; }
.doc-signs .s { border-top: 1px solid #999; padding-top: 6px; min-height: 90px; font-size: 12px; }
.doc-foot { margin-top: 30px; padding-top: 10px; border-top: 1px solid #E3E7E2; font-size: 10.5px; color: #777; text-align: center; }
.doc-stamp { position: absolute; top: 150px; right: 50px; border: 3px solid; border-radius: 8px; padding: 4px 14px; font-family: var(--font-display); font-weight: 700; font-size: 20px; transform: rotate(-12deg); opacity: .75; text-transform: uppercase; }
.doc-stamp.paid { color: var(--green); }
.doc-stamp.late { color: var(--red); }
.doc-stamp.draft { color: #999; }
.doc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.doc-kpis .k { border: 1px solid #E3E7E2; border-radius: 8px; padding: 10px 12px; }
.doc-kpis .k .l { font-size: 10.5px; text-transform: uppercase; color: #777; letter-spacing: .05em; }
.doc-kpis .k .v { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--green-dark); }
/* « screen » uniquement : une page A4 imprimée fait moins de 768 px de large,
   sans cette restriction l'impression prendrait la mise en page téléphone. */
@media screen and (max-width: 767.98px) {
  .doc-paper { padding: 22px 18px; }
  .doc-head { flex-direction: column; }
  .doc-title { text-align: left; }
  .doc-parties, .doc-signs { grid-template-columns: 1fr; }
  .doc-totals { width: 100%; }
  .doc-stamp { display: none; }
}

/* ---------- Impression / PDF ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; }
  .sidebar, .topbar, .no-print, .doc-toolbar, .toast-zone, .page-head .actions, .modal, .sidebar-backdrop { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  .doc-paper { box-shadow: none !important; padding: 0 !important; max-width: none !important; border-radius: 0; }
  .card-bem { box-shadow: none; break-inside: avoid; }
  .doc-table th, .doc-totals .g, .doc-totals .o, .doc-head, .doc-stamp, .doc-kpis .k { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit !important; text-decoration: none !important; }
  /* Mise en page du document conservée à l'impression (logo à gauche, titre à droite, blocs côte à côte) */
  .doc-paper { font-size: 12px; }
  .doc-head { flex-direction: row !important; }
  .doc-head .logo { width: 125px; }
  .doc-title { text-align: right !important; }
  .doc-parties, .doc-signs { grid-template-columns: 1fr 1fr !important; }
  .doc-totals { width: 300px !important; }
  .doc-paper .row > .col-md-6 { flex: 0 0 50%; max-width: 50%; }
  .doc-paper .row > .col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
  /* Pas de coupure de page au milieu d'un bloc */
  .doc-parties .box, .doc-totals, .doc-signs, .doc-table tr, .doc-kpis .k { break-inside: avoid; page-break-inside: avoid; }
  .doc-section h3, .doc-table thead { break-after: avoid; page-break-after: avoid; }
  .doc-table thead { display: table-header-group; }
  .doc-stamp { top: 120px; }
}
.min-w-0 { min-width: 0; }

.stat-line { gap: 12px; }
.stat-line .v { text-align: right; }
