/* Simpleclass ops console. Visual language of the Simpleclass admin app (admin.simpleclass.eu): light slate
   surfaces, white cards with a soft shadow, cyan-600 accent, system font. Dark mode is a selected set of tokens
   (OS setting or the toggle in the top bar), not an inverted copy. */
:root {
  color-scheme: light;
  --bg: #f1f5f9; --panel: #ffffff; --panel2: #f8fafc; --panel3: #f1f5f9;
  --line: #e2e8f0; --line2: #cbd5e1;
  --text: #1e293b; --text2: #334155; --muted: #64748b; --dim: #94a3b8;
  --accent: #0891b2; --accent2: #06b6d4; --accent-hover: #0e7490; --accent-soft: #ecfeff; --accent-line: #a5f3fc; --accent-ink: #ffffff;
  --ok: #16a34a; --ok-soft: #dcfce7; --ok-ink: #15803d;
  --warn: #d97706; --warn-soft: #fef3c7; --warn-ink: #b45309;
  --bad: #dc2626; --bad-soft: #fee2e2; --bad-ink: #b91c1c;
  --violet: #7c3aed; --violet-soft: #ede9fe; --violet-ink: #6d28d9;
  --series: #0891b2; --series-fill: rgba(8,145,178,.12); --grid: #e9eef4;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 1px 3px rgba(15,23,42,.06);
  --shadow-lg: 0 1px 3px rgba(15,23,42,.06), 0 10px 24px -12px rgba(15,23,42,.18);
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 10px; --radius-lg: 14px; --radius-sm: 8px;
  --top: 56px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1220; --panel: #111a2b; --panel2: #16213a; --panel3: #1b2845;
    --line: #1f2d47; --line2: #2c3d5c;
    --text: #e2e8f0; --text2: #cbd5e1; --muted: #94a3b8; --dim: #64748b;
    --accent: #22d3ee; --accent2: #06b6d4; --accent-hover: #67e8f9; --accent-soft: rgba(34,211,238,.12); --accent-line: rgba(34,211,238,.35); --accent-ink: #062a2f;
    --ok: #4ade80; --ok-soft: rgba(74,222,128,.14); --ok-ink: #86efac;
    --warn: #fbbf24; --warn-soft: rgba(251,191,36,.14); --warn-ink: #fcd34d;
    --bad: #f87171; --bad-soft: rgba(248,113,113,.14); --bad-ink: #fca5a5;
    --violet: #a78bfa; --violet-soft: rgba(167,139,250,.14); --violet-ink: #c4b5fd;
    --series: #22d3ee; --series-fill: rgba(34,211,238,.14); --grid: #1c2a44;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 1px 2px rgba(0,0,0,.35), 0 12px 28px -14px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220; --panel: #111a2b; --panel2: #16213a; --panel3: #1b2845;
  --line: #1f2d47; --line2: #2c3d5c;
  --text: #e2e8f0; --text2: #cbd5e1; --muted: #94a3b8; --dim: #64748b;
  --accent: #22d3ee; --accent2: #06b6d4; --accent-hover: #67e8f9; --accent-soft: rgba(34,211,238,.12); --accent-line: rgba(34,211,238,.35); --accent-ink: #062a2f;
  --ok: #4ade80; --ok-soft: rgba(74,222,128,.14); --ok-ink: #86efac;
  --warn: #fbbf24; --warn-soft: rgba(251,191,36,.14); --warn-ink: #fcd34d;
  --bad: #f87171; --bad-soft: rgba(248,113,113,.14); --bad-ink: #fca5a5;
  --violet: #a78bfa; --violet-soft: rgba(167,139,250,.14); --violet-ink: #c4b5fd;
  --series: #22d3ee; --series-fill: rgba(34,211,238,.14); --grid: #1c2a44;
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 1px 2px rgba(0,0,0,.35), 0 12px 28px -14px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; font-weight: 500; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 12px; color: var(--text2); font-weight: 500; box-shadow: var(--shadow); transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
button:hover { background: var(--panel2); border-color: var(--line2); color: var(--text); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: linear-gradient(90deg, #0891b2, #06b6d4); color: #fff; border-color: transparent; font-weight: 600; }
button.primary:hover { background: linear-gradient(90deg, #0e7490, #0891b2); color: #fff; }
button.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok-ink); }
button.ok:hover { filter: brightness(.97); color: var(--ok-ink); }
button.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad-ink); }
button.bad:hover { filter: brightness(.97); color: var(--bad-ink); }
button.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
button.ghost:hover { color: var(--text); background: var(--panel2); }
button.small { padding: 3px 9px; font-size: 12px; }
button.icon { padding: 6px; display: inline-flex; align-items: center; justify-content: center; }
input, select, textarea { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 11px; outline: none; transition: border-color .15s, box-shadow .15s; color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, select:focus, textarea:focus { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(6,182,212,.22); background: var(--panel); }
select { padding-right: 28px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
textarea { resize: vertical; min-height: 44px; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
pre { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; overflow: auto; margin: 6px 0; white-space: pre-wrap; word-break: break-word; }
code { background: var(--panel3); border-radius: 4px; padding: 1px 5px; }
pre code { background: none; border: 0; padding: 0; }
h1, h2, h3 { margin: 0 0 8px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; background: var(--panel2); white-space: nowrap; position: sticky; top: 0; }
tbody tr:hover td { background: var(--panel2); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
td.strong { color: var(--text); font-weight: 600; }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: auto; }
.table-wrap table th:first-child, .table-wrap table td:first-child { padding-left: 16px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); } .accent { color: var(--accent); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--panel3); color: var(--text2); line-height: 1.5; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok-ink); } .pill.bad { background: var(--bad-soft); color: var(--bad-ink); } .pill.warn { background: var(--warn-soft); color: var(--warn-ink); } .pill.accent { background: var(--accent-soft); color: var(--accent-hover); } .pill.violet { background: var(--violet-soft); color: var(--violet-ink); }
.pill.mono { font-family: var(--mono); font-weight: 500; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge { background: var(--bad); color: #fff; border-radius: 999px; font-size: 10.5px; padding: 0 6px; margin-left: auto; font-weight: 700; line-height: 17px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow); }
.card.pad0 { padding: 0; overflow: auto; }
.card .card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card .card-head h2 { margin: 0; font-size: 15px; }
.card.warn { border-color: var(--warn); border-left-width: 4px; background: var(--warn-soft); color: var(--warn-ink); }
.card.info { border-color: var(--accent2); border-left-width: 4px; background: var(--accent-soft); color: var(--accent-hover); }
.card.danger { border-color: var(--bad); border-left-width: 4px; background: var(--bad-soft); color: var(--bad-ink); }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat.text .v { font-size: 16px; font-weight: 600; word-break: break-word; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.stat .body { min-width: 0; flex: 1; }
.stat .l { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 2px; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.01em; line-height: 1.2; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.stat .d { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat .d.up { color: var(--ok-ink); } .stat .d.down { color: var(--bad-ink); }
.stat .ic { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat .ic.ok { background: var(--ok-soft); color: var(--ok); } .stat .ic.warn { background: var(--warn-soft); color: var(--warn); } .stat .ic.bad { background: var(--bad-soft); color: var(--bad); } .stat .ic.violet { background: var(--violet-soft); color: var(--violet); }
.stat .spark { height: 28px; margin-top: 6px; }
.meter { height: 8px; background: var(--panel3); border-radius: 999px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--accent2); }
.meter > i.warn { background: var(--warn); } .meter > i.bad { background: var(--bad); }
.empty { color: var(--dim); padding: 28px; text-align: center; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: var(--radius); z-index: 90; box-shadow: var(--shadow-lg); font-weight: 500; }
.toast.bad { background: var(--bad); color: #fff; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13.5px; align-items: center; }
.kv .k { color: var(--muted); font-weight: 500; }
.kv input, .kv select, .kv textarea { width: 100%; }
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 20px; }
.dl > div .k { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.dl > div .v { font-weight: 500; margin-top: 1px; word-break: break-word; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 8px 12px; box-shadow: none; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); background: transparent; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters input[type="search"], .filters input[type="text"] { min-width: 220px; }
.pager { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.log { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; max-height: 60vh; overflow: auto; line-height: 1.55; }
.editor { width: 100%; min-height: 60vh; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.switch input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.commit { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; align-items: center; }
.commit:last-child { border-bottom: 0; }
.commit .h { font-family: var(--mono); color: var(--accent); }
.commit .d { color: var(--dim); font-size: 11.5px; }
.notice { font-size: 13px; padding: 10px 14px; border-radius: var(--radius); display: flex; gap: 10px; align-items: flex-start; }

/* shell */
.app { display: flex; flex-direction: column; height: 100dvh; }
.topbar { height: var(--top); background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 18px; flex-shrink: 0; box-shadow: var(--shadow); z-index: 20; }
.topbar .brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; color: var(--accent); letter-spacing: -.02em; }
.topbar .brand .tag { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--panel3); border-radius: 6px; padding: 2px 7px; letter-spacing: .02em; }
.topbar .status { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.topbar .st { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 3px 9px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); }
.topbar .st i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.topbar .st.off i { background: var(--dim); }
.topbar .st.bad i { background: var(--bad); }
.topbar .spacer { flex: 1; }
.topbar .menu { display: none; }
.shell { display: grid; grid-template-columns: 236px 1fr; flex: 1; min-height: 0; }
.side { padding: 16px 0 16px 16px; min-height: 0; overflow: auto; }
.side .navcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.side .group { color: var(--dim); font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; font-weight: 700; padding: 10px 10px 4px; }
.side .group:first-child { padding-top: 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 11px; border-radius: 9px; color: var(--text2); font-weight: 500; font-size: 13.5px; }
.nav a svg { width: 18px; height: 18px; color: var(--dim); flex-shrink: 0; }
.nav a:hover { background: var(--panel3); color: var(--text); text-decoration: none; }
.nav a:hover svg { color: var(--muted); }
.nav a.active { background: var(--accent2); color: #fff; box-shadow: var(--shadow); }
.nav a.active svg { color: #fff; }
.nav a.active .badge { background: #fff; color: var(--accent-hover); }
.side .foot { padding: 12px 10px 0; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.page { padding: 18px 20px 28px; overflow: auto; min-height: 0; flex: 1; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.page-head a.crumb { color: var(--muted); font-weight: 500; }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.section-head h2 { margin: 0; }

/* chats */
.chats { display: grid; grid-template-columns: 272px 1fr; height: 100%; min-height: 0; padding: 16px; gap: 16px; }
.chats > * { min-width: 0; }
.chatlist { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.chatlist .tools { padding: 10px; display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.chatlist .tools input { flex: 1; min-width: 0; }
.chatlist .tools select { padding: 6px 24px 6px 8px; max-width: 96px; }
.chatlist ul { list-style: none; margin: 0; padding: 6px; overflow: auto; flex: 1; }
.chatlist li a { display: block; padding: 8px 10px; border-radius: 9px; color: var(--text); font-weight: 500; }
.chatlist li a:hover { background: var(--panel2); text-decoration: none; }
.chatlist li a.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent2); }
.chatlist .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.chatlist .m { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; margin-top: 2px; font-weight: 400; }
.chat { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.chat .head { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.chat .head .back { display: none; color: var(--muted); padding: 4px; }
.chat .head .back:hover { color: var(--text); }
.chat .head input.title { background: transparent; border-color: transparent; font-weight: 600; font-size: 15px; padding: 3px 6px; flex: 1; min-width: 0; box-shadow: none; }
.chat .head input.title:hover, .chat .head input.title:focus { border-color: var(--line); background: var(--panel2); }
.msgs { flex: 1; overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: var(--panel2); }
.msg { max-width: 860px; }
.msg.user { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 14px 14px 4px 14px; padding: 9px 13px; white-space: pre-wrap; max-width: 70%; color: var(--text); }
.msg.user .src { font-size: 10.5px; color: var(--muted); margin-top: 4px; font-family: var(--mono); }
.msg.assistant { padding: 2px 0; }
.msg.assistant .body > *:first-child { margin-top: 0; } .msg.assistant .body > *:last-child { margin-bottom: 0; }
.msg.assistant.sub { border-left: 3px solid var(--violet); padding-left: 10px; color: var(--muted); }
.msg.system { color: var(--warn-ink); font-size: 12.5px; font-family: var(--mono); }
.tool { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); font-size: 12.5px; max-width: 860px; }
.tool summary { cursor: pointer; padding: 6px 10px; display: flex; gap: 8px; align-items: center; list-style: none; color: var(--muted); }
.tool summary::-webkit-details-marker { display: none; }
.tool summary .name { color: var(--accent); font-family: var(--mono); font-weight: 600; }
.tool summary .sum { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); color: var(--dim); flex: 1; min-width: 0; }
.tool .in { padding: 0 10px 8px; }
.tool.result summary .name { color: var(--muted); }
.tool.result.err summary .name { color: var(--bad); }
.tool.sub { border-color: var(--violet-soft); }
.live { white-space: pre-wrap; color: var(--text); }
.live::after { content: ""; display: inline-block; width: 7px; height: 14px; background: var(--accent2); vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(2) infinite; border-radius: 2px; }
@keyframes blink { to { opacity: 0; } }
.gate { border: 1px dashed var(--warn); color: var(--warn-ink); background: var(--warn-soft); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12.5px; max-width: 860px; }
.approval { border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: var(--radius); padding: 12px 14px; background: var(--panel); max-width: 860px; box-shadow: var(--shadow); }
.approval.done { border-left-color: var(--line2); opacity: .85; }
.approval .t { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.approval pre { margin: 8px 0; max-height: 240px; }
.composer { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 8px; align-items: flex-end; background: var(--panel); }
.composer textarea { flex: 1; max-height: 40vh; }
.composer .voice { display: flex; gap: 6px; }
.mic, .speak { width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; padding: 0; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.mic.on { background: var(--bad); border-color: var(--bad); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(220,38,38,.2); } }
.speak.on { border-color: var(--accent2); color: var(--accent); background: var(--accent-soft); }
.interim { font-size: 12px; color: var(--muted); padding: 2px 14px 8px; font-style: italic; background: var(--panel); }
.interim .switch { font-style: normal; }
.search-results { padding: 8px; overflow: auto; }
.search-results a { display: block; padding: 6px 8px; border-radius: 8px; font-size: 12.5px; color: var(--text); }
.search-results a:hover { background: var(--panel2); text-decoration: none; }
.search-results .q { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 400; }

/* markdown */
.md p { margin: 6px 0; } .md ul, .md ol { margin: 6px 0; padding-left: 22px; } .md li { margin: 2px 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 10px 0 4px; font-size: 14px; color: var(--text); text-transform: none; letter-spacing: 0; }
.md h1 { font-size: 16px; } .md h2 { font-size: 15px; }
.md table { margin: 8px 0; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.md th, .md td { padding: 5px 9px; }
.md th { position: static; }
.md blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--line2); color: var(--muted); }

/* charts */
.chart { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px 10px; box-shadow: var(--shadow); min-width: 0; }
.chart .ch { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.chart .ch .t { font-weight: 600; font-size: 13.5px; }
.chart .ch .cur { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart .ch .cur small { color: var(--muted); font-weight: 500; margin-left: 3px; }
.chart svg { display: block; width: 100%; height: 150px; overflow: visible; }
.chart svg text { fill: var(--muted); font-size: 10.5px; font-family: var(--sans); }
.chart svg .grid line { stroke: var(--grid); stroke-width: 1; }
.chart svg .area { fill: var(--series-fill); }
.chart svg .line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart svg .xh { stroke: var(--line2); stroke-width: 1; }
.chart svg .pt { fill: var(--series); stroke: var(--panel); stroke-width: 2; }
.chart .tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font-size: 12px; padding: 5px 9px; border-radius: 7px; white-space: nowrap; box-shadow: var(--shadow-lg); transform: translate(-50%, -100%); z-index: 5; }
.chart .tip b { font-size: 13px; }
.chart .tip span { opacity: .75; margin-left: 6px; }
.chart .nodata { height: 150px; display: grid; place-items: center; color: var(--dim); font-size: 12.5px; }
.chart.loading { opacity: .6; }
.spark path { fill: none; stroke: var(--series); stroke-width: 1.5; }
.spark .a { fill: var(--series-fill); stroke: none; }

/* login */
.login { height: 100dvh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow-lg); }
.login .brand { font-size: 24px; font-weight: 800; color: var(--accent); letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.login .brand .tag { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--panel3); border-radius: 6px; padding: 2px 7px; }
.login .err { color: var(--bad-ink); font-size: 13px; background: var(--bad-soft); padding: 8px 10px; border-radius: 8px; }
.login button.primary { padding: 10px; border-radius: 10px; }
.login input { padding: 10px 12px; border-radius: 10px; }

/* activity feed */
.feed { display: flex; flex-direction: column; }
.feed .it { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: center; font-size: 13px; }
.feed .it:last-child { border-bottom: 0; }
.feed .it .ic { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--panel3); color: var(--muted); }
.feed .it .ic svg { width: 14px; height: 14px; }
.feed .it .ic.ok { background: var(--ok-soft); color: var(--ok); } .feed .it .ic.accent { background: var(--accent-soft); color: var(--accent); } .feed .it .ic.violet { background: var(--violet-soft); color: var(--violet); }
.feed .it .when { color: var(--dim); font-size: 12px; white-space: nowrap; }

/* chat transcript (platform) */
.bubbles { display: flex; flex-direction: column; gap: 8px; }
.bubble { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; max-width: 760px; }
.bubble .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; display: flex; gap: 8px; }
.bubble .who b { color: var(--text2); }
.bubble.teacher { border-color: var(--accent-line); background: var(--accent-soft); }
.bubble .att { font-size: 12px; margin-top: 4px; }

/* setup */
.setup-banner { display: flex; align-items: center; gap: 10px; padding: 9px 20px; background: var(--warn-soft); color: var(--warn-ink); font-size: 13px; border-bottom: 1px solid var(--line); }
.setup-banner.restart { background: var(--accent-soft); color: var(--accent-hover); }
.setup-banner a { font-weight: 600; }
.setup-item.req { border-left: 4px solid var(--accent2); }
.setup-item .kv { grid-template-columns: 240px 1fr; }
.setup-req { border-left-color: var(--accent2); }
.setup-req .kv { grid-template-columns: 220px 1fr; }
.setup-req.done { opacity: .85; }

/* drawer (mobile nav) */
.drawer-bg { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar .menu { display: inline-flex; }
  .topbar .status { display: none; }
  .topbar .brand { font-size: 17px; }
  .topbar .brand .tag { display: none; }
  .grid, .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .grid.wide { grid-template-columns: 1fr; }
  .stat { padding: 10px 12px; gap: 8px; }
  .stat .ic { width: 30px; height: 30px; border-radius: 8px; }
  .page-head h1 { font-size: 18px; }
  .filters input[type="search"], .filters input[type="text"] { min-width: 0; flex: 1; }
  .drawer-bg { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 40; }
  .drawer { position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); background: var(--panel); z-index: 41; overflow: auto; padding: 12px; box-shadow: var(--shadow-lg); }
  .drawer .navcard { display: flex; flex-direction: column; gap: 2px; }
  .drawer .group { color: var(--dim); font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; font-weight: 700; padding: 10px 10px 4px; }
  .drawer .foot { padding: 12px 10px 0; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
  .page { padding: 12px; }
  .chats { grid-template-columns: 1fr; padding: 10px; gap: 10px; }
  .chatlist { display: none; }
  .chatlist.show { display: flex; }
  .chat.hide { display: none; }
  .msg.user { max-width: 88%; }
  .msgs { padding: 12px; }
  .composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .chat .head { padding: 8px 10px; }
  .chat .head .back { display: inline-flex; }
  .hide-m { display: none !important; }
  .mic, .speak { width: 40px; height: 40px; }
  .composer .voice { gap: 4px; }
  .composer button.primary { padding: 8px 10px; }
  .stat .v { font-size: 20px; }
  .ellipsis { max-width: 200px; }
  .kv, .setup-item .kv, .setup-req .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .setup-banner { padding: 8px 12px; flex-wrap: wrap; }
  .kv .k { margin-top: 6px; }
  .grid.two { grid-template-columns: 1fr; }
}
