:root {
  --plum: #25035e;
  --night: #150b25;
  --violet: #5d438e;
  --lilac: #8a52f9;
  --rose: #b07b99;
  --pale: #f5f1fb;
  --bg: #f7f5fb;
  --surface: #ffffff;
  --ink: #211b2f;
  --muted: #6b6575;
  --line: #e8e2f0;
  --ok: #1f7a55;
  --warn: #a35a00;
  --bad: #b3261e;
  --focus: #8a52f9;
  --gradient: linear-gradient(105deg, #150b25 0%, #2e2358 44%, #6d528f 74%, #b07b99 100%);
  --shadow: 0 18px 50px rgba(37, 3, 94, .10);
  --radius: 16px;
  --font: "Funnel Display", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 0.9375rem; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
a { color: var(--violet); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.spacer { flex: 1; }

/* ---------- shell ---------- */
.topbar { background: var(--gradient); color: #fff; padding: 14px 24px; display: flex; align-items: center; gap: 16px; }
.brand { font-weight: 700; font-size: 1.125rem; letter-spacing: -.01em; color: #fff; text-decoration: none; }
.brand small { font-weight: 500; font-size: 0.6875rem; letter-spacing: .18em; text-transform: uppercase; opacity: .8; margin-left: 8px; }
.topbar .pill { background: rgba(255,255,255,.14); color: #fff; }
.space-switch select { width: auto; max-width: 220px; padding: 4px 28px 4px 10px; font-size: 0.8125rem; background-color: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.3); }
.space-switch select option { color: #211b2f; }
.topbar .pill:empty { display: none; }
.topbar .on-dark { color: #fff; }
.topbar .on-dark:hover { border-color: rgba(255,255,255,.5); }
main { max-width: 1120px; margin: 0 auto; padding: 28px 20px 80px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card.raised { box-shadow: var(--shadow); border-color: transparent; }
.card.click { display: block; border-radius: var(--radius); font-weight: 400; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; text-align: left; font: inherit; color: inherit; width: 100%; }
.card.click:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.section-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 28px 0 10px; font-weight: 600; }

/* ---------- controls ---------- */
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 9px 16px; cursor: pointer; font-weight: 600; display: inline-flex; gap: 8px; align-items: center; text-decoration: none; }
button:hover, .btn:hover { border-color: var(--rose); }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--plum); border-color: var(--plum); color: #fff; }
.primary:hover { background: var(--night); }
.ghost { background: transparent; border-color: transparent; color: var(--violet); }
.danger { color: var(--bad); }
.big { padding: 14px 24px; font-size: 1rem; }

label { display: block; font-weight: 600; font-size: 0.8125rem; margin-bottom: 4px; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.75rem; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=url], input[type=tel], input[type=time], input[type=datetime-local], textarea, select {
  width: 100%; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { resize: vertical; min-height: 70px; }
.field + .field { margin-top: 14px; }

.seg { display: inline-flex; background: var(--pale); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: none; background: transparent; padding: 7px 14px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed=true] { background: var(--surface); color: var(--plum); box-shadow: 0 1px 4px rgba(37,3,94,.15); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border-radius: 999px; padding: 5px 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 0.8125rem; cursor: pointer; }
.chip[aria-pressed=true] { background: var(--plum); color: #fff; border-color: var(--plum); }
fieldset.chips { border: 0; padding: 0; margin: 0; }
fieldset.chips legend { width: 100%; margin-bottom: 6px; font-weight: 600; }
label.chip { display: inline-flex; gap: 6px; align-items: center; }
label.chip input { width: auto; margin: 0; }
label.chip:has(input:checked) { background: var(--pale); border-color: var(--violet); color: var(--violet); }

.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 0.75rem; font-weight: 700; background: var(--pale); color: var(--violet); }
.pill.live { background: #e3f4ec; color: var(--ok); }
.pill.paused { background: #fff1dd; color: var(--warn); }
.pill.closed, .pill.revoked { background: #eee; color: #555; }
.pill.completed { background: #e3f4ec; color: var(--ok); }
.pill.in_progress { background: #ece6fb; color: var(--violet); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--pale); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--night); color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 50; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast.error { background: var(--bad); }

.linkbox { display: flex; gap: 8px; align-items: center; background: var(--pale); border-radius: 12px; padding: 8px 8px 8px 14px; }
.linkbox code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8125rem; }

/* ---------- scores ---------- */
.score { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.bar { grid-column: 1 / -1; height: 8px; background: var(--pale); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--violet); border-radius: 0 4px 4px 0; }
.bar.none > i { background: repeating-linear-gradient(45deg, #ddd, #ddd 4px, #eee 4px, #eee 8px); width: 100% !important; }
.big-score { font-size: 2.75rem; font-weight: 700; color: var(--plum); line-height: 1; }
.quote { border-left: 3px solid var(--lilac); padding: 4px 10px; margin: 6px 0; color: #3b3350; font-style: italic; background: var(--pale); border-radius: 0 8px 8px 0; }
.badge { font-size: 0.6875rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--pale); color: var(--violet); }
.badge.adjusted { background: #fff1dd; color: var(--warn); }
.badge.abstained, .badge.no_evidence { background: #eee; color: #555; }
.badge.reviewed { background: #e3f4ec; color: var(--ok); }
.dist { display: flex; gap: 3px; align-items: flex-end; height: 34px; }
.dist i { width: 14px; background: var(--lilac); border-radius: 3px 3px 0 0; opacity: .85; }
.list { margin: 0; padding-left: 18px; } .list li + li { margin-top: 4px; }
.rec { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.rec + .rec { margin-top: 8px; }

/* ---------- conversation ---------- */
.take { max-width: 760px; margin: 0 auto; padding: 20px 16px 40px; }
.hero { background: var(--gradient); color: #fff; border-radius: 22px; padding: 28px; }
.hero h1 { color: #fff; }
.chat { display: flex; flex-direction: column; gap: 12px; padding: 8px 0 16px; }
.bubble { max-width: 85%; padding: 12px 16px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.agent { background: var(--surface); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble.participant { background: var(--plum); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.bubble.typing { color: var(--muted); font-style: italic; }
.composer { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0 8px; border-top: 1px solid var(--line); }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--lilac); transition: width .4s ease; }
.mic { width: 84px; height: 84px; border-radius: 50%; border: none; background: var(--plum); color: #fff; font-size: 1.875rem; justify-content: center; box-shadow: var(--shadow); position: relative; }
.mic.rec { background: var(--bad); animation: pulse 1.2s infinite; }
.mic.busy { background: var(--muted); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(179,38,30,.45); } 70% { box-shadow: 0 0 0 18px rgba(179,38,30,0); } 100% { box-shadow: 0 0 0 0 rgba(179,38,30,0); } }
.level { height: 6px; width: 140px; background: var(--line); border-radius: 99px; overflow: hidden; }
.level > i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s linear; }
.center { text-align: center; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--lilac); border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  main { padding: 18px 16px 60px; }
  .topbar { padding: 12px 16px; }
  h1 { font-size: 1.4375rem; }
  .bubble { max-width: 92%; }
  .hide-sm { display: none; }
  th:nth-child(n+4), td:nth-child(n+4) { display: none; }
}

@media print {
  .topbar, .no-print, .composer, button { display: none !important; }
  body { background: #fff; }
  .card { border: none; padding: 0; break-inside: avoid; }
}
.loading { padding: 80px 0; }

/* ---------- navigation ---------- */
.skip { position: absolute; left: -999px; top: 8px; background: #fff; color: var(--plum); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.topbar { position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.menu { display: flex; align-items: center; gap: 16px; flex: 1; }
.nav { display: flex; gap: 4px; }
.nav a { color: rgba(255,255,255,.82); text-decoration: none; font-weight: 600; padding: 7px 12px; border-radius: 999px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.12); }
.nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.2); }
.nav a.cta { background: #fff; color: var(--plum); }
.menu-toggle { margin-left: auto; background: transparent; border-color: rgba(255,255,255,.4); font-size: 1.125rem; padding: 6px 12px; }
.crumbs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 0.8125rem; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 6px; color: var(--line); }
.crumbs a { color: var(--violet); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { padding: 5px 12px; font-size: 0.8125rem; }
main:focus { outline: none; }
@media (max-width: 1024px) {
  .menu-toggle[hidden] { display: none !important; }
  .menu-toggle { display: inline-flex; }
  .menu { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 8px; padding-top: 10px; }
  .menu.open { display: flex; }
  .nav { flex-direction: column; }
  .nav a { padding: 10px 12px; }
  .menu .pill { align-self: flex-start; }
}
@media (min-width: 1025px) { .menu-toggle { display: none !important; } }
.nav a, .topbar .pill, .topbar button { white-space: nowrap; }
@media (min-width: 1025px) and (max-width: 1200px) { .menu #provider { display: none; } }
@media (min-width: 1025px) { .topbar { flex-wrap: nowrap; } .menu { min-width: 0; } }
.crumbs ol, .crumbs li { min-width: 0; max-width: 100%; }
.crumbs li { display: flex; overflow: hidden; }
@media (max-width: 680px) { .crumbs [aria-current] { max-width: calc(100vw - 48px); } }

/* ---------- restitution ---------- */
.comp { padding: 16px 0; border-bottom: 1px solid var(--line); }
.comp:last-child { border-bottom: none; padding-bottom: 0; }
.comp:first-child { padding-top: 0; }
.coach { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: linear-gradient(135deg, #f5f1fb, #fdf3f6); border: 1px solid #ece3f7; }
blockquote.quote { margin: 6px 0; }

/* ---------- journeys ---------- */
.modules { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.module { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.module.available { border-color: var(--lilac); box-shadow: var(--shadow); }
.module.completed { opacity: .92; }
.module-num { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--pale); color: var(--plum); font-weight: 700; }
.module.completed .module-num { background: #e3f4ec; color: var(--ok); }
.module.available .module-num { background: var(--plum); color: #fff; }
.steps { margin: 0 0 12px; padding-left: 20px; } .steps li + li { margin-top: 6px; }

.dots { display: flex; gap: 4px; } .dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.dots i.in_progress { background: var(--lilac); } .dots i.completed { background: var(--ok); }

/* ---------- reporting ---------- */
.grid.three { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 12px; }
.stats.compact { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stats.compact .stat { background: var(--bg); border: none; }
.stat-value { font-size: 1.625rem; font-weight: 700; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.8125rem; color: var(--muted); margin-top: 4px; }
.chart { margin: 0; }
.chart figcaption { margin-bottom: 10px; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: 1fr 32px; grid-template-areas: 'label label' 'track value'; align-items: center; gap: 4px 10px; position: relative; }
.hbar-label { grid-area: label; font-size: 0.8125rem; }
.hbar-track { grid-area: track; }
.hbar-value { grid-area: value; }
.hbar-track { height: 12px; background: var(--pale); border-radius: 0 4px 4px 0; }
.hbar-track > i { display: block; height: 100%; background: var(--violet); border-radius: 0 4px 4px 0; }
.hbar-value { font-size: 0.8125rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.cols { display: flex; align-items: flex-end; gap: 2px; height: 120px; border-bottom: 1px solid var(--line); }
.col { flex: 1; height: 100%; display: flex; align-items: flex-end; position: relative; }
.col > i { display: block; width: 100%; max-width: 24px; margin: 0 auto; background: var(--violet); border-radius: 4px 4px 0 0; }
.col:hover > i { background: var(--plum); }
[data-tip]:hover::after, [data-tip]:focus::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--night); color: #fff; font-size: 0.75rem; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 5; pointer-events: none; }
.hbar[data-tip]:hover::after, .hbar[data-tip]:focus::after { left: auto; right: 0; transform: none; }
.preview-banner { background: #fff1dd; color: #5c3a00; border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-weight: 600; }
.role-icon { font-size: 1.625rem; }

.topbar.slim { padding: 10px 20px; position: static; }
.topbar.slim .brand { font-size: 1rem; }

/* ---------- participant home ---------- */
.topbar.slim .brand { text-decoration: none; }
.me-link { color: rgba(255,255,255,.88); text-decoration: none; font-weight: 600; font-size: 0.875rem; }
.me-link:hover { color: #fff; text-decoration: underline; }
.mine { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.mine-item { text-decoration: none; }
.mine-item.in_progress { border-color: var(--lilac); }
.small-btn { padding: 6px 12px; font-size: 0.8125rem; }

.chapter { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 0 0; }
.practice { margin-top: 8px; }
.practice-card { margin-top: 6px; padding: 14px; border: 1px dashed var(--lilac); border-radius: 12px; background: var(--surface); }
.practice-card textarea { margin-top: 4px; }

.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.checks li { font-size: 0.875rem; } .checks li.ok > span:first-child { color: var(--ok); font-weight: 700; } .checks li.ko > span:first-child { color: var(--bad); font-weight: 700; }

/* ---------- branding & comfort ---------- */
#client-logo { height: 28px; max-width: 140px; object-fit: contain; margin-right: 8px; vertical-align: middle; background: #fff; border-radius: 6px; padding: 2px 4px; }
.topbar.slim .brand { display: inline-flex; align-items: center; }
.powered { color: rgba(255,255,255,.75); font-size: 0.75rem; margin-left: 10px; }
.comfort-btn { font-weight: 700; padding: 6px 12px; margin-left: 8px; border-color: rgba(255,255,255,.4); }
.comfort { position: fixed; top: 58px; right: 16px; z-index: 40; width: min(340px, calc(100vw - 32px)); }
html.readable body { font-family: "Atkinson Hyperlegible", Inter, sans-serif; letter-spacing: .01em; word-spacing: .06em; line-height: 1.65; }
html.calm *, html.calm *::before, html.calm *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
.take:focus { outline: none; }

.brand-preview { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--bg); align-self: start; }
.brand-preview .small.muted { padding: 8px 12px 0; }
.bp-bar { color: #fff; padding: 12px; display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.bp-bar img { height: 26px; max-width: 120px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px 4px; }
input[type=color] { width: 64px; height: 40px; padding: 2px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }

/* ---------- collective & challenge ---------- */
.milestones { position: relative; margin-top: 12px; }
.milestones .progress { height: 10px; }
.milestones .ms { position: absolute; top: 14px; transform: translateX(-50%); font-size: 0.6875rem; color: var(--muted); }
.milestones .ms.on { color: var(--ok); font-weight: 700; }
.pick { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font-weight: 400; cursor: pointer; }
.pick.on { border-color: var(--lilac); background: var(--pale); }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.timeline li { padding-left: 14px; border-left: 3px solid var(--line); }
.timeline li.done { border-color: var(--ok); } .timeline li.due { border-color: var(--lilac); }

/* ---------- badges & signature ---------- */
.medal { --medal: #5d438e; width: 84px; height: 84px; flex: none; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fff 0, color-mix(in srgb, var(--medal) 30%, #fff) 35%, var(--medal) 100%); color: #fff; display: grid; place-items: center; text-align: center; box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--medal); }
.medal span { font-size: 1.6rem; line-height: 1; margin-top: 10px; }
.medal small { font-size: 0.55rem; font-weight: 700; padding: 0 8px; line-height: 1.1; margin-bottom: 12px; max-height: 2.3em; overflow: hidden; }
.radar { width: 100%; max-width: 380px; display: block; margin: 0 auto; overflow: visible; }
.radar-grid { fill: none; stroke: var(--line); stroke-width: 1; }
.radar-label { font-size: 9px; fill: var(--muted); }
.radar-latest { fill: color-mix(in srgb, var(--violet) 12%, transparent); stroke: var(--violet); stroke-width: 2; stroke-linejoin: round; }
.radar-first { fill: none; stroke: #9a93a6; stroke-width: 2; stroke-linejoin: round; }
.radar-dot { fill: var(--violet); stroke: var(--surface); stroke-width: 2; }
.legend { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 6px; }
.legend .key { width: 14px; height: 3px; border-radius: 2px; display: inline-block; margin-left: 10px; }
.legend .key.latest { background: var(--violet); } .legend .key.first { background: #9a93a6; }

.jump { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 0; position: sticky; top: calc(var(--hdr, 56px) + 8px); z-index: 5; }
.jump .chip { text-decoration: none; background: var(--surface); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
#understand, #act, #share { scroll-margin-top: 64px; }
.notice { border-radius: 10px; padding: 10px 12px; background: var(--pale); }
.notice.warn { background: #fff6e5; color: #6b4a00; }
.mail-frame { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 12px; background: #f5f3f9; }
ul.resources { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
a.resource { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: inherit; background: var(--surface); }
a.resource > span:nth-child(2) { flex: 1; }
a.resource:hover { border-color: var(--violet); }
.resource-icon { font-size: 1.2rem; }
main.trust { max-width: 920px; margin: 0 auto; padding: 24px 16px 64px; }
main.trust .card { margin-top: 14px; }
.control { padding: 10px 0; border-top: 1px solid var(--line); }
.control:first-of-type { border-top: 0; }
.pill.status-ok { background: #e3f4ea; color: #145c32; }
.pill.status-warn { background: #fff6e5; color: #6b4a00; }
.pill.status-todo { background: #eee; color: #444; }

/* ---------- fixed header on every screen ---------- */
.topbar.slim { position: sticky; top: 0; z-index: 20; }

/* ---------- conversation screen: stage (animated shape) + transcript ---------- */
body.in-convo main.take { max-width: 1280px; padding: 0 20px; }
.convo { display: flex; flex-direction: column; height: calc(100dvh - var(--hdr, 56px)); }
.convo-bar { position: sticky; top: var(--hdr, 56px); z-index: 6; background: var(--bg); padding: 12px 0 10px; }
.convo-bar .crumbs { margin: 0 0 6px; }
.convo-bar-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.convo-title { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.convo-bar .chapter { margin: 0; gap: 10px; }
.convo-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(320px, 5fr) 6fr; gap: 16px; padding-bottom: 16px; }
.convo-stage { position: relative; overflow: hidden; border-radius: 24px; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; padding: 24px 20px; min-height: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 45%, rgba(109, 82, 143, .55), transparent 70%), linear-gradient(180deg, #150b25 0%, #2e2358 55%, #6d528f 85%, #b07b99 100%); box-shadow: var(--shadow); }
.convo-stage canvas.aura { position: absolute; inset: 0; width: 100%; height: 100%; }
.convo-stage > :not(canvas) { position: relative; z-index: 1; }
.stage-agent { font-size: 0.75rem; letter-spacing: .2em; text-transform: uppercase; opacity: .75; }
.stage-status { font-weight: 600; font-size: 1.05rem; min-height: 1.6em; text-align: center; text-shadow: 0 1px 12px rgba(21, 11, 37, .6); }
.stage-controls { width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.stage-controls textarea { color: var(--ink); }
.stage-controls .small, .stage-hint { color: rgba(255, 255, 255, .78); text-align: center; margin: 0; }
.stage-controls label { color: #fff; }
.stage-btn { background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .28); border-radius: 999px; padding: 8px 16px; font-weight: 600; cursor: pointer; backdrop-filter: blur(6px); }
.stage-btn:hover { background: rgba(255, 255, 255, .2); }
.stage-btn[disabled] { opacity: .45; cursor: default; }
.convo-stage .mic { background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .35); backdrop-filter: blur(6px); }
.convo-stage .mic.rec { background: var(--bad); }
.convo-transcript { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; }
.convo-transcript .chat { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 18px 8px; scroll-behavior: smooth; }
.convo-transcript .composer { position: static; padding: 12px 16px 14px; background: var(--surface); border-top: 1px solid var(--line); }
.popins { padding: 0 16px; }
.popins:empty { display: none; }
.popins .popin { margin: 4px 0 10px; }
.popin { pointer-events: auto; display: flex; gap: 12px; align-items: center; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--lilac); border-radius: 16px; padding: 12px 16px; box-shadow: 0 18px 50px rgba(37, 3, 94, .18); animation: popin-in .35s ease-out; transition: opacity .35s ease, transform .35s ease; }
.popin.out { opacity: 0; transform: translateY(10px); }
.popin-icon { font-size: 1.15rem; color: var(--lilac); }
@keyframes popin-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
html.calm .popin { animation: none; }
@media (max-width: 860px) {
  .convo { height: auto; min-height: calc(100dvh - var(--hdr, 56px)); }
  .convo-grid { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .convo-stage { min-height: 300px; padding: 16px; }
  .convo-transcript { min-height: 52vh; }
  .convo-title { max-width: 60vw; }
}
@media print { .convo { height: auto; } .convo-grid { display: block; } .convo-stage { display: none; } .convo-transcript { border: 0; } .convo-transcript .chat { overflow: visible; } }
.stage-controls > .row { justify-content: center; }

/* ---------- pre-call briefing ---------- */
.brief { display: grid; grid-template-columns: minmax(300px, 5fr) 6fr; gap: 16px; margin: 20px auto; max-width: 1180px; align-items: stretch; }
body:has(.brief) main.take { max-width: 1280px; }
.brief-stage { min-height: 560px; }
.brief-stage .stage-status.ok { color: #b6f5cf; }
.mic-select { max-width: 320px; background: rgba(255, 255, 255, .92); }
.brief-info h1 { margin-bottom: 6px; }
.brief-kicker { text-transform: uppercase; letter-spacing: .16em; color: var(--violet); font-weight: 700; }
.brief-h { font-size: 1rem; margin: 18px 0 8px; color: var(--plum); }
.brief-chapters { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.brief-chapters li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--pale); }
.brief-num { width: 24px; height: 24px; border-radius: 50%; background: var(--plum); color: #fff; font-size: 0.75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.brief-label { flex: 1; font-weight: 600; }
.brief-tips li { margin-bottom: 4px; }
@media (max-width: 860px) { .brief { grid-template-columns: 1fr; } .brief-stage { min-height: 320px; } }

/* Floating language switcher (participant pages, bottom right) */
.lang-switch { position: fixed; right: 16px; bottom: 16px; z-index: 45; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.lang-btn { border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: .85rem; letter-spacing: .04em; background: var(--surface, #fff); color: var(--ink, #150b25); border: 1px solid rgba(21,11,37,.14); box-shadow: 0 6px 20px rgba(21,11,37,.14); }
.lang-btn:hover { border-color: var(--violet, #6b3fa0); }
.lang-menu { list-style: none; margin: 0; padding: 6px; width: 220px; max-height: min(420px, calc(100dvh - 120px)); overflow-y: auto; }
.lang-menu li { margin: 0; }
.lang-menu button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: none; border: 0; border-radius: 10px; padding: 9px 12px; text-align: left; font-weight: 500; color: inherit; }
.lang-menu button:hover, .lang-menu button:focus-visible { background: rgba(107,63,160,.08); }
.lang-menu li[aria-selected="true"] button { background: rgba(107,63,160,.12); font-weight: 700; }
/* Leave room so the switcher never hides the composer or the last line of a page. */
main.take { padding-bottom: 72px; }
.lang-switch.in-header { position: relative; right: auto; bottom: auto; margin-left: 8px; }
.lang-switch.in-header .lang-btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); box-shadow: none; padding: 6px 12px; }
.lang-switch.in-header .lang-menu { position: absolute; top: calc(100% + 8px); right: 0; color: var(--ink); }
@media print { .lang-switch { display: none; } }

/* Paused conversation (#34) */
.pause-card { max-width: 560px; margin-left: auto; margin-right: auto; padding: 36px 28px; }
.pause-icon { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; color: #fff; background: var(--gradient, linear-gradient(105deg, #2b1055, #7d5ba6)); }
.confirm-dialog { max-width: min(480px, calc(100vw - 32px)); border: 0; padding: 24px; }
.confirm-dialog::backdrop { background: rgba(21, 11, 37, .45); }
.confirm-dialog .confirm-actions { justify-content: flex-end; margin-top: 16px; }
@media (max-width: 900px) { .hide-narrow { display: none; } }
/* Keep title · chapter · pause · finish on one line: the title and chapter name shrink first. */
@media (min-width: 560px) {
  .convo-bar-row { flex-wrap: nowrap; }
  .convo-title { min-width: 0; flex: 0 1 auto; }
  .convo-bar .chapter { min-width: 0; flex: 0 1 auto; }
  .convo-bar .chapter .pill { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 26ch; }
  .convo-bar-row > button { flex: none; white-space: nowrap; }
  .convo-bar .chapter .muted { white-space: nowrap; }
}
.privacy-list li { padding: 8px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.privacy-list li:last-child { border-bottom: 0; }

/* Progress path (#37): explicit, milestone-based, celebrates each completed chapter. */
.quest { padding: 6px 0 2px; }
.quest-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.quest-label { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.quest-pct { font-size: 1.05rem; color: var(--plum); font-variant-numeric: tabular-nums; }
.quest-pct.bump { animation: quest-bump .6s ease; }
.quest-left { margin-left: auto; color: var(--muted); }
.quest-track { position: relative; height: 26px; }
.quest-track::before { content: ''; position: absolute; left: 13px; right: 13px; top: 50%; height: 6px; margin-top: -3px; border-radius: 99px; background: var(--line); }
.quest-fill { position: absolute; left: 13px; top: 50%; height: 6px; margin-top: -3px; border-radius: 99px; max-width: calc(100% - 26px);
  background: linear-gradient(90deg, var(--violet, #6b3fa0), var(--lilac, #b07b99), #f08a8a); background-size: 200% 100%;
  transition: width .9s cubic-bezier(.22, 1, .36, 1); animation: quest-shimmer 3.5s linear infinite; }
.quest-nodes { position: absolute; inset: 0; display: flex; justify-content: space-between; list-style: none; margin: 0; padding: 0; }
.quest-node { position: relative; width: 26px; height: 26px; }
.quest-dot { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: .72rem; font-weight: 700;
  background: var(--surface); border: 2px solid var(--line); color: var(--muted); transition: all .4s ease; }
.quest-node.done .quest-dot { background: var(--gradient, var(--violet)); border-color: transparent; color: #fff; }
.quest-node.current .quest-dot { border-color: var(--violet, #6b3fa0); color: var(--violet, #6b3fa0); box-shadow: 0 0 0 0 rgba(107, 63, 160, .45); animation: quest-pulse 2s ease-out infinite; }
.quest.last .quest-node.current .quest-dot { border-color: #f08a8a; color: #c2555a; }
.quest-node.just-done .quest-dot { animation: quest-pop .7s cubic-bezier(.34, 1.56, .64, 1); }
.quest-burst { position: absolute; left: 50%; top: 50%; pointer-events: none; }
.quest-burst i { position: absolute; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: var(--lilac, #b07b99); opacity: 0; animation: quest-spark .8s ease-out forwards; }
.quest-burst i:nth-child(odd) { background: #f0b27a; }
.quest-burst i:nth-child(1) { --dx: 0px; --dy: -22px; } .quest-burst i:nth-child(2) { --dx: 16px; --dy: -16px; }
.quest-burst i:nth-child(3) { --dx: 22px; --dy: 0px; } .quest-burst i:nth-child(4) { --dx: 16px; --dy: 16px; }
.quest-burst i:nth-child(5) { --dx: 0px; --dy: 22px; } .quest-burst i:nth-child(6) { --dx: -16px; --dy: 16px; }
.quest-burst i:nth-child(7) { --dx: -22px; --dy: 0px; } .quest-burst i:nth-child(8) { --dx: -16px; --dy: -16px; }
@keyframes quest-pulse { 0% { box-shadow: 0 0 0 0 rgba(107, 63, 160, .45); } 70% { box-shadow: 0 0 0 9px rgba(107, 63, 160, 0); } 100% { box-shadow: 0 0 0 0 rgba(107, 63, 160, 0); } }
@keyframes quest-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes quest-spark { 0% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.4); } }
@keyframes quest-bump { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.25); } }
@keyframes quest-shimmer { 0% { background-position: 0% 0; } 100% { background-position: 200% 0; } }
.calm .quest *, .calm .quest { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { .quest *, .quest { animation: none !important; transition: none !important; } }

/* Guided setup (#38) */
main:has(.setup-grid) { max-width: 1400px; }
.setup-steps { position: sticky; top: 0; z-index: 15; background: var(--bg); margin: 12px -4px 16px; padding: 10px 4px 8px; border-bottom: 1px solid var(--line); }
.setup-progress { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.setup-progress .progress { flex: 1 1 160px; height: 8px; min-width: 120px; }
.setup-progress .progress > i { background: var(--gradient, var(--violet)); }
.setup-steps ol { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0 0 2px; overflow-x: auto; scrollbar-width: thin; }
.setup-step { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 6px 12px 6px 6px; font-weight: 600; font-size: .85rem; white-space: nowrap; border: 1px solid transparent; background: transparent; }
.setup-step:hover { background: var(--surface); border-color: var(--line); }
.setup-step[aria-current="step"] { background: var(--surface); border-color: var(--violet, #6b3fa0); box-shadow: 0 2px 10px rgba(37, 3, 94, .08); }
.setup-dot { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: .75rem; background: var(--line); color: var(--ink); flex: none; }
.setup-step.ok .setup-dot { background: var(--gradient, var(--violet)); color: #fff; }
.setup-step.missing .setup-dot, .setup-step.partial .setup-dot { background: #f6c27a; color: #5a3500; }
.setup-step.overview .setup-dot { background: transparent; border: 1px solid var(--line); }
.setup-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(320px, 4fr); gap: 24px; align-items: start; }
.setup-head h2 { margin: 2px 0 4px; }
.setup-nav { margin-top: 20px; }
.setup-hero { background: linear-gradient(120deg, rgba(37, 3, 94, .04), rgba(176, 123, 153, .12)); }
.setup-overview { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.setup-card { text-align: left; display: block; }
.setup-card h3 { margin: 10px 0 4px; }
.setup-card.ok { border-color: color-mix(in srgb, var(--violet, #6b3fa0) 40%, var(--line)); }
.setup-card-n { font-weight: 700; color: var(--muted); }
.setup-preview { position: sticky; top: 130px; display: flex; flex-direction: column; gap: 10px; }
.lp-tabs { align-self: flex-start; }
.lp-phone { border-radius: 26px; border: 8px solid #1d1430; background: #f6f2fb; overflow: hidden; box-shadow: 0 18px 40px rgba(21, 11, 37, .22); max-height: calc(100vh - 290px); min-height: 420px; display: flex; flex-direction: column; color: #211b2f; }
.lp-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: #fff; font-size: .85rem; }
.lp-bar img { height: 20px; max-width: 90px; object-fit: contain; background: #fff; border-radius: 4px; padding: 1px 3px; }
.lp-body { padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; font-size: .82rem; }
.lp-hero { color: #fff; border-radius: 14px; padding: 14px; }
.lp-hero p { margin: 6px 0 0; font-size: .8rem; opacity: .92; }
.lp-kicker { font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.lp-title { font-weight: 700; font-size: 1.05rem; line-height: 1.25; margin-top: 2px; }
.lp-title.dark { color: #211b2f; }
.lp-meta { font-size: .72rem; opacity: .85; margin-top: 8px; }
.lp-label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #6d6680; margin-top: 4px; }
.lp-body .pill { font-size: .72rem; }
.lp-body .pill.on { background: var(--plum, #25035e); color: #fff; }
.lp-notice { font-size: .7rem; color: #6d6680; margin: 4px 0; }
.lp-hint { font-size: .68rem; color: #8a83a0; font-style: italic; margin: 0; }
.lp-btn { align-self: flex-start; color: #fff; border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: .8rem; }
.lp-quest span { font-size: .62rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #6d6680; }
.lp-track { display: flex; gap: 4px; margin-top: 4px; }
.lp-track i { flex: 1; height: 6px; border-radius: 99px; background: #e4ddef; }
.lp-track i.on { background: linear-gradient(90deg, #6b3fa0, #b07b99); }
.lp-stage { border-radius: 14px; color: #fff; text-align: center; padding: 14px 10px 10px; }
.lp-orb { width: 54px; height: 32px; margin: 0 auto 8px; border-radius: 50%; background: radial-gradient(ellipse at 40% 40%, #c7b6ff, #6f8dff 45%, rgba(240, 138, 138, .4) 75%, transparent 76%); filter: blur(.3px); }
.lp-bubble { border-radius: 14px; padding: 8px 10px; max-width: 88%; line-height: 1.4; }
.lp-bubble.agent { background: #fff; border: 1px solid #e4ddef; }
.lp-bubble.me { align-self: flex-end; background: var(--plum, #25035e); color: #fff; }
.lp-composer { border: 2px solid #b9a3dd; border-radius: 12px; padding: 10px; color: #6b6575; background: #fff; }
.lp-comp { display: grid; grid-template-columns: 1fr 90px; gap: 8px; align-items: center; background: #fff; border: 1px solid #e4ddef; border-radius: 10px; padding: 6px 8px; }
.lp-comp .lp-bar { height: 6px; padding: 0; border-radius: 99px; background: #eee8f6; }
.lp-comp .lp-bar i { display: block; height: 100%; border-radius: 99px; }
.lp-card { background: #fff; border: 1px solid #e4ddef; border-radius: 10px; padding: 8px 10px; font-weight: 600; }
.lp-medal { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: .7rem; }
.lp-test { align-self: stretch; }
@media (max-width: 1100px) {
  .setup-grid { grid-template-columns: 1fr; }
  .setup-preview { position: static; }
  .lp-phone { max-height: none; }
}
/* Guided setup previews: journey modules and e-mail (#39) */
.lp-module { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; background: #fff; border: 1px solid #e4ddef; border-radius: 12px; padding: 8px 10px; }
.lp-module.locked { opacity: .6; }
.lp-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #25035e; color: #fff; font-weight: 700; font-size: .72rem; }
.lp-module.locked .lp-num { background: #cfc6de; }
.lp-mailhead { background: #fff; border-bottom: 1px solid #e4ddef; padding: 10px 14px; font-size: .78rem; display: grid; gap: 2px; }
.lp-subject { font-weight: 700; font-size: .92rem; margin-top: 4px; }
.lp-mail { background: #fff; }
.lp-mail p { margin: 0 0 8px; line-height: 1.5; }
.lp-timeline { display: flex; flex-wrap: wrap; gap: 6px; }
.lp-timeline .pill.on { background: var(--plum, #25035e); color: #fff; }

/* Missions & emergency access (#44) */
.mission .chip.member { display: inline-flex; align-items: center; gap: 4px; }
.mission .chip.member button { padding: 0 6px; min-height: 0; }
details.breakglass > summary { cursor: pointer; font-weight: 600; color: var(--plum, #25035e); }
fieldset.locked-grid { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.locked-grid :is(input, textarea, select, button) { opacity: .85; }
.mission .row select { width: auto; flex: 1 1 180px; min-width: 0; }
/* Timestamped transcript (#45) */
.turn-meta { opacity: .7; margin-bottom: 2px; display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
button.link { background: none; border: 0; padding: 0 4px; min-height: 0; color: inherit; cursor: pointer; font: inherit; box-shadow: none; }
button.link:hover, button.link:focus-visible { text-decoration: underline; }
a.button { display: inline-flex; align-items: center; text-decoration: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line, #ddd); color: inherit; font-size: .85rem; }
.bubble del { opacity: .6; }
/* Chat timestamps (#47): shown under each participant-facing message, never part of its text */
.bubble[data-time]::after { content: attr(data-time); display: block; margin-top: 4px; font-size: .7rem; opacity: .75; text-align: right; }
/* Streamed message (#47): provisional until the validated final message replaces it */
.bubble.provisional { opacity: .8; }
/* 3D character (#48) */
.avatar-grid { display: grid; grid-template-columns: minmax(160px, 220px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 560px) { .avatar-grid { grid-template-columns: 1fr; } }
.avatar-preview { width: 100%; aspect-ratio: 3 / 4; border-radius: 14px; background: radial-gradient(circle at 50% 35%, #efe9f7, #d9cfe9); }
.swatch { width: 28px; height: 28px; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid transparent; }
.swatch[aria-pressed="true"] { border-color: var(--plum, #25035e); }
.avatar-color { display: flex; gap: 6px; align-items: center; font-weight: 500; }
.avatar-color input { width: 36px; height: 28px; padding: 0; border: 0; background: none; }
