:root {
  --ink: #1b1d21;
  --soft: #5d646e;
  --line: #dfe2e6;
  --bg: #f5f6f7;
  --card: #ffffff;
  --accent: #1f5fa8;
  --system: #eceef1;
  --caller: #d9e8f8;
  --warn: #9a3b12;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
h1 { font-size: 1.5rem; margin: 0 0 16px; }
h2 { font-size: 1rem; margin: 24px 0 8px; }
p { margin: 0 0 12px; }
[hidden] { display: none !important; }

.demobar { flex: 0 0 auto; background: #fff6dc; border-bottom: 1px solid #ecd9a0; color: #6b5200; text-align: center; font-size: 0.85rem; padding: 5px 12px; }

/* plain pages */
.page { max-width: 680px; margin: 48px auto; padding: 32px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.page.wide { max-width: 1040px; }
.two { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; }
.two h2:first-child { margin-top: 0; }
.consent-text { border-left: 3px solid var(--line); padding-left: 16px; margin: 0 0 20px; }
.notice { background: #fdf3e7; border: 1px solid #efc998; border-radius: 8px; padding: 12px 14px; margin: 0 0 20px; }
.error { color: var(--warn); font-weight: 600; }
.hint { color: var(--soft); font-size: 0.9rem; }
fieldset { border: 0; padding: 0; margin: 0 0 20px; }
legend { font-weight: 600; padding: 0; margin: 0 0 8px; }
.choice, .tick { display: block; padding: 4px 0; cursor: pointer; }
.choice input, .tick input { margin-right: 8px; }
textarea { width: 100%; min-height: 84px; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.actions { display: flex; gap: 14px; align-items: center; margin-top: 16px; }
button.primary, a.primary { font: inherit; font-weight: 600; color: #fff; background: var(--accent); border: 0; border-radius: 8px; padding: 10px 20px; cursor: pointer; text-decoration: none; display: inline-block; }
button.primary:focus-visible, a.primary:focus-visible { outline: 3px solid #9cc2ee; outline-offset: 2px; }
button.link { font: inherit; background: none; border: 0; padding: 0; margin-top: 18px; color: var(--soft); text-decoration: underline; cursor: pointer; }

/* the page for one call */
body.callpage { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.bar { flex: 0 0 auto; display: flex; gap: 12px; align-items: center; padding: 10px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.tag { font-size: 0.8rem; color: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; }
.saving { margin-left: auto; font-size: 0.85rem; color: var(--soft); }
.saving.problem { color: var(--warn); font-weight: 600; }
.split { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(360px, 5fr) minmax(520px, 7fr); }
.pane { overflow-y: auto; padding: 20px 24px 40px; }
.pane.chat { background: var(--card); border-right: 1px solid var(--line); }
.pane h2 { margin: 0 0 14px; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--soft); }

.msg { display: flex; flex-direction: column; max-width: 82%; margin: 0 0 10px; }
.msg.system { align-items: flex-start; }
.msg.caller { align-items: flex-end; margin-left: auto; }
.who { font-size: 0.72rem; color: var(--soft); margin: 0 6px 2px; }
.bubble { padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.system .bubble { background: var(--system); border-top-left-radius: 4px; }
.msg.caller .bubble { background: var(--caller); border-top-right-radius: 4px; }
.pause, .note { width: fit-content; margin: 4px auto 12px; font-size: 0.85rem; color: var(--soft); }
.pause { border: 1px solid var(--line); border-radius: 999px; padding: 3px 14px; background: var(--bg); }
.cue { font-size: 0.82rem; color: var(--soft); font-style: italic; margin: -4px 8px 10px; }
.cue.caller { text-align: right; margin: 6px 8px 2px; }
#chat-end { height: 1px; }

.readgate { background: var(--card); border: 1px dashed var(--line); border-radius: 10px; padding: 18px 20px; color: var(--soft); }
.readgate p { margin: 0 0 12px; }
.readbar { height: 8px; border-radius: 999px; background: #e9ecef; overflow: hidden; }
.readbar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.25s linear; }
.block { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; margin: 0 0 16px; }
.qtext { font-weight: 600; margin: 0 0 10px; display: block; }
.opts { display: flex; gap: 8px; flex-wrap: wrap; }
.opts label { cursor: pointer; }
.opts input { position: absolute; opacity: 0; }
.opts span { display: inline-block; border: 1px solid var(--line); border-radius: 8px; padding: 7px 16px; background: var(--card); }
.opts input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.opts input:focus-visible + span { outline: 3px solid #9cc2ee; outline-offset: 2px; }
.opts.fixed label { cursor: default; }
.opts.fixed input:not(:checked) + span { color: #a9aeb6; }

table.q { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin: 0 0 16px; }
table.q thead th { position: sticky; top: -20px; background: var(--card); font-size: 0.72rem; font-weight: 600; color: var(--soft); line-height: 1.2; padding: 10px 4px 8px; width: 72px; text-align: center; vertical-align: bottom; border-bottom: 1px solid var(--line); z-index: 1; }
table.q thead th:first-child { border-top-left-radius: 10px; }
table.q thead th:last-child { border-top-right-radius: 10px; }
table.q th.s { width: auto; }
table.q td { padding: 9px 4px; text-align: center; vertical-align: middle; border-top: 1px solid #eef0f2; }
table.q td.s { text-align: left; padding-left: 16px; padding-right: 10px; }
table.q .ct { border-left: 1px dashed var(--line); }
table.q tbody tr:nth-child(even) td { background: #f5f7fa; }
table.q tr.missing td.s { color: var(--warn); font-weight: 600; }
table.q input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; margin: 0; }

/* overall rating: continuous scale with overflow regions (ITU-T P.851); 0 to 6, Bad = 1 ... Excellent = 5 */
.scale { position: relative; padding: 18px 8px 4px; outline: none; border-radius: 8px; }
.scale:focus-visible { box-shadow: 0 0 0 3px #9cc2ee; }
.scale-track { position: relative; height: 34px; cursor: pointer; touch-action: none; }
.scale-track::before { content: ""; position: absolute; left: 0; right: 0; top: 16px; height: 3px; background: #9aa3ad; border-radius: 2px; }
.scale-overflow { position: absolute; top: 9px; height: 17px; width: 16.6667%; background: repeating-linear-gradient(45deg, #eef0f3, #eef0f3 4px, #e3e7ec 4px, #e3e7ec 8px); border-radius: 4px; }
.scale-overflow.left { left: 0; }
.scale-overflow.right { right: 0; }
.scale-tick { position: absolute; top: 8px; width: 2px; height: 19px; margin-left: -1px; background: #5d646e; }
.tick-1 { left: 16.6667%; } .tick-2 { left: 33.3333%; } .tick-3 { left: 50%; } .tick-4 { left: 66.6667%; } .tick-5 { left: 83.3333%; }
.scale-handle { position: absolute; top: 5px; width: 14px; height: 26px; margin-left: -7px; background: var(--accent); border: 2px solid #fff; border-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
.scale-labels { position: relative; height: 44px; font-size: 0.82rem; color: var(--soft); }
.scale-labels .lab { position: absolute; top: 4px; transform: translateX(-50%); white-space: nowrap; }
.scale-labels .over-left { left: 8.3333%; top: 24px; font-style: italic; }
.scale-labels .over-right { left: 91.6667%; top: 24px; font-style: italic; }
.scale.fixed .scale-track { cursor: default; }
.scale.fixed .scale-handle { background: #6b8fbf; }

/* privacy page and login */
.privacy h2 { margin-top: 28px; }
.privacy ul { padding-left: 22px; }
.narrow-page { max-width: 420px; }
.field { display: block; margin: 0 0 14px; font-weight: 600; }
.field input { display: block; width: 100%; margin-top: 4px; font: inherit; font-weight: 400; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }

/* dashboard */
body.dash { background: var(--bg); }
.dash-bar { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; padding: 10px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.dash-study { display: flex; gap: 6px; align-items: center; font-size: 0.9rem; }
.dash-study select, .dash-study button, .dash-exclude button, .dash-exclude input { font: inherit; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
.dash-nav { display: flex; gap: 4px; }
.dash-nav a { padding: 6px 12px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.dash-nav a.on { background: var(--accent); color: #fff; }
.dash-user { margin-left: auto; display: flex; gap: 8px; align-items: center; color: var(--soft); }
.dash-user button.link { margin: 0; }
.dash-main { max-width: 1280px; margin: 0 auto; padding: 24px; }
.dash-main h1 { margin-bottom: 4px; }
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0 18px; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; min-width: 150px; }
.stats b { display: block; font-size: 1.4rem; }
.stats span { color: var(--soft); font-size: 0.85rem; }
.dash-progress { width: 100%; max-width: 640px; height: 14px; }
.dash-table { border-collapse: collapse; background: var(--card); border: 1px solid var(--line); width: 100%; font-size: 0.88rem; margin: 8px 0 20px; }
.dash-table.narrow { width: auto; min-width: 360px; }
.dash-table th, .dash-table td { border-bottom: 1px solid #eef0f2; padding: 6px 8px; text-align: left; vertical-align: top; }
.dash-table th { background: #f7f8fa; font-weight: 600; color: var(--soft); white-space: nowrap; }
.dash-table tr.live td { background: #f1f7ff; }
.dash-table tr.excluded td { color: #8a9099; }
.scroll { overflow-x: auto; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; }
.flag { display: inline-block; margin: 0 4px 3px 0; padding: 1px 8px; border-radius: 999px; background: #fff1e6; color: var(--warn); font-size: 0.78rem; white-space: nowrap; }
.dash-downloads { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-downloads .button { padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); text-decoration: none; }
.dash-exclude { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin: 12px 0 8px; }
.dash-exclude p { margin: 0; }
.pager { display: flex; gap: 14px; align-items: center; }
button.primary:disabled { opacity: 0.45; cursor: not-allowed; }
