/* Discovery Coach: enterprise life-sciences look.
   Navy foundation, pale surfaces, teal for the learner and actions, violet reserved for the customer. */
:root {
  --navy: #0f1e36;
  --navy-2: #1a2d4c;
  --navy-3: #2a4068;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --text: #16223a;
  --muted: #56637a;
  --rule: #dde2ea;
  --teal: #0b7a74;
  --teal-strong: #08625d;
  --teal-soft: #e4f3f1;
  --teal-bright: #28b3a8;
  --violet: #5a4a9c;
  --violet-soft: #efedf8;
  --warn: #9a5b00;
  --warn-soft: #fdf3e2;
  --error: #a1372a;
  --error-soft: #fbeceb;

  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.375rem;
  --fs-xl: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem);

  --r-sm: 6px;
  --r-md: 10px;
  --shadow: 0 1px 2px rgba(15, 30, 54, 0.06), 0 4px 14px rgba(15, 30, 54, 0.05);
  --measure: 66ch;

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: var(--fs-base); line-height: 1.55; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
p { margin: 0; }
ul, ol { margin: 0; }
[hidden] { display: none !important; }
button { font-family: inherit; }

:focus-visible { outline: 3px solid var(--teal-bright); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0.5rem; background: #fff; color: var(--navy); padding: 0.5rem 0.9rem; border-radius: var(--r-sm); z-index: 50; }
.skip:focus { left: 0.5rem; }

.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.wrap { max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; }

/* App bar */
.appbar { background: var(--navy); color: #fff; border-bottom: 1px solid var(--navy-3); }
.appbar-inner { max-width: 72rem; margin: 0 auto; padding: 0.8rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brand { font-weight: 600; display: flex; align-items: center; gap: 0.6rem; letter-spacing: 0.01em; }
.brand-mark { width: 1.1rem; height: 1.1rem; border-radius: 4px; background: linear-gradient(135deg, var(--teal-bright), var(--violet)); }
.proto { font-size: var(--fs-sm); color: #cfd8e6; border: 1px solid var(--navy-3); padding: 0.25rem 0.65rem; border-radius: 999px; }

/* Buttons */
.btn { font-size: var(--fs-base); font-weight: 500; line-height: 1.2; border-radius: var(--r-sm); padding: 0.7rem 1.15rem; border: 1px solid transparent; cursor: pointer; transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--teal-strong); }
.btn-accent { background: var(--navy); color: #fff; width: 100%; }
.btn-accent:hover:not(:disabled) { background: var(--navy-2); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--rule); }
.btn-ghost:hover:not(:disabled) { border-color: var(--muted); }
.btn-lg { font-size: var(--fs-md); padding: 0.9rem 1.6rem; }
.btn-link { background: none; border: 0; padding: 0; color: var(--teal-strong); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: inherit; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 1.5rem; }
.card h2 { font-size: var(--fs-lg); margin-bottom: 0.7rem; }
.card h3 { font-size: var(--fs-base); margin: 1.2rem 0 0.35rem; }
.card p { max-width: var(--measure); }

.who { display: flex; align-items: center; gap: 0.9rem; }
.initials { flex: none; width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center; background: var(--violet-soft); color: var(--violet); font-weight: 600; box-shadow: inset 0 0 0 2px var(--violet); }
.who h2 { margin-bottom: 0.15rem; }

/* Briefing */
.hero { background: var(--navy); color: #fff; }
.hero-inner { max-width: 72rem; margin: 0 auto; padding: 3rem 1.25rem 3.5rem; }
.hero-sub { color: #9fb3cf; font-size: var(--fs-sm); margin-bottom: 0.8rem; }
.hero h1 { font-size: var(--fs-xl); max-width: 26ch; letter-spacing: -0.01em; margin-bottom: 1rem; }
.hero-lede { color: #d6deea; font-size: var(--fs-md); max-width: 52ch; }
.reminder { margin-top: 1.75rem; display: inline-block; font-size: var(--fs-md); font-weight: 600; padding: 0.6rem 0 0.6rem 1rem; border-left: 4px solid var(--teal-bright); }

.brief-body { margin-top: -1.5rem; padding-bottom: 3rem; display: grid; gap: 1.25rem; }
.brief-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 1.25rem; }
.customer-card { border-top: 4px solid var(--violet); }
.plain-list { padding-left: 1.1rem; margin-top: 1.1rem; display: grid; gap: 0.45rem; color: var(--muted); }
.obj-list { columns: 2; column-gap: 2rem; padding-left: 1.3rem; margin-bottom: 1rem; }
.obj-list li { margin-bottom: 0.45rem; break-inside: avoid; }
.begin { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; padding-top: 0.5rem; }
.begin p { max-width: 58ch; }

/* Conversation */
.screen { min-height: 60vh; }
.call-layout { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1.5rem; padding-top: 1.75rem; padding-bottom: 2rem; align-items: start; }
.call-side { position: sticky; top: calc(1rem + env(safe-area-inset-top, 0px)); }
.side-card { padding: 1.25rem; display: grid; gap: 1.1rem; }
.side-name { font-weight: 600; }
.turn-label { font-weight: 600; font-variant-numeric: tabular-nums; margin-bottom: 0.4rem; }
.meter { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; margin-bottom: 0.4rem; }
.meter i { height: 6px; border-radius: 2px; background: var(--rule); }
.meter i.done { background: var(--teal); }
.meter i.typical { box-shadow: inset 0 -2px 0 var(--muted); }
.side-reminder { font-size: var(--fs-sm); font-weight: 600; border-left: 3px solid var(--teal); padding-left: 0.7rem; }
.side-actions { display: grid; gap: 0.5rem; }

.transcript { list-style: none; padding: 0; display: grid; gap: 1rem; margin-bottom: 1.25rem; }
.msg { border-radius: var(--r-md); padding: 1rem 1.15rem; max-width: 46rem; border: 1px solid var(--rule); }
.msg-head { display: flex; align-items: center; gap: 0.55rem; font-size: var(--fs-sm); font-weight: 600; margin-bottom: 0.4rem; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.customer { background: var(--surface); border-left: 4px solid var(--violet); box-shadow: var(--shadow); }
.msg.customer .msg-head { color: var(--violet); }
.msg.customer .msg-body { font-size: var(--fs-md); line-height: 1.6; }
.msg.learner { background: var(--teal-soft); border-color: #c5e3df; margin-left: auto; }
.msg.learner .msg-head { color: var(--teal-strong); }
.msg .mini-initials { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-size: 0.7rem; background: var(--violet-soft); box-shadow: inset 0 0 0 1.5px var(--violet); }
.msg.pending { opacity: 0.7; }
.msg.failed { border-style: dashed; }

.thinking { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--muted); font-size: var(--fs-sm); }
.dots { display: inline-flex; gap: 4px; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--violet); opacity: 0.3; animation: pulse 1.2s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: 0.15s; }
.dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 40% { opacity: 1; } }

.msg-error { margin-top: 0.75rem; background: var(--error-soft); color: var(--error); border-radius: var(--r-sm); padding: 0.7rem 0.85rem; font-size: var(--fs-sm); display: grid; gap: 0.55rem; }
.msg-error .row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.msg-error .btn { font-size: var(--fs-sm); padding: 0.45rem 0.8rem; background: #fff; color: var(--text); border-color: #e6c3be; }

.ended-banner { background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--teal); border-radius: var(--r-md); padding: 1rem 1.2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }

.composer { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 1rem; }
.composer-label { display: block; font-weight: 600; font-size: var(--fs-sm); margin-bottom: 0.4rem; }
.composer textarea { width: 100%; min-height: 5rem; max-height: 14rem; resize: vertical; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 0.65rem 0.75rem; }
.composer textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(11, 122, 116, 0.18); }
.composer textarea:disabled { opacity: 0.65; }
.composer-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 0.6rem; }
.composer-row p { font-variant-numeric: tabular-nums; }

/* Report states */
.report-state { max-width: 38rem; margin: 4rem auto; text-align: center; display: grid; gap: 0.8rem; justify-items: center; }
.state-title { font-size: var(--fs-lg); }
.error-state { background: var(--surface); border: 1px solid var(--rule); border-top: 4px solid var(--error); border-radius: var(--r-md); padding: 1.75rem; }
.error-state .row { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; margin-top: 0.5rem; }
.loader { display: flex; gap: 6px; }
.loader span { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); animation: pulse 1.2s infinite ease-in-out; opacity: 0.3; }
.loader span:nth-child(2) { animation-delay: 0.15s; background: var(--navy-3); }
.loader span:nth-child(3) { animation-delay: 0.3s; background: var(--violet); }

/* Report */
#report { padding: 2rem 0 3rem; display: grid; gap: 1.25rem; }
.r-overall { background: var(--navy); color: #fff; border-radius: var(--r-md); padding: 1.75rem; display: grid; grid-template-columns: auto 1fr; gap: 1.75rem; align-items: center; }
.r-score { text-align: center; min-width: 8.5rem; padding-right: 1.75rem; border-right: 1px solid var(--navy-3); }
.r-score .num { font-size: 3rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.r-score .of { color: #9fb3cf; font-size: var(--fs-sm); margin-top: 0.3rem; }
.r-level { font-size: var(--fs-sm); color: #9fb3cf; margin-bottom: 0.25rem; }
.r-overall h1 { font-size: var(--fs-xl); margin-bottom: 0.6rem; }
.r-overall .summary { color: #dbe3ee; max-width: var(--measure); }
.r-overall .caveat { color: #f3d9a4; font-size: var(--fs-sm); margin-top: 0.6rem; }

.r-section h2 { font-size: var(--fs-lg); margin-bottom: 0.3rem; }
.r-section .intro { color: var(--muted); font-size: var(--fs-sm); margin-bottom: 1.1rem; max-width: var(--measure); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

.dims { display: grid; gap: 1.1rem; }
.dim { display: grid; grid-template-columns: minmax(11rem, 15rem) 1fr; gap: 1.25rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--rule); }
.dim:last-child { border-bottom: 0; padding-bottom: 0; }
.dim-name { font-weight: 600; }
.dim-weight { color: var(--muted); font-size: var(--fs-sm); }
.dim-level { font-size: var(--fs-sm); font-weight: 600; margin-bottom: 0.35rem; display: flex; justify-content: space-between; gap: 1rem; }
.bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-bottom: 0.5rem; }
.bar i { height: 8px; border-radius: 2px; background: var(--rule); }
.bar i.on { background: var(--teal); }
.bar.none i { background: repeating-linear-gradient(135deg, var(--rule) 0 4px, transparent 4px 8px); }
.dim-why { color: var(--muted); font-size: var(--fs-sm); max-width: var(--measure); }

.items { list-style: none; padding: 0; display: grid; gap: 1rem; }
.items li { padding-left: 1rem; border-left: 3px solid var(--rule); }
.items.good li { border-left-color: var(--teal); }
.items.missed li { border-left-color: var(--violet); }
.turn-tag { display: inline-block; font-size: 0.75rem; font-weight: 600; color: var(--muted); background: var(--bg); border: 1px solid var(--rule); border-radius: 999px; padding: 0.05rem 0.5rem; margin-bottom: 0.3rem; }
.quote { font-style: italic; color: var(--text); margin-top: 0.35rem; }
.items .better { margin-top: 0.4rem; color: var(--muted); font-size: var(--fs-sm); }

.evidence { display: grid; gap: 0.9rem; }
.ev { border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 1rem; display: grid; gap: 0.4rem; }
.ev-top { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.effect { font-size: 0.75rem; font-weight: 600; border-radius: 999px; padding: 0.1rem 0.55rem; }
.effect.strengthened { background: var(--teal-soft); color: var(--teal-strong); }
.effect.weakened { background: var(--warn-soft); color: var(--warn); }
.ev blockquote { margin: 0; font-style: italic; font-size: var(--fs-md); }

.rewrite { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.rewrite > div { border-radius: var(--r-sm); padding: 1rem; }
.rewrite h3 { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 0.4rem; }
.rewrite .before { background: var(--bg); }
.rewrite .after { background: var(--teal-soft); }
.rewrite .after p { font-size: var(--fs-md); }
.rewrite-why { margin-top: 0.9rem; color: var(--muted); font-size: var(--fs-sm); max-width: var(--measure); }

.maya-voice { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: start; }
.maya-voice blockquote { margin: 0; font-size: var(--fs-md); line-height: 1.65; border-left: 4px solid var(--violet); padding-left: 1rem; max-width: var(--measure); }

.focus-behaviour { font-size: var(--fs-md); font-weight: 600; margin-bottom: 0.5rem; }
.focus dl { display: grid; gap: 0.7rem; margin: 0.8rem 0 0; }
.focus dt { font-weight: 600; font-size: var(--fs-sm); }
.focus dd { margin: 0.15rem 0 0; color: var(--muted); max-width: var(--measure); }

.cmap { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.6rem; }
.cmap li { border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 0.85rem; display: grid; gap: 0.35rem; align-content: start; }
.cmap .area { font-weight: 600; font-size: var(--fs-sm); }
.cmap .status { display: flex; gap: 0.4rem; align-items: center; font-size: var(--fs-sm); font-weight: 600; }
.cmap .icon { width: 1.25rem; height: 1.25rem; flex: none; }
.cmap .explored { border-top: 4px solid var(--teal); }
.cmap .explored .status { color: var(--teal-strong); }
.cmap .partly_explored { border-top: 4px solid var(--warn); }
.cmap .partly_explored .status { color: var(--warn); }
.cmap .not_explored { border-top: 4px dashed #a7b0bf; }
.cmap .not_explored .status { color: var(--muted); }
.cmap .note { color: var(--muted); font-size: 0.8rem; }

.trace-block { margin-top: 1.5rem; display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; }
.trace-block h3 { font-size: var(--fs-base); margin-bottom: 0.3rem; }
.trace { width: 100%; height: auto; display: block; }
.trace .grid { stroke: var(--rule); }
.trace .lbl { font: 11px var(--font); fill: var(--muted); }
.trace .line { fill: none; stroke: var(--violet); stroke-width: 2.5; stroke-linejoin: round; }
.trace .pt { fill: #fff; stroke: var(--violet); stroke-width: 2; }
.needs { list-style: none; padding: 0; display: grid; gap: 0.45rem; font-size: var(--fs-sm); }
.needs li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.5rem; }
.needs .tag { white-space: nowrap; }
.needs .tag { font-weight: 600; }
.needs .yes .tag { color: var(--teal-strong); }
.needs .no { color: var(--muted); }

.r-foot { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.r-foot p { flex-basis: 100%; color: var(--muted); font-size: var(--fs-sm); max-width: var(--measure); }

.foot { border-top: 1px solid var(--rule); padding: 1.25rem; text-align: center; color: var(--muted); font-size: 0.8rem; }

@media (max-width: 960px) {
  .cmap { grid-template-columns: repeat(3, 1fr); }
  .trace-block { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .call-layout { grid-template-columns: 1fr; }
  .call-side { position: static; order: -1; }
  .side-card { grid-template-columns: 1fr; }
  .brief-grid, .two, .rewrite { grid-template-columns: 1fr; }
  .obj-list { columns: 1; }
  .dim { grid-template-columns: 1fr; gap: 0.4rem; }
}
@media (max-width: 560px) {
  .r-overall { grid-template-columns: 1fr; }
  .r-score { border-right: 0; border-bottom: 1px solid var(--navy-3); padding: 0 0 1rem; text-align: left; }
  .cmap { grid-template-columns: repeat(2, 1fr); }
  .msg.learner { margin-left: 1.5rem; }
  .composer-row { flex-direction: column; align-items: stretch; }
  .hero-inner { padding-top: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .dots span, .loader span { opacity: 1; }
}
@media print {
  .appbar, .foot, .r-foot, .skip { display: none !important; }
  body { background: #fff; }
  .card, .r-overall { box-shadow: none; break-inside: avoid; }
  .r-overall { background: #fff; color: #000; border: 1px solid #999; }
}
