:root {
  --bg: #f6f6f4; --surface: #ffffff; --surface-2: #f0efec; --border: #e2e1dc;
  --text: #16161a; --text-2: #52514e; --muted: #86857f;
  --accent: #c2410c; --accent-ink: #ffffff; --accent-soft: #fff1e8;
  --good: #15803d; --warn: #b45309; --bad: #b91c1c; --info: #1d4ed8;
  --series-1: #2a78d6; --chart-surface: #fcfcfb; --grid: #e7e6e1;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111110; --surface: #1a1a19; --surface-2: #232321; --border: #2f2f2c;
    --text: #f3f2ee; --text-2: #c3c2b7; --muted: #8d8c85;
    --accent: #fb7a3c; --accent-ink: #111110; --accent-soft: #2c1a10;
    --good: #4ade80; --warn: #fbbf24; --bad: #f87171; --info: #93b4ff;
    --series-1: #3987e5; --chart-surface: #1a1a19; --grid: #2f2f2c;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #111110; --surface: #1a1a19; --surface-2: #232321; --border: #2f2f2c;
  --text: #f3f2ee; --text-2: #c3c2b7; --muted: #8d8c85;
  --accent: #fb7a3c; --accent-ink: #111110; --accent-soft: #2c1a10;
  --good: #4ade80; --warn: #fbbf24; --bad: #f87171; --info: #93b4ff;
  --series-1: #3987e5; --chart-surface: #1a1a19; --grid: #2f2f2c; --shadow: none;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: .3em 0 .8em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .tiny { font-size: .75rem; }
.nowrap { white-space: nowrap; }

header.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.top .inner { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.brand { font-weight: 800; letter-spacing: .02em; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
nav.main { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav.main a { text-decoration: none; padding: 6px 10px; border-radius: 8px; color: var(--text-2); font-size: .92rem; }
nav.main a.on, nav.main a:hover { background: var(--surface-2); color: var(--text); }
main { max-width: 1120px; margin: 0 auto; padding: 22px 16px 60px; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.hero { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); }
.card h2 { margin-bottom: .6em; }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.big { font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); padding: 8px 14px; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; font-size: .92rem; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

label { display: block; font-weight: 600; font-size: .86rem; margin: 10px 0 4px; }
input[type=text], input[type=password], input[type=tel], input[type=number], input[type=datetime-local], input[type=time], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { margin: 0; font-weight: 500; border: 1px solid var(--border); border-radius: 99px; padding: 4px 10px; display: flex; gap: 6px; align-items: center; }
details > summary { cursor: pointer; font-weight: 600; }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; border: 1px solid var(--border); background: var(--surface); }
.flash.error { border-color: color-mix(in srgb, var(--bad) 50%, var(--border)); color: var(--bad); }
.banner { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; background: var(--surface-2); font-size: .9rem; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--text-2); }
.pill.good { color: var(--good); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); } .pill.accent { color: var(--accent); }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.list th { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.table-wrap { overflow-x: auto; }

.bars .bar { display: grid; grid-template-columns: 150px 1fr 44px; gap: 10px; align-items: center; margin: 7px 0; font-size: .9rem; }
.bars .track { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bars .fill { height: 100%; border-radius: 99px; background: var(--series-1); }
.bars .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.trend-up { color: var(--good); } .trend-down { color: var(--bad); }

/* session */
.session-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
@media (max-width: 860px) { .session-wrap { grid-template-columns: 1fr; } .bars .bar { grid-template-columns: 110px 1fr 40px; } }
.chat { display: flex; flex-direction: column; gap: 10px; min-height: 320px; max-height: 62vh; overflow-y: auto; padding: 4px; }
.msg { max-width: 84%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.assistant { background: var(--surface-2); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.user { background: var(--accent); color: var(--accent-ink); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.coach { align-self: stretch; max-width: 100%; border: 1px dashed color-mix(in srgb, var(--info) 50%, var(--border)); background: transparent; font-size: .9rem; }
.msg.interject { background: color-mix(in srgb, var(--bad) 14%, var(--surface-2)); }
.msg .who { font-size: .72rem; font-weight: 700; opacity: .7; margin-bottom: 2px; text-transform: uppercase; letter-spacing: .05em; }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.composer textarea { min-height: 70px; }
.timer { font-variant-numeric: tabular-nums; font-size: 2.4rem; font-weight: 800; letter-spacing: -.02em; }
.timer.low { color: var(--bad); }
.typing { color: var(--muted); font-style: italic; }
.brief { white-space: pre-wrap; font-size: .9rem; background: var(--surface-2); padding: 12px; border-radius: 10px; }

/* report */
.score-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.score { border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.score .n { font-size: 1.6rem; font-weight: 800; }
.quote { border-left: 3px solid var(--border); padding-left: 10px; color: var(--text-2); font-style: italic; margin: 6px 0; }
ul.clean { padding-left: 1.1em; margin: .3em 0; } ul.clean li { margin: .25em 0; }
.kb h2 { margin-top: 1em; } .kb h3 { margin-top: 1.2em; } .kb blockquote { border-left: 3px solid var(--accent); margin: 8px 0; padding: 4px 12px; color: var(--text-2); }

/* charts */
.spark { width: 100%; height: 90px; display: block; background: var(--chart-surface); border-radius: 8px; }
.spark .grid-line { stroke: var(--grid); stroke-width: 1; }
.spark .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .pt { fill: var(--series-1); stroke: var(--chart-surface); stroke-width: 2; }
.spark .hit { fill: transparent; }
.spark .hit:hover + .pt, .spark .pt:hover { r: 6; }
.spark text { fill: var(--muted); font-size: 10px; }
.login { max-width: 380px; margin: 10vh auto; }
#panelList li { padding: 4px 6px; border-radius: 8px; border-left: 3px solid transparent; }
#panelList li.speaking { border-left-color: var(--accent); background: var(--surface-2); }
.attempts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 720px) { .attempts { grid-template-columns: 1fr; } }
.attempt { background: var(--surface-2); border-radius: 10px; padding: 10px; min-width: 0; }
.dims { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; align-items: center; font-size: .8rem; margin-top: 6px; }
.dims .track { height: 6px; background: var(--surface); border-radius: 99px; overflow: hidden; }
.dims .fill { height: 100%; background: var(--series-1); border-radius: 99px; }

