/* ============================================================
   APB Transcription — Styles
   Toutes les couleurs, rayons et ombres sont des variables : c'est ici qu'on ajuste.
   ============================================================ */

/* Polices arabes personnalisées */
@font-face {
  font-family: 'Al-Harariyy';
  src: url('fonts/Al-Harariyy_1439.otf') format('opentype');
  font-display: swap;
}
@font-face {
  font-family: 'Al-Harariyy HAFS';
  src: url('fonts/Al-Harariyy_HAFS.otf') format('opentype');
  font-display: swap;
}
@font-face {
  font-family: 'Arabic Square';
  src: url('fonts/arabsq.ttf') format('truetype');
  font-display: swap;
}

/* Variables */
:root {
  /* Fonds et texte */
  --color-bg:            #f8f7fc;
  --color-surface:       #ffffff;
  --color-surface-soft:  #f3f2f9;
  --color-surface-hover: #e9e7f3;
  --color-border:        #e7e5f0;
  --color-border-strong: #d3d0e2;
  --color-text:          #1f1b33;
  --color-text-muted:    #625e78;

  /* Accent violet/indigo */
  --color-primary:       #6a3de8;
  --color-primary-hover: #5730c9;
  --color-primary-light: #f0ebff;
  --color-primary-soft:  #e2d9ff;
  --color-primary-ring:  rgba(106, 61, 232, .18);

  /* États */
  --color-danger:        #c9252d;
  --color-danger-bg:     #fdf0f1;
  --color-success:       #15803d;
  --color-success-bg:    #e9f8ef;
  --color-warn:          #94470a;
  --color-warn-line:     #b45309;

  /* Blocs bilingues */
  --color-ar-bg:         #f6f1ff;
  --color-ar-border:     #a78bfa;
  --color-ar-badge:      #7038e0;
  --color-fr-bg:         #eefaf3;
  --color-fr-border:     #4cc38a;
  --color-fr-badge:      #15803d;

  /* Surbrillance de la relecture : réglée pour le contraste, à ne pas éclaircir */
  --hl-word-bg:          #4c26b8;
  --hl-word-fg:          #ffffff;
  --hl-phrase-bar:       #6a3de8;
  --hl-phrase-bar-width: 4px;    /* repère de la phrase en cours ; 0 pour le retirer */

  /* Rayons */
  --radius-xs:           8px;
  --radius:              12px;
  --radius-lg:           16px;
  --radius-pill:         999px;

  /* Ombres : douces, jamais de bordure dure sur une carte */
  --shadow:              0 1px 2px rgba(31, 27, 51, .04), 0 6px 20px rgba(31, 27, 51, .05);
  --shadow-md:           0 2px 4px rgba(31, 27, 51, .05), 0 14px 36px rgba(31, 27, 51, .10);
  --shadow-bar:          0 1px 2px rgba(31, 27, 51, .04), 0 4px 14px rgba(31, 27, 51, .05);

  /* En-tête de page */
  --gradient-page:       linear-gradient(180deg, #efe9ff 0, #f6f3ff 150px, var(--color-bg) 340px);
  --gradient-thumb:      linear-gradient(135deg, #f0ebff 0, #e6e0ff 100%);

  --font:                -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:           ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--gradient-page) no-repeat, var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

/* Header */
header {
  text-align: left;
  margin-bottom: 2.25rem;
}
body:not(.has-sidebar) header { text-align: center; }
header h1 {
  font-size: 2.25rem;
  line-height: 1.15;
  font-weight: 750;
  color: var(--color-text);
  letter-spacing: -0.8px;
}
.subtitle {
  color: var(--color-text-muted);
  margin-top: 0.45rem;
  font-size: 1.02rem;
}

/* Card */
.card {
  background: var(--color-surface);
  border: 0;
  border-radius: var(--radius-lg);
  padding: 1.9rem 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--color-text);
  margin-bottom: 1.15rem;
}

/* Drop zone */
#drop-zone {
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  padding: 2.75rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--color-surface-soft);
  transition: border-color .2s, background .2s;
  color: var(--color-text-muted);
}
#drop-zone:hover,
#drop-zone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary-hover);
}
#drop-zone:focus-visible { outline: 3px solid var(--color-primary-ring); outline-offset: 2px; }
#drop-zone svg { margin-bottom: 0.75rem; }
#drop-zone p { font-size: 0.95rem; }
#drop-zone .hint {
  font-size: 0.875rem;
  color: var(--color-primary-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}
#drop-zone .formats {
  font-size: 0.78rem;
  margin-top: 0.5rem;
  color: var(--color-text-muted);
}

/* File info */
.file-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  background: var(--color-primary-light);
  border: 0;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--color-primary-hover);
}
#drop-zone.hidden + input + .file-info { margin-top: 0; }
.file-info svg { flex-shrink: 0; }
#file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--color-text-muted); font-size: 0.82rem; white-space: nowrap; }
#remove-file { margin-left: auto; }

/* Buttons */
button { cursor: pointer; font-family: inherit; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.72rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 650;
  transition: background .2s, opacity .2s, box-shadow .2s;
}
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); box-shadow: 0 6px 16px var(--color-primary-ring); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--color-surface-soft);
  color: var(--color-text);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.65rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 550;
  transition: background .15s, border-color .15s;
}
.btn-secondary:hover { background: var(--color-surface-hover); }
.btn-secondary:disabled,
.btn-secondary:disabled:hover {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--color-surface-soft);
  border-color: transparent;
}
.btn-primary:focus-visible, .btn-secondary:focus-visible, .btn-icon:focus-visible {
  outline: 3px solid var(--color-primary-ring);
  outline-offset: 2px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  padding: 4px;
  color: var(--color-text-muted);
  transition: color .15s, background .15s;
}
.btn-icon:hover { color: var(--color-danger); background: var(--color-danger-bg); }

/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem 1.5rem;
}
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field-full { grid-column: 1 / -1; }

label { font-size: 0.875rem; font-weight: 550; color: var(--color-text); }

select, textarea {
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-surface-soft);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  transition: border-color .2s, box-shadow .2s, background .2s;
  width: 100%;
}
.field label select { margin-top: 0.4rem; }
select:focus, textarea:focus {
  outline: none;
  background: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-ring);
}
textarea { resize: vertical; line-height: 1.5; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}
.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}
.checkbox-line input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: 0.15rem;
}
.field-hint code {
  font-family: var(--font-mono);
  background: var(--color-surface-soft);
  border: 0;
  border-radius: 6px;
  padding: 1px 5px;
}

/* Actions row */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

/* Progress */
.progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  background: var(--color-primary-light);
  border: 0;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--color-primary-hover);
  margin-bottom: 1.5rem;
}

/* Envoi du fichier audio : barre sous le libellé (la boîte passe sur deux lignes) */
.progress { flex-wrap: wrap; }
.progress > #progress-label { flex: 1 1 0; min-width: 0; }
.upload-bar { flex-basis: 100%; height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--color-primary) 18%, transparent); overflow: hidden; }
.upload-bar-fill { height: 100%; width: 0; border-radius: inherit; background: var(--color-primary); transition: width 0.25s ease-out; }
@media (prefers-reduced-motion: reduce) { .upload-bar-fill { transition: none; } }

/* Dot pulse animation */
.dot-pulse {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

/* Error */
.error-box {
  padding: 0.9rem 1.1rem;
  background: var(--color-danger-bg);
  border: 0;
  border-radius: var(--radius);
  color: var(--color-danger);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* Result */
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.result-header h2 { margin-bottom: 0; }
.result-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
/* Option de l'export Word, collée à son bouton (Transcription) */
.result-actions .docx-groupe { display: inline-flex; align-items: center; gap: 0.5rem; max-width: 100%; }
.result-actions .docx-groupe .btn-secondary { white-space: nowrap; }
.result-actions .docx-arabe { margin: 0 0.4rem 0 -0.1rem; white-space: nowrap; font-size: 0.85rem; }

/* Lecteur audio */
.audio-player {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  margin-bottom: 1.15rem;
  background: var(--color-surface-soft);
  border: 0;
  border-radius: var(--radius-lg);
}
.audio-player audio { flex: 1; min-width: 0; height: 40px; }
.audio-speed {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.audio-speed select { width: auto; padding: 0.3rem 0.5rem; font-size: 0.8rem; background: var(--color-surface); border-radius: var(--radius-xs); }

/* Éditeur WYSIWYG : texte rendu, jamais de balises */
.apbif-editor { display: flex; flex-direction: column; background: var(--color-surface-soft); border-radius: var(--radius-lg); }
.result-editor.apbif-editor { height: 70vh; min-height: 400px; }
.apbif-toolbar { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.6rem 0.7rem; }
.apbif-tool {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface);
  border: 0;
  border-radius: var(--radius-xs);
  padding: 0.38rem 0.75rem;
  transition: background .15s, color .15s;
}
.apbif-tool:hover:not(:disabled) { background: var(--color-primary-light); color: var(--color-primary-hover); }
.apbif-tool[aria-pressed="true"] { background: var(--color-primary); color: #fff; }
.apbif-tool:disabled { opacity: 0.45; cursor: not-allowed; }
.apbif-tool:focus-visible { outline: 3px solid var(--color-primary-ring); outline-offset: 1px; }
.apbif-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 3px 0.7rem 0.7rem; }
.apbif-single .apbif-surface { min-height: 76px; }
.apbif-surface {
  min-height: 100%;
  outline: none;
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.75;
}
.apbif-surface.ProseMirror-focused { box-shadow: 0 0 0 2px var(--color-primary); }
.apbif-surface p { min-height: 1.75em; }
.apbif-raw { display: none; }
.apbif-block { padding: 0.6rem 0.9rem; border-radius: var(--radius); margin: 0.6rem 0; }
.apbif-block::before {
  content: attr(data-label);
  display: block;
  width: max-content;
  font-family: var(--font);
  font-size: 0.68rem;
  line-height: 1.5;
  font-weight: 700;
  color: #fff;
  padding: 1px 9px;
  margin-bottom: 0.35rem;
  border-radius: var(--radius-pill);
  user-select: none;
}
.apbif-fr { background: var(--color-fr-bg); box-shadow: inset 4px 0 0 var(--color-fr-border); }
.apbif-fr::before { background: var(--color-fr-badge); }
.apbif-fr p { unicode-bidi: plaintext; }
.apbif-ar { background: var(--color-ar-bg); box-shadow: inset -4px 0 0 var(--color-ar-border); font-family: 'Al-Harariyy', "Noto Naskh Arabic", "Amiri", serif; font-size: 1.45rem; line-height: 2.1; text-align: right; }
.apbif-ar::before { background: var(--color-ar-badge); }
.apbif-single .apbif-block { margin: 0; padding: 0.2rem 0.3rem; background: transparent; box-shadow: none; }
.apbif-single .apbif-block::before { display: none; }
.apbif-surface em { font-style: italic; }
.apbif-surface u { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 2px; text-decoration-skip-ink: none; }

.result-output {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.cost-info {
  margin-top: 0.9rem;
  padding: 0.6rem 0.85rem;
  background: var(--color-surface-soft);
  border: 0;
  border-radius: var(--radius);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}
.cost-info .cost-free { color: var(--color-success); font-weight: 500; }
.cost-info .cost-paid { color: var(--color-warn); font-weight: 500; }

/* Language blocks */
.block-wrap { margin: 0.75rem 0; }

.block-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  margin-bottom: 6px;
}
.block-badge.badge-ar {
  background: var(--color-ar-badge);
  color: #fff;
}
.block-badge.badge-fr {
  background: var(--color-fr-badge);
  color: #fff;
}

.block-ar {
  direction: rtl;
  text-align: right;
  background: var(--color-ar-bg);
  border-right: 4px solid var(--color-ar-border);
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  /* 2026-11-14 : menu « Police arabe » retiré, Al-Harariyy imposée (taille de l'ancien choix Al-Harariyy) */
  font-family: 'Al-Harariyy', "Noto Naskh Arabic", "Amiri", serif;
  font-size: 1.35rem;
  line-height: 2.2;
  white-space: pre-wrap;
}
/* Police des versets (2026-11-14). Transcription, relecture, OCR, éditeur : texte entre ﴿ et ﴾, crochets
   compris (span.verset-hafs posé par public/versets-hafs.js, décoration dans l'éditeur TipTap).
   Traduction : bloc arabe d'une citation [VERSET] (tr-verset-ar). Al-Harariyy HAFS n'a pas les glyphes
   ﴿ ﴾ ni la ponctuation latine : le navigateur les prend alors dans Al-Harariyy (police suivante). */
.verset-hafs,
.block-ar.tr-verset-ar { font-family: 'Al-Harariyy HAFS', 'Al-Harariyy', "Noto Naskh Arabic", "Amiri", serif; }

.block-fr {
  direction: ltr;
  text-align: left;
  background: var(--color-fr-bg);
  border-left: 4px solid var(--color-fr-border);
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  font-size: 1rem;
  line-height: 1.75;
  white-space: pre-wrap;
}
.block-fr em { font-style: italic; }
.block-fr u  { text-decoration: underline; }

/* Traduction : termes surlignés (marqueur ==…==) */
mark.doctrine { background: #ffeb3b; color: inherit; padding: 0 .1em; border-radius: 2px; }
/* Traduction : structure (titre, citations, signature) — sans encadré */
.block-fr .tr-p { margin: 0 0 .5em; text-indent: 1.2em; text-align: justify; }
.tr-titre { text-align: center; font-size: 1.45rem; font-weight: 700; color: #3b1c5a; border-bottom: 1px solid #b9a3cf; padding-bottom: .3em; margin: .2em 0 .4em; text-indent: 0; }
.tr-soustitre { text-align: center; font-style: italic; color: var(--color-text-muted); margin-bottom: .6em; }
.tr-meta { text-align: center; color: var(--color-text-muted); font-size: .9rem; }
.block-ar.tr-quote-ar { text-align: center; }
.tr-translit { text-align: center; font-style: italic; margin: .2em 0; }
.tr-sens { margin: .3em 0 .1em; text-align: justify; }
.tr-sens-verset span { font-weight: 700; }
.tr-sens-hadith span { font-weight: 700; font-style: italic; }
.tr-ref { text-align: right; font-size: .82rem; color: var(--color-text-muted); margin-bottom: .8em; }
.tr-signature { text-align: right; font-weight: 600; border-top: 1px solid #b9a3cf; padding-top: .4em; margin-top: 1em; }
.lang-row { display: flex; gap: .5rem; align-items: center; }

/* Utilities */
.hidden { display: none !important; }

/* Footer */
footer {
  text-align: center;
  margin-top: 3rem;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

/* ============================================================
   Model cards
   ============================================================ */
.model-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.85rem;
  margin-top: 0.5rem;
}

.model-card {
  position: relative;
  display: block;
  padding: 1.05rem 1.15rem;
  background: var(--color-surface-soft);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.15s ease;
}

.model-card:hover {
  background: var(--color-surface-hover);
}

.model-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.model-card:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  box-shadow: 0 0 0 3px var(--color-primary-ring);
}
.model-card:has(input:focus-visible) { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.model-card-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.4rem;
}

.model-card-badges {
  display: flex;
  gap: 4px;
  margin-bottom: 0.65rem;
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
}

.badge-default  { background: #ddd0f7; color: #5b21b6; }
.badge-quality  { background: #c9f4d8; color: #166534; }
.badge-preview  { background: #fde68a; color: #92400e; }
.badge-recommended { background: #ede9fe; color: #4c1d95; }
.badge-alt      { background: #e6e9f1; color: #475569; }
.badge-latest   { background: #dbeafe; color: #1e40af; }
.badge-gold     { background: #fef3c7; color: #92400e; }
.badge-new      { background: #dcfce7; color: #15803d; }

.model-card-info {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.info-label {
  font-weight: 600;
  color: var(--color-text-muted);
}

/* Transcription enregistrée */
.doc-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-bottom: 1.15rem; }
.doc-title-label { color: var(--color-text-muted); font-size: 0.8rem; }
.doc-title {
  flex: 1 1 240px;
  min-width: 0;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface-soft);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.55rem 0.8rem;
}
.doc-title:focus { outline: none; background: var(--color-surface); border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-ring); }
.doc-title:read-only { background: var(--color-bg); }
.doc-status { font-size: 0.8rem; color: var(--color-text-muted); }

/* Mes transcriptions : sous-navigation + recherche + filtres + cartes */
body.ts-page .container { max-width: 1240px; }
.ts-layout { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.ts-subnav-toggle { display: none; }
.ts-subnav { display: flex; flex-direction: column; gap: 0.2rem; }
/* Colonne de gauche (vues + dossiers) collée en haut d'un seul bloc, défilante si l'arborescence est longue */
.ts-layout > div:first-child { position: sticky; top: 2rem; max-height: calc(100vh - 4rem); overflow-y: auto; }
.ts-dz { margin-top: 1.5rem; padding-top: 1.1rem; border-top: 1px solid var(--color-border); }
.ts-subnav button {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 550;
  text-align: left;
  color: var(--color-text);
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  padding: 0.62rem 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  transition: background .15s, color .15s;
}
.ts-subnav button:hover { background: var(--color-surface-hover); }
.ts-subnav button[aria-current="true"] { background: var(--color-primary-soft); color: var(--color-primary-hover); font-weight: 700; }
.ts-count { color: var(--color-text-muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.ts-page-title { font-size: 2.25rem; line-height: 1.15; font-weight: 750; letter-spacing: -0.8px; margin-bottom: 1.5rem; }
.ts-search { position: relative; }
.ts-search svg { position: absolute; left: 1.15rem; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); pointer-events: none; }
.ts-search input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow);
  padding: 0.85rem 1.25rem 0.85rem 3rem;
  transition: border-color .15s, box-shadow .15s;
}
.ts-search input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-ring); }
.ts-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 1rem 0 1.5rem; }
.ts-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; }
.ts-pill {
  width: auto;
  max-width: 100%;
  font-size: 0.85rem;
  font-weight: 550;
  background-color: var(--color-surface-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0.42rem 0.8rem;
}
.ts-pill.is-on { background-color: var(--color-primary-light); color: var(--color-primary-hover); }
.ts-reset { font: inherit; font-size: 0.85rem; color: var(--color-primary-hover); background: none; border: 0; text-decoration: underline; text-underline-offset: 2px; padding: 0.3rem; }
.ts-tools { display: flex; align-items: center; gap: 0.25rem; }
.ts-tool { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; color: var(--color-text-muted); background: transparent; border: 0; border-radius: 50%; transition: background .15s, color .15s; }
.ts-tool:hover { background: var(--color-surface-hover); color: var(--color-text); }
.ts-tool[aria-pressed="true"] { background: var(--color-primary-light); color: var(--color-primary-hover); }
.ts-tool:focus-visible, .ts-subnav button:focus-visible { outline: 3px solid var(--color-primary-ring); outline-offset: 1px; }
.ts-sep { width: 1px; height: 22px; background: var(--color-border-strong); margin: 0 0.3rem; }
.ts-total { color: var(--color-text-muted); font-size: 0.85rem; margin-bottom: 0.9rem; }
.ts-list { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.ts-item { display: flex; flex-direction: column; min-width: 0; background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; transition: box-shadow .15s, transform .15s; }
.ts-item:hover { box-shadow: var(--shadow-md); }
.ts-thumb { display: flex; align-items: center; justify-content: center; height: 96px; color: var(--color-primary); background: var(--gradient-thumb); text-decoration: none; }
.ts-main { flex: 1; min-width: 0; padding: 0.95rem 1.1rem 0.5rem; }
.ts-title { display: block; font-weight: 700; font-size: 1rem; line-height: 1.35; color: var(--color-text); text-decoration: none; overflow-wrap: anywhere; }
.ts-title:hover { color: var(--color-primary-hover); text-decoration: underline; text-underline-offset: 2px; }
.ts-sub { display: flex; align-items: flex-start; gap: 0.35rem; margin-top: 0.3rem; font-size: 0.8rem; line-height: 1.4; color: var(--color-text-muted); }
.ts-sub svg { flex-shrink: 0; margin-top: 2px; }
.ts-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.55rem; }
.ts-badge { font-size: 0.72rem; font-weight: 650; padding: 1px 9px; border-radius: var(--radius-pill); background: var(--color-surface-soft); color: var(--color-text-muted); }
.ts-badge.is-shared { background: var(--color-primary-light); color: var(--color-primary-hover); }
.ts-badge.is-ready { background: var(--color-success-bg); color: var(--color-success); }
.ts-actions { display: flex; flex-wrap: wrap; gap: 0.15rem; padding: 0.4rem 0.55rem 0.8rem; }
.ts-actions .btn-secondary { padding: 0.36rem 0.5rem; font-size: 0.78rem; background: transparent; }
.ts-actions .btn-secondary:hover { background: var(--color-surface-soft); }
.btn-secondary.ts-danger, .ts-danger { color: var(--color-danger); }
.btn-secondary.ts-danger:hover { background: var(--color-danger-bg); }
.ts-list.is-rows { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
.is-rows .ts-item { flex-direction: row; flex-wrap: wrap; align-items: center; }
.is-rows .ts-thumb { width: 64px; height: auto; align-self: stretch; }
.is-rows .ts-main { flex: 1 1 260px; padding: 0.8rem 1.1rem; }
.is-rows .ts-actions { padding: 0.5rem 0.9rem; }
.ts-empty { color: var(--color-text-muted); font-size: 0.95rem; padding: 2.5rem 1.5rem; text-align: center; background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); }

/* Dialogues (partage, suppression d'un compte) */
.ts-dialog { margin: auto; width: min(500px, calc(100vw - 32px)); padding: 1.6rem; border: 0; border-radius: var(--radius-lg); background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-md); }
.ts-dialog::backdrop { background: rgba(31, 27, 51, .4); }
.ts-dialog h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.9rem; overflow-wrap: anywhere; }
.ts-dialog p { font-size: 0.875rem; margin-bottom: 0.75rem; }
.ts-choice { display: block; font-size: 0.9rem; font-weight: 550; margin-bottom: 0.7rem; cursor: pointer; }
.ts-choice input { accent-color: var(--color-primary); }
.ts-choice small { display: block; margin-left: 1.4rem; font-weight: 400; color: var(--color-text-muted); font-size: 0.8rem; }
.ts-choice select { margin-top: 0.3rem; }
.ts-accounts { margin: 0 0 0.75rem 1.4rem; max-height: 180px; overflow-y: auto; }
.ts-accounts label { display: block; font-size: 0.875rem; font-weight: 400; }
.ts-accounts input { accent-color: var(--color-primary); }
.ts-dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.1rem; }
.ts-error { color: var(--color-danger); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .audio-player { flex-direction: column; align-items: stretch; }
  .audio-player audio { flex: none; width: 100%; }
}

@media (max-width: 900px) {
  .ts-layout { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
  .ts-subnav-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 650;
    color: var(--color-primary-hover);
    background: var(--color-primary-light);
    border: 0;
    border-radius: var(--radius);
    padding: 0.65rem 0.9rem;
  }
  .ts-subnav { position: static; display: none; margin-top: 0.4rem; }
  .ts-layout > div:first-child { position: static; max-height: none; overflow: visible; }
  .ts-dz { margin-top: 0.6rem; padding-top: 0; border-top: 0; }
  .ts-subnav.is-open { display: flex; }
}

@media (max-width: 640px) {
  .container { padding: 1.5rem 1rem 3rem; }
  header { margin-bottom: 1.5rem; }
  header h1 { font-size: 1.7rem; letter-spacing: -0.5px; }
  .ts-page-title { font-size: 1.7rem; letter-spacing: -0.5px; }
  .card { padding: 1.35rem 1.15rem; margin-bottom: 1.15rem; }
  .settings-grid { grid-template-columns: 1fr; }
  .model-cards { grid-template-columns: 1fr; }
  .result-header { flex-direction: column; align-items: flex-start; }
  .result-output { max-height: 50vh; }
  .block-ar { font-size: 1.05rem; }
}
