/* Power FM — backoffice sur Bootstrap 5, au look de Power Studio (inspiré de tool1280.power-ai.fr) :
   Rubik, violet (#8b17e5 → #4d0c80) à motif pointillé, corail #ff6f4f en boutons pilule,
   fond lavande très clair, cartes très arrondies. */
:root {
  --ps-purple: #8b17e5;
  --ps-purple-deep: #4d0c80;
  --ps-purple-ink: #3b0a6b;
  --ps-purple-soft: #f1e9fb;
  --ps-coral: #ff6f4f;
  --ps-coral-deep: #f2583a;
  --ps-coral-soft: #fff0eb;
  --ps-blue: #009efb;
  --ps-green: #39c449;
  --ps-red: #f62d51;
  --ps-yellow: #ffbc34;
  --ps-ink: #2b2b3d;
  --ps-text: #54667a;
  --ps-muted: #8a93a6;
  --ps-bg: #f6f3fb;
  --ps-surface: #ffffff;
  --ps-surface-2: #faf8fd;
  --ps-line: #ebe6f3;
  --ps-shadow: 0 2px 4px rgba(61, 20, 110, .04), 0 14px 40px -24px rgba(61, 20, 110, .25);
  --ps-violet-fond: radial-gradient(rgba(255, 255, 255, .13) 1px, transparent 1.2px) 0 0 / 18px 18px, linear-gradient(170deg, #8b17e5 0%, #6a10b8 55%, #4d0c80 100%);
  --ps-sidebar-w: 256px;
  --bs-font-sans-serif: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bs-body-font-size: .94rem;
  --bs-body-bg: var(--ps-bg);
  --bs-body-color: var(--ps-text);
  --bs-secondary-color: var(--ps-muted);
  --bs-heading-color: var(--ps-ink);
  --bs-emphasis-color: var(--ps-ink);
  --bs-border-color: var(--ps-line);
  --bs-border-radius: 10px;
  --bs-link-color: var(--ps-purple);
  --bs-link-color-rgb: 139, 23, 229;
  --bs-link-hover-color: var(--ps-purple-deep);
  --bs-link-hover-color-rgb: 77, 12, 128;
  --bs-primary: var(--ps-coral);
  --bs-primary-rgb: 255, 111, 79;
  --bs-success-rgb: 57, 196, 73;
  --bs-danger-rgb: 246, 45, 81;
  --bs-warning-rgb: 255, 188, 52;
  --bs-info-rgb: 0, 158, 251;
}
[data-bs-theme="dark"] {
  --ps-purple-soft: rgba(139, 23, 229, .18);
  --ps-coral-soft: rgba(255, 111, 79, .16);
  --ps-ink: #eceaf4;
  --ps-text: #c9c6d8;
  --ps-muted: #8f8aa6;
  --ps-bg: #130b22;
  --ps-surface: #1d1330;
  --ps-surface-2: #261a3d;
  --ps-line: #2d2144;
  --ps-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --bs-body-bg: var(--ps-bg);
  --bs-body-color: var(--ps-text);
  --bs-secondary-color: var(--ps-muted);
  --bs-heading-color: var(--ps-ink);
  --bs-emphasis-color: var(--ps-ink);
  --bs-border-color: var(--ps-line);
  --bs-link-color: #c08bf5;
  --bs-link-color-rgb: 192, 139, 245;
  --bs-link-hover-color: #d7b4fa;
  --bs-link-hover-color-rgb: 215, 180, 250;
}

html, body { font-family: var(--bs-font-sans-serif); }
body { background: var(--ps-bg); color: var(--ps-text); -webkit-font-smoothing: antialiased; min-height: 100vh; }
h1, h2, h3, h4, h5, h6, .h5, .h6, .card-header, .valeur { font-weight: 500; color: var(--ps-ink); letter-spacing: -.01em; }
strong, .fw-semibold, .fw-bold { color: var(--ps-ink); }
.alert strong, .badge strong, .btn strong { color: inherit; }
a { text-underline-offset: 3px; }
.text-secondary { color: var(--ps-muted) !important; }

/* ---------- composants Bootstrap aux couleurs Power AI */
.btn { font-weight: 500; border-radius: 10px; }
.btn-primary, .btn-outline-primary, .btn-outline-secondary, .btn-outline-danger { border-radius: 80px; }
.btn-primary {
  --bs-btn-bg: var(--ps-coral); --bs-btn-border-color: var(--ps-coral);
  --bs-btn-hover-bg: var(--ps-coral-deep); --bs-btn-hover-border-color: var(--ps-coral-deep);
  --bs-btn-active-bg: #e04c2e; --bs-btn-active-border-color: #e04c2e;
  --bs-btn-disabled-bg: var(--ps-coral); --bs-btn-disabled-border-color: var(--ps-coral);
  --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff; --bs-btn-disabled-color: #fff;
  box-shadow: 0 8px 18px -8px rgba(255, 111, 79, .75); padding-left: 1.1rem; padding-right: 1.1rem;
}
.btn-outline-primary {
  --bs-btn-color: var(--ps-coral-deep); --bs-btn-border-color: var(--ps-coral);
  --bs-btn-hover-bg: var(--ps-coral); --bs-btn-hover-border-color: var(--ps-coral); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--ps-coral-deep); --bs-btn-active-border-color: var(--ps-coral-deep); --bs-btn-active-color: #fff;
}
.btn-outline-secondary {
  --bs-btn-color: var(--ps-text); --bs-btn-border-color: var(--ps-line);
  --bs-btn-hover-bg: var(--ps-purple-soft); --bs-btn-hover-border-color: var(--ps-purple-soft); --bs-btn-hover-color: var(--ps-purple);
  --bs-btn-active-bg: var(--ps-purple); --bs-btn-active-border-color: var(--ps-purple); --bs-btn-active-color: #fff;
  background-color: var(--ps-surface);
}
.btn-outline-secondary:hover { background-color: var(--ps-purple-soft); }
.btn-sm { padding-left: .8rem; padding-right: .8rem; }
.btn-icone { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; border-radius: 50%; border: 0; background: transparent; color: var(--ps-text); font-size: 1.1rem; }
.btn-icone:hover { background: var(--ps-purple-soft); color: var(--ps-purple); }
.form-control, .form-select { border-radius: 10px; border-color: var(--ps-line); background-color: var(--ps-surface); color: var(--ps-ink); }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--ps-purple); box-shadow: 0 0 0 .2rem rgba(139, 23, 229, .14); background-color: var(--ps-surface); color: var(--ps-ink); }
.form-check-input:checked { background-color: var(--ps-purple); border-color: var(--ps-purple); }
.form-label { font-weight: 500; font-size: .9rem; color: var(--ps-ink); }
.form-text { color: var(--ps-muted); }
.input-group-text { background: var(--ps-surface-2); border-color: var(--ps-line); color: var(--ps-muted); }
.badge { border-radius: 50px; font-weight: 500; letter-spacing: .01em; padding: .38em .75em; }
.text-bg-primary { background-color: var(--ps-coral) !important; color: #fff !important; }
.text-bg-success { background-color: var(--ps-green) !important; color: #fff !important; }
.text-bg-danger { background-color: var(--ps-red) !important; color: #fff !important; }
.text-bg-warning { background-color: var(--ps-yellow) !important; color: #3a2a00 !important; }
.text-bg-info { background-color: var(--ps-blue) !important; color: #fff !important; }
.text-bg-secondary, .text-bg-light { background-color: var(--ps-purple-soft) !important; color: var(--ps-purple-ink) !important; }
[data-bs-theme="dark"] .text-bg-secondary, [data-bs-theme="dark"] .text-bg-light { color: #d7b4fa !important; }
.text-danger { color: var(--ps-red) !important; }
.text-warning { color: #e09b00 !important; }
.alert { border-radius: 14px; border: 0; }
.alert-warning { background: #fff6e0; color: #6b4a00; }
.alert-danger { background: #ffe9ed; color: #a3122e; }
.alert-success { background: #e6f8e8; color: #1a6b27; }
.alert-info { background: var(--ps-purple-soft); color: var(--ps-purple-ink); }
.alert a { color: inherit; font-weight: 500; }
[data-bs-theme="dark"] .alert-warning { background: rgba(255, 188, 52, .14); color: #ffd98a; }
[data-bs-theme="dark"] .alert-danger { background: rgba(246, 45, 81, .16); color: #ff9aac; }
[data-bs-theme="dark"] .alert-success { background: rgba(57, 196, 73, .14); color: #8fe39a; }
[data-bs-theme="dark"] .alert-info { color: #d7b4fa; }
.page-link { color: var(--ps-text); border-color: var(--ps-line); background: var(--ps-surface); }
.page-link:hover { color: var(--ps-purple); background: var(--ps-purple-soft); border-color: var(--ps-line); }
.active > .page-link { background: var(--ps-purple); border-color: var(--ps-purple); color: #fff; }
.pagination { --bs-pagination-border-radius: 10px; }
.spinner-border { color: var(--ps-purple); }
.btn .spinner-border { color: inherit; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }

/* ---------- cartes et tableaux */
.card { --bs-card-bg: var(--ps-surface); --bs-card-border-radius: 20px; --bs-card-inner-border-radius: 20px; --bs-card-cap-bg: transparent; border: 0; border-radius: 20px; box-shadow: var(--ps-shadow); color: var(--ps-text); }
.card-header { border-bottom: 1px solid var(--ps-line); background: transparent; padding: 1rem 1.4rem; font-size: 1.05rem; }
.card-body { padding: 1.25rem 1.4rem; }
.card-footer { border-top: 1px solid var(--ps-line); background: transparent; padding: .9rem 1.4rem; }
.card > .table-responsive:last-child, .card > .list-group:last-child { border-radius: 0 0 20px 20px; }
.card-img-top { border-radius: 20px 20px 0 0; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--ps-text); --bs-table-border-color: var(--ps-line); --bs-table-hover-bg: var(--ps-purple-soft); --bs-table-hover-color: var(--ps-text); margin-bottom: 0; }
.table thead th { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ps-muted); background: transparent; font-weight: 500; border-bottom: 1px solid var(--ps-line); white-space: nowrap; }
.table td { vertical-align: middle; border-color: var(--ps-line); }
.table tr:last-child td { border-bottom: 0; }
.table a.titre { font-weight: 500; color: var(--ps-ink); text-decoration: none; }
.table a.titre:hover { color: var(--ps-purple); }
.list-group { --bs-list-group-bg: transparent; --bs-list-group-border-color: var(--ps-line); --bs-list-group-color: var(--ps-text); }
.list-group-item { border-color: var(--ps-line); background: transparent; }
.inactive td { opacity: .55; }
.inactive td:last-child { opacity: 1; }

/* ---------- gabarit : barre latérale + corps */
/* Le fond est porté par .menu-corps : au-delà de 992 px, Bootstrap rend .offcanvas-lg transparent. */
.menu { --bs-offcanvas-width: var(--ps-sidebar-w); border: 0 !important; }
.menu-corps { background: var(--ps-violet-fond); color: #fff; padding: 1.6rem 1.1rem 1.2rem; overflow-y: auto; }
@media (min-width: 992px) {
  .menu { width: var(--ps-sidebar-w); flex: 0 0 var(--ps-sidebar-w); height: 100vh; position: sticky; top: 0; }
}
.menu-tete { display: flex; flex-direction: column; }
.marque { display: block; }
.marque-logo { width: 100%; max-width: 200px; display: block; }
.menu-sous { font-size: .74rem; color: rgba(255, 255, 255, .7); margin: .55rem 0 1.6rem .1rem; letter-spacing: .02em; overflow-wrap: anywhere; }
.menu .nav { gap: .25rem; flex-wrap: nowrap; }
.menu .nav-link { display: flex; align-items: center; gap: .75rem; padding: .5rem .9rem; border-radius: 80px; color: rgba(255, 255, 255, .82); font-weight: 500; font-size: .86rem; transition: background .15s, color .15s; }
.menu .nav-link .bi { font-size: 1.1rem; opacity: .95; }
.menu .nav-link:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.menu .nav-link.active { background: var(--ps-coral); color: #fff; box-shadow: 0 10px 22px -10px rgba(255, 111, 79, .9); }
.menu .nav-link .badge { background: #fff !important; color: var(--ps-coral-deep) !important; }
.menu-titre { font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .5); padding: .9rem .9rem .3rem; overflow-wrap: anywhere; }
.menu-pied { margin-top: 1.2rem; font-size: .76rem; color: rgba(255, 255, 255, .7); display: grid; gap: .45rem; padding: 0 .3rem; }
.menu-pied a { color: rgba(255, 255, 255, .8); text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; overflow-wrap: anywhere; }
.menu-pied a:hover { color: #fff; }
.menu-copie { color: rgba(255, 255, 255, .5); }

.corps { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.barre { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; height: 68px; padding: 0 2rem; background: rgba(246, 243, 251, .85); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--ps-line); }
[data-bs-theme="dark"] .barre { background: rgba(19, 11, 34, .85); }
.barre-titre { font-size: 1.35rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.barre-compte { display: inline-flex; align-items: center; gap: .5rem; font-size: .88rem; color: var(--ps-text); font-weight: 500; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--ps-purple), var(--ps-purple-deep)); color: #fff; font-weight: 600; font-size: .85rem; text-transform: uppercase; }
.contenu { padding: 1.6rem 2rem 2.5rem; flex: 1; min-width: 0; max-width: 1280px; width: 100%; }
@media (max-width: 991.98px) {
  .barre { padding: 0 1rem; }
  .contenu { padding: 1rem 1rem 2rem; }
}
.entete-page { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 1.3rem; }
.entete-page h1 { font-size: 1.5rem; margin: 0; }
.entete-page .sous { color: var(--ps-muted); margin: 2px 0 0; font-size: .9rem; }
.fil { font-size: .82rem; color: var(--ps-muted); margin-bottom: 4px; display: block; text-decoration: none; }
.fil:hover { color: var(--ps-purple); }
.surtitre { color: var(--ps-purple); font-weight: 500; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 4px; }

/* ---------- cartes de chiffres */
.chiffre { display: flex; align-items: center; gap: 1rem; padding: 1.2rem 1.4rem; height: 100%; }
.chiffre > div { min-width: 0; }
.chiffre .pastille { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; color: #fff; font-size: 1.4rem; background: linear-gradient(135deg, #a64cff, var(--ps-purple-deep)); }
.row > div:nth-child(4n+2) > .card > .chiffre .pastille { background: linear-gradient(135deg, #ff8f6b, var(--ps-coral-deep)); }
.row > div:nth-child(4n+3) > .card > .chiffre .pastille { background: linear-gradient(135deg, #5fd36d, #1fa83a); }
.row > div:nth-child(4n+4) > .card > .chiffre .pastille { background: linear-gradient(135deg, #3fb6ff, #0077c2); }
.chiffre .valeur { font-size: 1.45rem; line-height: 1.15; }
.chiffre .legende { color: var(--ps-muted); font-size: .78rem; }

/* ---------- pages */
audio { width: 100%; }
.erreur-source { color: var(--ps-red); font-size: .82rem; overflow-wrap: anywhere; }
.texte-journal { color: var(--ps-ink); }
.texte-journal p { margin-bottom: .9rem; }
.texte-journal p:last-child { margin-bottom: 0; }
.locuteur { color: var(--ps-purple); font-weight: 600; }
.fait { padding: 14px 0; border-bottom: 1px solid var(--ps-line); }
.fait:first-child { padding-top: 0; }
.fait:last-child { border-bottom: 0; padding-bottom: 0; }
.fait .citation { font-weight: 500; color: var(--ps-ink); }
.fait .detail { font-size: .88rem; color: var(--ps-muted); margin-top: 4px; }
.fait .preuves a { overflow-wrap: anywhere; }
.sommaire { padding-left: 1.2rem; margin-bottom: 0; }
.sommaire > li { margin-bottom: 10px; }
.sommaire > li::marker { color: var(--ps-purple); font-weight: 600; }
.sommaire ul { list-style: none; padding: 0; margin: 2px 0 0; font-size: .86rem; color: var(--ps-muted); }

@media (max-width: 767.98px) {
  .barre { height: 56px; }
  .barre-titre { font-size: 1.05rem; }
  .contenu { padding: .85rem .75rem 2rem; }
  .card { border-radius: 16px; --bs-card-border-radius: 16px; --bs-card-inner-border-radius: 16px; }
  .card-header { padding: .8rem 1rem; }
  .card-body { padding: .9rem 1rem; }
  .card-footer { padding: .8rem 1rem; }
  .card-img-top { border-radius: 16px 16px 0 0; }
  .chiffre { padding: .85rem .9rem; gap: .65rem; }
  .chiffre .pastille { flex-basis: 40px; width: 40px; height: 40px; border-radius: 12px; font-size: 1.1rem; }
  .chiffre .valeur { font-size: 1.2rem; }
  .entete-page h1 { font-size: 1.25rem; }
}

/* ---------- connexion (gabarit Power AI) */
.connexion { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, 34%) 1fr; }
.connexion-cote { color: #fff; display: flex; align-items: center; justify-content: center; padding: 3rem 2rem;
  background: radial-gradient(rgba(255, 255, 255, .14) 1px, transparent 1.2px) 0 0 / 18px 18px, linear-gradient(175deg, #8b17e5 0%, #6a10b8 50%, #4d0c80 100%); }
.connexion-cote-corps { text-align: center; max-width: 360px; }
.connexion-logo { width: 100%; max-width: 320px; display: block; margin: 0 auto 1.2rem; }
.connexion-accroche { font-size: 1.15rem; line-height: 1.45; color: rgba(255, 255, 255, .92); margin: 0 0 2.2rem; }
.connexion-copie { font-size: .8rem; color: rgba(255, 255, 255, .6); }
.connexion-formulaire { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem 1rem 0; background: var(--ps-bg); overflow: hidden; }
.connexion-carte { width: 100%; max-width: 450px; background: var(--ps-surface); border-radius: 32px; padding: 2.6rem 2.2rem 2rem; box-shadow: 0 30px 80px -40px rgba(61, 20, 110, .35); text-align: center; position: relative; z-index: 1; }
.connexion-carte h2 { font-size: 1.7rem; margin: 0 0 1.4rem; font-weight: 600; }
.connexion-carte .form-control-lg { border-radius: 12px; padding: .9rem 1rem; font-size: 1rem; }
.connexion-carte .btn-lg { font-size: 1.05rem; padding-top: .7rem; padding-bottom: .7rem; }
.connexion-petit { display: none; height: 30px; width: auto; margin: 0 auto 1.2rem; }
.connexion-pied { margin: 1.2rem 0 0; font-size: .78rem; color: var(--ps-muted); }
.connexion-prise { width: 76px; margin-top: 1.2rem; align-self: center; }
@media (max-width: 860px) {
  .connexion { grid-template-columns: 1fr; }
  .connexion-cote { display: none; }
  .connexion-petit { display: block; }
}
