/* ============================================================================
 * SINGA — styles.css
 * 1. Design system & thèmes   2. Base & typographie   3. Connexion
 * 4. Coque / navigation       5. Composants           6. Vues & tableaux
 * 7. Éditeur de documents    8. Modales & drawers    9. Aperçu & impression A4
 * 10. Mobile & accessibilité
 * ==========================================================================*/

/* ---------------------------- 1. DESIGN SYSTEM ---------------------------- */
:root {
  /* Palette de marque */
  --ink: #0D1526;
  --ivory: #F4F6FA;
  --white: #FFFFFF;
  --brand: #2457E6;
  --brand-deep: #1B45BD;
  --brand-tint: #E8EFFF;
  --gold: var(--brand);
  --gold-light: var(--brand-tint);
  --gold-deep: var(--brand-deep);
  --night: #0D1526;
  --success: #12A150;
  --warning: #B54708;
  --danger: #D92D20;
  --info: #2457E6;

  /* Couleurs des pôles */
  --pole-BRD: #6A3FA0;
  --pole-STR: #E07B1F;
  --pole-PRT: #2A6EBB;
  --pole-WEB: #3A8F3F;
  --pole-CNT: #1E8A8A;
  --pole-OPT: #777777;

  /* Thème clair (par défaut) */
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #F8F9FC;
  --surface-3: #EEF1F6;
  --text: #101828;
  --text-soft: #475467;
  --muted: #667085;
  --border: #E4E8F0;
  --border-strong: #D0D5DD;
  --input-bg: #FFFFFF;
  --overlay: rgba(15, 22, 41, .46);
  --gold-tint: var(--brand-tint);
  --success-tint: #E7F6EC;
  --warning-tint: #FEF0C7;
  --danger-tint: #FEE4E2;
  --info-tint: #E8EFFF;
  --shadow-sm: 0 1px 2px rgba(15, 22, 41, .05), 0 2px 8px rgba(15, 22, 41, .035);
  --shadow-md: 0 2px 6px rgba(15, 22, 41, .05), 0 12px 28px rgba(15, 22, 41, .075);
  --shadow-lg: 0 8px 24px rgba(15, 22, 41, .10), 0 30px 70px rgba(15, 22, 41, .16);
  --shadow-gold: 0 2px 8px rgba(36, 87, 230, .16), 0 10px 24px rgba(36, 87, 230, .10);

  /* Rythme */
  --sp: 8px;
  --r-sm: 10px;
  --r: 12px;
  --r-lg: 12px;
  --sidebar-w: 244px;
  --topbar-h: 72px;
  --ease: cubic-bezier(.22, .68, 0, 1);
  --t: 200ms var(--ease);

  /* Typographie */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  
}

[data-theme="dark"] {
  --brand-tint: rgba(36,87,230,.18);
  --bg: #0B1220;
  --surface: #121B2E;
  --surface-2: #1A2439;
  --surface-3: #212D45;
  --text: #F3F0E9;
  --text-soft: #C8CFDE;
  --muted: #94A0B6;
  --border: #2A3550;
  --border-strong: #3A4764;
  --input-bg: #101827;
  --overlay: rgba(3, 7, 16, .70);
  --brand-tint: rgba(36,87,230,.18);
  --gold-tint: var(--brand-tint);
  --success-tint: rgba(46, 158, 107, .18);
  --warning-tint: rgba(224, 160, 42, .18);
  --danger-tint: rgba(214, 69, 69, .17);
  --info-tint: rgba(72, 140, 217, .17);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px rgba(0, 0, 0, .22);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .3), 0 12px 28px rgba(0, 0, 0, .32);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .42), 0 30px 70px rgba(0, 0, 0, .5);
  --shadow-gold: 0 2px 8px rgba(36, 87, 230, .16), 0 10px 24px rgba(0, 0, 0, .3);
  --gold-light: #8BA9FF;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0B1220; --surface: #121B2E; --text: #F2F4F7; --border: #27344D;
  }
}

/* ------------------------- 2. BASE & TYPOGRAPHIE ------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.02em; }
h1, h2 { font-weight: 600; }
h1 { font-size: clamp(25px, 3.2vw, 36px); }
h2 { font-size: clamp(20px, 2.4vw, 26px); }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
small { font-size: 12px; }
strong { font-weight: 600; }
::selection { background: var(--gold-tint); color: var(--text); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 15px; height: 15px; }
.icon--lg { width: 22px; height: 22px; }
.num { font-variant-numeric: tabular-nums lining-nums; font-feature-settings: 'tnum' 1; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.scroll-y { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ----------------------------- 3. CONNEXION ------------------------------ */
.login-screen { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(380px, .95fr); min-height: 100vh; }
.login-art {
  position: relative; overflow: hidden; color: #F5F1E6;
  background: #0D1526;
  display: flex; align-items: center;
}
.login-art::after {
  content: ''; position: absolute; inset: 0; opacity: .35;
  background-image: none;
}
.login-art__glow { display: none; }
.login-art__inner { position: relative; z-index: 1; padding: clamp(32px, 6vw, 88px); width: 100%; }
.login-brand { display: flex; align-items: center; gap: 14px; font-size: 20px; letter-spacing: .16em; }
.login-brand strong { display: block; font-family: var(--font-sans); font-size: 25px; letter-spacing: .12em; }
.login-brand small { display: block; color: rgba(245,241,230,.6); letter-spacing: .12em; font-size: 10px; text-transform: uppercase; margin-top: 2px; }
.login-mark {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex: none;
  font-family: var(--font-sans); font-size: 30px; font-weight: 600; color: #101827;
  background: var(--brand);
  box-shadow: 0 8px 30px rgba(36, 87, 230, .15);
}
.login-mark--small { width: 40px; height: 40px; border-radius: 11px; font-size: 24px; }
.login-mark--tiny { width: 34px; height: 34px; border-radius: 9px; font-size: 19px; }
.login-quote { font-family: var(--font-sans); font-size: clamp(30px, 4vw, 52px); line-height: 1.18; margin: clamp(60px, 12vh, 130px) 0 32px; font-weight: 400; }
.login-art__lines { display: flex; gap: 8px; margin-bottom: 28px; }
.login-art__lines span { height: 2px; width: 56px; background: var(--gold); opacity: .85; }
.login-art__lines span + span { width: 26px; opacity: .45; }
.login-art__lines span:last-child { width: 12px; opacity: .25; }
.login-art__foot { color: rgba(245,241,230,.62); font-size: 12px; letter-spacing: .04em; }
.login-panel { background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px 24px; gap: 24px; }
.login-card { width: min(100%, 384px); animation: fade-up .45s var(--ease) both; }
.login-card__brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-sans); font-size: 20px; letter-spacing: .14em; margin-bottom: 44px; }
.login-card__title { font-size: 32px; margin-bottom: 8px; }
.login-card__subtitle { color: var(--muted); margin-bottom: 32px; }
.login-card form { display: grid; gap: 16px; }
.login-links { display: flex; justify-content: flex-end; margin-top: 12px; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--muted); font-size: 12.5px; }
.link-btn:hover { color: var(--gold-deep); text-decoration: underline; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 26px 0 18px; color: var(--muted); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.demo-roles { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.login-hint { color: var(--muted); font-size: 11.5px; text-align: center; margin-top: 18px; line-height: 1.5; }
.login-legal { color: var(--muted); font-size: 11px; opacity: .8; }
.form-error { color: var(--danger); background: var(--danger-tint); border-radius: var(--r-sm); padding: 10px 12px; font-size: 12.5px; }

/* --------------------------- 4. COQUE / NAVIGATION ----------------------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--night); color: #E9EDF6; padding: 24px 14px 18px; z-index: 30;
}
[data-theme="dark"] .sidebar { background: #0A1120; border-right: 1px solid var(--border); }
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; }
.sidebar__brand-text strong { display: block; font-family: var(--font-sans); font-size: 20px; letter-spacing: .14em; }
.sidebar__brand-text small { color: rgba(233,237,246,.55); font-size: 10px; letter-spacing: .03em; }
.sidebar__nav { display: grid; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 10px 12px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: rgba(233,237,246,.72);
  font-size: 13.5px; font-weight: 500; text-align: left; transition: background var(--t), color var(--t), transform var(--t);
}
.nav-item .icon { width: 19px; height: 19px; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #FFF; }
.nav-item.is-active { background: rgba(36,87,230,.18); color: #FFFFFF; box-shadow: inset 3px 0 0 var(--brand); }
.sidebar__foot { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(255,255,255,.10); }
.sidebar__workspace { display: flex; align-items: center; gap: 8px; font-size: 10.5px; color: rgba(233,237,246,.5); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.dot--blue { background: var(--gold); box-shadow: 0 0 0 3px rgba(36,87,230,.18); }
.sidebar__user { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 600; font-size: 12px; color: #101827; background: var(--brand); }
.sidebar__user small { display: block; color: rgba(233,237,246,.55); font-size: 10px; }
.main-column { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 25; height: var(--topbar-h); display: flex; align-items: center; gap: 16px;
  padding: 0 clamp(16px, 3vw, 36px); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.topbar__menu { display: none; }
.topbar__search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); transition: border-color var(--t), box-shadow var(--t); }
.topbar__search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }
.topbar__search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: 0; font-size: 13px; }
.topbar__search kbd { font-family: var(--font-sans); font-size: 10px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 2px 5px; white-space: nowrap; }
.topbar__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.view { flex: 1; padding: clamp(20px, 3vw, 36px); max-width: 1560px; width: 100%; margin: 0 auto; animation: fade-in .28s var(--ease) both; }
.bottom-nav { display: none; }
.demo-banner { display: flex; align-items: center; gap: 10px; padding: 8px clamp(16px, 3vw, 36px); background: var(--warning-tint); color: var(--text); border-bottom: 1px solid var(--border); font-size: 12.5px; font-weight: 500; }
.demo-banner .icon { color: var(--warning); }
.demo-banner .icon-btn { margin-left: auto; }

/* ------------------------------ 5. COMPOSANTS ---------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 10px 18px; border-radius: var(--r-sm); border: 1px solid transparent; font-size: 13px; font-weight: 600;
  letter-spacing: .01em; transition: transform var(--t), box-shadow var(--t), background var(--t), border-color var(--t), opacity var(--t);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.995); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { color: #FFFFFF; background: linear-gradient(180deg, #2E63EC 0%, #2457E6 100%); box-shadow: var(--shadow-gold); }
.btn--primary:hover:not(:disabled) { box-shadow: 0 4px 12px rgba(36,87,230,.18), 0 14px 30px rgba(36,87,230,.12); filter: brightness(1.04); }
.btn--outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn--outline:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-deep); background: var(--gold-tint); }
.btn--ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn--danger { background: var(--danger-tint); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn--danger:hover:not(:disabled) { background: var(--danger); color: #FFF; }
.btn--compact { min-height: 38px; padding: 8px 14px; font-size: 12.5px; }
.btn--tiny { min-height: 34px; padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn--block { width: 100%; }
.icon-btn { width: 40px; height: 40px; min-width: 40px; display: inline-grid; place-items: center; border: 1px solid transparent; background: transparent; border-radius: var(--r-sm); color: var(--muted); transition: background var(--t), color var(--t), border-color var(--t); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn--tiny { width: 30px; height: 30px; min-width: 30px; }
.icon-btn--danger:hover { background: var(--danger-tint); color: var(--danger); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.card--pad { padding: 24px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.panel__title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 9px; }
.panel__body { padding: 18px 20px; }
.panel__foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* En-têtes de vue */
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.view-head__eyebrow { font-size: 10.5px; text-transform: uppercase; letter-spacing: .16em; color: var(--gold-deep); font-weight: 600; margin-bottom: 6px; }
.view-head__sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.view-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.breadcrumb button { background: none; border: 0; padding: 0; color: var(--muted); }
.breadcrumb button:hover { color: var(--gold-deep); }

/* Champs */
.field { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field__label { font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.field input, .field select, .field textarea, .input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); background: var(--input-bg); color: var(--text); outline: 0;
  transition: border-color var(--t), box-shadow var(--t); font-size: 13.5px;
}
.field textarea, .textarea { min-height: 84px; resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }
.field input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .75; }
.field--floating > input { height: 52px; padding: 20px 14px 6px; }
.field--floating > label { position: absolute; top: 16px; left: 14px; font-size: 13.5px; font-weight: 400; color: var(--muted); pointer-events: none; transition: transform var(--t), font-size var(--t), color var(--t); transform-origin: left top; }
.field--floating > input:focus + label, .field--floating > input:not(:placeholder-shown) + label { transform: translateY(-11px) scale(.78); color: var(--gold-deep); font-weight: 600; }
.field-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.field-help { font-size: 11px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--gold-deep); }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--gold-deep); }

/* Badges, puces, chips */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--neutre { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.badge--info { background: var(--info-tint); color: var(--info); }
.badge--succes { background: var(--success-tint); color: var(--success); }
.badge--alerte { background: var(--warning-tint); color: #A97413; }
.badge--erreur { background: var(--danger-tint); color: var(--danger); }
[data-theme="dark"] .badge--alerte { color: var(--warning); }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; font-weight: 500; color: var(--muted); transition: all var(--t); }
.chip:hover { border-color: var(--gold); color: var(--text); }
.chip.is-active { background: var(--ink); color: #FFF; border-color: var(--ink); }
[data-theme="dark"] .chip.is-active { background: var(--gold); color: #101827; border-color: var(--gold); }
.chip--action { cursor: pointer; }
.chip__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pill-pole { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; padding: 3px 9px; border-radius: 999px; border: 1px solid currentColor; }

/* Barres d'outils / filtres */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar__search { position: relative; flex: 1; min-width: 180px; max-width: 340px; }
.toolbar__search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar__search input { width: 100%; height: 40px; padding: 8px 12px 8px 36px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--input-bg); outline: 0; font-size: 13px; }
.toolbar__search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }
.toolbar select { height: 40px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--input-bg); font-size: 12.5px; }
.toolbar__spacer { flex: 1; }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab { min-height: 44px; padding: 10px 16px; border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; }
.tab.is-active { color: var(--text); border-bottom-color: var(--gold); font-weight: 600; }

/* Tableaux */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background var(--t); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .align-r { text-align: right; }
.table .row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.table__link { color: var(--text); font-weight: 600; background: none; border: 0; padding: 0; text-align: left; }
.table__link:hover { color: var(--gold-deep); text-decoration: underline; }
.table__ref { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.table__sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.price-input { width: 120px; min-height: 34px; padding: 5px 8px; text-align: right; border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.price-input:focus { border-color: var(--gold); outline: 0; }

/* KPI & graphiques */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { position: relative; padding: 20px; min-height: 132px; overflow: hidden; }
.kpi::after { content: ''; position: absolute; right: -28px; top: -28px; width: 96px; height: 96px; border-radius: 50%; background: var(--gold-tint); opacity: .65; }
.kpi__label { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.kpi__label .icon { color: var(--gold-deep); }
.kpi__value { font-family: var(--font-sans); font-size: clamp(22px, 2.4vw, 30px); font-weight: 600; margin-top: 14px; letter-spacing: -.02em; }
.kpi__foot { font-size: 11px; color: var(--muted); margin-top: 6px; }
.kpi--danger::after { background: var(--danger-tint); }
.kpi--danger .kpi__value { color: var(--danger); }
.kpi--success::after { background: var(--success-tint); }
.charts-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 16px; margin-bottom: 24px; }
.chart-bars { display: grid; gap: 14px; padding: 8px 0; }
.chart-bar { display: grid; grid-template-columns: 82px minmax(0, 1fr) 110px; align-items: center; gap: 12px; font-size: 12px; }
.chart-bar__track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.chart-bar__fill { height: 100%; border-radius: 999px; transition: width .7s var(--ease); }
.chart-bar__value { text-align: right; color: var(--muted); font-size: 11.5px; }
.spark { width: 100%; height: 140px; display: block; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.mini-list { display: grid; }
.mini-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); transition: background var(--t); }
.mini-item:last-child { border-bottom: 0; }
.mini-item:hover { background: var(--surface-2); }
.mini-item__main { flex: 1; min-width: 0; }
.mini-item__title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item__sub { font-size: 11px; color: var(--muted); }
.mini-item__amount { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }

/* Cartes de pôles & catalogue */
.pole-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.pole-card { position: relative; padding: 22px; cursor: pointer; overflow: hidden; transition: transform var(--t), box-shadow var(--t), border-color var(--t); }
.pole-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--pole-color); }
.pole-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--pole-color); }
.pole-card__code { font-size: 10px; letter-spacing: .16em; font-weight: 700; color: var(--pole-color); }
.pole-card__name { font-family: var(--font-sans); font-size: 22px; margin: 8px 0 6px; }
.pole-card__desc { font-size: 11.5px; color: var(--muted); min-height: 34px; }
.pole-card__count { margin-top: 18px; display: flex; align-items: baseline; gap: 6px; }
.pole-card__count strong { font-size: 24px; font-family: var(--font-sans); }
.pole-card__count span { font-size: 11px; color: var(--muted); }
.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.category-card { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; text-align: left; transition: all var(--t); }
.category-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.category-card__code { font-size: 10px; color: var(--muted); letter-spacing: .1em; }
.category-card__name { font-size: 13px; font-weight: 600; margin-top: 4px; }
.category-card__count { font-size: 11px; color: var(--muted); margin-top: 8px; }

/* États vides, squelettes, toasts */
.empty { display: grid; justify-items: center; text-align: center; padding: 48px 24px; color: var(--muted); gap: 8px; }
.empty svg { width: 92px; height: 92px; color: var(--gold); opacity: .8; }
.empty h3 { color: var(--text); font-family: var(--font-sans); font-size: 19px; }
.empty p { max-width: 340px; font-size: 12.5px; }
.empty .btn { margin-top: 10px; }
.skeleton { background: var(--surface-2); animation: none; border-radius: 8px; }
.skeleton-line { height: 12px; margin: 10px 0; }
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 10px; max-width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px; border-radius: var(--r-sm); background: var(--ink); color: #F7F4EC; box-shadow: var(--shadow-lg); font-size: 12.5px; pointer-events: auto; animation: slide-in .25s var(--ease) both; }
[data-theme="dark"] .toast { background: #26324A; border: 1px solid var(--border-strong); }
.toast .icon { color: var(--gold-light); margin-top: 1px; }
.toast--error .icon { color: #FF9C9C; }
.toast--success .icon { color: #87E0B4; }

/* Drawers, modales, palette */
.drawer-backdrop, .modal-backdrop, .palette-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 100; animation: fade-in .18s var(--ease) both; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(480px, 100vw); background: var(--bg); z-index: 110; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide-left .26s var(--ease) both; }
.drawer--wide { width: min(720px, 100vw); }
.drawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.drawer__head h2 { font-size: 22px; }
.drawer__head p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.drawer__body { flex: 1; overflow-y: auto; padding: 24px; display: grid; gap: 18px; align-content: start; }
.drawer__foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface); }
.modal-backdrop { display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: fade-up .24s var(--ease) both; overflow: hidden; }
.modal--wide { width: min(860px, 100%); }
.modal--doc { width: min(1120px, 100%); height: min(92vh, 1000px); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal__body { padding: 22px; overflow-y: auto; flex: 1; }
.modal__foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.palette-backdrop { display: flex; align-items: flex-start; justify-content: center; padding: min(14vh, 110px) 16px 16px; }
.palette { width: min(600px, 100%); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: fade-up .2s var(--ease) both; }
.palette__input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.palette__input input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 15px; }
.palette__list { max-height: 340px; overflow-y: auto; padding: 8px; }
.palette__item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: var(--r-sm); background: none; text-align: left; font-size: 13px; }
.palette__item.is-active, .palette__item:hover { background: var(--gold-tint); }
.palette__item small { margin-left: auto; color: var(--muted); font-size: 10.5px; }
.palette__foot { padding: 10px 16px; border-top: 1px solid var(--border); font-size: 10.5px; color: var(--muted); }

/* Divers */
.separator { height: 1px; background: var(--border); margin: 4px 0; }
.section-title { font-family: var(--font-sans); font-size: 17px; margin: 4px 0 12px; }
.hint-box { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--info-tint); color: var(--text-soft); font-size: 12px; line-height: 1.5; }
.hint-box .icon { color: var(--info); }
.hint-box code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.stat-inline { display: flex; gap: 18px; flex-wrap: wrap; }
.stat-inline > div { min-width: 100px; }
.stat-inline small { display: block; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; }
.stat-inline strong { font-size: 16px; font-family: var(--font-sans); }
.color-swatch { width: 30px; height: 30px; border-radius: 8px; border: 2px solid var(--border); cursor: pointer; }
.color-swatch.is-active { outline: 2px solid var(--gold); outline-offset: 2px; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--r); padding: 32px 20px; text-align: center; display: grid; gap: 8px; justify-items: center; background: var(--surface-2); transition: all var(--t); cursor: pointer; }
.dropzone.is-over { border-color: var(--gold); background: var(--gold-tint); transform: scale(1.01); }
.dropzone .icon { width: 30px; height: 30px; color: var(--gold-deep); }
.dropzone p { font-size: 12.5px; color: var(--muted); }
.report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.report-cell { padding: 14px; border-radius: var(--r-sm); background: var(--surface-2); text-align: center; }
.report-cell strong { display: block; font-family: var(--font-sans); font-size: 24px; }
.report-cell small { color: var(--muted); font-size: 11px; }
.dropzone-file { font-size: 12px; font-weight: 600; color: var(--text); }
.stack { display: grid; gap: 12px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flex--between { justify-content: space-between; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-right { text-align: right; }
.hidden-mobile { display: initial; }

/* Animations */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes slide-left { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* --------------------------- 7. ÉDITEUR DE DOCUMENTS --------------------- */
.editor { padding-bottom: 96px; }
.editor__bar {
  position: sticky; top: var(--topbar-h); z-index: 22; display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; padding: 12px 0; margin-bottom: 16px; background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.editor__bar h1 { font-size: clamp(19px, 2.2vw, 26px); font-family: var(--font-sans); font-weight: 600; letter-spacing: -.02em; }
.editor__bar .num { font-size: 12px; color: var(--muted); font-weight: 500; }
.editor__bar__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.save-indicator { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); white-space: nowrap; padding: 0 8px; }
.save-indicator .dot { width: 7px; height: 7px; }
.save-indicator.is-saving .dot { background: var(--warning); animation: pulse 1s infinite; }
.save-indicator.is-saved .dot { background: var(--success); }
.save-indicator.is-error .dot { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }
.editor__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 350px); gap: 20px; align-items: start; }
.editor__main { min-width: 0; display: grid; gap: 18px; }
.editor__side { position: sticky; top: calc(var(--topbar-h) + 76px); display: grid; gap: 16px; }
.editor__tabs { display: none; }
.editor-card { padding: 20px; }
.editor-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.editor-card__head h2 { font-family: var(--font-sans); font-size: 14px; font-weight: 600; letter-spacing: 0; display: flex; align-items: center; gap: 8px; }
.editor-card__head .icon { color: var(--gold-deep); }
.client-picker { display: flex; gap: 10px; align-items: center; }
.client-picker select { flex: 1; }
.client-selected { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); }
.client-selected strong { display: block; font-size: 13.5px; }
.client-selected small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }

/* Catalogue rapide dans l'éditeur */
.catalog-picker { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.catalog-picker__head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: grid; gap: 10px; }
.catalog-picker__search { position: relative; }
.catalog-picker__search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.catalog-picker__search input { width: 100%; height: 42px; padding: 8px 12px 8px 36px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--input-bg); outline: 0; }
.catalog-picker__search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }
.catalog-picker__chips { display: flex; gap: 6px; flex-wrap: wrap; }
.catalog-picker__list { max-height: 260px; overflow-y: auto; }
.catalog-result { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; transition: background var(--t); }
.catalog-result:hover { background: var(--gold-tint); }
.catalog-result:last-child { border-bottom: 0; }
.catalog-result__main { flex: 1; min-width: 0; }
.catalog-result__title { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-result__sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.catalog-result__price { font-size: 12px; font-weight: 600; white-space: nowrap; }
.catalog-result__add { color: var(--gold-deep); }

/* Lignes : grille dense sur grand écran, carte empilée sur mobile */
.line-list { display: grid; gap: 10px; }
.line-group { display: grid; gap: 8px; }
.line-group__head { display: flex; align-items: center; gap: 8px; padding: 4px 2px 0; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--pole-color); }
.line-group__head::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.line-group__subtotal { text-align: right; font-size: 11.5px; color: var(--muted); padding-right: 4px; }
.line-row {
  display: grid; grid-template-columns: 22px minmax(170px, 1fr) 72px 78px 108px 64px 100px 64px;
  gap: 8px; align-items: start; padding: 10px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); transition: border-color var(--t), box-shadow var(--t), opacity var(--t);
}
.line-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.line-row.is-dragging { opacity: .42; border-style: dashed; }
.line-row.is-drop { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }
.line-row.is-option { background: color-mix(in srgb, var(--surface) 90%, var(--pole-OPT) 10%); }
.line-row.is-proposed { opacity: .72; }
.line-row__grip { color: var(--muted); cursor: grab; padding-top: 10px; }
.line-row__grip:active { cursor: grabbing; }
.line-row__label { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 3px; }
.line-row input, .line-row textarea, .line-row select {
  width: 100%; min-height: 36px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--input-bg); font-size: 12.5px; outline: 0; font-variant-numeric: tabular-nums;
}
.line-row textarea { min-height: 36px; resize: vertical; line-height: 1.4; }
.line-row input:focus, .line-row textarea:focus, .line-row select:focus { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-tint); }
.line-row__total { text-align: right; padding-top: 16px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.line-row__actions { display: flex; gap: 1px; justify-content: flex-end; padding-top: 2px; }
.line-row__actions .icon-btn { width: 30px; height: 30px; min-width: 30px; }
.line-row__ref { font-size: 9.5px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.line-options { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; grid-column: 2 / -1; }
.line-options label { font-size: 10.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.line-options input { width: 15px; height: 15px; min-height: 0; }
.prt-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; grid-column: 2 / -1; margin-top: 6px; }
.prt-fields input { min-height: 32px; font-size: 11px; }
.lines-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 12.5px; border: 1px dashed var(--border-strong); border-radius: var(--r-sm); }

/* Totaux */
.totals-card { padding: 20px; }
.totals-card h2 { font-family: var(--font-sans); font-size: 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.total-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 12.5px; }
.total-row span:first-child { color: var(--muted); }
.total-row strong { font-weight: 600; }
.total-row--net { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 12px; }
.total-row--grand { border-top: 2px solid var(--ink); margin-top: 8px; padding-top: 14px; font-family: var(--font-sans); font-size: 20px; }
[data-theme="dark"] .total-row--grand { border-top-color: var(--gold); }
.total-row--grand span:first-child { color: var(--text); font-family: var(--font-sans); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.total-row--grand strong { font-size: 22px; font-weight: 600; }
.total-row--reste { background: var(--gold-tint); margin: 10px -20px -20px; padding: 14px 20px; border-radius: 0 0 var(--r) var(--r); font-size: 13px; }
.total-row--reste strong { color: var(--gold-deep); font-size: 16px; }
.compact-fields { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 6px; align-items: center; }
.compact-fields select, .compact-fields input { min-height: 38px; padding: 6px 8px; font-size: 12.5px; }
.mini-doc { padding: 18px; background: #FFF; color: #16203A; border-radius: var(--r-sm); border: 1px solid var(--border); font-size: 10.5px; max-height: 250px; overflow: hidden; position: relative; }
.mini-doc::after { display: none; }
.mini-doc h4 { font-family: var(--font-sans); font-size: 16px; margin-bottom: 6px; }
.mini-doc__rule { height: 3px; background: var(--gold); width: 42px; margin: 8px 0 12px; }
.mini-doc__row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid #EEE9DD; }
.sticky-totals { display: none; }

/* ------------------------ 9. APERÇU & IMPRESSION A4 --------------------- */
.print-root { display: none; }
.doc-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.doc-toolbar__spacer { flex: 1; }
.doc-preview-wrap { flex: 1; overflow: auto; background: #E9E6DE; padding: 24px; }
[data-theme="dark"] .doc-preview-wrap { background: #0A1020; }

/* La feuille est partagée entre l'aperçu écran et l'impression */
.print-sheet {
  --doc-accent: #2457E6;
  --doc-ink: #16203A;
  width: 210mm; min-height: 297mm; margin: 0 auto 24px; padding: 16mm 15mm 22mm;
  background: #FFFFFF; color: var(--doc-ink); font-family: var(--font-sans);
  font-size: 9.6pt; line-height: 1.5; position: relative; box-shadow: var(--shadow-lg);
  print-color-adjust: exact; -webkit-print-color-adjust: exact;
}
.print-sheet *, .print-sheet *::before, .print-sheet *::after { box-sizing: border-box; }
.print-sheet p { margin: 0 0 6px; }
.print-sheet 
.doc-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12mm; padding-bottom: 8mm; margin-bottom: 9mm; border-bottom: 1px solid #E4E8F0; }
.doc-brand { display: flex; align-items: center; gap: 10px; }
.doc-brand__logo { width: 22mm; height: 22mm; object-fit: contain; }
.doc-brand__mark { width: 15mm; height: 15mm; border-radius: 3mm; display: grid; place-items: center; background: var(--doc-accent); color: #FFF; font-family: var(--font-sans); font-size: 22pt; }
.doc-brand__name { font-family: var(--font-sans); font-size: 19pt; letter-spacing: .08em; line-height: 1.1; }
.doc-brand__slogan { font-size: 7.5pt; color: #6B7285; letter-spacing: .04em; margin-top: 2px; }
.doc-company { text-align: right; font-size: 7.8pt; color: #53607A; line-height: 1.5; }
.doc-company strong { color: var(--doc-ink); }
.doc-title-block { display: flex; align-items: flex-end; justify-content: space-between; gap: 10mm; margin-bottom: 9mm; }
.doc-title { font-family: var(--font-sans); font-size: 27pt; font-weight: 600; line-height: 1.05; letter-spacing: -.01em; }
.doc-title__num { font-family: var(--font-sans); font-size: 10pt; color: var(--doc-accent); font-weight: 700; letter-spacing: .08em; margin-bottom: 3mm; text-transform: uppercase; }
.doc-title__objet { font-size: 9pt; color: #53607A; margin-top: 3mm; max-width: 105mm; }
.doc-meta { text-align: right; font-size: 8.2pt; color: #53607A; min-width: 48mm; }
.doc-meta div { margin-bottom: 1.5mm; }
.doc-meta b { color: var(--doc-ink); }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 10mm; margin-bottom: 10mm; }
.doc-party { padding: 5mm 6mm; border: 1px solid #E4E8F0; border-radius: 2mm; }
.doc-party__label { font-size: 7pt; text-transform: uppercase; letter-spacing: .12em; color: #8A8F9C; margin-bottom: 3mm; }
.doc-party__name { font-family: var(--font-sans); font-size: 12pt; margin-bottom: 2mm; }
.doc-party__line { font-size: 8pt; color: #53607A; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 6mm; }
.doc-table thead th { font-size: 7pt; text-transform: uppercase; letter-spacing: .09em; color: #7C8494; font-weight: 700; text-align: left; padding: 2mm 2mm; border-bottom: 1px solid #E4E8F0; }
.doc-table thead th.r { text-align: right; }
.doc-table tbody td { padding: 2.6mm 2mm; border-bottom: 1px solid #E4E8F0; vertical-align: top; font-size: 8.6pt; }
.doc-table tbody td.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-table .doc-line { break-inside: avoid; page-break-inside: avoid; }
.doc-table .doc-line__title { font-weight: 600; font-size: 9pt; }
.doc-table .doc-line__ref { font-size: 6.8pt; color: #8A8F9C; letter-spacing: .04em; }
.doc-table .doc-line__desc { font-size: 7.6pt; color: #5E687D; white-space: pre-line; margin-top: 1mm; }
.doc-group td { padding: 3mm 2mm 1.5mm; font-size: 7.4pt; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: var(--pole-color, #777); border-left: 2.5px solid var(--pole-color, #777); border-bottom: 0; }
.doc-option-note { color: #8A8F9C; font-size: 7.5pt; font-style: italic; }
.doc-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 66mm; gap: 10mm; margin-top: 4mm; }
.doc-notes { font-size: 7.8pt; color: #53607A; }
.doc-notes h4 { font-size: 7.2pt; text-transform: uppercase; letter-spacing: .1em; color: #8A8F9C; margin: 4mm 0 1.5mm; }
.doc-notes__letters { font-family: var(--font-sans); font-size: 9pt; color: var(--doc-ink); line-height: 1.45; padding: 3mm 4mm; background: color-mix(in srgb, var(--doc-accent) 9%, #FFF); border-left: 2px solid var(--doc-accent); margin-bottom: 4mm; }
.doc-totals { width: 100%; border-collapse: collapse; font-size: 8.6pt; }
.doc-totals td { padding: 1.8mm 0; border-bottom: 1px solid #E4E8F0; }
.doc-totals td.r { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.doc-totals tr.grand td { border-top: 1.5px solid var(--doc-ink); border-bottom: 0; padding-top: 3mm; font-family: var(--font-sans); font-size: 13pt; font-weight: 600; }
.doc-totals tr.grand td.r { color: var(--doc-accent); }
.doc-totals tr.reste td { background: color-mix(in srgb, var(--doc-accent) 10%, #FFF); padding: 2.5mm 3mm; border: 0; }
.doc-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 10mm; margin: 9mm 0 6mm; }
.doc-sign__box { border: 1px solid #E4E8F0; border-radius: 2mm; padding: 4mm 5mm; min-height: 26mm; }
.doc-sign__box small { font-size: 7.4pt; color: #8A8F9C; text-transform: uppercase; letter-spacing: .08em; }
.doc-sign__line { margin-top: 14mm; border-top: 1px solid #E4E8F0; padding-top: 2mm; font-size: 7.4pt; color: #53607A; }
.doc-sign__stamp { font-family: var(--font-sans); font-size: 10pt; color: var(--doc-accent); margin-top: 3mm; }
.doc-payments { font-size: 7.6pt; color: #53607A; margin-top: 4mm; }
.doc-payments table { width: 100%; border-collapse: collapse; }
.doc-payments td { padding: 1.2mm 0; border-bottom: 1px solid #E4E8F0; }
.doc-payments td.r { text-align: right; font-variant-numeric: tabular-nums; }
.doc-foot { position: absolute; left: 15mm; right: 15mm; bottom: 9mm; padding-top: 3mm; border-top: 1px solid #E4E8F0; display: flex; justify-content: space-between; gap: 6mm; font-size: 6.6pt; color: #8A8F9C; line-height: 1.4; }
.doc-foot__legal { max-width: 140mm; }
.doc-foot__page { white-space: nowrap; }
.doc-foot__page::after { content: 'Page ' counter(page); }
.doc-badge-late { display: inline-block; padding: 1mm 3mm; border-radius: 1mm; background: #FBE9E9; color: #B33A3A; font-size: 7pt; font-weight: 700; letter-spacing: .06em; }

/* Modèle 1 — Classique : sobre, filets fins */
.tpl-classique .doc-header { border-bottom: 2px solid var(--doc-ink); }
.tpl-classique .doc-title { font-size: 24pt; }
.tpl-classique .doc-party { border-radius: 0; border-color: #E4E8F0; }
.tpl-classique .doc-table thead th { border-bottom: 1.5px solid var(--doc-ink); color: var(--doc-ink); }
.tpl-classique .doc-notes__letters { background: transparent; border-left: 2px solid var(--doc-ink); }
.tpl-classique .doc-totals tr.grand td.r { color: var(--doc-ink); }

/* Modèle 2 — Moderne : bandeau de couleur */
.tpl-moderne .doc-header { position: relative; margin: -16mm -15mm 9mm; padding: 10mm 15mm 7mm; background: var(--doc-ink); color: #FFF; border: 0; }
.tpl-moderne .doc-header::after { content: ''; position: absolute; left: 0; bottom: 0; width: 100%; height: 2.2mm; background: var(--doc-accent); }
.tpl-moderne .doc-brand__name, .tpl-moderne .doc-company, .tpl-moderne .doc-company strong, .tpl-moderne .doc-brand__slogan { color: #FFF; }
.tpl-moderne .doc-company { color: rgba(255,255,255,.72); }
.tpl-moderne .doc-title__num { color: var(--doc-accent); }
.tpl-moderne .doc-party { border: 1px solid #E4E8F0; border-top: 2px solid var(--doc-accent); }
.tpl-moderne .doc-totals tr.grand td { border-top-color: var(--doc-accent); }
.tpl-moderne .doc-foot { border-top: 2px solid var(--doc-accent); }

/* Modèle 3 — Épuré : minimal et structuré */
.tpl-epure .doc-header { border-bottom: 0; padding-bottom: 3mm; }
.tpl-epure .doc-brand__name { font-size: 23pt; }
.tpl-epure .doc-title-block { display: block; border-top: 1px solid var(--doc-ink); padding-top: 7mm; }
.tpl-epure .doc-title { font-size: 40pt; line-height: 1; }
.tpl-epure .doc-meta { text-align: left; margin-top: 5mm; display: flex; gap: 10mm; flex-wrap: wrap; }
.tpl-epure .doc-parties { border-top: 1px solid #E4E8F0; padding-top: 6mm; }
.tpl-epure .doc-party { border: 0; border-left: 2px solid var(--doc-accent); border-radius: 0; padding: 1mm 5mm; }
.tpl-epure .doc-table thead th { color: var(--doc-ink); border-bottom: 1px solid var(--doc-ink); }
.tpl-epure .doc-notes__letters { font-size: 10.5pt; }
.tpl-epure .doc-totals tr.grand td { font-size: 15pt; }

/* ------------------------------ IMPRESSION ------------------------------- */
@media print {
  @page { size: A4; margin: 0; }
  html, body { width: 210mm; margin: 0 !important; padding: 0 !important; background: #FFF !important; color: #16203A !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root, .print-root { display: block !important; position: static !important; }
  .print-sheet { width: 210mm; min-height: 297mm; margin: 0 !important; padding: 14mm 14mm 22mm; box-shadow: none !important; }
  .print-sheet + .print-sheet { page-break-before: always; break-before: page; }
  .doc-table .doc-line, .doc-group, .doc-party, .doc-sign__box, .doc-notes__letters { break-inside: avoid; page-break-inside: avoid; }
  .doc-foot { bottom: 8mm; left: 14mm; right: 14mm; }
  .doc-foot__page::after { content: 'Page ' counter(page) ' / ' counter(pages); }
  .no-print { display: none !important; }
}

/* -------------------------- 10. RESPONSIVE / MOBILE --------------------- */
@media (max-width: 1240px) {
  .editor__grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .line-row { grid-template-columns: 20px minmax(140px, 1fr) 64px 70px 96px 56px 92px 56px; gap: 6px; }
  .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1060px) {
  .editor__grid { grid-template-columns: minmax(0, 1fr); }
  .editor__side { position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  .editor__tabs { display: flex; gap: 6px; margin-bottom: 14px; }
  .editor__tabs .tab { flex: 1; text-align: center; }
  .editor.is-preview .editor__main { display: none; }
  .editor:not(.is-preview) .editor__side { display: none; }
  .editor.is-preview .editor__side { display: grid; }
  .login-screen { grid-template-columns: minmax(0, .8fr) minmax(360px, 1.2fr); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; width: min(280px, 86vw); transform: translateX(-102%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg); }
  .sidebar.is-open { transform: none; }
  .topbar__menu { display: inline-grid; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(64px + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom); align-items: center; justify-content: space-around; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(16px); border-top: 1px solid var(--border); }
  .bottom-nav__item { display: grid; justify-items: center; gap: 2px; flex: 1; min-height: 52px; padding: 6px 2px; border: 0; background: none; color: var(--muted); font-size: 10px; }
  .bottom-nav__item.is-active { color: var(--gold-deep); }
  .bottom-nav__fab { flex: none; width: 52px; height: 52px; min-height: 52px; margin-top: -22px; border-radius: 50%; background: var(--brand); color: #FFFFFF; box-shadow: var(--shadow-gold); }
  .bottom-nav__fab .icon { width: 24px; height: 24px; }
  .view { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  .topbar { padding: 0 14px; height: 62px; }
  .editor__bar { top: 62px; }
  .editor__side { top: 130px; }
  .topbar__search kbd { display: none; }
  #btn-quick span { display: none; }
  #btn-quick { width: 40px; padding: 0; }
  .login-screen { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { min-height: 100vh; }
  .doc-modal .print-sheet { zoom: .72; }
  .modal--doc { height: calc(100vh - 24px); }
}
@media (max-width: 700px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 16px; min-height: 112px; }
  .kpi__value { font-size: 21px; margin-top: 10px; }
  .view-head { align-items: flex-start; }
  .view-head__actions { width: 100%; }
  .view-head__actions .btn { flex: 1; }
  .line-row { grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px; }
  .line-row__grip { display: none; }
  .line-row__designation { grid-column: 1 / -1; }
  .line-row__total { grid-column: 1 / -1; text-align: left; padding-top: 0; border-top: 1px dashed var(--border); padding-top: 8px; display: flex; justify-content: space-between; }
  .line-row__total::before { content: 'Total ligne'; font-size: 10px; color: var(--muted); font-weight: 500; }
  .line-row__actions { grid-column: 1 / -1; justify-content: flex-end; }
  .line-options, .prt-fields { grid-column: 1 / -1; }
  .compact-fields { grid-template-columns: 80px minmax(0, 1fr); }
  .table th, .table td { padding: 11px 10px; }
  .table { min-width: 620px; }
  .doc-preview-wrap { padding: 12px; }
  .doc-toolbar { padding: 10px; }
  .doc-toolbar .btn span { display: none; }
  .sticky-totals { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 35; padding: 10px 16px; background: var(--ink); color: #F6F2E8; box-shadow: 0 -6px 20px rgba(0,0,0,.18); }
  .sticky-totals small { display: block; font-size: 10px; color: rgba(246,242,232,.65); text-transform: uppercase; letter-spacing: .08em; }
  .sticky-totals strong { font-family: var(--font-sans); font-size: 18px; }
  .sticky-totals .btn { min-height: 38px; }
  .editor { padding-bottom: 150px; }
  .report-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .hidden-mobile { display: none; }
  .drawer__body, .drawer__head, .drawer__foot { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi__value { font-size: 19px; }
  .chart-bar { grid-template-columns: 64px minmax(0, 1fr) 86px; gap: 8px; font-size: 11px; }
  .login-card__title { font-size: 27px; }
  .view-head h1 { font-size: 25px; }
  .btn { padding: 9px 13px; font-size: 12.5px; }
  .doc-modal .print-sheet { zoom: .52; }
}
@media (max-width: 700px) and (prefers-reduced-motion: no-preference) {
  .view { animation-duration: .2s; }
}

/* ============================================================================
 * SINGA — Redesign SaaS bleu (remplace uniquement la présentation)
 * ==========================================================================*/
:root {
  --brand: #2457E6;
  --brand-deep: #1B45BD;
  --brand-tint: #E8EFFF;
  --gold: var(--brand);
  --gold-tint: var(--brand-tint);
  --gold-deep: var(--brand-deep);
  --gold-light: #E8EFFF;
  --ink: #0D1526;
  --night: #0D1526;
  --ivory: #F4F6FA;
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #F8F9FC;
  --surface-3: #EEF1F6;
  --text: #101828;
  --text-soft: #475467;
  --muted: #667085;
  --border: #E4E8F0;
  --border-strong: #D0D5DD;
  --input-bg: #FFFFFF;
  --success: #12A150;
  --success-tint: #E7F6EC;
  --warning: #B54708;
  --warning-tint: #FEF0C7;
  --danger: #D92D20;
  --danger-tint: #FEE4E2;
  --info: #2457E6;
  --info-tint: #E8EFFF;
  --overlay: rgba(13, 21, 38, .42);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .035);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .07);
  --shadow-lg: 0 12px 30px rgba(16, 24, 40, .14);
  --shadow-gold: 0 2px 5px rgba(36, 87, 230, .16);
  --r-sm: 10px;
  --r: 12px;
  --r-lg: 12px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  
}
[data-theme="dark"] {
  --bg: #0B1220;
  --surface: #121B2E;
  --surface-2: #172238;
  --surface-3: #1C2942;
  --text: #F2F4F7;
  --text-soft: #D0D5DD;
  --muted: #98A2B3;
  --border: #27344D;
  --border-strong: #34435E;
  --input-bg: #0F192B;
  --overlay: rgba(3, 8, 18, .76);
  --brand-tint: rgba(36, 87, 230, .18);
  --gold-tint: var(--brand-tint);
  --success-tint: rgba(18, 161, 80, .16);
  --warning-tint: rgba(181, 71, 8, .20);
  --danger-tint: rgba(217, 45, 32, .18);
  --info-tint: rgba(36, 87, 230, .18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .18);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .24);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, .38);
  --shadow-gold: 0 2px 5px rgba(0, 0, 0, .2);
  --gold-light: #8BA9FF;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0B1220; --surface: #121B2E; --surface-2: #172238;
    --surface-3: #1C2942; --text: #F2F4F7; --text-soft: #D0D5DD;
    --muted: #98A2B3; --border: #27344D; --border-strong: #34435E;
    --input-bg: #0F192B; --brand-tint: rgba(36,87,230,.18);
    --gold-tint: var(--brand-tint);
  }
}
html, body { font-family: var(--font-sans); }
body, button, input, select, textarea { font-family: var(--font-sans); }
h1, h2, h3, h4, .login-brand strong, .login-card__brand,
.sidebar__brand-text strong, .avatar, .kpi__value, .pole-card__name,
.pole-card__count strong, .empty h3, .section-title, .stat-inline strong,
.report-cell strong, .total-row--grand, .mini-doc h4, .print-sheet *,
.sticky-totals strong { font-family: var(--font-sans) !important; }
.num, .kpi__value, .total-row, .doc-table, .doc-totals { font-variant-numeric: tabular-nums lining-nums; }
::selection { background: var(--brand-tint); color: var(--text); }
:focus-visible { outline-color: var(--brand); }
a, .view-head__eyebrow, .breadcrumb button:hover, .link-btn:hover,
.table__link:hover, .kpi__label .icon, .empty svg, .editor-card__head .icon,
.catalog-result__add, .dropzone .icon { color: var(--brand); }

/* Connexion : panneau marine uni, sans halo ni éléments décoratifs. */
.login-screen { grid-template-columns: minmax(0, 1fr) minmax(380px, 1fr); }
.login-art { background: #0D1526; color: #FFFFFF; }
.login-art::after, .login-art__glow, .login-art__lines, .login-quote { display: none !important; }
.login-art__inner { padding: clamp(36px, 7vw, 96px); }
.login-brand { gap: 16px; }
.login-brand strong { font-size: 26px; letter-spacing: .12em; }
.login-brand small { color: #98A2B3; }
.login-art__message { margin-top: 36px; color: #D0D5DD; font-size: clamp(20px, 2.4vw, 30px); line-height: 1.45; font-weight: 500; }
.login-art__foot { margin-top: 18px; color: #98A2B3; letter-spacing: 0; }
.login-panel { background: #F4F6FA; }
.login-card__brand { margin-bottom: 34px; }
.login-mark { color: #FFFFFF; background: #2457E6; border-radius: 11px; box-shadow: none; font-weight: 600; }
.login-mark--small, .login-mark--tiny { color: #FFFFFF; }

/* Navigation, cartes et boutons : aplats, traits fins, ombres discrètes. */
.sidebar { background: #0D1526; }
[data-theme="dark"] .sidebar { background: #090F1B; }
.nav-item.is-active { background: rgba(36, 87, 230, .20); color: #FFFFFF; box-shadow: inset 3px 0 0 var(--brand); }
.dot--blue, .dot--blue { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.avatar { color: #FFFFFF; background: var(--brand); }
.topbar__search:focus-within, .field input:focus, .field select:focus,
.field textarea:focus, .input:focus, .select:focus, .textarea:focus,
.toolbar__search input:focus, .catalog-picker__search input:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint);
}
.btn--primary { color: #FFFFFF; background: linear-gradient(180deg, #2E63EC 0%, #2457E6 100%); box-shadow: 0 1px 2px rgba(36,87,230,.18); }
.btn--primary:hover:not(:disabled) { color: #FFFFFF; background: #1B45BD; box-shadow: 0 2px 6px rgba(36,87,230,.18); filter: none; }
.btn--outline:hover:not(:disabled), .chip:hover, .category-card:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
.btn--tiny { border-radius: 10px; }
.card, .panel, .modal, .palette, .catalog-picker { border-radius: 12px; box-shadow: var(--shadow-sm); }
.field input, .field select, .field textarea, .toolbar__search input, .toolbar select,
.price-input, .line-row input, .line-row textarea, .line-row select { border-radius: 10px; }
.switch input, .check input { accent-color: var(--brand); }
.color-swatch.is-active { outline-color: var(--brand); }
.dropzone.is-over, .line-row.is-drop { border-color: var(--brand); background: var(--brand-tint); box-shadow: 0 0 0 2px var(--brand-tint); }

/* Statuts fonctionnels : palette discrète conforme aux libellés métier. */
.badge { border: 0; padding: 4px 9px; font-weight: 600; }
.badge--succes { color: #12A150; background: #E7F6EC; }
.badge--alerte { color: #B54708; background: #FEF0C7; }
.badge--erreur { color: #D92D20; background: #FEE4E2; }
.badge--neutre { color: #475467; background: #F2F4F7; border: 0; }
.badge--info { color: #2457E6; background: #E8EFFF; }
[data-theme="dark"] .badge--succes { color: #75D99D; background: rgba(18,161,80,.16); }
[data-theme="dark"] .badge--alerte { color: #F5B66D; background: rgba(181,71,8,.20); }
[data-theme="dark"] .badge--erreur { color: #FDA29B; background: rgba(217,45,32,.18); }
[data-theme="dark"] .badge--neutre { color: #D0D5DD; background: #27344D; }
[data-theme="dark"] .badge--info { color: #AFC2FF; background: rgba(36,87,230,.18); }
.chip.is-active, [data-theme="dark"] .chip.is-active { background: var(--brand-tint); color: var(--brand); border-color: var(--brand); }
[data-theme="dark"] .chip.is-active { color: #B8C8FF; }

/* Neutraliser les anciennes dorures et les dégradés décoratifs hérités. */
.nav-item.is-active, .avatar, .bottom-nav__fab, .login-mark { background-image: none; }
.skeleton { background: var(--surface-2); animation: none; }
.mini-doc::after { display: none; }
.kpi::after { background: var(--brand-tint); }
.toast { color: #FFFFFF; background: #0D1526; }
.toast .icon { color: #AFC2FF; }
.total-row--grand { border-top-color: var(--border-strong); }
.total-row--reste { color: var(--text); background: var(--brand-tint); }
.total-row--reste strong { color: var(--brand-deep); }
[data-theme="dark"] .total-row--reste strong { color: #AFC2FF; }
.sticky-totals { background: #0D1526; color: #FFFFFF; }
.sticky-totals small { color: #98A2B3; }
.sticky-totals strong { color: #FFFFFF; }
.bottom-nav__item.is-active { color: var(--brand); }
.bottom-nav__fab { color: #FFFFFF; background: var(--brand); box-shadow: 0 2px 6px rgba(36,87,230,.2); }
.bottom-nav__fab:hover { background: var(--brand-deep); }

/* Documents : gamme bleue, bandeau moderne réduit à un filet, modèle épuré. */
.print-sheet { --doc-accent: #2457E6; --doc-ink: #0D1526; }
.doc-header, .doc-party, .doc-sign__box, .doc-table tbody td,
.doc-table thead th, .doc-totals td, .doc-foot { border-color: #E4E8F0; }
.doc-party { border-radius: 3mm; }
.doc-notes__letters { background: #F5F8FF; border-left-color: #2457E6; }
.doc-totals tr.grand td { border-top-color: #2457E6; }
.doc-totals tr.grand td.r, .doc-title__num, .doc-sign__stamp { color: #2457E6; }
.doc-totals tr.reste td { background: #E8EFFF; }
.tpl-classique .doc-notes__letters { background: transparent; border-left-color: #2457E6; }
.tpl-moderne .doc-header { background: #0D1526; }
.tpl-moderne .doc-header::after { height: .8mm; background: #2457E6; }
.tpl-moderne .doc-party { border-color: #E4E8F0; border-top-color: #2457E6; }
.tpl-moderne .doc-totals tr.grand td { border-top-color: #2457E6; }
.tpl-moderne .doc-foot { border-top-color: #2457E6; }
.tpl-epure .doc-header { border-bottom: 1px solid #E4E8F0; }
.tpl-epure .doc-brand__name { font-size: 19pt; }
.tpl-epure .doc-title-block { border-top-color: #E4E8F0; }
.tpl-epure .doc-title { font-size: 30pt; }
.tpl-epure .doc-party { border-left-color: #2457E6; }
.tpl-epure .doc-parties { border-top-color: #E4E8F0; }
.tpl-epure .doc-totals tr.grand td { font-size: 13pt; }

@media (max-width: 760px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { background: var(--bg); }
}

/* ============================================================================
 * Correctif : fenêtres modales et palette de commandes
 * Ces éléments sont insérés À CÔTÉ du fond (et non dedans) : sans position fixe,
 * ils s'affichaient en bas de page. On les fixe et on les centre ici.
 * ==========================================================================*/
.modal-backdrop { z-index: 120; }
.palette-backdrop { z-index: 130; }

.modal {
  position: fixed; inset: 0; margin: auto; z-index: 121;
  width: min(560px, calc(100vw - 32px));
  height: fit-content; max-height: calc(100vh - 32px);
}
.modal--wide { width: min(860px, calc(100vw - 32px)); }
.modal--doc  { width: min(1120px, calc(100vw - 32px)); height: min(92vh, 1000px); }

.palette {
  position: fixed; z-index: 131;
  top: min(14vh, 110px); left: 0; right: 0; margin: 0 auto;
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100vh - min(14vh, 110px) - 16px);
  display: flex; flex-direction: column;
}
.palette__list { overflow-y: auto; }

/* Aperçu A4 réduit sur petit écran (l'ancienne règle visait une classe jamais utilisée) */
@media (max-width: 700px) {
  .modal--doc { width: calc(100vw - 16px); height: calc(100vh - 24px); }
  .modal--doc .print-sheet { zoom: .6; }
}
@media (max-width: 480px) {
  .modal--doc .print-sheet { zoom: .4; }
}
