@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Palette calquée sur le logo ARH : vert feuilles vif + anthracite */
  --primary: #4e8c1a;
  --primary-dark: #386010;
  --primary-light: #eef6e4;
  --secondary: #6db33f;
  --bg: #f7f8f5;
  --bg-alt: #eef0ea;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --muted: #5e6e52;
  --border: #d8e0cc;
  --success: #4e8c1a;
  --error: #c0392b;
  --radius: 12px;
}

/* ========== MODE SOMBRE ========== */
[data-theme="dark"] {
  --primary: #7cc93f;
  --primary-dark: #6db33f;
  --primary-light: #1a2e0a;
  --secondary: #94d456;
  --bg: #111a0e;
  --bg-alt: #1a2814;
  --card-bg: #162210;
  --text: #e4edd8;
  --muted: #8aaa72;
  --border: #2a3f1e;
  --success: #7cc93f;
  --error: #e06060;
}
[data-theme="dark"] .site-header { background: #162210; }
[data-theme="dark"] .nav-dropdown__menu { background: #1e3016; }
[data-theme="dark"] .question-block { background: #1a2810; }
[data-theme="dark"] .question-block.locked { background: #1a2e10; }
[data-theme="dark"] .chat-window { background: #162210; }
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select { background: #1a2810; color: var(--text); }
[data-theme="dark"] .arh-banner { background: #1e3a10; }



* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img { max-width: 100%; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Bandeau ARH */
.arh-banner {
  background: var(--primary);
  color: #fff;
  font-size: 0.82rem;
  text-align: center;
  padding: 8px 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.arh-banner-icon { margin-right: 6px; }

/* ========== HEADER / NAVBAR ========== */

.site-header {
  background: var(--card-bg);
  border-bottom: 2px solid var(--primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  gap: 16px;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.brand-name {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
}
.brand-sub {
  font-size: 0.68rem;
  color: var(--primary);
  font-weight: 500;
  letter-spacing: 0.03em;
}
.school-logo-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  width: 52px;
  flex-shrink: 0;
}
.brand img.school-logo {
  height: 52px;
  width: 52px;
  object-fit: contain;
}
.school-logo-placeholder {
  height: 52px;
  width: 52px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--primary);
}

/* ---- Main nav ---- */
nav.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
  min-width: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-link:hover { background: var(--bg-alt); color: var(--primary); text-decoration: none; }
.nav-link--active { color: var(--primary); font-weight: 700; background: var(--primary-light); }

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-link:hover .nav-icon,
.nav-link--active .nav-icon { opacity: 1; }

.nav-chevron {
  width: 14px;
  height: 14px;
  opacity: 0.5;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.nav-dropdown.open .nav-chevron { transform: rotate(180deg); }

.nav-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 6px;
}

/* ---- Dropdown ---- */
.nav-dropdown {
  position: relative;
}
.nav-dropdown__menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  min-width: 200px;
  padding: 6px;
  z-index: 200;
  animation: dropIn 0.15s ease;
}
.nav-dropdown--right .nav-dropdown__menu { left: auto; right: 0; min-width: 220px; }
.nav-dropdown.open .nav-dropdown__menu { display: block; }

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nav-dropdown__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.nav-dropdown__item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.6; }
.nav-dropdown__item:hover { background: var(--bg-alt); color: var(--primary); text-decoration: none; }
.nav-dropdown__item:hover svg { opacity: 1; }
.nav-dropdown__item--danger { color: var(--error); }
.nav-dropdown__item--danger:hover { background: #fde8e8; color: var(--error); }

.nav-dropdown__divider { height: 1px; background: var(--border); margin: 5px 0; }

.nav-dropdown__header {
  padding: 8px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-dropdown__header strong { font-size: 0.88rem; color: var(--text); }
.nav-dropdown__header span { font-size: 0.75rem; color: var(--muted); }

/* Le trigger utilisateur : bouton circulaire standalone (pas de nav-link) */
.nav-user-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: border-color 0.15s;
}
.nav-user-trigger:hover { border-color: var(--primary); }
.nav-avatar {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

/* ---- Burger mobile ---- */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }


/* Layout */
main.page {
  padding: 32px 0 64px;
  flex: 1 0 auto;
  width: 100%;
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.card h2, .card h3 { margin-top: 0; }
.grid {
  display: grid;
  gap: 20px;
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* Forms */
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  margin-bottom: 16px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,92,58,0.1);
}
textarea { resize: vertical; min-height: 100px; }
.form-group { margin-bottom: 16px; }

.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-secondary { background: var(--muted); }
.btn-secondary:hover { background: #47584a; }
.btn-danger { background: var(--error); }
.btn-danger:hover { background: #a93226; }
.btn-success { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-success:hover { background: #15803d; border-color: #15803d; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

/* Flash messages */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 0.92rem; }
.flash-success { background: #d1f0de; color: #0d3d22; border: 1px solid #a3e0bb; }
.flash-error { background: #fde8e8; color: #7b1111; border: 1px solid #f5b8b8; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-pending { background: #fef3c7; color: #78400a; }
.badge-approved { background: #d1f0de; color: #0d3d22; }
.badge-draft { background: var(--bg-alt); color: var(--muted); }
.badge-active { background: #d1f0de; color: #0d3d22; }
.badge-archived { background: #f1f5f1; color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 10px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
table th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }

/* Hero */
.hero {
  text-align: center;
  padding: 60px 20px;
}
.hero h1 { font-size: 2.4rem; margin-bottom: 12px; color: var(--text); }
.hero p { color: var(--muted); font-size: 1.05rem; max-width: 600px; margin: 0 auto 28px; }
.hero .btn { margin: 4px; }

/* Footer */
footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  color: var(--muted);
  font-size: 0.82rem;
  flex-shrink: 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
footer.site-footer a { color: var(--muted); margin: 0 6px; }
footer.site-footer a:hover { color: var(--primary); }

/* Question builder */
.question-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
  background: #fafcfa;
}
.question-block.locked {
  background: var(--primary-light);
  border-color: #a3d4b8;
}
.option-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.option-row input { margin-bottom: 0; }

.survey-share-card { border: 1px solid var(--primary); border-radius: 10px; padding: 10px 14px; margin-top: 6px; background: var(--primary-light); }

/* Public survey */
.public-page { background: linear-gradient(135deg, #f0f7f2, #eef1ee); min-height: 100vh; }
.public-card { max-width: 640px; margin: 40px auto; }

/* Print */
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
}
.print-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 0;
  width: 210mm;
  height: 297mm;
  margin: 0 auto;
}
.print-card {
  border: 1.5px dashed #999;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.print-card h3 { margin: 0 0 6px; font-size: 1rem; }
.print-card p { margin: 0 0 8px; font-size: 0.75rem; color: #444; }
.print-card img { width: 110px; height: 110px; margin-bottom: 8px; }
.print-card .link { font-size: 0.8rem; font-weight: 700; word-break: break-all; }

/* ========== BADGE RÉPONSES (navbar) ========== */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-badge--inline {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.7rem;
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}
.chart-toggle-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ========== SLUG BOX (liste sondages) ========== */
.survey-slug-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-alt);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 0;
}
.survey-slug-code {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  color: var(--primary);
  font-family: monospace;
}





@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .brand-sub { display: none; }
  .site-header { position: relative; }

  nav.main-nav {
    display: none;
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-bottom: 2px solid var(--primary);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px 12px 16px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    z-index: 99;
  }
  nav.main-nav.open { display: flex; }

  /* En mobile, les dropdowns s'affichent inline */
  .nav-dropdown { width: 100%; }
  .nav-dropdown__trigger { width: 100%; justify-content: flex-start; }
  .nav-dropdown__menu {
    position: static;
    box-shadow: none;
    border: none;
    border-left: 2px solid var(--primary-light);
    border-radius: 0;
    padding: 0 0 0 12px;
    margin: 4px 0 4px 12px;
    animation: none;
  }
  .nav-dropdown.open .nav-dropdown__menu { display: block; }

  .nav-link { width: 100%; }
  .nav-sep { display: none; }
  /* Le bouton avatar garde sa taille — pas de width:100% */

  .print-grid {
    width: 100%;
    height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  .footer-inner { flex-direction: column; text-align: center; }
}


/* ========== STAT CARDS (dashboard / admin) ========== */

.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.stat-card--primary { border-left: 4px solid var(--primary); }
.stat-card--warn { border-left: 4px solid #f59e0b; }
.stat-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-card__body { min-width: 0; }
.stat-card__num {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  margin: 0;
}
.stat-card__label {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 3px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== ACTION CARDS (dashboard raccourcis) ========== */

.card--action {
  display: block;
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow 0.15s, transform 0.12s, border-color 0.15s;
  text-align: center;
  padding: 28px 20px;
}
.card--action:hover {
  box-shadow: 0 6px 20px rgba(78,140,26,0.15);
  border-color: var(--primary);
  transform: translateY(-2px);
  text-decoration: none;
}
.card--action h3 { margin: 10px 0 6px; color: var(--text); }
.card--action p { color: var(--muted); font-size: 0.88rem; margin: 0; }

/* ========== AUTH PAGES ========== */

.auth-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: 32px 16px;
}
.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.auth-footer-note {
  margin-top: 18px;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  max-width: 340px;
}

/* ========== NOTES ========== */

.note-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: box-shadow 0.15s;
}
.note-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.07); }
.note-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.note-card__header h3 { margin: 0; font-size: 1rem; }
.note-card__excerpt {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0;
  flex: 1;
}
.note-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.note-shared {
  background: var(--bg-alt);
  border-radius: 10px;
  padding: 16px;
}

/* ========== CHAT ========== */

.chat-window {
  height: 52vh;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg);
  scroll-behavior: smooth;
}
.chat-message {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  align-items: flex-end;
}
.chat-message--me {
  flex-direction: row-reverse;
}
.chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.chat-bubble-wrap { max-width: 70%; }
.chat-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.chat-message--me .chat-meta { text-align: right; }
.chat-bubble {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 2px;
  padding: 10px 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  display: inline-block;
  word-break: break-word;
}
.chat-message--me .chat-bubble {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  border-radius: 12px 12px 2px 12px;
}
.chat-form-wrap {
  border-top: 1px solid var(--border);
  padding: 16px;
  background: var(--card-bg);
}
.chat-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  resize: none;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: 0;
  transition: border-color 0.15s;
}
.chat-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(78,140,26,0.1);
}
.chat-send { flex-shrink: 0; }

/* ========== ERROR PAGES ========== */

.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 65vh;
  padding: 32px 16px;
}
.error-card {
  text-align: center;
  max-width: 440px;
}
.error-code {
  font-size: 6rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 8px;
  opacity: 0.25;
}
.error-card h1 { margin: 0 0 10px; }
.error-card p { color: var(--muted); margin: 0 0 24px; }

/* ========== DARK MODE additions ========== */
[data-theme="dark"] .stat-card { background: var(--card-bg); }
[data-theme="dark"] .note-card { background: var(--card-bg); }
[data-theme="dark"] .auth-card { background: var(--card-bg); }
[data-theme="dark"] .chat-window { background: var(--bg-alt); }
[data-theme="dark"] .chat-bubble { background: var(--card-bg); }
[data-theme="dark"] .note-shared { background: var(--bg); }

/* ========== RESPONSIVE additions ========== */
@media (max-width: 600px) {
  .auth-card { padding: 24px 16px; }
  .stat-card__num { font-size: 1.4rem; }
  .chat-bubble-wrap { max-width: 90%; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ========== PAGE LOADER (barre fine en haut) ========== */
#pageLoader {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  z-index: 9999;
  opacity: 0;
  transition: width 0.4s ease, opacity 0.4s ease;
  pointer-events: none;
  border-radius: 0 2px 2px 0;
}

/* ========== SUBMIT SPINNER ========== */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== QR CODE MODAL ========== */
#qrModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.qr-modal-box {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px 24px;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: popIn 0.2s ease;
}
@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.qr-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.qr-close:hover { background: var(--bg-alt); }

/* ========== TOAST NOTIFICATION ========== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a1a;
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
[data-theme="dark"] .toast { background: #e4edd8; color: #1a1a1a; }

/* ========== TEMPLATE CARDS ========== */
.template-card {
  transition: box-shadow 0.15s, border-color 0.15s;
}
.template-card:hover {
  box-shadow: 0 6px 20px rgba(78,140,26,0.12);
  border-color: var(--primary);
}
.template-icon {
  font-size: 2rem;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ========== PROGRESS BAR (objectif réponses) ========== */
.progress-bar-wrap {
  background: var(--bg-alt);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== CHART WRAP ========== */
/* Pas de hauteur fixe ici — le canvas height="220" suffit.
   La hauteur fixe empêchait Chart.js de rendre (conflit responsive). */
.chart-wrap {
  position: relative;
}
/* Pour peakChart et dailyChart on utilise un style inline sur le div */

/* ========== DARK MODE additions ========== */
[data-theme="dark"] .qr-modal-box { background: var(--card-bg); }
[data-theme="dark"] .template-icon { background: var(--primary-light); }
[data-theme="dark"] .template-card { border-color: var(--border); }
[data-theme="dark"] #pageLoader { background: linear-gradient(90deg, var(--primary), var(--secondary)); }


/* ========== JOURNAL DE BORD (timeline) ========== */
.journal-timeline { position: relative; padding-left: 24px; }
.journal-timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.journal-stage-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 20px 0 8px;
  padding-left: 8px;
}
.journal-entry { position: relative; margin-bottom: 16px; }
.journal-dot {
  position: absolute;
  left: -22px; top: 16px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--card-bg);
  box-shadow: 0 0 0 2px var(--primary);
}
.journal-card { padding: 16px 20px; }
.journal-card__head {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 8px; gap: 8px;
}
.journal-excerpt { color: var(--muted); font-size: 0.88rem; line-height: 1.6; margin: 0 0 10px; }
.journal-card__foot { display: flex; gap: 6px; margin-top: 8px; }
[data-theme="dark"] .journal-dot { border-color: var(--bg); }

/* ========== SIGNALEMENTS ========== */
.report-categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.report-cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.report-cat-card:hover { border-color: var(--primary); background: var(--primary-light); }
.report-cat-card.active { border-color: var(--primary); background: var(--primary-light); }
.report-cat-card.active strong { color: var(--primary); }
.report-cat-icon { font-size: 1.8rem; line-height: 1; }
.report-cat-card strong { font-size: 0.82rem; color: var(--text); }
.report-cat-card small { font-size: 0.72rem; color: var(--muted); line-height: 1.3; }
[data-theme="dark"] .report-cat-card:hover,
[data-theme="dark"] .report-cat-card.active { background: rgba(78,140,26,0.15); }
