/* NeuroScribe — thème clair sobre (inspiration Apple, adapté au médical)
   Principes : fonds blancs/gris très clair, aucun dégradé, aucune lueur,
   aucune transparence floue, accent bleu unique, statuts en pastilles plates. */

:root {
  --bg-dark: #f5f5f7; --bg-card: #ffffff; --border-glass: rgba(0,0,0,0.09);
  --text-main: #1d1d1f; --text-muted: #6e6e73;
  --accent: #0071e3; --accent-glow: transparent;
  --success: #248a3d; --error: #d70015; --pending: #b25000;
  /* dictaphone */
  --card-bg: #ffffff; --card-border: rgba(0,0,0,0.09);
  --primary: #0071e3; --primary-glow: transparent;
  --accent-irm: #0071e3; --accent-scan: #1d1d1f;
  --record-red: #ff3b30; --record-glow: transparent;
  /* login */
  --bg-base: #f5f5f7; --accent-cyan: #0071e3; --accent-blue: #0071e3;
  --input-bg: #ffffff; --input-border: rgba(0,0,0,0.18); --danger: #d70015;
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html, body {
  background: #f5f5f7 !important; background-image: none !important;
  color: #1d1d1f !important;
  font-family: var(--font-ui) !important;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}
body::before, body::after { display: none !important; content: none !important; }
* { text-shadow: none !important; }
*, *::before, *::after { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
::selection { background: rgba(0,113,227,0.2); }

h1, h2, h3, h4 { font-family: var(--font-ui) !important; color: #1d1d1f; letter-spacing: -0.022em; font-weight: 600; }
a { color: #0066cc; }

/* ---------- En-tête ---------- */
header {
  border-bottom: 1px solid rgba(0,0,0,0.09) !important;
  padding-bottom: 1.25rem !important; margin-bottom: 2rem !important;
}
header h1 {
  background: none !important; -webkit-background-clip: initial !important; background-clip: initial !important;
  -webkit-text-fill-color: #1d1d1f !important; color: #1d1d1f !important;
  font-size: 2rem !important; font-weight: 700 !important; letter-spacing: -0.03em !important;
}
header p, header .subtitle { color: #6e6e73 !important; }

/* ---------- Cartes ---------- */
.card, .login-card, .center-card, .result-card, .recorder-box, .dosimetry-box {
  background: #ffffff !important; border: 1px solid rgba(0,0,0,0.08) !important;
  border-radius: 18px !important; box-shadow: none !important;
}
.card:hover { transform: none !important; box-shadow: 0 2px 12px rgba(0,0,0,0.06) !important; }
.card h3 {
  color: #6e6e73 !important; font-size: 0.78rem !important; font-weight: 600 !important;
  text-transform: none !important; letter-spacing: 0 !important;
}
.card .value { color: #1d1d1f !important; font-weight: 700 !important; letter-spacing: -0.03em !important; }
.kpi-grid .card { border-top: 1px solid rgba(0,0,0,0.08) !important; }

/* ---------- Tableaux ---------- */
table { margin-top: 0.5rem; }
th {
  color: #6e6e73 !important; font-weight: 500 !important; font-size: 0.78rem !important;
  text-transform: none !important; letter-spacing: 0 !important;
  border-bottom: 1px solid rgba(0,0,0,0.12) !important; background: transparent !important;
}
td { color: #1d1d1f; border-bottom: 1px solid rgba(0,0,0,0.06) !important; }
tbody tr:hover { background-color: #fafafc !important; }

/* ---------- Statuts : pastilles plates ---------- */
.badge { border-radius: 980px !important; font-weight: 500 !important; padding: 0.2rem 0.7rem !important; border: none !important; }
.badge.success   { background: #e3f4e8 !important; color: #1f7a38 !important; }
.badge.error     { background: #fde8ea !important; color: #c3101f !important; }
.badge.pending   { background: #fdf0dc !important; color: #9a4a00 !important; }
.badge.transcribing { background: #e5f0fc !important; color: #0058b0 !important; }
.badge.copied    { background: #d4eddb !important; color: #1f7a38 !important; }
.badge.edit-pending { background: #efe9f8 !important; color: #5b3a96 !important; }
.badge.review    { background: #fdf0dc !important; color: #9a4a00 !important; font-weight: 500 !important; }

/* ---------- Boutons ---------- */
button, .btn, .copy-btn, .dic-btn { font-family: var(--font-ui) !important; }
.copy-btn {
  background: #0071e3 !important; color: #fff !important; border-radius: 980px !important;
  box-shadow: none !important; font-weight: 500 !important;
}
.copy-btn:hover { background: #0077ed !important; transform: none !important; box-shadow: none !important; }
.dic-btn {
  background: #f5f5f7 !important; color: #0066cc !important; border: none !important;
  border-radius: 980px !important; box-shadow: none !important; font-weight: 500 !important;
}
.dic-btn:hover { background: #e8e8ed !important; color: #0066cc !important; transform: none !important; }

button[style*="background: #"], .btn-submit, .btn-send, .btn-action {
  border-radius: 12px !important; box-shadow: none !important;
}
.btn-submit, .btn-send {
  background: #0071e3 !important; color: #fff !important; border: none !important; font-weight: 500 !important;
}
.btn-submit:hover, .btn-send:hover { background: #0077ed !important; }
.btn-action, .btn-cancel {
  background: #f5f5f7 !important; color: #1d1d1f !important; border: none !important; font-weight: 500 !important;
}
.btn-action:hover, .btn-cancel:hover { background: #e8e8ed !important; }
.btn-send { background: #0071e3 !important; color: #fff !important; }

/* ---------- Champs ---------- */
input, select, textarea {
  font-family: var(--font-ui) !important; color: #1d1d1f !important;
  background: #ffffff !important; border: 1px solid rgba(0,0,0,0.18) !important;
  border-radius: 12px !important; box-shadow: none !important;
}
input::placeholder, textarea::placeholder { color: #86868b !important; }
input:focus, select:focus, textarea:focus {
  outline: none !important; border-color: #0071e3 !important; box-shadow: 0 0 0 4px rgba(0,113,227,0.18) !important;
}
select option { background: #fff; color: #1d1d1f; }

/* ---------- Fenêtres modales ---------- */
dialog {
  background: #ffffff !important; color: #1d1d1f !important;
  border: none !important; border-radius: 20px !important;
  box-shadow: 0 24px 70px rgba(0,0,0,0.20) !important;
}
dialog::backdrop { background: rgba(0,0,0,0.32); }
dialog h2, dialog h3 { color: #1d1d1f !important; }
dialog label { color: #6e6e73 !important; }

/* ---------- Chat ---------- */
.chat-toggle { background: #0071e3 !important; box-shadow: 0 4px 14px rgba(0,0,0,0.18) !important; }
.chat-panel { background: #ffffff !important; border: 1px solid rgba(0,0,0,0.1) !important; border-radius: 18px !important; box-shadow: 0 20px 50px rgba(0,0,0,0.16) !important; }
.chat-header { background: #f5f5f7 !important; color: #1d1d1f !important; border-bottom: 1px solid rgba(0,0,0,0.08) !important; }
.chat-message.sent { background: #0071e3 !important; color: #fff !important; }
.chat-message.received { background: #f0f0f3 !important; color: #1d1d1f !important; }
.chat-input-area { background: #fafafc !important; border-top: 1px solid rgba(0,0,0,0.08) !important; }
.chat-input-area input { background: #fff !important; color: #1d1d1f !important; }
.chat-input-area button { background: #0071e3 !important; border-radius: 12px !important; }

/* ---------- Login ---------- */
.login-card { padding: 2.5rem !important; }
.logo-badge {
  background: #1d1d1f !important; color: #fff !important; box-shadow: none !important; border: none !important;
  border-radius: 14px !important;
}
.brand-title {
  background: none !important; -webkit-text-fill-color: #1d1d1f !important; color: #1d1d1f !important;
  font-weight: 700 !important; letter-spacing: -0.03em !important;
}
.security-pill { background: #f5f5f7 !important; color: #6e6e73 !important; border: none !important; }
.otp-input { background: #fff !important; color: #1d1d1f !important; border: 1px solid rgba(0,0,0,0.18) !important; }

/* ---------- Dictaphone ---------- */
.brand-badge { background: #f5f5f7 !important; color: #6e6e73 !important; border: none !important; box-shadow: none !important; animation: none !important; border-radius: 980px !important; }
.center-card { color: #1d1d1f !important; }
.center-card.active { border: 2px solid #0071e3 !important; background: #fff !important; }
.center-card.scanner.active { border: 2px solid #1d1d1f !important; }
.center-card h3, .center-card .center-name { color: #1d1d1f !important; }
.center-card p, .center-card span { color: #6e6e73; }
.recorder-box { background: #ffffff !important; }
.btn-record {
  background: #ff3b30 !important; color: #fff !important; box-shadow: none !important; border: none !important;
}
.btn-record:hover { background: #ff453a !important; }
.btn-record.recording { background: #1d1d1f !important; animation: none !important; }
.result-card { color: #1d1d1f !important; }
.result-badge { background: #e5f0fc !important; color: #0058b0 !important; border: none !important; }
.overlay-loader { background: rgba(255,255,255,0.88) !important; color: #1d1d1f !important; }
.step-item { color: #6e6e73 !important; }
.step-item.active, .step-item.done { color: #1d1d1f !important; }
.booth-sync-notice { background: #f5f5f7 !important; color: #6e6e73 !important; border: none !important; }

/* ---------- Accessoires ---------- */
hr { border-color: rgba(0,0,0,0.08) !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 10px; border: 2px solid #fff; }
::-webkit-scrollbar-track { background: transparent; }

/* Libellés de formulaire lisibles sur fond blanc */
label { color: #6e6e73 !important; font-weight: 500; }
.login-footer, .login-card small, .login-card p { color: #6e6e73 !important; }
.login-card a { color: #0066cc !important; }

/* ---------- Dictaphone : lisibilité (compteur, centres, aperçu) ---------- */
.timer {
  color: #1d1d1f !important; font-size: 3rem !important; font-weight: 700 !important;
  letter-spacing: -0.02em !important; font-variant-numeric: tabular-nums;
}
.rec-status { color: #424245 !important; font-weight: 500 !important; }
.selector-label { color: #1d1d1f !important; font-weight: 600 !important; }
.center-card { background: #ffffff !important; border: 1.5px solid rgba(0,0,0,0.14) !important; }
.center-card.active { background: #eef5fd !important; border: 2px solid #0071e3 !important; }
.center-card.scanner.active { background: #f0f0f3 !important; border: 2px solid #1d1d1f !important; }
.center-title { color: #1d1d1f !important; font-weight: 700 !important; }
.center-sub { color: #6e6e73 !important; }
.btn-cancel { background: #e8e8ed !important; color: #1d1d1f !important; border: none !important; }
.btn-send { background: #0071e3 !important; color: #fff !important; box-shadow: none !important; }
.btn-send:disabled, .btn-action:disabled { opacity: 0.35 !important; }
.result-card { border: 1.5px solid rgba(0,0,0,0.1) !important; }
.result-header { border-bottom: 1px solid rgba(0,0,0,0.1) !important; }
.result-badge { background: #e3f4e8 !important; color: #1f7a38 !important; border: none !important; }
.report-preview-text { background: #f5f5f7 !important; border: 1px solid rgba(0,0,0,0.08) !important; color: #1d1d1f !important; }
.report-preview-text b, .report-preview-text strong { color: #1d1d1f !important; }
.dosimetry-box { background: #fdf0dc !important; border: none !important; color: #9a4a00 !important; }
.recorder-box { border: 1.5px solid rgba(0,0,0,0.12) !important; }
.btn-record { border: 4px solid #ffffff !important; outline: 1px solid rgba(0,0,0,0.12); }

/* =====================================================================
   Identité NeuroScribe + mise en page finale (v5)
   ===================================================================== */

/* ---------- Back-office : largeur, ordre des blocs ---------- */
body.page-backoffice {
  max-width: 1280px; margin: 0 auto !important; padding: 2rem 2.5rem 4rem !important;
  display: flex; flex-direction: column;
}
body.page-backoffice > * { flex-shrink: 0; }
body.page-backoffice #recentCard { order: 1; margin-bottom: 2rem; }
body.page-backoffice .charts-container { order: 2; }
body.page-backoffice #adminUsersSection, body.page-backoffice #adminSystemSection,
body.page-backoffice #adminResetSection, body.page-backoffice #adminAliasSection,
body.page-backoffice #adminSyncSection, body.page-backoffice #billingSection,
body.page-backoffice #adminTrashSection { order: 3; }
body.page-backoffice .chart-wrapper { height: 240px !important; }
body.page-backoffice .kpi-grid { gap: 1rem !important; }

/* ---------- En-tête / marque ---------- */
header h1.brand {
  display: flex !important; align-items: center; gap: 0.7rem;
  font-size: 1.45rem !important; letter-spacing: -0.025em !important; margin: 0;
}
.brand-mark { width: 34px; height: 34px; display: block; }
.brand-word { font-weight: 400; }
.brand-word b { font-weight: 700; }
.brand-center {
  font-size: 1rem; font-weight: 500; color: #6e6e73; -webkit-text-fill-color: #6e6e73;
  padding-left: 0.8rem; border-left: 1px solid rgba(0,0,0,0.15); letter-spacing: -0.01em;
}
.brand-center:empty { display: none; }

header nav { gap: 0.25rem !important; }
header nav .dic-btn {
  background: transparent !important; color: #1d1d1f !important; border: none !important;
  padding: 0.5rem 0.85rem !important; border-radius: 980px !important;
  font-size: 0.88rem !important; font-weight: 500 !important;
}
header nav .dic-btn:hover { background: #e8e8ed !important; }
header nav #navDictaphoneBtn { background: #0071e3 !important; color: #fff !important; margin-right: 0.35rem; }
header nav #navDictaphoneBtn:hover { background: #0077ed !important; }
header nav #navLogoutBtn { color: #6e6e73 !important; }
#userProfileBadge {
  background: transparent !important; border: none !important; padding: 0.4rem 0.6rem !important;
  border-left: 1px solid rgba(0,0,0,0.12) !important; border-radius: 0 !important; margin-left: 0.35rem;
}
#userProfileName { color: #1d1d1f !important; font-weight: 500 !important; }

/* ---------- Indicateurs ---------- */
.kpi-grid .card { padding: 1.25rem 1.4rem !important; text-align: left !important; }
.kpi-grid .card .value { font-size: 2.1rem !important; margin: 0.35rem 0 0.15rem !important; color: #1d1d1f; }
#kpiMessagesCard:hover { background: #fafafc !important; }
/* emplacement gris pendant le chargement (valeur vide) */
.card .value:empty::before {
  content: ""; display: block; width: 56px; height: 2.1rem; border-radius: 8px; background: #ececf0;
}

/* ---------- Tableau ---------- */
#recentCard h3, .card > h3 { color: #1d1d1f !important; font-size: 1.05rem !important; font-weight: 600 !important; }
.badge.formatting { background: #e5f0fc !important; color: #0058b0 !important; }
#recentTable td button svg { display: block; }
#recentTable tbody:empty::after {
  content: "Aucune dictée pour le moment"; display: table-cell; padding: 2.5rem 1rem;
  color: #86868b; font-size: 0.9rem;
}

/* ---------- Dictaphone : marque + exemples ---------- */
.brand-lockup {
  display: inline-flex; align-items: center; gap: 0.55rem; margin-bottom: 0.6rem;
  font-size: 1.05rem; letter-spacing: -0.02em; color: #1d1d1f;
}
.brand-lockup span { font-weight: 400; }
.brand-lockup b { font-weight: 700; }
.selector-label {
  text-transform: none !important; letter-spacing: -0.01em !important;
  font-size: 0.95rem !important; color: #1d1d1f !important; font-weight: 600 !important;
}
canvas#visualizer {
  height: 40px !important; margin-bottom: 0.75rem !important;
  background: linear-gradient(#e5e5ea, #e5e5ea) center / 100% 1px no-repeat;
}
.templates-box {
  margin: 0.5rem 0 1.25rem 0; background: #ffffff; border: 1.5px solid rgba(0,0,0,0.12);
  border-radius: 18px; padding: 1rem;
}
.templates-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.75rem; }
.templates-title { font-size: 0.95rem; font-weight: 600; color: #1d1d1f; letter-spacing: -0.01em; }
.templates-hint { font-size: 0.75rem; color: #86868b; }
.templates-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.tpl-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.1rem;
  background: #f5f5f7 !important; border: none !important; border-radius: 12px !important;
  padding: 0.75rem 0.4rem !important; cursor: pointer; transition: background 0.15s;
  font-family: var(--font-ui) !important;
}
.tpl-btn:hover { background: #e8e8ed !important; }
.tpl-btn:active { background: #dcdce1 !important; }
.tpl-mod { font-size: 0.7rem; font-weight: 500; color: #6e6e73; }
.tpl-name { font-size: 0.95rem; font-weight: 600; color: #1d1d1f; }

/* ---------- Connexion ---------- */
.bg-grid { display: none !important; }
.logo-badge {
  background: none !important; border: none !important; box-shadow: none !important;
  width: auto !important; height: auto !important; padding: 0 !important; margin: 0 auto 1rem !important;
  display: flex !important; justify-content: center;
}
.logo-badge img { display: block; border-radius: 14px; }

/* Libellés d'indicateurs : petits, gris (prioritaires sur le titre de carte) */
.kpi-grid .card h3 { font-size: 0.82rem !important; font-weight: 500 !important; color: #6e6e73 !important; margin-bottom: 0.2rem !important; }

/* Fenêtres modales centrées (le reset "* { margin: 0 }" des pages les collait en haut à gauche) */
dialog[open] { margin: auto !important; }
dialog button:focus { outline: none; }
dialog button:focus-visible { outline: 2px solid rgba(0,113,227,0.55); outline-offset: 2px; border-radius: 8px; }

/* Date et centre sur une seule ligne */
#recentTable td:nth-child(3), #recentTable td:nth-child(4) { white-space: nowrap; }
