:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --ink: #1b2230;
  --muted: #5d6676;
  --line: #e2e5eb;
  --accent: #2f5bd3;
  --accent-ink: #ffffff;
  --accent-soft: #e9effc;
  --good: #137a43;
  --good-soft: #e6f4ec;
  --bad: #b3261e;
  --bad-soft: #fbeceb;
  --branch: #8a5a00;
  --branch-soft: #fdf3dd;
  --neutral-soft: #eef0f3;
  --shadow: 0 1px 2px rgba(20, 28, 45, .05), 0 4px 16px rgba(20, 28, 45, .05);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151b; --surface: #1a1e26; --surface-2: #20252f; --ink: #e8ebf1; --muted: #9aa3b2; --line: #2c323e;
    --accent: #7b9bff; --accent-ink: #0d1220; --accent-soft: #232c45;
    --good: #5fd08f; --good-soft: #17301f; --bad: #ff8a80; --bad-soft: #3a1d1b; --branch: #f0c060; --branch-soft: #33290f; --neutral-soft: #252a33;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151b; --surface: #1a1e26; --surface-2: #20252f; --ink: #e8ebf1; --muted: #9aa3b2; --line: #2c323e;
  --accent: #7b9bff; --accent-ink: #0d1220; --accent-soft: #232c45;
  --good: #5fd08f; --good-soft: #17301f; --bad: #ff8a80; --bad-soft: #3a1d1b; --branch: #f0c060; --branch-soft: #33290f; --neutral-soft: #252a33;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 4vw, 38px); }
h2 { font-size: clamp(21px, 2.6vw, 26px); }
h3 { font-size: 17px; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 6px; }
.error { color: var(--bad); background: var(--bad-soft); padding: 10px 14px; border-radius: 10px; margin-top: 14px; }

.top { display: flex; align-items: center; gap: 20px; padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 600; display: flex; align-items: center; gap: 10px; }
.logo { background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: 2px 7px; font-size: 13px; font-weight: 700; }
.steps { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.steps span { font-size: 13px; padding: 4px 11px; border-radius: 99px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.steps span.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.steps span.done { color: var(--good); border-color: transparent; background: var(--good-soft); }
.round-tag { font-size: 13px; font-weight: 600; color: var(--muted); }

main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }
.screen-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.actions { display: flex; align-items: center; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.center { text-align: center; max-width: 560px; margin: 70px auto; }

.btn { font: inherit; font-weight: 600; border-radius: 10px; padding: 11px 20px; border: 1px solid transparent; cursor: pointer; transition: filter .15s, background .15s; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.link { background: none; color: var(--accent); padding: 6px 4px; font-weight: 500; }
.btn:disabled { opacity: .5; cursor: default; }
input, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { font-weight: 600; font-size: 14px; display: block; margin-bottom: 6px; }

/* intro */
.intro { max-width: 780px; margin: 0 auto; }
.lead { font-size: 18px; color: var(--muted); }
.rounds { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 24px 0; }
.round-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.round-card .num { font-size: 12px; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.round-card b { font-size: 19px; }
.round-card span:last-child { color: var(--muted); }
.flow { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; counter-reset: f; }
.flow li { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; border: 1px solid var(--line); }
.flow b { font-size: 15px; }
.flow span { color: var(--muted); font-size: 14px; }
.mic-check { display: grid; gap: 16px; margin-top: 20px; }
.mic-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.meter { width: 140px; height: 8px; background: var(--neutral-soft); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--good); transition: width .08s; }
.small-meter { width: 110px; height: 6px; margin: 6px 0; }

/* case */
.case-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 18px; }
.kpi { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.kpi .v { font-size: 22px; font-weight: 700; }
.kpi .l { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.kpi .n { font-size: 13px; color: var(--muted); }
.facts { margin: 0 0 16px; padding-left: 20px; }
.facts li { margin-bottom: 8px; }
.task { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; }
.task b { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.memo ol { padding-left: 20px; margin: 8px 0 12px; }
.memo li { margin-bottom: 7px; }
.memo ul { padding-left: 18px; margin: 4px 0; color: var(--muted); font-size: 14.5px; }
.memo .after { font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; margin: 0; }

.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 22px; padding: 6px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); min-width: 84px; text-align: center; }
.timer.warn { color: var(--branch); background: var(--branch-soft); border-color: transparent; }
.timer.over { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.timer.soft { font-size: 16px; color: var(--muted); }

/* call */
.call-grid { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
.side { display: grid; gap: 14px; position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; }
.side details.panel { padding: 14px 16px; }
.side summary { font-weight: 600; cursor: pointer; }
.side .kpis { grid-template-columns: repeat(3, 1fr); margin: 10px 0; }
.side .kpi .v { font-size: 17px; }
.side .facts, .side .memo { font-size: 14.5px; }
.call-panel { display: flex; flex-direction: column; min-height: 560px; }
.call-top { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.who-agent { display: flex; align-items: center; gap: 12px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 20px; position: relative; }
.avatar.speaking::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 3px solid var(--accent); animation: pulse 1.1s infinite ease-out; }
@keyframes pulse { from { opacity: .9; transform: scale(.95); } to { opacity: 0; transform: scale(1.25); } }
.status { font-size: 14px; color: var(--muted); }
.transcript { flex: 1; overflow-y: auto; padding: 16px 2px; display: flex; flex-direction: column; gap: 10px; max-height: 52vh; min-height: 260px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; }
.msg .who { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.msg.agent { background: var(--surface-2); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: var(--accent-soft); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.pending { opacity: .6; font-style: italic; }
.talk { display: flex; align-items: center; gap: 16px; border-top: 1px solid var(--line); padding-top: 16px; flex-wrap: wrap; }
.mic { width: 72px; height: 72px; border-radius: 50%; border: none; background: var(--accent); color: var(--accent-ink); cursor: pointer; display: grid; place-items: center; transition: transform .1s, background .2s; flex-shrink: 0; }
.mic:disabled { background: var(--neutral-soft); color: var(--muted); cursor: default; }
.mic.rec { background: var(--bad); color: #fff; animation: rec 1.4s infinite; }
@keyframes rec { 0%, 100% { box-shadow: 0 0 0 0 rgba(179, 38, 30, .45); } 50% { box-shadow: 0 0 0 12px rgba(179, 38, 30, 0); } }
.talk-info { flex: 1; min-width: 200px; }
#talkHint { font-weight: 600; }
.toggle { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--muted); margin: 0; cursor: pointer; }
.toggle input { width: auto; }
.text-fallback { display: flex; gap: 10px; margin-top: 12px; }
.text-fallback input { flex: 1; }
#textToggle { align-self: flex-start; margin-top: 6px; }

/* summary */
.summary-form { display: grid; gap: 18px; }
.summary-form textarea { min-height: 72px; resize: vertical; }
.summary-form .hint { font-weight: 400; color: var(--muted); font-size: 13.5px; }

.spinner { width: 46px; height: 46px; border: 4px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 22px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* review */
.verdict { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.score { font-size: 44px; font-weight: 700; line-height: 1; }
.score small { font-size: 18px; color: var(--muted); font-weight: 500; }
.badge { display: inline-block; padding: 5px 12px; border-radius: 99px; font-weight: 600; font-size: 14px; }
.badge.pass { background: var(--good-soft); color: var(--good); }
.badge.fail { background: var(--bad-soft); color: var(--bad); }
.section { margin-top: 28px; }
.section > h3 { margin-bottom: 12px; }
.crit-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.crit { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; border-left: 4px solid var(--bad); }
.crit.ok { border-left-color: var(--good); }
.crit-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.crit-head b { font-size: 16px; }
.crit .req { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-left: 6px; }
.mark { font-weight: 700; font-size: 15px; }
.crit.ok .mark { color: var(--good); }
.crit:not(.ok) .mark { color: var(--bad); }
.crit .what { font-size: 13.5px; color: var(--muted); margin: 2px 0 10px; }
.quote { font-size: 14.5px; border-left: 3px solid var(--line); padding: 2px 0 2px 10px; margin: 6px 0; color: var(--ink); }
.quote .tag { font-weight: 700; color: var(--muted); margin-right: 6px; font-size: 12.5px; }
.better { margin-top: 10px; background: var(--accent-soft); border-radius: 10px; padding: 9px 12px; font-size: 14.5px; }
.better b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.tbl th, .tbl td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.tbl th { background: var(--surface-2); font-size: 13px; color: var(--muted); font-weight: 600; }
.pill { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.pill.ok { background: var(--good-soft); color: var(--good); }
.pill.missing, .pill.unsupported, .pill.distorted { background: var(--bad-soft); color: var(--bad); }
.disc { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; font-size: 14.5px; }
.disc b { display: block; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.two ul { margin: 0; padding-left: 20px; }

.map { display: grid; gap: 16px; }
.phase { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: start; }
.phase-name { font-weight: 600; font-size: 14px; padding-top: 10px; color: var(--muted); }
.nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.node { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); font-size: 13.5px; opacity: .55; }
.node.fired { opacity: 1; box-shadow: var(--shadow); }
.node.good.fired { border-color: var(--good); background: var(--good-soft); }
.node.bad.fired { border-color: var(--bad); background: var(--bad-soft); }
.node.branch.fired { border-color: var(--branch); background: var(--branch-soft); }
.node.neutral.fired { border-color: var(--muted); background: var(--neutral-soft); }
.node .k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.node.good .k { color: var(--good); }
.node.bad .k { color: var(--bad); }
.node.branch .k { color: var(--branch); }
.node.neutral .k { color: var(--muted); }
.node .tr { font-weight: 600; margin: 3px 0; }
.node .re { color: var(--muted); }
.node .at { margin-top: 6px; font-weight: 600; font-size: 12.5px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
details.tr-full { margin-top: 28px; }
details.tr-full summary { cursor: pointer; font-weight: 600; }
.tr-lines { margin-top: 12px; display: grid; gap: 6px; font-size: 14.5px; }
.tr-lines .tag { font-weight: 700; color: var(--muted); margin-right: 6px; font-size: 12.5px; }
.tr-lines .agent { color: var(--muted); }

.final-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 12px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .case-grid, .call-grid, .crit-grid, .two { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
  .flow { grid-template-columns: 1fr 1fr; }
  .phase { grid-template-columns: 1fr; gap: 6px; }
}
@media (max-width: 560px) {
  main { padding: 18px 16px 48px; }
  .top { padding: 12px 16px; }
  .rounds, .kpis, .disc { grid-template-columns: 1fr; }
  .side .kpis { grid-template-columns: repeat(3, 1fr); }
  .screen-head { flex-direction: column; }
  .msg { max-width: 92%; }
}
