/* whoami — styles partagés (accueil, compte, questionnaires) */
:root {
  color-scheme: light;
  --page: #f4f6f4;
  --surface: #ffffff;
  --ink: #1c2826;
  --ink-2: #52514e;
  --muted: #898781;
  --hairline: #dce3df;
  --border: rgba(11, 11, 11, 0.1);
  --accent: #2e6e5e;
  --accent-ink: #ffffff;
  --danger: #b5563c;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0e1211;
    --surface: #1a1f1d;
    --ink: #f2f4f2;
    --ink-2: #c3c8c3;
    --muted: #8d968f;
    --hairline: #2b322f;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #4c9b87;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--hairline);
}
header.site .brand { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; letter-spacing: 0.02em; color: var(--ink); }
header.site .brand:hover { text-decoration: none; }
header.site nav { font-size: 0.95rem; }

h1 { font-family: var(--serif); font-weight: 600; font-size: 2rem; letter-spacing: 0.01em; margin: 0 0 6px; }
p.lead { color: var(--ink-2); margin: 0 0 32px; max-width: 640px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 14px;
}
.card h2 { font-family: var(--serif); margin: 0 0 4px; font-size: 1.15rem; }
.card p { margin: 0 0 12px; color: var(--ink-2); }
.card .meta { font-size: 0.85rem; color: var(--muted); }

/* --- Accueil : sections par thème + grille de questionnaires --- */
.theme-section { margin-bottom: 36px; }
.theme-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 14px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.theme-title::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
.qgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

/* Barre de progression (nombre de questionnaires passés) */
.qprogress { display: flex; align-items: center; gap: 12px; margin: -14px 0 28px; }
.qprogress-track {
  flex: 0 0 170px;
  height: 6px;
  border-radius: 999px;
  background: var(--hairline);
  overflow: hidden;
}
.qprogress-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.3s; }
.qprogress-txt { font-size: 0.85rem; color: var(--muted); }

/* Carte questionnaire — --qc : couleur du test (manifest), accent par défaut */
.qcard {
  --qc: var(--accent);
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.qcard:hover {
  border-color: color-mix(in srgb, var(--qc) 60%, transparent);
  box-shadow: 0 2px 16px color-mix(in srgb, var(--qc) 14%, transparent);
}
.qcard-head { display: flex; align-items: center; gap: 13px; margin-bottom: 10px; }
.qcard h3 { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; margin: 0; }
.qhead-txt { min-width: 0; }
.qmeta { font-size: 0.78rem; color: var(--muted); }
.qicon {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--qc) 13%, transparent);
  color: var(--qc);
  font-family: var(--serif);
  font-size: 1.35rem;
}
.qicon > svg { width: 27px; height: 27px; }
.qcheck {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--qc);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}
.qcheck svg { width: 11px; height: 11px; }
.qdesc {
  font-size: 0.9rem;
  color: var(--ink-2);
  margin: 0 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.qcard-foot { margin-top: auto; display: flex; flex-direction: column; gap: 9px; align-items: stretch; }
.qcard-foot .btn { font-size: 0.9rem; padding: 7px 15px; align-self: flex-start; }

/* Test déjà passé : bordure et fond teintés + panneau « dernier résultat » */
.qcard.done {
  border-color: color-mix(in srgb, var(--qc) 38%, var(--border));
  background: linear-gradient(180deg, color-mix(in srgb, var(--qc) 5%, var(--surface)), var(--surface) 60%);
}
.qresult {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--qc) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--qc) 24%, transparent);
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}
.qresult:hover {
  text-decoration: none;
  border-color: var(--qc);
  background: color-mix(in srgb, var(--qc) 14%, transparent);
}
.qresult-txt { display: flex; flex-direction: column; min-width: 0; }
.qresult-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--qc) 72%, var(--ink));
}
.qresult-value {
  font-weight: 600;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qresult-arrow { margin-left: auto; flex-shrink: 0; width: 17px; height: 17px; color: var(--qc); }

.badge {
  flex-shrink: 0;
  font-size: 0.74rem;
  color: var(--muted);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}

.btn {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 16px;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: default; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.9rem; color: var(--ink-2); margin-bottom: 4px; }
.field input {
  width: 100%;
  padding: 9px 12px;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--page);
  color: var(--ink);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

select.lang {
  padding: 6px 8px;
  font: inherit;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.error { color: var(--danger); font-size: 0.9rem; margin: 8px 0; min-height: 1.2em; }
.notice { color: var(--ink-2); font-size: 0.9rem; }
.hidden { display: none !important; }

table.history { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.history th, table.history td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--hairline);
}
table.history th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
table.history td.actions { text-align: right; white-space: nowrap; }
table.history .btn { padding: 5px 10px; font-size: 0.85rem; margin-left: 6px; }

footer.site {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.85rem;
}
