/*
 * CASTALIA dans DataGrade — compléments à style.css (celui de Castalia, recopié
 * tel quel par tools/castalia-sync.py) pour l'accueil et « Mon espace ».
 */
body { background: var(--tp-bg); }

/* Wordmark de l'en-tête */
.cs-logo { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--tp-ink); }
.cs-logo__name { font-family: var(--tp-font-serif); font-weight: 600; font-size: 20px; letter-spacing: .26em; padding-left: .26em; line-height: 1; }
.cs-logo__sub { display: flex; align-items: center; gap: 8px; width: 100%; }
.cs-logo__sub span { flex: 1; height: 1px; background: var(--tp-line); }
.cs-logo__sub em { font-style: normal; font: 500 8px var(--tp-font-mono); letter-spacing: .26em; text-transform: uppercase; color: var(--tp-mut); white-space: nowrap; }
.tp-hd-nav a.cs-back { color: var(--tp-mut); font-size: 13px; }
.cs-logout { padding: 8px 14px; font-size: 13px; }
@media (max-width: 720px) {
    .tp-hd-inner { gap: 10px; }
    .cs-user-name { display: none; }
    .tp-hd-user { padding: 4px; }
    .cs-logout { padding: 6px 10px; font-size: 12px; }
    .cs-logo__name { font-size: 16px; letter-spacing: .2em; }
}

/* Hero */
.cs-hero { padding: 54px 0 46px; }
.cs-mark { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 0 auto 26px; }
.cs-mark img { width: 64px; height: 64px; margin-bottom: 6px; }
.cs-mark__name { font-family: var(--tp-font-serif); font-weight: 600; font-size: clamp(26px, 4.2vw, 38px); letter-spacing: .26em; padding-left: .26em; color: var(--tp-ink); line-height: 1; }
.cs-mark__rule { display: flex; align-items: center; gap: 12px; max-width: 280px; width: 70%; }
.cs-mark__rule span { flex: 1; height: 1px; background: var(--tp-line); }
.cs-mark__rule em { font-style: normal; font: 500 10px var(--tp-font-mono); letter-spacing: .26em; text-transform: uppercase; color: var(--tp-mut); white-space: nowrap; }
.cs-hero h1 { max-width: 22ch; margin-left: auto; margin-right: auto; }
.cs-hero .tp-lede { margin-left: auto; margin-right: auto; }

/* Progression */
.cs-progress { display: flex; justify-content: center; gap: 36px; flex-wrap: wrap; margin-top: 34px; }
.cs-stat { text-align: center; }
.cs-stat b { display: block; font-family: var(--tp-font-serif); font-size: 30px; font-weight: 600; color: var(--tp-ink); line-height: 1.1; }
.cs-stat span { font: 500 11px var(--tp-font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--tp-mut); }

/* Familles */
.cs-family { margin-top: 46px; }
.cs-family:first-of-type { margin-top: 10px; }
.cs-family__head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; border-bottom: 1px solid var(--tp-line); padding-bottom: 10px; margin-bottom: 18px; }
.cs-family__head h3 { margin: 0; font-family: var(--tp-font-serif); font-size: 22px; }
.cs-family__head p { margin: 0; color: var(--tp-mut); font-size: 14px; }
.cs-family__count { margin-left: auto; font: 500 11px var(--tp-font-mono); letter-spacing: .1em; color: var(--tp-mut); text-transform: uppercase; }

.cs-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.cs-card .tp-card-text { flex: 1; }
.cs-card__foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.cs-card__go { margin-left: auto; font-weight: 600; font-size: 14px; color: var(--tp-accent-d); }
.cs-done { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--tp-success); font-weight: 500; }
.cs-done::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--tp-success); }
.cs-done b { color: var(--tp-ink); font-weight: 600; }
.cs-card.is-done { border-color: #cfe3d6; }

/* Encart « comment lire ces tests » */
.cs-note { border-left: 3px solid var(--tp-accent); background: var(--tp-surface); padding: 18px 22px; border-radius: var(--tp-radius); box-shadow: var(--tp-shadow-1); }
.cs-note h3 { margin: 0 0 6px; font-family: var(--tp-font-serif); font-size: 18px; }
.cs-note p { margin: 6px 0 0; color: var(--tp-ink-soft); font-size: 14.5px; line-height: 1.55; }
.cs-warn { margin: 26px 0 0; padding: 14px 18px; border-radius: var(--tp-radius); background: #fbf3e6; color: #7a5410; font-size: 14px; }

/* Mon espace */
.cs-big { font-family: var(--tp-font-serif); font-size: 40px; font-weight: 600; color: var(--tp-ink); line-height: 1.1; }
.cs-code { font: 500 14px var(--tp-font-mono); color: var(--tp-accent-d); letter-spacing: .04em; word-break: break-all; }
.cs-result { margin-bottom: 18px; scroll-margin-top: 90px; }
.cs-result__head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.cs-result__title { flex: 1; min-width: 220px; }
.cs-result__title h3 { margin: 0; }
.cs-result__score { text-align: right; }
.cs-bars { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 44px; gap: 6px 12px; align-items: center; margin-top: 16px; font-size: 13.5px; }
.cs-bars__label { color: var(--tp-ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-bars__track { display: block; height: 8px; border-radius: 99px; background: var(--tp-line-soft); overflow: hidden; }
.cs-bars__fill { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #4a7ec1, #0d2b4d); }
.cs-bars__val { font: 500 12px var(--tp-font-mono); color: var(--tp-ink); text-align: right; }
.cs-history { margin-top: 14px; font-size: 13px; color: var(--tp-mut); }
.cs-history summary { cursor: pointer; }
.cs-history table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.cs-history td { padding: 6px 4px; border-top: 1px solid var(--tp-line-soft); }
.cs-inline-form { display: inline; }
.cs-link-btn { background: none; border: none; padding: 0; color: var(--tp-mut); font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; }
.cs-link-btn:hover { color: var(--tp-error); }
.cs-answers { margin-top: 12px; }
.cs-answers summary { cursor: pointer; font-size: 13px; color: var(--tp-mut); }
.cs-answers pre { white-space: pre-wrap; font: 12px/1.5 var(--tp-font-mono); background: var(--tp-surface-2); padding: 12px; border-radius: var(--tp-radius); max-height: 360px; overflow: auto; }
.cs-flash { margin: 18px auto 0; max-width: 760px; padding: 12px 16px; border-radius: var(--tp-radius); font-size: 14px; }
.cs-flash--success { background: #e9f4ee; color: #24603f; }
.cs-flash--error { background: #f8e8e8; color: #8a2b2b; }
.cs-input { display: block; width: 100%; margin-top: 8px; padding: 12px 14px; font: 16px var(--tp-font-sans, inherit); color: var(--tp-ink); background: var(--tp-surface); border: 1px solid var(--tp-line); border-radius: var(--tp-radius); }
.cs-input:focus { outline: 2px solid var(--tp-accent); outline-offset: 1px; }
.cs-note-small { margin-top: 18px; font-size: 13.5px; color: var(--tp-mut); }
.cs-candidates { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 14px; }
.cs-candidates th { text-align: left; font: 500 11px var(--tp-font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--tp-mut); padding: 6px 6px; border-bottom: 1px solid var(--tp-line); }
.cs-candidates td { padding: 10px 6px; border-top: 1px solid var(--tp-line-soft); vertical-align: top; }
.cs-candidates td.num { text-align: right; font-family: var(--tp-font-mono); }
.cs-verdict { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 500; background: var(--tp-surface-2); color: var(--tp-ink); white-space: nowrap; }
.cs-verdict--strong { background: #e9f4ee; color: #24603f; }
.cs-verdict--partial { background: #eef3fa; color: #234a7a; }
.cs-verdict--explore { background: #fbf3e6; color: #7a5410; }
.cs-verdict--caution { background: #f8e8e8; color: #8a2b2b; }
.cs-candidate { margin-top: 10px; border-top: 1px solid var(--tp-line-soft); padding-top: 10px; }
.cs-candidate > summary { cursor: pointer; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14.5px; }
.cs-candidate > summary b { color: var(--tp-ink); }
.cs-candidate__meta { color: var(--tp-mut); font-size: 13px; }
.cs-open { margin-top: 14px; }
.cs-open h4 { margin: 14px 0 4px; font-size: 13.5px; color: var(--tp-ink-soft); font-weight: 600; }
.cs-open p { margin: 0; white-space: pre-wrap; font-size: 14px; line-height: 1.55; color: var(--tp-ink); background: var(--tp-surface-2); padding: 10px 12px; border-radius: var(--tp-radius); }
.cs-kit { margin: 6px 0 0; padding-left: 22px; font-size: 14px; line-height: 1.55; color: var(--tp-ink); }
.cs-kit li { margin: 4px 0; }
.cs-empty { text-align: center; padding: 40px 20px; color: var(--tp-mut); }

@media (max-width: 720px) {
    .cs-bars { grid-template-columns: 110px 1fr 38px; }
    .cs-result__score { text-align: left; }
}

/* ── Attribuer des tests (/castalia/attribuer.php), résultats, entrée /psy/ (migration 0086) ── */
.cs-muted { color: var(--tp-mut); }
.cs-mono { font-family: var(--tp-font-mono); letter-spacing: .06em; }
.cs-danger { color: #b53b3b; }
.cs-assign { display: grid; grid-template-columns: 290px 1fr; gap: 28px; align-items: start; }
@media (max-width: 900px) { .cs-assign { grid-template-columns: 1fr; } }
.cs-assign__side { background: var(--tp-surface); border: 1px solid var(--tp-line); border-radius: var(--tp-radius-lg); padding: 12px; position: sticky; top: 16px; }
@media (max-width: 900px) { .cs-assign__side { position: static; } }
.cs-assign__title { font: 500 11px var(--tp-font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--tp-mut); padding: 8px 10px 6px; }
.cs-assign__others > summary { cursor: pointer; list-style: none; }
.cs-assign__others > summary::-webkit-details-marker { display: none; }
.cs-target { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--tp-radius); color: var(--tp-ink); text-decoration: none; }
.cs-target:hover { background: var(--tp-surface-2); }
.cs-target.is-active { background: var(--tp-accent-l); }
.cs-target__dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; }
.cs-target__dot--group { background: transparent; border: 2px solid var(--tp-accent); }
.cs-target__name { flex: 1; font-weight: 600; font-size: 14px; line-height: 1.25; }
.cs-target__name small { display: block; font-weight: 400; font-size: 12px; color: var(--tp-mut); }
.cs-target__n { font: 500 11px var(--tp-font-mono); background: var(--tp-surface-2); border-radius: 999px; padding: 3px 8px; color: var(--tp-ink); }
.cs-newgroup { margin-top: 8px; padding: 6px 10px; }
.cs-newgroup > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--tp-accent-d); }
.cs-newgroup form { margin-top: 10px; }
.cs-newgroup textarea, .cs-codes textarea { resize: vertical; font-size: 14px; }
.cs-assign__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.cs-assign__main .cs-family { margin-top: 34px; }
.cs-pick { display: flex; align-items: flex-start; gap: 14px; padding: 12px 14px; border: 1px solid var(--tp-line); border-radius: var(--tp-radius); background: var(--tp-surface); margin-bottom: 8px; }
.cs-pick.is-on { border-color: var(--tp-accent); background: #fffaf2; }
.cs-pick.is-locked { opacity: .65; }
.cs-pick__main { flex: 1; display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 14.5px; }
.cs-pick__main input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--tp-accent); flex: 0 0 18px; }
.cs-pick__desc { display: block; color: var(--tp-mut); font-size: 13px; margin-top: 2px; line-height: 1.45; }
.cs-pick__show { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--tp-mut); white-space: nowrap; cursor: pointer; padding-top: 2px; }
.cs-pick__show input { accent-color: var(--tp-accent); }
.cs-pick:not(.is-on) .cs-pick__show { visibility: hidden; }
@media (max-width: 640px) { .cs-pick { flex-direction: column; gap: 6px; } .cs-pick__show { padding-left: 30px; } }
.cs-assign__save { position: sticky; bottom: 0; padding: 16px 0; background: linear-gradient(to top, var(--tp-bg) 70%, transparent); margin-top: 18px; }
.cs-codes__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.cs-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.cs-table td { padding: 8px 6px; border-bottom: 1px solid var(--tp-line); }
.cs-matrix-wrap { overflow-x: auto; margin-top: 14px; border: 1px solid var(--tp-line); border-radius: var(--tp-radius-lg); background: var(--tp-surface); }
.cs-matrix { border-collapse: collapse; font-size: 13.5px; min-width: 100%; }
.cs-matrix th, .cs-matrix td { padding: 9px 12px; border-bottom: 1px solid var(--tp-line); text-align: left; white-space: nowrap; }
.cs-matrix th { font-weight: 600; vertical-align: bottom; background: var(--tp-surface-2); }
.cs-matrix th small { display: block; font-weight: 400; font-size: 11px; color: var(--tp-mut); }
.cs-matrix__who { font-weight: 600; position: sticky; left: 0; background: var(--tp-surface); }
.cs-cell { display: inline-block; color: var(--tp-mut); }
.cs-cell--done { padding: 3px 9px; border-radius: 999px; background: var(--tp-accent-l); color: var(--tp-ink); text-decoration: none; font-family: var(--tp-font-mono); font-size: 12px; }
.cs-cell--done:hover { background: var(--tp-accent); color: #fff; }
.cs-entry { max-width: 420px; margin: 8px auto 0; text-align: left; }
.cs-entry h2 { margin: 0 0 6px; font-family: var(--tp-font-serif); }
.cs-entry__go { width: 100%; margin-top: 16px; justify-content: center; }
.cs-input--code { font-family: var(--tp-font-mono); letter-spacing: .14em; text-transform: uppercase; text-align: center; font-size: 20px; }
@media print {
    .tp-hd, .tp-ft, .cs-assign__side, .cs-noprint, .cs-flash, .tp-lede, .tp-eyebrow, .cs-assign__head .tp-btn { display: none !important; }
    .cs-assign { display: block; }
    .cs-codes { border: 0; box-shadow: none; }
    .cs-table td { font-size: 15px; padding: 12px 6px; }
}
