/* ============================================================
   DICTA — feuille de style unique
   Marque IAvocat · noir & or · accent Dicta indigo
   RGPD : aucune police externe / CDN. Polices auto-hébergées
   (déposer les .woff2 dans /static/fonts/) avec repli system-ui.
   ============================================================ */

/* ---------- Polices auto-hébergées (facultatives) ----------
   Tant que les .woff2 ne sont pas présents, les piles de repli
   system-ui prennent le relais : la maquette reste lisible. */
@font-face {
  font-family: "Newsreader";
  src: url("/static/fonts/Newsreader-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/static/fonts/Newsreader-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/static/fonts/Newsreader-SemiBold.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/static/fonts/Newsreader-Italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/static/fonts/InstrumentSans-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/static/fonts/InstrumentSans-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/static/fonts/InstrumentSans-SemiBold.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/static/fonts/InstrumentSans-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ============================================================
   VARIABLES
   ============================================================ */
:root {
  /* Couleurs de maison */
  --ink:        #0e1726;
  --ink-2:      #182338;
  --paper:      #f5f1e8;
  --paper-2:    #efe9dc;
  --card:       #fffdf8;
  --gold:       #b08a45;
  --gold-deep:  #7c6026;
  --gold-1:     #F0C368;
  --gold-2:     #A5762A;
  --muted:      #4c5666;
  --muted-2:    #6b7482;
  --line:       rgba(14, 23, 38, .13);
  --line-2:     rgba(14, 23, 38, .07);

  /* Accent Dicta + statuts */
  --dicta:      #3f57a0;
  --dicta-soft: rgba(63, 87, 160, .08);
  --green:      #2f6a5f;
  --green-soft: rgba(47, 106, 95, .10);
  --amber:      #c07a24;
  --amber-soft: rgba(192, 122, 36, .10);
  --red:        #b3402f;
  --red-soft:   rgba(179, 64, 47, .10);
  --teal:       #3a8f86;
  --teal-soft:  rgba(58, 143, 134, .10);

  /* Typographie */
  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans:  "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Rayons */
  --r-xs: 7px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 100px;

  /* Espacements */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 44px; --s-9: 64px;

  /* Ombres */
  --sh-sm: 0 2px 8px -4px rgba(14, 23, 38, .30);
  --sh-md: 0 18px 40px -28px rgba(14, 23, 38, .45);
  --sh-lg: 0 30px 60px -30px rgba(14, 23, 38, .50);

  /* Surfaces de thème (clair par défaut) */
  --bg:        var(--paper);
  --surface:   var(--card);
  --surface-2: var(--paper-2);
  --text:      var(--ink);
  --text-soft: var(--muted);
  --border:    var(--line);
}

/* ---------- Thème sombre (écran mobile d'enregistrement) ---------- */
[data-theme="dark"] {
  --bg:        #0b1220;
  --surface:   #131d30;
  --surface-2: #1a2740;
  --text:      #f5f1e8;
  --text-soft: #9aa6ba;
  --border:    rgba(245, 241, 232, .12);
  --muted:     #9aa6ba;
  --line:      rgba(245, 241, 232, .12);
  --card:      #131d30;
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: var(--gold-deep); text-decoration: none; }
a:hover { color: var(--gold); }
button { font: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; }
::selection { background: var(--gold); color: #fff; }
:focus-visible {
  outline: 2px solid var(--dicta);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Utilitaires de fond de page (aperçu maquette) */
.canvas       { min-height: 100vh; background: var(--paper); }
.canvas--tint { min-height: 100vh; background: #eef1f6; }
.serif { font-family: var(--font-serif); }
.italic { font-style: italic; }

/* ============================================================
   MARQUE
   ============================================================ */
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; }
.brand__mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--ink); flex-shrink: 0;
}
.brand__mark svg { width: 26px; height: 26px; }
.brand__name {
  font-family: var(--font-serif);
  font-size: 22px; font-weight: 600; letter-spacing: -.01em;
}
.brand__name small {
  display: block; font-family: var(--font-sans);
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  color: var(--gold-deep); text-transform: uppercase;
}

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 20px; border: 1px solid transparent; border-radius: var(--r-sm);
  font-weight: 600; font-size: 15px; line-height: 1; cursor: pointer;
  transition: background .18s, border-color .18s, color .18s, transform .18s;
  text-decoration: none; white-space: nowrap;
}
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--ink-2); color: #fff; }
.btn--gold { background: var(--gold); color: var(--ink); }
.btn--gold:hover { background: var(--gold-2); }
.btn--dicta { background: var(--dicta); color: #fff; }
.btn--dicta:hover { background: #34488a; }
.btn--ghost {
  background: var(--surface); color: var(--text); border-color: var(--border);
}
.btn--ghost:hover { border-color: var(--gold); color: var(--gold-deep); }
.btn--quiet { background: transparent; color: var(--text-soft); }
.btn--quiet:hover { background: var(--surface-2); color: var(--text); }
.btn--danger { background: var(--red); color: #fff; }
.btn--danger:hover { background: #97372a; }
.btn--block { width: 100%; }
.btn--lg { padding: 15px 26px; font-size: 16px; border-radius: var(--r-md); }
.btn--sm { padding: 8px 14px; font-size: 13.5px; }
.btn__icon { width: 18px; height: 18px; }

/* ============================================================
   CARTES & SURFACES
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
}
.card--flat { box-shadow: none; }
.card--raised { box-shadow: var(--sh-md); }
.card--pad-sm { padding: var(--s-4); }
.card__title { font-weight: 600; font-size: 16px; margin-bottom: var(--s-4); }
.eyebrow {
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 600; color: var(--gold-deep);
}
.eyebrow--dicta { color: var(--dicta); }

/* ============================================================
   BADGES DE STATUT
   ============================================================ */
.status {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 600; line-height: 1.4;
  white-space: nowrap;
}
.status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.status--progress   { color: var(--dicta); background: var(--dicta-soft); }
.status--transcribed{ color: var(--teal);  background: var(--teal-soft); }
.status--analyzed   { color: var(--gold-deep); background: rgba(176,138,69,.12); }
.status--done       { color: var(--green); background: var(--green-soft); }
.status--error      { color: var(--red);   background: var(--red-soft); }
.status--new        { color: var(--muted); background: var(--surface-2); }
.status--question   { color: var(--amber); background: var(--amber-soft); }
.status--locked     { color: var(--gold-deep); background: rgba(176,138,69,.12); }
.status--live::before { animation: pulse 1.4s ease-in-out infinite; }

/* Petite pastille de tag neutre */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
}

/* ============================================================
   ENCARTS « CONTRÔLES »
   ============================================================ */
.callout {
  border-left: 3px solid var(--muted);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 12px 15px;
  background: var(--surface-2);
}
.callout__label {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; margin-bottom: 4px;
}
.callout__label svg { width: 14px; height: 14px; }
.callout__body { font-size: 13.5px; color: var(--text); }
.callout--error     { border-color: var(--red);   background: var(--red-soft); }
.callout--error .callout__label { color: var(--red); }
.callout--attention { border-color: var(--dicta); background: var(--dicta-soft); }
.callout--attention .callout__label { color: var(--dicta); }
.callout--task      { border-color: var(--green); background: var(--green-soft); }
.callout--task .callout__label { color: var(--green); }

/* ============================================================
   MISE EN PAGE — MOBILE (application)
   ============================================================ */
.app {
  width: 100%; max-width: 440px; margin: 0 auto;
  min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); position: relative;
}
.app--dark { color: var(--text); }
.app__bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; gap: 12px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
}
.app__bar-title { font-family: var(--font-serif); font-size: 20px; font-weight: 600; }
.app__main { flex: 1; padding: 20px; display: flex; flex-direction: column; }
.app__main--center { justify-content: center; align-items: center; text-align: center; }
.app__footer { padding: 16px 20px 24px; }

/* Barre d'onglets bas */
.tabbar {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
  background: var(--surface); position: sticky; bottom: 0;
}
.tabbar__item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 0 14px; color: var(--text-soft);
  font-size: 11px; font-weight: 600; cursor: pointer; background: none; border: none;
}
.tabbar__item svg { width: 22px; height: 22px; }
.tabbar__item.is-active { color: var(--dicta); }
[data-theme="dark"] .tabbar__item.is-active { color: var(--gold); }

/* Cadre d'aperçu « téléphone » (retirer pour Jinja) */
.phone-stage {
  min-height: 100vh; display: grid; place-items: center;
  padding: 32px; background: #d9dee7;
}
[data-theme="dark"] .phone-stage,
.phone-stage--dark { background: #05080f; }
.phone {
  width: 400px; max-width: 100%;
  border-radius: 44px; padding: 12px;
  background: #05070c; box-shadow: 0 50px 90px -40px rgba(0,0,0,.7);
}
.phone__screen {
  border-radius: 33px; overflow: hidden; position: relative;
  height: 812px; max-height: 82vh; overflow-y: auto; background: var(--bg);
}
.phone__notch {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 140px; height: 26px; background: #05070c;
  border-radius: 0 0 16px 16px; z-index: 60;
}

/* ============================================================
   ÉCRAN D'ENREGISTREMENT
   ============================================================ */
.record {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 28px; text-align: center;
  padding: 24px;
}
.record__context {
  font-size: 13px; color: var(--text-soft); font-weight: 600;
  letter-spacing: .02em;
}
.record__timer {
  font-family: var(--font-serif); font-size: 60px; font-weight: 500;
  letter-spacing: .01em; font-variant-numeric: tabular-nums; line-height: 1;
}
.record__hint { font-size: 15px; color: var(--text-soft); max-width: 260px; }

/* Bouton micro rond */
.mic-btn {
  width: 108px; height: 108px; border-radius: 50%;
  border: none; cursor: pointer; display: grid; place-items: center;
  background: var(--dicta); color: #fff;
  box-shadow: 0 0 0 0 rgba(63,87,160,.45);
  transition: transform .18s, background .18s;
}
.mic-btn svg { width: 42px; height: 42px; }
.mic-btn:hover { transform: scale(1.03); }
.mic-btn--gold { background: var(--gold); color: var(--ink); box-shadow: 0 0 0 0 rgba(176,138,69,.45); }
.mic-btn--recording { background: var(--red); animation: haloRed 1.8s ease-out infinite; }
.mic-btn--recording svg { width: 34px; height: 34px; }
.mic-btn--stop { background: var(--red); }

/* Onde sonore */
.wave { display: flex; align-items: center; justify-content: center; gap: 5px; height: 64px; }
.wave span {
  width: 5px; border-radius: 3px; background: var(--gold);
  animation: eq 1s ease-in-out infinite;
}
.wave--dicta span { background: var(--dicta); }
.wave span:nth-child(1) { animation-delay: 0s;   }
.wave span:nth-child(2) { animation-delay: .12s; }
.wave span:nth-child(3) { animation-delay: .24s; }
.wave span:nth-child(4) { animation-delay: .36s; }
.wave span:nth-child(5) { animation-delay: .48s; }
.wave span:nth-child(6) { animation-delay: .60s; }
.wave span:nth-child(7) { animation-delay: .72s; }
.wave span:nth-child(8) { animation-delay: .84s; }
.wave span:nth-child(9) { animation-delay: .96s; }

/* Contrôles d'enregistrement */
.record__controls { display: flex; align-items: center; gap: 28px; }
.record__side-btn {
  width: 56px; height: 56px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.record__side-btn svg { width: 22px; height: 22px; }

/* Anneau de progression (envoi) */
.spinner {
  width: 76px; height: 76px; border-radius: 50%;
  border: 5px solid var(--surface-2); border-top-color: var(--dicta);
  animation: spin 1s linear infinite;
}
.check-badge {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--green); color: #fff; display: grid; place-items: center;
  animation: pop .4s cubic-bezier(.2,.9,.3,1.4) both;
}
.check-badge svg { width: 42px; height: 42px; }

/* Champ « intention » / méta dictée */
.meta-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface);
}
.meta-row__label { font-size: 12px; color: var(--text-soft); font-weight: 600; }
.meta-row__value { font-size: 15px; font-weight: 600; }

/* ============================================================
   LISTES DE DICTÉES
   ============================================================ */
.dictee-list { display: flex; flex-direction: column; gap: 10px; }
.dictee {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 16px; border: 1px solid var(--border);
  border-radius: var(--r-md); background: var(--surface);
  text-align: left; cursor: pointer; transition: border-color .18s, box-shadow .18s;
}
.dictee:hover { border-color: var(--gold); box-shadow: var(--sh-sm); }
.dictee.is-selected { border-color: var(--dicta); box-shadow: 0 0 0 1px var(--dicta); }
.dictee__icon {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--surface-2); color: var(--dicta);
}
.dictee__icon svg { width: 20px; height: 20px; }
.dictee__body { flex: 1; min-width: 0; }
.dictee__title {
  font-weight: 600; font-size: 15px; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dictee__meta { font-size: 12.5px; color: var(--text-soft); display: flex; gap: 10px; flex-wrap: wrap; }
.dictee__meta span { display: inline-flex; align-items: center; gap: 5px; }
.dictee__aside { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.dictee__time { font-size: 12px; color: var(--text-soft); }

/* Séparateur de jour */
.list-day {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-soft); margin: 18px 2px 8px;
}

/* ============================================================
   MISE EN PAGE — POSTE (bureau)
   ============================================================ */
.desk { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.desk--wide { grid-template-columns: 248px 380px 1fr; }
.sidebar {
  background: var(--ink); color: var(--paper);
  padding: 22px 18px; display: flex; flex-direction: column; gap: 6px;
}
.sidebar .brand__name { color: var(--paper); }
.sidebar__group-label {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(245,241,232,.45); font-weight: 600; margin: 20px 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: rgba(245,241,232,.78); font-size: 14.5px; font-weight: 500;
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(245,241,232,.07); color: var(--paper); }
.nav-item.is-active { background: rgba(245,241,232,.12); color: #fff; }
.nav-item__count {
  margin-left: auto; font-size: 12px; font-weight: 700;
  background: var(--gold); color: var(--ink); border-radius: var(--r-pill); padding: 1px 8px;
}

.desk__main { background: #eef1f6; min-height: 100vh; overflow: auto; }
.desk__header {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 14px; padding: 26px 32px 20px;
  border-bottom: 1px solid var(--border); background: var(--paper);
}
.desk__title { font-family: var(--font-serif); font-size: 28px; font-weight: 600; }
.desk__subtitle { font-size: 14px; color: var(--text-soft); margin-top: 2px; }
.desk__body { padding: 26px 32px 60px; }

/* Colonne liste (vue secrétaire à 3 colonnes) */
.desk__list {
  background: var(--paper); border-right: 1px solid var(--border);
  overflow: auto; display: flex; flex-direction: column;
}
.desk__list-head {
  padding: 20px 20px 14px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--paper); z-index: 5;
}
.desk__list-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }

/* Barre de recherche / filtres */
.field {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface); color: var(--text);
}
.field svg { width: 17px; height: 17px; color: var(--text-soft); flex-shrink: 0; }
.field input, .field textarea {
  border: none; outline: none; background: none; font: inherit;
  color: inherit; width: 100%; resize: none;
}
.field input::placeholder { color: var(--text-soft); }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip {
  padding: 6px 13px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
}
.chip.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ============================================================
   DÉTAIL DICTÉE (courrier + tâches + contrôles)
   ============================================================ */
.detail { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.detail__doc { display: flex; flex-direction: column; gap: 16px; }
.detail__aside { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 20px; }

/* Éditeur de courrier */
.letter {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}
.letter__toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--paper-2);
}
.letter__tool {
  width: 32px; height: 32px; border-radius: var(--r-xs);
  border: 1px solid transparent; background: none; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; font-weight: 600; font-size: 14px;
}
.letter__tool:hover { background: var(--card); border-color: var(--border); color: var(--ink); }
.letter__tool svg { width: 16px; height: 16px; }
.letter__sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.letter__paper {
  padding: 34px 40px; font-size: 15px; line-height: 1.75; color: var(--ink);
  min-height: 380px;
}
.letter__paper[contenteditable]:focus { outline: none; }
.letter__paper p { margin: 0 0 14px; }
.letter__paper h1, .letter__paper h2 { font-family: var(--font-serif); }
.letter__paper .edit-mark { background: rgba(176,138,69,.22); border-radius: 4px; padding: 1px 3px; }

/* Liste de tâches */
.tasklist { display: flex; flex-direction: column; }
.task {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid var(--line-2);
}
.task:last-child { border-bottom: none; }
.task__check {
  width: 20px; height: 20px; border-radius: 6px; flex-shrink: 0; margin-top: 1px;
  border: 1.5px solid var(--border); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; color: transparent;
}
.task__check.is-done { background: var(--green); border-color: var(--green); color: #fff; }
.task__check svg { width: 13px; height: 13px; }
.task__body { flex: 1; }
.task__text { font-size: 14px; }
.task__text.is-done { text-decoration: line-through; color: var(--text-soft); }
.task__meta { font-size: 12px; color: var(--text-soft); margin-top: 3px; }

/* En-tête détail (dossier) */
.detail__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.detail__case {
  font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--gold-deep); font-weight: 600; margin-bottom: 4px;
}
.detail__client { font-family: var(--font-serif); font-size: 24px; font-weight: 600; }
.detail__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.audio-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border: 1px solid var(--border);
  border-radius: var(--r-md); background: var(--surface-2);
}
.audio-bar__play {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: var(--dicta); color: #fff; border: none; cursor: pointer;
  display: grid; place-items: center;
}
.audio-bar__play svg { width: 16px; height: 16px; }
.audio-bar__track { flex: 1; height: 6px; border-radius: 3px; background: var(--border); position: relative; }
.audio-bar__track::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 38%;
  background: var(--dicta); border-radius: 3px;
}
.audio-bar__time { font-size: 12.5px; color: var(--text-soft); font-variant-numeric: tabular-nums; }

/* ============================================================
   TABLEAUX
   ============================================================ */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead th {
  text-align: left; padding: 12px 18px; font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft);
  background: #f6f8fb; border-bottom: 1px solid var(--border);
}
.table tbody td { padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.table tbody tr:hover { background: #f6f8fb; }
.table tbody tr:last-child td { border-bottom: none; }
.table__strong { font-weight: 600; }

/* ============================================================
   KPI / STATS
   ============================================================ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 20px; }
.kpi__label { font-size: 13px; color: var(--text-soft); font-weight: 600; margin-bottom: 8px; }
.kpi__value { font-family: var(--font-serif); font-size: 32px; font-weight: 600; line-height: 1; }
.kpi__delta { font-size: 12.5px; font-weight: 600; margin-top: 8px; color: var(--green); }
.kpi__delta--warn { color: var(--amber); }

/* ============================================================
   AUTH (connexion)
   ============================================================ */
.auth {
  min-height: 100vh; display: grid; place-items: center;
  padding: 32px; background:
    radial-gradient(120% 80% at 80% 0%, rgba(176,138,69,.14), transparent 55%),
    var(--paper);
}
.auth__card {
  width: 100%; max-width: 400px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 36px 32px; box-shadow: var(--sh-lg);
}
.auth__logo { display: flex; justify-content: center; margin-bottom: 22px; }
.auth__logo .brand__mark { width: 52px; height: 52px; border-radius: 13px; }
.auth__logo .brand__mark svg { width: 34px; height: 34px; }
.auth__title { font-family: var(--font-serif); font-size: 26px; font-weight: 600; text-align: center; }
.auth__sub { text-align: center; color: var(--text-soft); font-size: 14.5px; margin: 6px 0 26px; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface); color: var(--text);
  font: inherit; outline: none;
}
.input:focus { border-color: var(--dicta); box-shadow: 0 0 0 3px var(--dicta-soft); }
.auth__foot { text-align: center; font-size: 13px; color: var(--text-soft); margin-top: 20px; }

/* ============================================================
   AIDE / CHAT
   ============================================================ */
.chat { display: flex; flex-direction: column; gap: 16px; max-width: 760px; margin: 0 auto; }
.msg { display: flex; gap: 12px; max-width: 82%; }
.msg__avatar {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--ink);
}
.msg__avatar svg { width: 22px; height: 22px; }
.msg__bubble {
  padding: 13px 16px; border-radius: var(--r-md); font-size: 14.5px; line-height: 1.6;
  background: var(--card); border: 1px solid var(--border);
}
.msg--user { margin-left: auto; flex-direction: row-reverse; }
.msg--user .msg__bubble { background: var(--dicta); color: #fff; border-color: transparent; }
.msg--user .msg__avatar { background: var(--gold); color: var(--ink); }
.chat__composer {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--card); max-width: 760px; margin: 20px auto 0;
}
.chat__composer .field { flex: 1; border: none; padding: 6px 8px; }

/* ============================================================
   DIVERS
   ============================================================ */
.stack   { display: flex; flex-direction: column; }
.stack-2 { display: flex; flex-direction: column; gap: 8px; }
.stack-3 { display: flex; flex-direction: column; gap: 12px; }
.stack-4 { display: flex; flex-direction: column; gap: 16px; }
.row     { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap    { flex-wrap: wrap; }
.grow    { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.muted   { color: var(--text-soft); }
.small   { font-size: 13px; }
.center  { text-align: center; }
.notice {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: var(--r-md); font-size: 13.5px; font-weight: 500;
  background: var(--amber-soft); border: 1px solid rgba(192,122,36,.3); color: #8a5a12;
}
.notice svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ============================================================
   MÉTA (paires clé/valeur)
   ============================================================ */
.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 20px; }
.meta-grid > div { display: flex; flex-direction: column; gap: 2px; }
.meta-grid dt { font-size: 12px; color: var(--text-soft); font-weight: 600; }
.meta-grid dd { margin: 0; font-size: 14px; font-weight: 600; }

/* Onglets de documents (multi-courriers) */
.doc-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.doc-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--r-sm) var(--r-sm) 0 0;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); border-bottom: none;
  background: var(--surface-2); color: var(--text-soft);
}
.doc-tab.is-active { background: var(--card); color: var(--ink); }
.doc-tab__badge {
  font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: var(--r-pill);
  background: var(--dicta-soft); color: var(--dicta);
}

/* Bloc transcription (source) */
.transcript {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px 18px;
  font-size: 14px; line-height: 1.7; color: var(--text);
}
.transcript mark { background: rgba(192,122,36,.22); color: inherit; border-radius: 3px; padding: 0 2px; }
.transcript .doubt { border-bottom: 2px dotted var(--amber); cursor: help; }

/* ============================================================
   INTERRUPTEUR (switch)
   ============================================================ */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__track {
  position: absolute; inset: 0; cursor: pointer; border-radius: var(--r-pill);
  background: var(--border); transition: background .18s;
}
.switch__track::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .18s; box-shadow: var(--sh-sm);
}
.switch input:checked + .switch__track { background: var(--dicta); }
.switch input:checked + .switch__track::before { transform: translateX(18px); }

/* Ligne de réglage */
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 0; border-bottom: 1px solid var(--line-2);
}
.setting-row:last-child { border-bottom: none; }
.setting-row__text { max-width: 70%; }
.setting-row__title { font-weight: 600; font-size: 14.5px; }
.setting-row__desc { font-size: 13px; color: var(--text-soft); margin-top: 2px; }

/* ============================================================
   MODALE
   ============================================================ */
.modal-scrim {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(14, 23, 38, .5); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 24px;
}
.modal {
  width: 100%; max-width: 720px; max-height: 90vh; overflow: auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--sh-lg);
}
.modal__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 22px 26px; border-bottom: 1px solid var(--border);
}
.modal__title { font-family: var(--font-serif); font-size: 22px; font-weight: 600; }
.modal__body { padding: 24px 26px; }
.modal__foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 18px 26px; border-top: 1px solid var(--border); background: var(--paper-2);
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}
.modal__close {
  width: 34px; height: 34px; border-radius: var(--r-sm); flex-shrink: 0;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  display: grid; place-items: center; cursor: pointer;
}
.modal__close:hover { color: var(--ink); border-color: var(--gold); }

/* Choix en tuiles (options radio visuelles) */
.option-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.option-tile {
  border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 16px;
  cursor: pointer; background: var(--surface); text-align: left;
}
.option-tile.is-active { border-color: var(--dicta); background: var(--dicta-soft); }
.option-tile__title { font-weight: 600; font-size: 14px; }
.option-tile__desc { font-size: 12.5px; color: var(--text-soft); margin-top: 3px; }

/* ============================================================
   BANNIÈRE GLOBALE (états système : 423 suspendu, etc.)
   ============================================================ */
.banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 22px; font-size: 14px; font-weight: 500;
}
.banner svg { width: 20px; height: 20px; flex-shrink: 0; }
.banner__actions { margin-left: auto; display: flex; gap: 8px; }
.banner--warn { background: #fff4d6; color: #8a6a10; border-bottom: 1px solid #e6c265; }
.banner--danger { background: var(--red-soft); color: var(--red); border-bottom: 1px solid rgba(179,64,47,.3); }
.banner--info { background: var(--dicta-soft); color: var(--dicta); border-bottom: 1px solid rgba(63,87,160,.25); }

/* ============================================================
   STATISTIQUES (barres simples)
   ============================================================ */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 180px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bars__bar { width: 100%; border-radius: 6px 6px 0 0; background: linear-gradient(var(--dicta), #6377b8); }
.bars__bar--gold { background: linear-gradient(var(--gold), #cba659); }
.bars__label { font-size: 12px; color: var(--text-soft); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-soft); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.progress-line { height: 9px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; }
.progress-line > i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--dicta); }

/* Étapes de pipeline (file de traitement) */
.pipeline { display: flex; flex-direction: column; gap: 0; }
.pipe-step { display: flex; gap: 14px; align-items: flex-start; }
.pipe-step__rail { display: flex; flex-direction: column; align-items: center; align-self: stretch; }
.pipe-step__dot {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; border: 2px solid var(--border);
  background: var(--surface); color: var(--text-soft);
}
.pipe-step__dot svg { width: 15px; height: 15px; }
.pipe-step__line { width: 2px; flex: 1; background: var(--border); min-height: 22px; }
.pipe-step__body { padding-bottom: 22px; }
.pipe-step.is-done .pipe-step__dot { background: var(--green); border-color: var(--green); color: #fff; }
.pipe-step.is-active .pipe-step__dot { background: var(--dicta); border-color: var(--dicta); color: #fff; }
.pipe-step.is-done .pipe-step__line { background: var(--green); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes eq   { 0%,100% { height: 14%; } 50% { height: 100%; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse{ 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes pop  { 0% { transform: scale(.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes haloRed {
  0%   { box-shadow: 0 0 0 0 rgba(179,64,47,.45); }
  70%  { box-shadow: 0 0 0 22px rgba(179,64,47,0); }
  100% { box-shadow: 0 0 0 0 rgba(179,64,47,0); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ============================================================
   RESPONSIVE (postes → tablette)
   ============================================================ */
@media (max-width: 1080px) {
  .desk, .desk--wide { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; overflow-x: auto; }
  .detail { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
