:root { font-family: system-ui, Segoe UI, sans-serif; color: #1a1a2e; }
body { margin: 0; background: #f4f6fb; min-height: 100vh; }
.wrap { max-width: 900px; margin: 0 auto; padding: 1.5rem; }
.wrap.wide { max-width: 1100px; }
.card { background: #fff; border-radius: 12px; padding: 1.25rem; box-shadow: 0 2px 12px rgba(0,0,0,.06); margin-bottom: 1rem; }
h1 { font-size: 1.35rem; margin: 0 0 .5rem; }
label { display: block; font-weight: 600; margin: .75rem 0 .25rem; font-size: .9rem; }
input, textarea, button, select { font: inherit; }
input[type=text], input[type=password], textarea, select {
  width: 100%; box-sizing: border-box; padding: .55rem .65rem; border: 1px solid #ccd; border-radius: 8px;
}
textarea { min-height: 120px; resize: vertical; }
button, .btn {
  background: #3d5afe; color: #fff; border: none; border-radius: 8px; padding: .55rem 1rem; cursor: pointer; text-decoration: none; display: inline-block;
  touch-action: manipulation;
}
button.secondary { background: #5c6bc0; }
button.small { padding: .35rem .65rem; font-size: .85rem; }
.muted { color: #667; font-size: .9rem; }
.err { color: #c62828; }
.chat-layout { display: grid; grid-template-columns: 220px 1fr; gap: 1rem; }
@media (max-width: 700px) { .chat-layout { grid-template-columns: 1fr; } }
.sidebar { background: #fff; border-radius: 12px; padding: .75rem; box-shadow: 0 2px 12px rgba(0,0,0,.06); max-height: 480px; overflow-y: auto; }
.sidebar a { display: block; padding: .4rem .5rem; border-radius: 6px; text-decoration: none; color: #1a1a2e; font-size: .9rem; margin-bottom: .25rem; }
.sidebar a.active { background: #e8eaf6; font-weight: 600; }
.chat-box { height: 340px; overflow-y: auto; border: 1px solid #dde; border-radius: 8px; padding: .75rem; background: #fafbff; margin-bottom: .75rem; }
.msg { margin: .4rem 0; }
.msg.user { text-align: right; }
.msg.user span { background: #e3f2fd; padding: .35rem .55rem; border-radius: 8px; display: inline-block; max-width: 85%; text-align: left; }
.msg.bot span { background: #fff; border: 1px solid #e0e0e0; padding: .35rem .55rem; border-radius: 8px; display: inline-block; max-width: 85%; }
.staff-chat .msg.flagged-msg span { background: #fff3e0; border-color: #ffcc80; }
.staff-chat .flagged { display: block; font-size: .75rem; color: #e65100; margin-top: .2rem; }
.bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.bot-tile { background: #fff; border-radius: 10px; padding: 1rem; box-shadow: 0 2px 8px rgba(0,0,0,.05); text-decoration: none; color: inherit; border-left: 5px solid #90a4ae; }
.bot-tile:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); }
.bot-row-label { font-size: .85rem; font-weight: 700; color: #556; margin: 1rem 0 .35rem; text-transform: uppercase; letter-spacing: .03em; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat-card { background: #f5f7ff; border-radius: 10px; padding: .85rem 1rem; }
.stat-card strong { display: block; font-size: 1.4rem; }
.section-title { font-size: 1.05rem; margin: 1.25rem 0 .65rem; color: #334; }
.student-engagement { margin-bottom: 1.25rem; }
.student-engagement .engagement-title { font-size: 1.15rem; margin: 0 0 .25rem; }
.student-engagement .engagement-intro { margin-bottom: 1rem; }
.engagement-stats .engagement-stat.streak strong { color: #e65100; }
.engagement-week-progress { margin: .25rem 0 1rem; }
.engagement-progress-label {
  display: flex; justify-content: space-between; gap: .75rem; font-size: .85rem; color: #556; margin-bottom: .35rem;
}
.engagement-progress-track {
  height: .65rem; background: #eef0f8; border-radius: 999px; overflow: hidden;
}
.engagement-progress-fill {
  height: 100%; background: linear-gradient(90deg, #5c6bc0, #3d5afe); border-radius: 999px; min-width: 0;
  transition: width .25s ease;
}
.engagement-heatmap-wrap { margin-top: .5rem; }
@media (max-width: 520px) {
  .engagement-stats { grid-template-columns: repeat(2, 1fr); }
  .engagement-progress-label { flex-direction: column; gap: .15rem; }
}
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; margin-top: .75rem; }
.bar-chart .bar { flex: 1; background: #5c6bc0; border-radius: 4px 4px 0 0; min-height: 4px; position: relative; }
.bar-chart .bar span { position: absolute; bottom: -1.4rem; left: 50%; transform: translateX(-50%); font-size: .65rem; color: #667; white-space: nowrap; }
.hbar-chart { display: flex; flex-direction: column; gap: .45rem; margin-top: .5rem; }
.hbar-row { display: grid; grid-template-columns: 7rem 1fr 2.5rem; gap: .5rem; align-items: center; font-size: .85rem; }
.hbar-row .hbar-label { color: #445; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-row .hbar-track { background: #eef0f8; border-radius: 6px; height: 1.25rem; overflow: hidden; }
.hbar-row .hbar-fill { height: 100%; background: #5c6bc0; border-radius: 6px; min-width: 2px; }
.hbar-row .hbar-val { text-align: right; color: #667; font-size: .8rem; }
.analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.analytics-dashboard {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-top: 1rem;
}
@media (max-width: 720px) { .analytics-dashboard { grid-template-columns: 1fr; } }
.analytics-tile {
  background: linear-gradient(145deg, #fff 0%, #f8f9ff 100%);
  border-radius: 14px; padding: 1.1rem 1.15rem; box-shadow: 0 2px 14px rgba(61,90,254,.08);
  border: 1px solid #e8ecf8; text-decoration: none; color: inherit; display: block;
  transition: transform .15s, box-shadow .15s;
}
.analytics-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(61,90,254,.14); }
.analytics-tile h2 { font-size: 1rem; margin: 0 0 .25rem; color: #1a1a2e; }
.analytics-tile .tile-preview { min-height: 140px; margin-top: .5rem; }
.analytics-tile .tile-cta { font-size: .8rem; color: #3d5afe; margin-top: .65rem; font-weight: 600; }
.leaderboard-list { list-style: none; padding: 0; margin: .5rem 0 0; }
.leaderboard-list li {
  display: grid; grid-template-columns: 1.75rem 1fr auto; gap: .5rem; align-items: center;
  padding: .45rem 0; border-bottom: 1px solid #eef1f8; font-size: .9rem;
}
.leaderboard-list li:last-child { border-bottom: none; }
.leaderboard-list .rank {
  width: 1.75rem; height: 1.75rem; border-radius: 50%; background: #e8eaf6; color: #3d5afe;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .75rem;
}
.leaderboard-list .rank.gold { background: #fff3e0; color: #e65100; }
.leaderboard-list .rank.silver { background: #f5f5f5; color: #616161; }
.leaderboard-list .rank.bronze { background: #efebe9; color: #795548; }
.hour-chart-grid {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end;
  height: 120px; margin-top: .75rem;
}
.hour-chart-grid .hour-cell {
  background: #5c6bc0; border-radius: 4px 4px 0 0; min-height: 3px; position: relative;
}
.hour-chart-grid .hour-cell span {
  position: absolute; bottom: -1.1rem; left: 50%; transform: translateX(-50%);
  font-size: .55rem; color: #889;
}
.calendar-heatmap {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: .75rem;
}
.calendar-heatmap .cal-day {
  aspect-ratio: 1; border-radius: 6px; background: #eef0f8; min-height: 28px;
  display: flex; align-items: center; justify-content: center; font-size: .65rem; color: #667;
}
.calendar-heatmap .cal-day.has-data { color: #fff; font-weight: 600; }
.table-toolbar { display: flex; justify-content: flex-end; align-items: center; margin-bottom: .5rem; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  background: #eef0f8; color: #3d5afe; border: 1px solid #dde3f0; border-radius: 8px;
  padding: .4rem .65rem; text-decoration: none; font-size: .85rem; font-weight: 600;
  touch-action: manipulation;
}
.icon-btn:hover { background: #e8eaf6; }
.icon-btn.icon-only { padding: .45rem; min-width: 2.25rem; }
.icon-btn.inline { padding: .3rem; min-width: auto; vertical-align: middle; }
.icon-btn.publish:not(:disabled) { background: #43a047; color: #fff; border-color: #2e7d32; }
.icon-btn.publish:not(:disabled):hover { background: #388e3c; }
.bot-edit-actions button.publish:not(:disabled) { background: #43a047; color: #fff; border: none; border-radius: 8px; padding: .55rem 1rem; font-weight: 600; cursor: pointer; }
.bot-edit-actions button.publish:not(:disabled):hover { background: #388e3c; }
.bot-edit-actions button.publish:disabled { opacity: 0.38; cursor: not-allowed; }
.bot-edit-actions button.secondary:disabled { opacity: 0.38; cursor: not-allowed; }
button.undo-all-btn:disabled { opacity: 0.38; cursor: not-allowed; }
.icon-btn.danger:not(:disabled) { background: #ffebee; color: #c62828; border-color: #ef9a9a; }
button.icon-btn:disabled, a.icon-btn.disabled { opacity: 0.38; cursor: not-allowed; pointer-events: none; }
.row-actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.icon-toolbar { justify-content: flex-end; }
.bot-name-with-icons { display: inline-flex; align-items: center; gap: .35rem; }
.status-badge.draft-pending { background: #fff8e1; color: #f57f17; }
tr.bot-row-unpublished td { background: #fffde7; }
tr.bot-row-unpublished td:first-child { box-shadow: inset 3px 0 0 #fbc02d; }
td.col-actions { white-space: nowrap; text-align: right; vertical-align: middle; }
td.col-actions .icon-toolbar { flex-wrap: nowrap; justify-content: flex-end; }
td.col-actions form.inline-action-form { margin: 0; display: inline-flex; }
details.edit-panel { margin-bottom: .75rem; }
details.edit-panel summary {
  cursor: pointer; font-weight: 600; padding: .85rem 1rem; background: #f5f7ff;
  border: 1px solid #dde3f0; border-radius: 10px; list-style: none; user-select: none;
  color: #3d5afe; transition: background .15s, border-color .15s, color .15s;
}
details.edit-panel summary::before { content: '+ '; font-weight: 700; }
details.edit-panel summary::-webkit-details-marker { display: none; }
details.edit-panel[open] summary {
  background: #e8eaf6; border-color: #3d5afe; color: #1a1a2e;
  border-radius: 10px 10px 0 0; border-bottom: none;
}
details.edit-panel[open] summary::before { content: '− '; color: #3d5afe; }
details.edit-panel .edit-panel-body {
  padding: 1rem 1rem .25rem; border: 1px solid #3d5afe; border-top: none;
  border-radius: 0 0 10px 10px; background: #fff;
}
.bot-edit-actions { padding: 1rem 0 .5rem; margin-top: .25rem; }
.org-chart-wrap { margin: 1.25rem 0 1.5rem; overflow-x: auto; }
.org-chart-wrap h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.org-mode-panel { display: none; }
.org-mode-panel.active { display: block; }
.org-graph-subtabs { margin: .75rem 0 1rem; }
.org-hub { display: flex; justify-content: center; margin-bottom: 1rem; position: relative; }
.org-hub::after {
  content: ''; position: absolute; bottom: -1rem; left: 15%; right: 15%; height: 2px; background: #c5cae9;
}
.org-root-node {
  background: linear-gradient(135deg, #3d5afe, #5c6bc0); color: #fff; font-weight: 700;
  padding: .75rem 1.5rem; border-radius: 12px; box-shadow: 0 4px 14px rgba(61,90,254,.35);
  position: relative; z-index: 1;
}
.org-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1.5rem; }
@media (max-width: 700px) { .org-split { grid-template-columns: 1fr; } }
.org-branch { background: #fff; border: 1px solid #e0e4ef; border-radius: 12px; padding: 1rem; }
.org-branch h3 {
  font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: #667; margin: 0 0 .75rem;
  text-align: center;
}
.org-branch-left h3 { color: #2e7d32; }
.org-branch-right h3 { color: #1565c0; }
details.org-node { margin-bottom: .5rem; }
details.org-node > summary {
  list-style: none; cursor: pointer; padding: .55rem .75rem; border-radius: 8px;
  background: #f5f7ff; border: 1px solid #dde3f0; font-weight: 600; font-size: .9rem;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  transition: background .15s, border-color .15s;
}
details.org-node[open] > summary { background: #e8eaf6; border-color: #3d5afe; border-radius: 8px 8px 0 0; }
details.org-node > summary::-webkit-details-marker { display: none; }
.org-badge {
  font-size: .75rem; background: #3d5afe; color: #fff; padding: .15rem .45rem; border-radius: 999px; font-weight: 700;
}
.org-children {
  border: 1px solid #3d5afe; border-top: none; border-radius: 0 0 8px 8px; padding: .5rem .5rem .35rem;
  background: #fafbff; display: flex; flex-direction: column; gap: .35rem;
}
.org-leaf {
  font-size: .82rem; padding: .35rem .6rem; border-radius: 6px; background: #fff;
  border: 1px solid #e8eaf0; color: #334;
}
.org-branch-left .org-leaf { border-left: 3px solid #66bb6a; }
.org-branch-right .org-leaf { border-left: 3px solid #42a5f5; }
.org-empty { font-size: .82rem; color: #889; padding: .35rem .5rem; font-style: italic; }
.org-view-tabs { margin-bottom: 1rem; }
.org-view-tabs button {
  padding: .4rem .85rem; border-radius: 8px; font-size: .88rem; cursor: pointer;
  background: #eef0f8; color: #1a1a2e; border: 1px solid #dde1ef; font-weight: 600;
}
.org-view-tabs button:hover { background: #e8eaf6; }
.org-view-tabs button.active { background: #3d5afe; color: #fff; border-color: #3d5afe; }
.org-view-panel { display: none; }
.org-view-panel.active { display: block; }
.org-tree { text-align: center; padding: .5rem 0 1rem; min-width: min(100%, 640px); }
.org-tree ul {
  padding-top: 1.25rem; position: relative; display: flex; justify-content: center;
  flex-wrap: wrap; margin: 0; padding-left: 0;
}
.org-tree > ul { padding-top: 0; }
.org-tree li {
  list-style: none; position: relative; padding: 1.25rem .45rem 0 .45rem; display: flex;
  flex-direction: column; align-items: center;
}
.org-tree li::before, .org-tree li::after {
  content: ''; position: absolute; top: 0; right: 50%; border-top: 2px solid #90a4ae;
  width: 50%; height: 1.25rem;
}
.org-tree li::after {
  right: auto; left: 50%; border-left: 2px solid #90a4ae;
}
.org-tree li:only-child::before, .org-tree li:only-child::after { display: none; }
.org-tree li:first-child::before, .org-tree li:last-child::after { border: none; }
.org-tree > ul > li::before, .org-tree > ul > li::after { display: none; }
.org-tree ul ul::before {
  content: ''; position: absolute; top: 0; left: 50%; border-left: 2px solid #90a4ae;
  width: 0; height: 1.25rem;
}
.org-graph-node {
  display: inline-block; padding: .45rem .75rem; border-radius: 10px; font-size: .82rem;
  font-weight: 600; border: 2px solid #dde3f0; background: #fff; color: #1a1a2e;
  box-shadow: 0 2px 8px rgba(0,0,0,.06); white-space: nowrap; max-width: 11rem;
  overflow: hidden; text-overflow: ellipsis;
}
.org-graph-node.org-root {
  background: linear-gradient(135deg, #3d5afe, #5c6bc0); color: #fff; border-color: #3d5afe;
  font-size: .95rem; padding: .6rem 1.2rem;
}
.org-graph-node.org-teacher { border-color: #7986cb; background: #e8eaf6; }
.org-graph-node.org-student { border-color: #66bb6a; background: #f1f8e9; font-weight: 500; }
.org-graph-node.org-bot { border-color: #42a5f5; background: #e3f2fd; font-weight: 500; }
.org-graph-node.org-meta { border-style: dashed; color: #667; font-weight: 500; font-size: .75rem; }
.org-empty-chart { color: #889; font-style: italic; padding: 1.5rem; text-align: center; }
.settings-edit-banner {
  background: #e8eaf6; border: 1px solid #c5cae9; border-radius: 10px; padding: .65rem 1rem;
  font-size: .88rem; color: #3949ab; margin-bottom: 1rem;
}
.settings-list { display: flex; flex-direction: column; gap: .5rem; margin: .75rem 0; }
.settings-item {
  display: grid; grid-template-columns: 1fr auto auto; gap: .75rem; align-items: center;
  padding: .75rem 1rem; border: 1px solid #e0e4ef; border-radius: 10px; background: #fafbff;
  transition: opacity .15s, background .15s;
}
.settings-item.year-item { grid-template-columns: 1fr auto; }
.settings-remove-locked {
  background: #eceff4 !important; color: #9aa3b2 !important; border: 1px solid #dde3f0 !important;
  cursor: not-allowed !important; pointer-events: none; opacity: 0.55;
}
.settings-undo-btn { display: none; }
.settings-undo-btn.visible, .panel-undo-btn.visible { display: inline-block; }
.panel-undo-btn { display: none; }
.panel-edit-bar { display: flex; justify-content: flex-end; margin: 0 0 .5rem; }
.settings-item.marked-remove { opacity: .4; background: #fff5f5; border-color: #ffcdd2; }
.settings-item-new { border-style: dashed; border-color: #3d5afe; background: #f5f7ff; grid-template-columns: 1fr auto auto; }
.settings-item-new.year-item { grid-template-columns: 1fr auto; }
.settings-item-new.settings-item-composing { border-color: #3d5afe; }
.settings-item-new.settings-item-confirmed { border-style: solid; border-color: #66bb6a; background: #f1f8e9; }
.settings-confirm-btn { background: #2e7d32; color: #fff; border: none; }
.settings-confirmed-badge { display: none; color: #2e7d32; font-weight: 700; font-size: .8rem; white-space: nowrap; }
.settings-item-confirmed .settings-confirm-btn { display: none; }
.settings-item-confirmed .settings-confirmed-badge { display: inline; }
.settings-scope.in-dev-edit { border-color: #ffb74d !important; box-shadow: inset 0 0 0 1px rgba(255, 183, 77, .45); }
.settings-scope { border-radius: inherit; }
.undo-all-btn { margin-right: .5rem; }
.bot-edit-actions, .settings-save-bar { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.settings-item-actions { display: flex; align-items: center; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }
.settings-id-badge {
  font-size: .75rem; color: #667; background: #eef0f8; padding: .2rem .5rem; border-radius: 6px;
  font-family: ui-monospace, monospace;
}
.settings-usage { font-size: .8rem; color: #889; white-space: nowrap; }
.settings-usage.locked { color: #e65100; }
.color-field { display: flex; gap: .4rem; align-items: center; }
.color-field input[type="color"] {
  width: 2.4rem; height: 2.4rem; padding: 0; border: 2px solid #dde3f0; border-radius: 8px;
  cursor: pointer; background: none;
}
.settings-hex-input { width: 6.5rem; font-family: ui-monospace, monospace; font-size: .85rem; }
.settings-label-input { width: 100%; }
.settings-add-row {
  display: inline-flex; align-items: center; gap: .35rem; margin-top: .5rem;
  background: #eef0f8; color: #3d5afe; border: 1px dashed #3d5afe; border-radius: 8px;
  padding: .45rem .85rem; font-weight: 600; font-size: .88rem; cursor: pointer;
}
.settings-add-row:hover { background: #e8eaf6; }
.settings-save-bar {
  position: sticky; bottom: 0; margin-top: 1.25rem; padding: 1rem 0 1.25rem;
  background: linear-gradient(transparent, #f4f6fb 25%);
  border-top: 1px solid #dde3f0;
}
.settings-save-bar button { padding: .7rem 1.5rem; font-size: 1rem; }
.unsaved-warn-banner {
  display: none; background: #fff3e0; border: 1px solid #ffb74d; border-radius: 10px;
  padding: .65rem 1rem; font-size: .88rem; color: #e65100; margin-bottom: 1rem; font-weight: 600;
}
.has-unsaved-edits .unsaved-warn-banner { display: block; }
.in-dev-edit {
  border-color: #ffb74d !important; background: #fffde7 !important;
  box-shadow: inset 0 0 0 1px rgba(255, 183, 77, .45);
}
details.edit-panel.in-dev-edit > summary { background: #fff8e1; border-color: #ffb74d; color: #e65100; }
details.edit-panel.in-dev-edit[open] > summary { background: #fff3e0; border-color: #ff9800; }
.in-dev-badge {
  display: inline-block; font-size: .6rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: #e65100; background: #ffe0b2; padding: .12rem .4rem;
  border-radius: 4px; margin-left: .35rem; vertical-align: middle;
}
.status-badge {
  display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: .2rem .5rem; border-radius: 5px; vertical-align: middle;
}
.status-badge.testing { color: #e65100; background: #ffe0b2; }
.status-badge.live { color: #1b5e20; background: #c8e6c9; }
.status-badge.retired { color: #546e7a; background: #eceff1; }
.bot-status-row { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; margin: .5rem 0 1rem; }
.test-chat-banner {
  background: #e8eaf6; border: 1px solid #c5cae9; border-radius: 10px;
  padding: .65rem 1rem; font-size: .88rem; color: #3949ab; margin-bottom: 1rem;
}
.transcript-page-shell { margin-bottom: .75rem; }
.filter-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-tabs a {
  padding: .4rem .85rem; border-radius: 8px; text-decoration: none; font-size: .88rem;
  background: #eef0f8; color: #1a1a2e; border: 1px solid #dde1ef;
}
.filter-tabs a:hover { background: #e8eaf6; }
.filter-tabs a.active { background: #3d5afe; color: #fff; border-color: #3d5afe; font-weight: 600; }
.flag-row { border-bottom: 1px solid #eef; padding: .55rem 0; }
.flag-row.unreviewed { background: #fff8e1; margin: 0 -.5rem; padding-left: .5rem; padding-right: .5rem; border-radius: 6px; }
.transcript .line.flagged-line { background: #fff3e0; border-radius: 6px; padding: .35rem .5rem; }
.transcript .line:target { outline: 2px solid #ff9800; }
button.danger, .danger { background: #c62828; color: #fff; }
button:disabled, button.disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.toast-banner { display: none; margin-bottom: 1rem; padding: .65rem 1rem; border-radius: 8px; font-size: .9rem; }
.toast-banner.show { display: block; }
.toast-banner.ok { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.toast-banner.err { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.version-tag { font-size: .75rem; color: #889; }
ul.docs { padding-left: 1.2rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.site-bar {
  background: #fff; border-bottom: 1px solid #e0e4ef; padding: .65rem 1.25rem;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem;
}
.site-bar .brand-wrap {
  display: flex; align-items: center; gap: .5rem; text-decoration: none; color: #1a1a2e;
}
.site-bar .brand-wrap strong { font-weight: 700; font-size: 1.05rem; }
.site-bar .home-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; background: #e8eaf6; border-radius: 10px; color: #3d5afe;
  flex-shrink: 0; transition: background .15s, color .15s;
}
.site-bar .home-icon svg { width: 1.05rem; height: 1.05rem; display: block; }
.site-bar .brand-wrap:hover .home-icon { background: #dce3ff; }
.site-bar .brand-wrap.is-home .home-icon { background: #3d5afe; color: #fff; }
.site-bar .tab-nav { display: flex; flex-wrap: wrap; gap: .2rem; align-items: center; }
.site-bar .tab {
  padding: .45rem .85rem; border-radius: 8px; text-decoration: none; font-size: .9rem;
  color: #5c6bc0; transition: background .15s, color .15s;
}
.site-bar .tab:hover { background: #eef1ff; color: #3d5afe; }
.site-bar .tab.active { background: #e8eaf6; color: #1a1a2e; font-weight: 600; cursor: default; }
.site-bar .logout-form { margin: 0; }
.page-title { font-size: 1.35rem; margin: 0 0 .75rem; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid #e8eaf0; }
.transcript { font-size: .85rem; max-height: 420px; overflow-y: auto; }
.transcript .line { margin: .35rem 0; }
.ok { color: #2e7d32; }
.flagged { background: #fff3e0; padding: .15rem .35rem; border-radius: 4px; font-size: .75rem; }
.upload-zone.uploading { border-color: #3d5afe; background: #eef1ff; }
.upload-status { margin-top: .65rem; font-size: .88rem; min-height: 1.25rem; }
.upload-status.ok { color: #2e7d32; font-weight: 600; }
.upload-status.err { color: #c62828; font-weight: 600; }
.upload-status.busy { color: #3949ab; }
tr.doc-row-pending { background: #fffde7; }
tr.doc-row-pending td:first-child { box-shadow: inset 3px 0 0 #ffb74d; }
.upload-zone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-pick { display: inline-block; background: #3d5afe; color: #fff; padding: .65rem 1.1rem; border-radius: 8px; cursor: pointer; font-weight: 600; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-top: 1rem; }
.hub-card {
  background: #fff; border-radius: 12px; padding: 1.25rem; box-shadow: 0 2px 12px rgba(0,0,0,.06);
  text-decoration: none; color: inherit; border: 1px solid #e8eaf6; display: block;
}
.hub-card:hover { border-color: #5c6bc0; box-shadow: 0 4px 14px rgba(61,90,254,.12); }
.hub-card strong { display: block; font-size: 1.05rem; margin-bottom: .35rem; }
#file-names { margin-top: .75rem; font-size: .9rem; text-align: left; }
.student-chat-page { margin: 0; padding: 0 1.25rem .5rem; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.student-chat-shell { display: flex; flex: 1; min-height: 0; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.chat-sidebar { width: 280px; flex-shrink: 0; background: #f7f8fc; border-right: 1px solid #e0e4ef; display: flex; flex-direction: column; }
.chat-sidebar-header { padding: 1rem; border-bottom: 1px solid #e0e4ef; }
.chat-sidebar-header .back-link { font-size: .85rem; color: #5c6bc0; text-decoration: none; }
.chat-sidebar-header .back-link:hover { text-decoration: underline; }
.bot-identity { margin-top: .65rem; }
.bot-identity strong { display: block; font-size: 1.05rem; }
.bot-identity .bot-meta { font-size: .8rem; color: #667; margin-top: .15rem; }
.sidebar-hint { font-size: .78rem; margin: .65rem 0 0; line-height: 1.35; }
.chat-sidebar-threads { flex: 1; overflow-y: auto; padding: .5rem; }
.new-chat-form { margin: 0 0 .35rem; }
.new-chat-row {
  display: flex; align-items: center; gap: .45rem; width: 100%; box-sizing: border-box;
  padding: .7rem .85rem; border: none; border-radius: 10px; background: #fff;
  color: #3d5afe; font-weight: 600; cursor: pointer; font-size: .9rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.05); text-align: left;
  touch-action: manipulation;
}
.new-chat-row:hover { background: #eef1ff; }
.thread-item {
  display: block; padding: .65rem .85rem; border-radius: 10px; text-decoration: none;
  color: #1a1a2e; font-size: .88rem; margin-bottom: .2rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; cursor: pointer; user-select: none;
  touch-action: manipulation;
}
.thread-item .thread-title { display: block; overflow: hidden; text-overflow: ellipsis; }
.thread-item:hover { background: #e8eaf6; }
.thread-item.active { background: #fff; font-weight: 600; box-shadow: 0 1px 6px rgba(0,0,0,.07); }
.thread-item.renaming { padding: .35rem .5rem; }
.thread-rename-input {
  width: 100%; box-sizing: border-box; padding: .55rem .75rem; border: 2px solid #3d5afe;
  border-radius: 8px; font-size: .88rem; margin-bottom: .2rem;
}
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.chat-main-header {
  padding: .9rem 1.25rem; border-bottom: 1px solid #eef; background: #fafbff; flex-shrink: 0;
  display: flex; align-items: flex-start; gap: .65rem;
}
.chat-main-title { min-width: 0; flex: 1; }
.chat-main-title .chat-title { display: block; cursor: text; line-height: 1.3; }
.chat-main-title .chat-main-sub { display: block; font-size: .85rem; margin-top: .15rem; }
.chat-main-header .chat-title:hover { color: #3d5afe; }
.sidebar-toggle { display: none; flex-shrink: 0; }
.chat-sidebar-backdrop { display: none; }
.chat-title-rename-btn { display: none; }
.chat-main .chat-box {
  flex: 1 1 0; min-height: 0; border: none; border-radius: 0; margin: 0;
  background: #fff; overflow-y: auto; overflow-x: hidden; padding: .85rem 1.1rem;
}
.chat-input-area { padding: 1rem 1.25rem 1.25rem; border-top: 1px solid #eef; background: #fafbff; flex-shrink: 0; }
.chat-input-area textarea { border-radius: 12px; min-height: 52px; }
.chat-empty { color: #889; text-align: center; padding: 3rem 1rem; font-size: .95rem; }
.sidebar-empty { padding: .5rem .85rem; font-size: .85rem; color: #889; }
body.student-chat-body { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.student-chat-body .site-bar { flex-shrink: 0; }
body.student-chat-body .wrap.wide.student-chat-page { max-width: none; width: 100%; box-sizing: border-box; }
body.student-chat-body .student-chat-version { display: none; }
@media (max-width: 768px) {
  .wrap { padding: 1rem .75rem; }
  .site-bar { padding: .5rem .75rem; }
  .student-chat-page { padding: 0 .35rem .35rem; }
  .student-chat-shell { border-radius: 10px; position: relative; }
  .sidebar-toggle { display: inline-flex; }
  .chat-sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(26, 26, 46, .42); z-index: 190;
  }
  .student-chat-shell.sidebar-open .chat-sidebar-backdrop { display: block; }
  .chat-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 88vw); z-index: 200;
    transform: translateX(-105%); transition: transform .22s ease; box-shadow: 4px 0 24px rgba(0, 0, 0, .18);
  }
  .student-chat-shell.sidebar-open .chat-sidebar { transform: translateX(0); }
  .chat-sidebar-header .sidebar-hint { display: none; }
  .chat-main-header { padding: .75rem .85rem; }
  .chat-main .chat-box { padding: .75rem .85rem; }
  .chat-input-area {
    padding: .75rem .85rem calc(.85rem + env(safe-area-inset-bottom, 0px));
  }
  .chat-input-area textarea { font-size: 16px; min-height: 48px; }
  .chat-input-area form p { margin-top: .45rem !important; }
  .chat-input-area button[type="submit"] {
    width: 100%; padding: .7rem 1rem; font-size: 1rem; min-height: 44px;
  }
  .new-chat-row { min-height: 44px; }
  .thread-item { min-height: 44px; display: flex; align-items: center; }
  .bot-grid { grid-template-columns: 1fr; }
  .icon-btn.icon-only { min-width: 44px; min-height: 44px; }
  .chat-title-rename-btn { display: inline-flex; }
  input[type=text], input[type=password], select { font-size: 16px; }
  .settings-hex-input { font-size: 16px; width: auto; }
  .color-field input[type="color"] { width: 44px; height: 44px; }
  .site-bar .tab { min-height: 44px; display: inline-flex; align-items: center; }
  .filter-tabs a { min-height: 44px; display: inline-flex; align-items: center; }
}
.scroll-panel {
  max-height: min(440px, 58vh); overflow: auto; border: 1px solid #e8eaf0; border-radius: 8px;
}
.scroll-panel .data { margin: 0; }
.scroll-panel .data thead th {
  position: sticky; top: 0; background: #fff; z-index: 1; box-shadow: 0 1px 0 #e8eaf0;
}
table.data th.col-actions, table.data td.col-actions { text-align: right; width: 6.5rem; white-space: nowrap; }
table.data td.col-actions form { margin: 0; display: inline; }
details.create-panel { margin: 0; }
details.create-panel summary {
  cursor: pointer; font-weight: 600; padding: .85rem 1rem; background: #f5f7ff;
  border: 1px solid #dde3f0; border-radius: 10px; list-style: none; user-select: none;
  color: #3d5afe; transition: background .15s, border-color .15s, color .15s;
}
details.create-panel summary::before { content: '+ '; font-weight: 700; }
details.create-panel summary::-webkit-details-marker { display: none; }
details.create-panel[open] summary {
  background: #e8eaf6; border-color: #3d5afe; color: #1a1a2e;
  border-radius: 10px 10px 0 0; border-bottom: none;
}
details.create-panel[open] summary::before { content: '− '; color: #3d5afe; }
details.create-panel .create-panel-body {
  padding: 1rem 1rem .25rem; border: 1px solid #3d5afe; border-top: none;
  border-radius: 0 0 10px 10px; background: #fff;
}
.staff-transcript-shell {
  display: grid; grid-template-columns: minmax(150px, 190px) minmax(150px, 210px) 1fr;
  gap: 0; align-items: stretch;
  height: min(calc(100dvh - 11rem), 560px);
  max-height: min(calc(100dvh - 11rem), 560px);
  background: #fff; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.06); overflow: hidden;
}
.staff-transcript-shell > * { min-height: 0; overflow: hidden; }
@media (max-width: 800px) {
  .staff-transcript-shell {
    grid-template-columns: 1fr;
    height: min(calc(100dvh - 10rem), 520px);
    max-height: min(calc(100dvh - 10rem), 520px);
  }
  .transcript-pane-chats { display: none; }
  .staff-transcript-shell.has-bot .transcript-pane-chats { display: flex; }
  .staff-transcript-shell.has-bot .transcript-pane-tutors { display: none; }
}
.transcript-pane {
  border-right: 1px solid #e0e4ef; display: flex; flex-direction: column; min-height: 0; background: #fafbfc;
}
.transcript-pane-header {
  padding: .7rem .85rem; font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: #889; border-bottom: 1px solid #e8eaf6; flex-shrink: 0;
}
.transcript-pane-list { flex: 1; overflow-y: auto; padding: .4rem; min-height: 0; }
.transcript-pane-list a {
  display: block; padding: .55rem .65rem; border-radius: 8px; text-decoration: none; color: #1a1a2e;
  font-size: .88rem; margin-bottom: .12rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.transcript-pane-list a:hover { background: #eef0f8; }
.transcript-pane-list a.active { background: #e8eaf6; font-weight: 600; }
.transcript-pane-empty { padding: 1rem .75rem; font-size: .85rem; color: #889; line-height: 1.4; }
.staff-transcript-main {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  margin: 0 !important; box-shadow: none !important; border-radius: 0 !important; background: #fff;
  overflow: hidden;
}
.staff-transcript-main .chat-box {
  flex: 1 1 0; min-height: 0; max-height: 100%;
  overflow-y: auto; overflow-x: hidden;
  border: none; border-radius: 0; margin: 0;
  padding: .85rem 1rem; background: #fafbff;
}
.scroll-panel.safeguarding-panel { max-height: min(520px, 62vh); }
.scroll-panel .flag-row:last-child { border-bottom: none; }


.student-panel-tabs {
  display: flex; gap: 0; border-bottom: 1px solid #eef; padding: 0 1rem; flex-shrink: 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.student-panel-tab {
  background: none; border: none; border-bottom: 2px solid transparent; padding: .65rem .85rem;
  font-size: .82rem; color: #667; cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.student-panel-tab.active { color: #3d5afe; border-bottom-color: #3d5afe; font-weight: 600; }
.student-panels { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.student-panel { display: none; flex: 1; min-height: 0; overflow-y: auto; }
.student-panel.active { display: flex; flex-direction: column; }
.student-panel[data-panel="chat"] .chat-box { flex: 1; }
.student-panel-empty { padding: 2rem 1.1rem; text-align: center; }
.student-materials-list { list-style: none; padding: 1rem 1.1rem; margin: 0; }
.student-material-item {
  display: flex; align-items: center; gap: .55rem; padding: .55rem 0;
  border-bottom: 1px solid #f0f2f8; font-size: .92rem;
}
.student-material-item:last-child { border-bottom: none; }
.material-icon { font-size: 1.1rem; line-height: 1; }
.student-starters-panel { padding: 1rem 1.1rem 1.25rem; }
.student-starters-hint { margin: 0 0 .75rem; font-size: .92rem; color: #556; }
.student-starters-inline {
  display: flex; flex-wrap: wrap; gap: .4rem .5rem; align-items: center; justify-content: flex-start;
}
.starter-chip-inline {
  border: 1px solid #c5d4e8; background: #f4f8fc; color: #234; border-radius: 999px;
  padding: .35rem .75rem; font-size: .85rem; cursor: pointer; width: auto; max-width: 100%;
  transition: background .15s;
}
.starter-chip-inline:hover { background: #e3eef9; border-color: #7ba7d8; }
.conversation-starters { display: flex; flex-wrap: wrap; gap: .4rem .5rem; justify-content: flex-start; padding: 1.25rem 1rem .5rem; align-items: center; }
.starter-chip {
  border: 1px solid #c5d4e8; background: #f4f8fc; color: #234; border-radius: 999px;
  padding: .45rem .85rem; font-size: .9rem; cursor: pointer; transition: background .15s;
}
.starter-chip:hover { background: #e3eef9; border-color: #7ba7d8; }

.engagement-stats-kids { grid-template-columns: repeat(2, 1fr); }
.engagement-fortnight-wrap { margin-top: 1rem; }
.fortnight-heading { font-size: .88rem; font-weight: 600; color: #445; margin: 0 0 .5rem; }
.fortnight-chart {
  display: flex; align-items: flex-end; gap: .35rem; height: 88px;
  padding: .5rem .35rem 0; background: #f7f9ff; border-radius: 12px;
}
.fortnight-bar {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; min-width: 0; height: 100%;
}
.fortnight-fill {
  width: 100%; max-width: 28px; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #7c9cff, #3d5afe); min-height: 4px;
}
.fortnight-bar.empty .fortnight-fill { background: #dde3f0; }
.fortnight-label { font-size: .62rem; color: #778; margin-top: .35rem; font-weight: 600; }

.home-continue-card {
  margin-top: 1.1rem; padding: 1rem 1.1rem 1.15rem;
  border-radius: 16px; background: linear-gradient(135deg, #f4f8ff 0%, #eef3ff 100%);
  border: 2px solid var(--continue-accent, #3d5afe); box-shadow: 0 4px 16px rgba(61,90,254,.12);
}
.home-continue-kicker { margin: 0 0 .65rem; font-weight: 700; font-size: 1rem; color: #334; }
.home-continue-btn {
  display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem;
  border-radius: 14px; text-decoration: none; color: #fff;
  background: linear-gradient(135deg, var(--continue-accent, #3d5afe), #5c6bc0);
  box-shadow: 0 3px 12px rgba(61,90,254,.25); transition: transform .12s, box-shadow .12s;
}
.home-continue-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 18px rgba(61,90,254,.32); }
.home-continue-btn-emoji { font-size: 1.6rem; line-height: 1; }
.home-continue-btn-text { display: flex; flex-direction: column; gap: .1rem; flex: 1; min-width: 0; }
.home-continue-btn-label { font-size: .78rem; opacity: .92; }
.home-continue-btn-name { font-size: 1.15rem; line-height: 1.2; }
.home-continue-btn-go { font-weight: 700; font-size: 1rem; opacity: .95; }
.home-continue-btn.convo-hub-cta { display: inline-flex; width: auto; color: #fff; }

.student-convos-shell { min-height: min(520px, calc(100dvh - 140px)); }
.convo-thread-item { display: flex; flex-direction: column; align-items: stretch; gap: .15rem; white-space: normal; }
.convo-thread-item .thread-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-thread-meta { font-size: .75rem; color: #778; display: block; }
.convo-new-row { text-decoration: none; margin-bottom: .35rem; }
.convo-hub-main { display: flex; align-items: center; justify-content: center; background: #fafbff; }
.convo-hub { text-align: center; padding: 2rem 1.5rem; max-width: 360px; }
.convo-hub-emoji { font-size: 2.5rem; margin: 0 0 .5rem; }
.convo-hub-title { font-size: 1.2rem; margin: 0 0 .5rem; }

.admin-starters-editor { margin-top: .35rem; }

.admin-starter-bubbles {
  display: flex; flex-direction: column; gap: .55rem; margin-bottom: .75rem;
}
.admin-starter-card {
  background: linear-gradient(180deg, #fff 0%, #fafbff 100%);
  border: 1px solid #e3e8f2; border-radius: 12px; padding: .55rem .65rem .6rem;
  box-shadow: 0 1px 3px rgba(42, 52, 86, .05);
  transition: border-color .15s, box-shadow .15s;
}
.admin-starter-card.is-open {
  border-color: #c8d4f0; box-shadow: 0 2px 8px rgba(61, 90, 254, .08);
}
.admin-starter-header {
  display: flex; align-items: center; gap: .45rem; flex-wrap: wrap;
}
.admin-starter-chip-wrap { flex: 1 1 auto; min-width: 0; }
.admin-starter-input.starter-chip {
  flex: 0 0 auto; width: auto; min-width: 2.75rem; max-width: 100%;
  field-sizing: content; cursor: text; border-radius: 999px; text-align: left;
  border-color: #b8c9e8; background: #f6f9ff; color: #1e2a44;
}
.admin-starter-input.starter-chip:focus {
  outline: none; border-color: #7b93e8; background: #fff; box-shadow: 0 0 0 3px rgba(61, 90, 254, .12);
}
.admin-starter-expand {
  display: inline-flex; align-items: center; gap: .3rem;
  border: 1px solid #d8e0f0; background: #f3f6fc; color: #4a5678;
  border-radius: 999px; padding: .28rem .55rem .28rem .65rem;
  font-size: .78rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.admin-starter-expand:hover { background: #e9eef9; border-color: #b8c9e8; }
.admin-starter-expand.has-note::before {
  content: ''; width: .4rem; height: .4rem; border-radius: 50%;
  background: #5c6bc0; margin-right: -.1rem;
}
.admin-starter-expand-icon {
  width: .55rem; height: .55rem; border-right: 2px solid #667; border-bottom: 2px solid #667;
  transform: rotate(45deg); margin-top: -.15rem; transition: transform .15s;
}
.admin-starter-card.is-open .admin-starter-expand-icon { transform: rotate(-135deg); margin-top: .1rem; }
.admin-starter-detail { margin-top: .5rem; padding-top: .45rem; border-top: 1px solid #e8ecf4; }
.admin-starter-secret {
  width: 100%; box-sizing: border-box; min-height: 3.25rem; resize: vertical;
  font-size: .84rem; line-height: 1.45; padding: .5rem .7rem;
  border: 1px solid #dce4f4; border-radius: 10px;
  background: #f8f6ff; color: #334155;
}
.admin-starter-secret:focus {
  outline: none; border-color: #9aa8e8; background: #fff;
  box-shadow: 0 0 0 3px rgba(92, 107, 192, .12);
}
.admin-starter-secret::placeholder { color: #8896b0; }
.admin-starter-remove {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; border: none; background: #eef1f8; color: #5a6478;
  width: 1.85rem; height: 1.85rem; border-radius: 999px; cursor: pointer;
  padding: 0; font-size: 0; line-height: 0;
  transition: background .15s, color .15s;
}
.admin-starter-remove span {
  display: block; font-size: 1.35rem; font-weight: 400; line-height: 1;
  transform: translateY(-.5px);
}
.admin-starter-remove:hover:not(:disabled) { background: #fde8ea; color: #b71c1c; }
.admin-starter-add { margin-top: .15rem; }
