/* ============================================================================
   ESPACE CLIENT — page vitrine. Reproduit fidèlement le vrai portail client
   (palette onyx + indigo #6366f1, glass cards) en DÉMO INTERACTIVE.
   S'appuie sur le design system .sec-* ; mockups = classes .ec-*.
   ============================================================================ */

/* ---------- HERO ----------
   Le héros utilise le design system standard, à l'identique des autres pages
   vitrine : .sec-hero--brand (dégradé sombre), aligné à GAUCHE, breadcrumb +
   h1 + sous-titre + CTA + .sec-hero-stats. Aucun override de disposition ici. */

/* ---------- Fenêtre = reproduction du portail ---------- */
.ec-window {
  --p-accent: #6366f1; --p-accent2: #14b8a6;
  --p-ok: #10b981; --p-warn: #f59e0b; --p-danger: #f43f5e;
  --p-text: #f0f0f8; --p-muted: #8a8ca6;
  --p-border: rgba(139, 92, 246, .15); --p-surface: rgba(255, 255, 255, .04);
  border-radius: 16px; overflow: hidden;
  background: #0c0f1a; border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 40px 100px -36px rgba(0, 0, 0, .75); color: var(--p-text);
}
.ec-window--demo { max-width: 1040px; margin: 30px auto 0; transform-origin: center; will-change: transform; backface-visibility: hidden; }
.ec-window-bar { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: rgba(255, 255, 255, .03); border-bottom: 1px solid var(--p-border); }
.ec-dots { display: inline-flex; gap: 6px; }
.ec-dots i { width: 10px; height: 10px; border-radius: 50%; }
.ec-dots i:nth-child(1){ background: #ff5f57; } .ec-dots i:nth-child(2){ background: #febc2e; } .ec-dots i:nth-child(3){ background: #28c840; }
.ec-url { flex: 1; text-align: center; font-size: 11.5px; color: var(--p-muted); background: rgba(255, 255, 255, .05); border-radius: 7px; padding: 5px 10px; max-width: 300px; margin: 0 auto; }

/* ---------- Dashboard : sidebar + main ---------- */
.ec-dash { display: grid; grid-template-columns: 198px 1fr; min-height: 430px; }
.ec-side { border-right: 1px solid var(--p-border); padding: 14px 10px; display: flex; flex-direction: column; gap: 3px; background: rgba(255, 255, 255, .015); }
.ec-side-grp { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; color: #5b5d77; padding: 12px 11px 5px; }
.ec-side-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px;
  font-size: 12.5px; font-weight: 500; color: #a9abc4; background: none; border: 0; width: 100%;
  text-align: left; cursor: pointer; transition: background .15s ease, color .15s ease; font-family: inherit;
}
.ec-side-item .material-symbols-rounded { font-size: 18px; }
.ec-side-item:hover { background: rgba(255, 255, 255, .04); color: var(--p-text); }
.ec-side-item.is-active { background: rgba(99, 102, 241, .16); color: #fff; }
.ec-side-item.is-active .material-symbols-rounded { color: #a5b4fc; }
.ec-side-badge { margin-left: auto; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--p-danger); color: #fff; font-size: 9.5px; font-weight: 800; display: grid; place-items: center; }

/* Main + panneaux (interactif) */
.ec-main { position: relative; }
.ec-panel { display: none; padding: 18px; flex-direction: column; gap: 14px; animation: ec-fade .28s ease; }
.ec-panel.is-active { display: flex; }
@keyframes ec-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ec-phead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ec-phead strong { font-size: 14px; font-weight: 700; color: #f1f5f9; }
.ec-phead span.sub { font-size: 11px; color: var(--p-muted); }
.ec-live { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 10.5px; font-weight: 700; background: rgba(16, 185, 129, .15); color: #34d399; border: 1px solid rgba(16, 185, 129, .28); }
.ec-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #34d399; animation: ec-blink 2s infinite; }
@keyframes ec-blink { 0%,100%{ opacity: 1; } 50%{ opacity: .3; } }

/* KPIs (glass-cards, comme le vrai portail) */
.ec-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ec-kpi { background: var(--p-surface); border: 1px solid var(--p-border); border-radius: 13px; padding: 12px; position: relative; }
.ec-kpi .material-symbols-rounded { font-size: 18px; color: var(--p-accent); }
.ec-kpi.is-warn .material-symbols-rounded { color: var(--p-warn); }
.ec-kpi.is-ok .material-symbols-rounded { color: var(--p-ok); }
.ec-kpi-lbl { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--p-muted); font-weight: 700; margin: 6px 0 4px; }
.ec-kpi-val { display: block; font-size: 16px; font-weight: 800; color: #fff; }
.ec-kpi-sub { font-size: 9.5px; color: var(--p-muted); }

.ec-sec-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--p-muted); font-weight: 800; }
.ec-rows { display: flex; flex-direction: column; gap: 8px; }
.ec-row { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; background: var(--p-surface); border: 1px solid var(--p-border); }
.ec-date { width: 40px; min-width: 40px; text-align: center; border-radius: 8px; padding: 5px 0; background: rgba(99, 102, 241, .14); border: 1px solid rgba(99, 102, 241, .22); }
.ec-date b { display: block; font-size: 14px; font-weight: 800; color: #c7d2fe; line-height: 1; }
.ec-date span { font-size: 8.5px; text-transform: uppercase; color: var(--p-muted); font-weight: 700; }
.ec-row-tx { flex: 1; min-width: 0; }
.ec-row-tx strong { display: block; font-size: 12px; font-weight: 700; color: #f1f5f9; }
.ec-row-tx span { font-size: 10.5px; color: var(--p-muted); }
.ec-chip { padding: 3px 9px; border-radius: 999px; font-size: 9.5px; font-weight: 700; white-space: nowrap; }
.ec-chip.ok { background: rgba(16, 185, 129, .14); color: #34d399; border: 1px solid rgba(16, 185, 129, .24); }
.ec-chip.plan { background: rgba(99, 102, 241, .14); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, .24); }
.ec-chip.due { background: rgba(245, 158, 11, .14); color: #fbbf24; border: 1px solid rgba(245, 158, 11, .26); }
.ec-chip.late { background: rgba(244, 63, 94, .14); color: #fb7185; border: 1px solid rgba(244, 63, 94, .26); }
.ec-geo { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 9.5px; font-weight: 700; background: rgba(16, 185, 129, .14); color: #34d399; border: 1px solid rgba(16, 185, 129, .24); white-space: nowrap; }
.ec-geo .material-symbols-rounded { font-size: 12px; }

/* Analytics : score + tendance */
.ec-analytics { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.ec-bigscore { text-align: center; }
.ec-bigscore b { font-size: 42px; font-weight: 900; color: #34d399; line-height: 1; }
.ec-bigscore b small { font-size: 17px; color: var(--p-muted); font-weight: 700; }
.ec-bigscore span { display: block; font-size: 11px; color: var(--p-muted); margin-top: 4px; }
.ec-trend { display: flex; align-items: flex-end; gap: 7px; height: 90px; }
.ec-trend i { flex: 1; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--p-accent), rgba(99, 102, 241, .25)); }
.ec-trend i:last-child { background: linear-gradient(180deg, #34d399, rgba(16, 185, 129, .3)); }
.ec-substats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ec-substat { background: var(--p-surface); border: 1px solid var(--p-border); border-radius: 11px; padding: 11px; text-align: center; }
.ec-substat b { display: block; font-size: 16px; font-weight: 800; color: #fff; }
.ec-substat span { font-size: 9px; text-transform: uppercase; letter-spacing: .3px; color: var(--p-muted); font-weight: 700; }

/* Factures */
.ec-finance-hero { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; border-radius: 13px; background: linear-gradient(135deg, rgba(99, 102, 241, .18), rgba(20, 184, 166, .12)); border: 1px solid rgba(99, 102, 241, .25); }
.ec-finance-hero span { font-size: 11px; color: #c7d2fe; } .ec-finance-hero b { display: block; font-size: 22px; font-weight: 900; color: #fff; }
.ec-finance-hero .ec-chip { font-size: 10px; }
.ec-inv { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; background: var(--p-surface); border: 1px solid var(--p-border); }
.ec-inv .material-symbols-rounded.f { color: #a5b4fc; font-size: 19px; }
.ec-inv-tx { flex: 1; min-width: 0; }
.ec-inv-tx strong { display: block; font-size: 12px; color: #f1f5f9; }
.ec-inv-tx span { font-size: 10px; color: var(--p-muted); }
.ec-inv-amt { font-size: 12.5px; font-weight: 800; color: #fff; }

/* Géofence (preuves) */
.ec-map { position: relative; height: 210px; border-radius: 13px; overflow: hidden; background: #0a1020; border: 1px solid var(--p-border); }
.ec-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ec-map-pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -78%); color: #34d399; font-size: 36px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .45)); }
.ec-pulse { transform-origin: 200px 100px; animation: ec-radar 2.8s ease-out infinite; }
@keyframes ec-radar { 0%{ transform: scale(.45); opacity: .8; } 100%{ transform: scale(1.05); opacity: 0; } }
.ec-map-chip { position: absolute; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; font-size: 11px; font-weight: 700; color: #0b1424; background: rgba(255, 255, 255, .94); }
.ec-map-chip .material-symbols-rounded { font-size: 14px; color: #059669; }

/* ---------- Sections fonctionnalités (alternées) ---------- */
.ec-feature .container { display: grid; grid-template-columns: 1fr 1fr; gap: 52px; align-items: center; }
.ec-feature--rev .ec-feature-visual { order: -1; }
.ec-feature-copy h2 { font-size: clamp(1.5rem, 2.6vw, 2.05rem); font-weight: 800; letter-spacing: -.02em; color: var(--sec-ink, #0F172A); margin: 14px 0; }
.ec-feature-copy > p { color: var(--sec-body, #475569); font-size: 1.05rem; line-height: 1.7; margin-bottom: 18px; }
.ec-flist { display: flex; flex-direction: column; gap: 11px; }
.ec-flist li { display: flex; gap: 11px; align-items: flex-start; color: var(--sec-body, #475569); font-size: .98rem; line-height: 1.5; }
.ec-flist .material-symbols-rounded { color: var(--sec-accent, #2563EB); font-size: 21px; flex-shrink: 0; }
.ec-card { background: linear-gradient(165deg, #111c30 0%, #0b1424 100%); border: 1px solid rgba(255, 255, 255, .08); border-radius: 20px; padding: 18px; box-shadow: 0 30px 64px -30px rgba(11, 20, 36, .6); color: #e2e8f0; }
.ec-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.ec-card-head .material-symbols-rounded { font-size: 18px; color: #60A5FA; }
.ec-card-head strong { font-size: 13px; font-weight: 700; flex: 1; color: #f1f5f9; }

/* Avant / après — GLISSABLE */
.ec-ba { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 10; cursor: ew-resize; user-select: none; touch-action: none; }
.ec-ba-img { position: absolute; inset: 0; background-size: cover; background-position: center; }
.ec-ba-before { filter: grayscale(.7) brightness(.58) contrast(.92); clip-path: inset(0 50% 0 0); }
.ec-ba-divider { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: #fff; transform: translateX(-1px); }
.ec-ba-handle { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 36px; height: 36px; border-radius: 50%; background: #fff; display: grid; place-items: center; color: #0b1424; box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }
.ec-ba-handle .material-symbols-rounded { font-size: 20px; }
.ec-ba-lbl { position: absolute; top: 10px; padding: 3px 10px; border-radius: 999px; font-size: 10.5px; font-weight: 700; color: #fff; pointer-events: none; }
.ec-ba-lbl.is-before { left: 10px; background: rgba(11, 20, 36, .6); }
.ec-ba-lbl.is-after { right: 10px; background: rgba(16, 185, 129, .65); }

/* ---------- Personas ---------- */
.ec-personas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.ec-persona { background: #fff; border: 1px solid var(--sec-line, #E2E8F0); border-radius: var(--sec-radius, 20px); padding: 26px 24px; }
.ec-persona-ic { width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 16px; color: #fff; background: var(--sec-accent, #2563EB); }
.ec-persona-ic .material-symbols-rounded { font-size: 26px; }
.ec-persona h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 9px; color: var(--sec-ink, #0F172A); }
.ec-persona p { color: var(--sec-body, #475569); font-size: .96rem; line-height: 1.6; }

/* ---------- Sécurité ---------- */
.ec-secu { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.ec-secu-item { display: flex; gap: 13px; align-items: flex-start; padding: 20px; border-radius: 16px; background: var(--sec-bg-alt, #F8FAFC); border: 1px solid var(--sec-line, #E2E8F0); }
.ec-secu-item .material-symbols-rounded { color: var(--sec-accent, #2563EB); font-size: 24px; }
.ec-secu-item strong { display: block; font-size: 1rem; color: var(--sec-ink, #0F172A); margin-bottom: 3px; }
.ec-secu-item p { font-size: .9rem; color: var(--sec-body, #475569); line-height: 1.5; }
.ec-demo-hint { text-align: center; font-size: .92rem; color: var(--sec-muted, #94A3B8); margin-top: 16px; }
.ec-demo-hint .material-symbols-rounded { font-size: 17px; vertical-align: -3px; color: var(--sec-accent, #2563EB); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .ec-window--demo { margin-top: 16px; }
  .ec-kpis { grid-template-columns: repeat(2, 1fr); }
  .ec-feature .container { grid-template-columns: 1fr; gap: 30px; }
  .ec-feature--rev .ec-feature-visual { order: 0; }
  .ec-personas { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .ec-dash { grid-template-columns: 1fr; }
  .ec-side { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 6px; border-right: 0; border-bottom: 1px solid var(--p-border); }
  .ec-side-grp { display: none; }
  .ec-side-item { white-space: nowrap; width: auto; }
  .ec-analytics { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .ec-pulse, .ec-live::before { animation: none; } }

/* ════════ DÉMO ENRICHIE — chrome d'app + panneaux détaillés ════════ */
.ec-dash { min-height: 500px; }

/* Sidebar : carte utilisateur, sélecteur de site, footer */
.ec-usercard { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 11px; background: var(--p-surface); border: 1px solid var(--p-border); margin-bottom: 6px; }
.ec-avatar { width: 30px; height: 30px; min-width: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #6366f1, #14b8a6); }
.ec-avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 10px; }
.ec-uc-tx { flex: 1; min-width: 0; }
.ec-uc-tx strong { display: block; font-size: 11.5px; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec-uc-tx span { font-size: 9.5px; color: var(--p-muted); }
.ec-usercard > .material-symbols-rounded { font-size: 16px; color: var(--p-muted); }
.ec-switch { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 9px; background: rgba(99, 102, 241, .1); border: 1px solid rgba(99, 102, 241, .2); font-size: 11px; font-weight: 600; color: #c7d2fe; margin-bottom: 8px; }
.ec-switch .material-symbols-rounded { font-size: 15px; }
.ec-switch .sm { margin-left: auto; font-size: 16px; opacity: .7; }
.ec-side-foot { margin-top: auto; display: flex; gap: 4px; padding: 10px 2px 0; border-top: 1px solid var(--p-border); }
.ec-side-foot .material-symbols-rounded { font-size: 17px; color: var(--p-muted); padding: 6px; border-radius: 8px; }

/* Barre d'app (top-bar) */
.ec-mainwrap { display: flex; flex-direction: column; min-width: 0; }
.ec-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--p-border); }
.ec-tb-title { font-size: 13px; font-weight: 700; color: #f1f5f9; }
.ec-tb-actions { display: flex; align-items: center; gap: 10px; }
.ec-tb-search { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--p-muted); background: var(--p-surface); border: 1px solid var(--p-border); border-radius: 8px; padding: 6px 11px; }
.ec-tb-search .material-symbols-rounded { font-size: 15px; }
.ec-tb-ic { position: relative; color: var(--p-muted); display: grid; place-items: center; }
.ec-tb-ic .material-symbols-rounded { font-size: 19px; }
.ec-tb-ic .ec-dot { position: absolute; top: -1px; right: -1px; width: 7px; height: 7px; border-radius: 50%; background: var(--p-danger); border: 1.5px solid #0c0f1a; }

/* Cockpit tableau de bord (2 colonnes) */
.ec-cockpit { display: grid; grid-template-columns: 1.5fr 1fr; gap: 12px; }
.ec-ck-main, .ec-ck-aside { display: flex; flex-direction: column; gap: 11px; }
.ec-alert { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 11px; background: rgba(245, 158, 11, .1); border: 1px solid rgba(245, 158, 11, .24); }
.ec-alert > .material-symbols-rounded { color: #fbbf24; font-size: 19px; }
.ec-alert div { flex: 1; } .ec-alert strong { display: block; font-size: 12px; color: #f1f5f9; } .ec-alert span { font-size: 10.5px; color: var(--p-muted); }
.ec-asidecard { background: var(--p-surface); border: 1px solid var(--p-border); border-radius: 12px; padding: 12px; }
.ec-ac-lbl { font-size: 9.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--p-muted); font-weight: 800; }
.ec-ac-amt { font-size: 19px; font-weight: 900; color: #fff; margin: 6px 0; } .ec-ac-amt span { font-size: 10px; color: var(--p-muted); font-weight: 600; margin-left: 5px; }
.ec-ac-row { font-size: 10.5px; color: #cbd5e1; } .ec-ac-row b { color: #fff; }
.ec-ac-doc { display: flex; align-items: center; gap: 7px; font-size: 11px; color: #cbd5e1; margin-top: 9px; } .ec-ac-doc .material-symbols-rounded { font-size: 16px; color: #a5b4fc; } .ec-ac-doc .ec-chip { margin-left: auto; }

/* Calendrier (planning) */
.ec-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.ec-cal-day { background: var(--p-surface); border: 1px solid var(--p-border); border-radius: 9px; padding: 8px 6px; min-height: 104px; }
.ec-cal-day .d { font-size: 9px; text-transform: uppercase; color: var(--p-muted); font-weight: 700; }
.ec-cal-day .n { font-size: 13px; font-weight: 800; color: #e2e8f0; margin-bottom: 7px; }
.ec-cal-day.today { border-color: rgba(99, 102, 241, .45); background: rgba(99, 102, 241, .08); }
.ec-ev { font-size: 8.5px; font-weight: 700; padding: 4px 5px; border-radius: 6px; margin-bottom: 4px; line-height: 1.15; }
.ec-ev.b { background: rgba(99, 102, 241, .2); color: #c7d2fe; } .ec-ev.g { background: rgba(16, 185, 129, .16); color: #6ee7b7; }

/* Graphique (analytics) */
.ec-chart { background: var(--p-surface); border: 1px solid var(--p-border); border-radius: 13px; padding: 14px 14px 8px; }
.ec-chart svg { width: 100%; height: 132px; display: block; }
.ec-chart-x { display: flex; justify-content: space-between; margin-top: 6px; }
.ec-chart-x span { font-size: 9px; color: var(--p-muted); font-weight: 600; }

@media (max-width: 1000px) { .ec-cockpit { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .ec-usercard, .ec-switch, .ec-side-foot { display: none; }
  .ec-tb-search { display: none; }
  .ec-cal { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 96px; overflow-x: auto; }
}
