:root {
  --bg: #f6f4ee; --surface: #fffefb; --surface-2: #efece3; --ink: #1d2a2a; --ink-2: #4d5c5b; --ink-3: #6b7877;
  --line: #dcd8cb; --brand: #0f6b63; --brand-ink: #ffffff; --brand-soft: #d9efeb; --accent: #b4540a; --accent-soft: #fbe9d7;
  --good: #1f7a3d; --good-soft: #dff2e4; --warn: #94640a; --warn-soft: #f9eecb; --bad: #b3261e; --bad-soft: #fae3e1;
  --chart: #0f6b63; --grid: #e6e2d6; --radius: 12px; --shadow: 0 1px 2px rgba(29,42,42,.06), 0 2px 10px rgba(29,42,42,.05);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: Georgia, "Iowan Old Style", "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141b1b; --surface: #1c2525; --surface-2: #263131; --ink: #e9eeec; --ink-2: #b4c0be; --ink-3: #93a19f;
    --line: #334040; --brand: #58c7b9; --brand-ink: #08201d; --brand-soft: #1b3a37; --accent: #f0a763; --accent-soft: #3d2c1b;
    --good: #6fd08e; --good-soft: #1a3524; --warn: #e6c15c; --warn-soft: #3a3115; --bad: #f28b82; --bad-soft: #421f1c;
    --chart: #58c7b9; --grid: #2c3838; --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141b1b; --surface: #1c2525; --surface-2: #263131; --ink: #e9eeec; --ink-2: #b4c0be; --ink-3: #93a19f;
    --line: #334040; --brand: #58c7b9; --brand-ink: #08201d; --brand-soft: #1b3a37; --accent: #f0a763; --accent-soft: #3d2c1b;
    --good: #6fd08e; --good-soft: #1a3524; --warn: #e6c15c; --warn-soft: #3a3115; --bad: #f28b82; --bad-soft: #421f1c;
    --chart: #58c7b9; --grid: #2c3838; --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font: 700 1.75rem/1.2 var(--display); letter-spacing: -.01em; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .75em; }
a { color: var(--brand); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 50; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--ink-2); } .small { font-size: .875rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.loading { padding: 40px; text-align: center; color: var(--ink-2); }

/* shell: side menu, top bar, page tabs */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.shell.collapsed { grid-template-columns: minmax(0, 1fr); }
.shell.collapsed .side { display: none; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 12px 10px 24px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 2px 10px; }
.logo { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; padding: 0 6px; }
.logo .brand-mark { flex: none; border-radius: 7px; }
.logo .wordmark { height: 17px; width: auto; }
.icon-btn { background: none; border: 1px solid transparent; color: var(--ink-2); border-radius: 8px; min-width: 34px; height: 34px; padding: 0 8px; font-size: 1rem; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.nav-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.nav-head { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; padding: 8px 10px 4px; color: var(--ink-2);
  font: 700 .72rem/1.2 var(--font); letter-spacing: .08em; text-transform: uppercase; text-align: left; cursor: pointer; border-radius: 6px; }
.nav-head:hover { color: var(--ink); background: var(--surface-2); }
.nav-head::after { content: "▾"; margin-left: auto; transition: transform .15s; }
.nav-head[aria-expanded="false"]::after { transform: rotate(-90deg); }
.nav-head .count { background: var(--accent); color: var(--brand-ink); border-radius: 999px; padding: 1px 7px; font-size: .7rem; letter-spacing: 0; }
.nav-items { display: flex; flex-direction: column; gap: 2px; }
.nav-items[hidden] { display: none; }
.side a.nav.nav-home { margin: 2px 0 8px; font-weight: 600; }
.nav-ico { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.side a.nav.on .nav-ico { opacity: 1; color: var(--brand); }
.nav-head.has-active { color: var(--brand); }
.nav-head .group-ico { width: 15px; height: 15px; opacity: .85; }
.nav-head > span:first-of-type { display: inline-flex; align-items: center; white-space: nowrap; }
.nav-head.has-active[aria-expanded="false"] > span:first-of-type::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 7px; border-radius: 50%; background: var(--brand); vertical-align: middle; }
.side a.nav { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .95rem; }
.side a.nav:hover { background: var(--surface-2); }
.side a.nav.on { background: var(--brand-soft); font-weight: 650; box-shadow: inset 3px 0 0 var(--brand); }
#in-progress { background: var(--accent-soft); border-radius: 10px; padding: 2px 4px 6px; margin-bottom: 8px; }
#in-progress[hidden] { display: none; }
#in-progress .nav-head { color: var(--accent); }
.side a.nav.resume { display: flex; gap: 9px; align-items: flex-start; padding: 6px 8px; }
.side a.nav.resume:hover { background: var(--surface); }
.resume-icon { color: var(--accent); width: 1.1em; text-align: center; flex: none; }
.resume-text { display: flex; flex-direction: column; min-width: 0; }
.resume-label { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resume-sub { font-size: .78rem; color: var(--ink-2); }
.page { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 clamp(12px, 2.5vw, 28px);
  background: var(--surface); border-bottom: 1px solid var(--line); }
.menu-btn, .topbar-logo { display: none; }
.shell.collapsed .menu-btn { display: block; }
.shell.collapsed .topbar-logo { display: flex; }
.me-wrap { position: relative; margin-left: auto; }
.me-button { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; font: inherit; }
.me-button:hover { border-color: var(--brand); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; text-transform: uppercase; }
.me-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-menu { position: absolute; right: 0; top: 46px; width: 290px; padding: 8px; z-index: 40; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 10px 28px rgba(0,0,0,.18); }
.me-menu[hidden] { display: none; }
.me-who { display: flex; flex-direction: column; padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.me-item { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--ink); padding: 8px 10px; border-radius: 8px; text-decoration: none; font: inherit; cursor: pointer; }
.me-item:hover { background: var(--surface-2); }
.me-logout { color: var(--bad); border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 4px; }
.me-section { padding: 6px 10px; display: flex; flex-direction: column; gap: 6px; }
.me-row { flex-direction: row; align-items: center; justify-content: space-between; }
.me-label { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.me-note { margin: 0; padding: 0 10px 6px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented button { background: var(--surface); border: 0; border-right: 1px solid var(--line); padding: 6px 4px; color: var(--ink); font: inherit; font-size: .88rem; cursor: pointer; border-radius: 0; }
.segmented button:last-child { border-right: 0; }
.segmented button[aria-checked="true"] { background: var(--brand); color: var(--brand-ink); font-weight: 650; }
.switch { display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; font-weight: 500; }
.switch input { width: auto; margin: 0; accent-color: var(--brand); }
.page-tabs { position: sticky; top: 56px; z-index: 19; display: flex; align-items: flex-end; gap: 4px; overflow-x: auto; overflow-y: hidden; padding: 6px clamp(12px, 2.5vw, 28px) 0;
  background: var(--bg); border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.page-tabs:empty { display: none; }
.page-tab { display: flex; align-items: center; flex: none; max-width: 240px; margin-bottom: -1px; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; color: var(--ink-2); }
.page-tab:hover:not(.active) { background: var(--surface-2); color: var(--ink); }
.page-tab.active { background: var(--surface); color: var(--brand); border-color: var(--line); box-shadow: inset 0 2px 0 var(--brand); font-weight: 650; }
.page-tab-open { padding: 7px 6px 7px 12px; color: inherit; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; }
.page-tab-close { width: 22px; height: 22px; margin-right: 6px; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; font-size: 1rem; line-height: 1; cursor: pointer; flex: none; }
.page-tab-close:hover { background: var(--line); color: var(--ink); }
main { padding: 22px clamp(16px, 3vw, 36px) 60px; width: 100%; min-width: 0; }  /* fills the space, menu open or hidden */
main.exam-main { max-width: 820px; margin: 0 auto; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.head p { margin: 0; }
@media (max-width: 860px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); }
  .side, .shell.collapsed .side { display: flex; position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 30; transform: translateX(-100%); transition: transform .18s; }
  .side.open { transform: none; box-shadow: 0 0 30px rgba(0,0,0,.3); }
  .menu-btn { display: block; }
  .topbar-logo { display: flex; }
  .me-name { display: none; }
  .me-button { padding-right: 8px; }
  main { padding-top: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* paging */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }

/* the question a tutor conversation is about */
.qref { margin-bottom: 12px; border-left: 4px solid var(--brand); }
.qref .stem { margin: 6px 0 8px; font-size: 1.02rem; }
.qref ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.qref li { display: flex; gap: 8px; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); font-size: .93rem; }
.qref li .letter { font-weight: 700; color: var(--ink-2); }
.qref li.mine { border-color: var(--brand); background: var(--brand-soft); }
.qref li.key { border-color: var(--good); background: var(--good-soft); }
.qref li .mark { margin-left: auto; font-size: .8rem; color: var(--ink-2); white-space: nowrap; }

/* blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card > h2:first-child { margin-bottom: .6em; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.wide { grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); }
@media (max-width: 960px) { .wide { grid-template-columns: minmax(0, 1fr); } }
.cur-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-top: 16px; align-items: start; }
.cur-area .list li { gap: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; overflow-wrap: anywhere; }
.tile b { display: block; font: 700 1.6rem/1.15 var(--font); font-variant-numeric: tabular-nums; }
.tile span { color: var(--ink-2); font-size: .85rem; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 0; border-top: 1px solid var(--line); } .list > li:first-child { border-top: 0; padding-top: 0; } .list > li:last-child { padding-bottom: 0; }
.empty { color: var(--ink-2); padding: 14px; border: 1px dashed var(--line); border-radius: 10px; text-align: center; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* controls */
button, .btn { font: inherit; font-weight: 600; font-size: .92rem; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 7px 13px; cursor: pointer; text-decoration: none; display: inline-block; min-height: 38px; }
button:hover, .btn:hover { background: var(--surface-2); }
button:disabled { opacity: .55; cursor: not-allowed; }
.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); } .primary:hover { background: var(--brand); filter: brightness(1.08); }
.danger { color: var(--bad); border-color: var(--bad); }
.link { border: 0; background: none; padding: 0; color: var(--brand); text-decoration: underline; min-height: 0; font-weight: 500; }
.icon { min-width: 40px; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 12px; }
label .hint { font-weight: 400; color: var(--ink-2); display: block; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; font: inherit; font-weight: 400; color: var(--ink); background: var(--surface); border: 1px solid #8d9a98; border-radius: 8px; padding: 8px 10px; min-height: 40px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; display: inline-block; margin: 0 8px 0 0; vertical-align: -3px; accent-color: var(--brand); }
label.check { font-weight: 400; display: flex; align-items: flex-start; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.error { color: var(--bad); background: var(--bad-soft); padding: 8px 12px; border-radius: 8px; margin: 0 0 12px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button.on { background: var(--brand-soft); border-color: var(--brand); }

/* tags */
.tag { display: inline-block; font-size: .75rem; font-weight: 650; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tag.official { background: var(--brand-soft); color: var(--ink); }
.tag.ai { background: var(--accent-soft); color: var(--ink); }
.tag.good { background: var(--good-soft); color: var(--ink); } .tag.warn { background: var(--warn-soft); color: var(--ink); } .tag.bad { background: var(--bad-soft); color: var(--ink); }
.notice { background: var(--accent-soft); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }
.meter { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; min-width: 80px; }
.meter i { display: block; height: 100%; background: var(--chart); border-radius: 99px; }
.prog { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; margin-bottom: 12px; }
.prog .meter { grid-column: 1 / -1; }

/* plan */
.plan-item { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.plan-item:first-child { border-top: 0; padding-top: 2px; }
.tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: .8rem; color: transparent; margin-top: 2px; }
.done .tick { background: var(--good); border-color: var(--good); color: var(--surface); }
.done .title { text-decoration: line-through; color: var(--ink-2); }
.lede { font: 1.05rem/1.5 var(--display); margin-bottom: 8px; }

/* tree */
details.unit { border-top: 1px solid var(--line); padding: 8px 0; } details.unit:first-of-type { border-top: 0; }
summary { cursor: pointer; font-weight: 650; padding: 4px 0; }
.chapter { margin: 8px 0 12px 8px; padding-left: 12px; border-left: 2px solid var(--line); }
.topic-row { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; padding: 6px 0; }
.code { font-size: .8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* exam */
.exam-wrap { max-width: 760px; margin: 0 auto; padding: 20px 16px 60px; }
.exam-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.option { display: flex; width: 100%; text-align: left; font-weight: 400; padding: 12px 14px; margin-bottom: 8px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); gap: 10px; align-items: flex-start; font-size: 1rem; }
.option:hover:not(:disabled) { border-color: var(--brand); background: var(--surface); }
.option.sel { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.option.right { border-color: var(--good); background: var(--good-soft); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option:disabled { opacity: 1; cursor: default; }
.letter { font-weight: 700; color: var(--ink-2); }
.stem { font-size: 1.15rem; margin: 14px 0 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback { padding: 12px 14px; border-radius: 10px; margin: 10px 0; }
.feedback.ok { background: var(--good-soft); } .feedback.no { background: var(--bad-soft); }
.dots { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0; }
.dots button { min-width: 32px; min-height: 32px; padding: 0; font-size: .8rem; }
.dots button.ans { background: var(--brand-soft); } .dots button.cur { border-color: var(--brand); border-width: 2px; }
.score { font: 700 3rem/1 var(--font); font-variant-numeric: tabular-nums; }

/* tutorial + chat */
.prose { max-width: 70ch; overflow-wrap: anywhere; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 .75em; }
.section { margin-bottom: 22px; }
.diagram { max-width: 420px; width: 100%; background: #fff; border-radius: 8px; border: 1px solid var(--line); display: block; }
.source-note { font-size: .85rem; color: var(--ink-2); border-left: 3px solid var(--line); padding-left: 10px; margin-top: 8px; }
.chat { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; }
@media (max-width: 820px) { .chat { grid-template-columns: minmax(0, 1fr); } }
.chat-log { min-height: 340px; max-height: 58vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px; margin-bottom: 10px; }
.msg { padding: 10px 14px; border-radius: 14px; max-width: 86%; overflow-wrap: anywhere; }
.msg p:last-child { margin-bottom: 0; }
.msg.user { background: var(--brand); color: var(--brand-ink); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.assistant { background: var(--surface-2); align-self: flex-start; border-bottom-left-radius: 4px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0; width: 38px; min-width: 38px; height: 38px; border-radius: 50%; }
.icon-btn .nav-ico { opacity: .85; }
.icon-btn.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.icon-btn.on .nav-ico { opacity: 1; color: inherit; }
.msg .speak { float: right; width: 30px; min-width: 30px; height: 30px; margin: -4px -8px 4px 8px; background: transparent; border-color: transparent; }
.msg .speak:hover { background: var(--surface); }
.msg .speak.on { background: var(--brand); }
.icon-btn.mic.on { animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .icon-btn.mic.on { animation: none; } }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.quick button { font-weight: 500; font-size: .85rem; min-height: 32px; padding: 3px 10px; border-radius: 99px; }
.chart-box { position: relative; height: 230px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th { text-align: left; font-weight: 650; color: var(--ink-2); border-bottom: 1px solid var(--line); padding: 6px 8px; white-space: nowrap; }
td { border-bottom: 1px solid var(--line); padding: 7px 8px; vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
pre.log { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; max-height: 220px; overflow: auto; font-size: .8rem; color: var(--ink-2); margin: 6px 0 0; }

/* auth */
.auth { max-width: 460px; margin: 6vh auto; padding: 0 16px 40px; }
.auth h1 { color: var(--brand); }
.auth-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.auth-brand img { flex: none; border-radius: 16px; }
.auth h1.auth-name { color: var(--ink); margin: 0; line-height: 1; }
.auth-name .wordmark { height: 34px; width: auto; display: block; }
.tagline { margin: 8px 0 0; font-size: .82rem; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.eyebrow { margin: 0 0 4px; font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; z-index: 60; }
#toast.show { opacity: 1; }
#say label { min-width: 0; }
.chat > * { min-width: 0; }
.quick button { white-space: normal; text-align: left; }
.tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
@media (max-width: 820px) { .chat-log { min-height: 200px; max-height: 50vh; } }

/* AI settings: company cards, connection banner, model for each tier */
.section-title { font-size: 1.05rem; margin: 22px 0 10px; }
.conn-banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
.conn-banner div { display: flex; flex-direction: column; gap: 2px; }
.conn-banner.ok { background: var(--good-soft); border-color: var(--good); }
.conn-banner.bad { background: var(--bad-soft); border-color: var(--bad); }
.conn-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ink-3); flex: none; }
.conn-banner.ok .conn-dot { background: var(--good); box-shadow: 0 0 0 4px rgba(31,122,61,.18); }
.conn-banner.bad .conn-dot { background: var(--bad); }
.conn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.conn-card.in-use { border-color: var(--brand); box-shadow: inset 0 3px 0 var(--brand), var(--shadow); }
.conn-name { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.provider-badge { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 800; }
.error-text { color: var(--bad); }
.danger-link { color: var(--bad); }
.tier-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 8px 18px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tier-row:last-of-type { border-bottom: 0; }
.tier-label { display: flex; flex-direction: column; gap: 2px; }
.tier-pick { display: flex; flex-direction: column; gap: 4px; }
.tier-pick select { margin: 0; }
@media (max-width: 640px) { .tier-row { grid-template-columns: minmax(0, 1fr); } }

/* Coverage: region and board toolbar, grade tabs, subject tabs */
.cov-toolbar { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 360px) minmax(0, 1fr); gap: 12px 16px; align-items: end; margin-bottom: 14px; }
.cov-toolbar label { margin: 0; }
.cov-toolbar select { margin-bottom: 0; }
.cov-action { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
@media (max-width: 860px) { .cov-toolbar { grid-template-columns: minmax(0, 1fr); } }
.cov-report { margin-bottom: 14px; }
.cov-report ul { margin: 10px 0; padding-left: 1.2em; display: grid; gap: 6px; }
.tabbar { display: flex; gap: 4px; overflow-x: auto; overflow-y: hidden; box-shadow: inset 0 -1px 0 var(--line); scrollbar-width: thin; }
.tabbar.sub { margin: -4px 0 14px; flex-wrap: wrap; box-shadow: none; gap: 6px; }
.tabbar-tab { display: flex; align-items: center; gap: 6px; flex: none; padding: 8px 12px; color: var(--ink-2); text-decoration: none; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; white-space: nowrap; }
.tabbar-tab:hover { background: var(--surface-2); color: var(--ink); }
.tabbar-tab.active { background: var(--surface); color: var(--brand); border-color: var(--line); box-shadow: inset 0 2px 0 var(--brand); font-weight: 650; }
.tabbar.sub .tabbar-tab { border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: .9rem; }
.tabbar.sub .tabbar-tab.active { background: var(--brand-soft); color: var(--ink); box-shadow: none; margin: 0; border-color: var(--brand); }
.tab-count { font-size: .75rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tab-count.warn { color: var(--bad); font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.dot.dot-full { background: var(--good); } .dot.dot-part { background: var(--warn); } .dot.dot-none { background: var(--line); }
.cov-panel { border-top-left-radius: 0; }
.doc-list li { padding: 8px 0; }

/* AI Tasks */
.tile-link { text-decoration: none; color: inherit; }
.tile-link:hover { border-color: var(--brand); }
.approve-list li { padding: 0; }
.approve-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 4px; margin: 0; cursor: pointer; font-weight: 400; }
.approve-row input { width: auto; margin: 0; accent-color: var(--brand); }
.approve-text, .task-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.task-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 0; }
.task-row .tag { justify-self: start; }
.card.attention { border-color: var(--accent); }
.nav-badge { margin-left: 6px; background: var(--accent); color: var(--brand-ink); border-radius: 999px; padding: 0 7px; font-size: .75rem; font-weight: 700; }
@media (max-width: 640px) { .task-row { grid-template-columns: minmax(0, 1fr); } }

/* Accent colours (Theme > Colour). Teal is the default, defined on :root above. */
:root[data-accent="blue"] { --brand: #1f5fbf; --brand-soft: #dde8fa; --chart: #1f5fbf; }
:root[data-accent="purple"] { --brand: #6a3fb5; --brand-soft: #ece4f9; --chart: #6a3fb5; }
:root[data-accent="rose"] { --brand: #b23a6b; --brand-soft: #f8e1ea; --chart: #b23a6b; }
:root[data-accent="orange"] { --brand: #a8500b; --brand-soft: #fbe9d7; --chart: #a8500b; }
:root[data-accent="green"] { --brand: #2e7d32; --brand-soft: #e1f1e2; --chart: #2e7d32; }
@media (prefers-color-scheme: dark) { :root[data-accent="blue"]:not([data-theme="light"]) { --brand: #7fb0ff; --brand-soft: #1c2c47; --chart: #7fb0ff; } }
:root[data-theme="dark"][data-accent="blue"] { --brand: #7fb0ff; --brand-soft: #1c2c47; --chart: #7fb0ff; }
@media (prefers-color-scheme: dark) { :root[data-accent="purple"]:not([data-theme="light"]) { --brand: #b79cf2; --brand-soft: #2d2342; --chart: #b79cf2; } }
:root[data-theme="dark"][data-accent="purple"] { --brand: #b79cf2; --brand-soft: #2d2342; --chart: #b79cf2; }
@media (prefers-color-scheme: dark) { :root[data-accent="rose"]:not([data-theme="light"]) { --brand: #f095b8; --brand-soft: #3d1f2c; --chart: #f095b8; } }
:root[data-theme="dark"][data-accent="rose"] { --brand: #f095b8; --brand-soft: #3d1f2c; --chart: #f095b8; }
@media (prefers-color-scheme: dark) { :root[data-accent="orange"]:not([data-theme="light"]) { --brand: #f0a763; --brand-soft: #3d2c1b; --chart: #f0a763; } }
:root[data-theme="dark"][data-accent="orange"] { --brand: #f0a763; --brand-soft: #3d2c1b; --chart: #f0a763; }
@media (prefers-color-scheme: dark) { :root[data-accent="green"]:not([data-theme="light"]) { --brand: #7fd18a; --brand-soft: #1c3420; --chart: #7fd18a; } }
:root[data-theme="dark"][data-accent="green"] { --brand: #7fd18a; --brand-soft: #1c3420; --chart: #7fd18a; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); padding: 0; cursor: pointer; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--ink); }
.swatch:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.usage-table td.usage-name { overflow-wrap: anywhere; min-width: 80px; }
.usage-table th, .usage-table td { padding-left: 6px; padding-right: 6px; }
.usage-table th, .usage-table td.num { white-space: nowrap; }
.grid > .card { min-width: 0; }

/* Avatars and the avatar picker */
.avatar-img { object-fit: cover; background: var(--surface-2); padding: 0; }
.avatar-lg { width: 44px; height: 44px; font-size: 1.2rem; flex: none; }
.me-who { flex-direction: row !important; align-items: center; gap: 10px; }
.me-who > div { display: flex; flex-direction: column; min-width: 0; }
.avatar-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; padding: 20px; border: 1px solid var(--line); color: var(--ink); }
.avatar-dialog::backdrop { background: rgba(10, 20, 20, .45); }
.avatar-dialog h3 { margin: 14px 0 8px; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.avatar-choice { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; text-align: center; }
.avatar-choice:hover { border-color: var(--brand); }
.avatar-choice.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.avatar-choice img { width: 72px; height: 72px; border-radius: 50%; margin-bottom: 4px; }
.avatar-choice strong { font-size: .85rem; line-height: 1.2; }
.avatar-choice span { font-size: .72rem; color: var(--ink-2); line-height: 1.2; }

/* Menu search */
.menu-search { padding: 0 2px 8px; }
.menu-search input { margin: 0; padding: 7px 10px; font-size: .9rem; }
.menu-empty { padding: 0 10px; margin: 0 0 6px; }
.side a.nav[hidden], .nav-group[hidden] { display: none; }
.usage-grid { grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); }
