:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #d8dee8;
  --line-strong: #b9c3d4;
  --text: #172033;
  --subtle: #63708a;
  --brand: #155e75;
  --brand-strong: #0e4b5f;
  --brand-soft: #e6f4f7;
  --success: #216e4e;
  --warning: #8a5a00;
  --shadow: 0 12px 28px rgba(23, 32, 51, 0.08);
}

body[data-theme="dark"] {
  --bg: #10130f;
  --panel: #181d16;
  --panel-soft: #22291f;
  --line: #445040;
  --line-strong: #66745f;
  --text: #f7f3ea;
  --subtle: #c8d0c1;
  --brand: #9ed7c2;
  --brand-strong: #d8f2e7;
  --brand-soft: #20392f;
  --success: #a9e8cf;
  --warning: #f2d48a;
  --shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(230, 244, 247, 0.85) 0, rgba(244, 246, 248, 0) 360px),
    var(--bg);
  color: var(--text);
  font-family: "Noto Sans TC", "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

button,
select,
textarea {
  font: inherit;
}

button:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

[hidden] {
  display: none !important;
}

.chat-root {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 20px;
  display: grid;
  gap: 16px;
}

.product-header,
.sidebar-sessions-panel,
.sidebar-notes-panel,
.chat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.product-header {
  overflow: hidden;
  box-shadow: var(--shadow);
}

.ghost-link {
  color: inherit;
  text-decoration: none;
}

.hero-actions {
  position: absolute;
  right: 30px;
  bottom: 24px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill,
.ghost-link,
.ghost-btn,
.primary-btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 8px 12px;
  white-space: nowrap;
}

.status-pill {
  color: var(--success);
  background: #e8f5ee;
  border: 1px solid #b8ddc9;
  font-size: 13px;
}

.ghost-link,
.ghost-btn {
  color: var(--brand-strong);
  background: var(--brand-soft);
  border: 1px solid #b8dbe4;
}

.primary-btn {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

.ghost-btn {
  cursor: pointer;
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 48px 30px 58px;
  background: linear-gradient(135deg, #ffffff 0%, #f5fbfc 58%, #eef7f9 100%);
}

.hero-copy {
  max-width: 760px;
}

.hero-logo-stage {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  min-height: 156px;
  border-right: 1px solid var(--line);
  padding-right: 22px;
}

.hero-logo {
  width: min(172px, 100%);
  max-height: 172px;
  object-fit: contain;
}

.eyebrow,
.summary-label {
  margin: 0 0 6px;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-panel h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.12;
  letter-spacing: 0;
}

.hero-text {
  max-width: 660px;
  margin: 14px 0 0;
  color: #40506a;
  font-size: 17px;
  line-height: 1.75;
}

.trust-panel {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
}

.trust-panel[hidden] {
  display: none;
}

.trust-panel span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #40506a;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  padding: 8px 10px;
}

.trust-panel span::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand);
  flex: 0 0 auto;
}

.chat-layout {
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.session-sidebar,
.chat-card {
  min-height: 620px;
}

.session-sidebar {
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  gap: 12px;
}

.sidebar-sessions-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.sidebar-head,
.conversation-toolbar,
.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.conversation-toolbar > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.toolbar-status {
  margin: 0;
  color: var(--subtle);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.sidebar-head h2,
.conversation-toolbar h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.session-list {
  min-height: 0;
  height: clamp(420px, 56vh, 620px);
  max-height: 620px;
  overflow: auto;
  display: grid;
  align-content: start;
  align-items: start;
  grid-auto-rows: max-content;
  gap: 8px;
}

.session-item {
  width: 100%;
  align-self: start;
  align-content: start;
  align-items: start;
  grid-template-rows: auto auto;
  min-height: 104px;
  text-align: left;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  display: grid;
  gap: 10px;
}

.session-open,
.session-archive {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.session-open {
  width: 100%;
  min-width: 0;
  align-self: start;
  display: grid;
  align-content: start;
  justify-items: start;
  padding: 0;
  text-align: left;
}

.session-item:hover,
.session-item:focus-within {
  border-color: var(--brand);
  outline: none;
}

.session-item.is-active {
  border-color: var(--brand);
  box-shadow: inset 4px 0 0 var(--brand);
  background: #f1fafc;
}

.session-title,
.session-meta,
.session-preview,
.session-primary-label {
  display: block;
  overflow-wrap: anywhere;
}

.session-title {
  font-weight: 800;
}

.session-meta,
.session-preview,
.subtle,
.empty {
  color: var(--subtle);
}

.session-meta,
.session-preview {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
}

.session-primary-label {
  margin-top: 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.session-archive {
  width: fit-content;
  min-height: 30px;
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 9px;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 700;
}

.session-archive:hover,
.session-archive:focus-visible {
  border-color: var(--warning);
  color: var(--warning);
  outline: none;
}

.archived-session-toggle {
  display: none !important;
}

.archived-session-toggle.is-active,
.session-item.is-archived {
  background: #f8fafc;
}

.chat-card {
  padding: 16px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  box-shadow: var(--shadow);
}

.messages {
  min-height: 260px;
  height: clamp(420px, 56vh, 620px);
  max-height: 620px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcff;
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
}

.conversation-panel {
  display: grid;
  gap: 8px;
  min-height: 0;
  position: relative;
}

.conversation-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("./assets/img/logo.png") center / min(340px, 44vw) auto no-repeat;
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
}

.conversation-panel > * {
  position: relative;
  z-index: 1;
}

.section-head {
  display: grid;
  gap: 2px;
}

.section-head h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.message {
  display: grid;
  gap: 6px;
  max-width: min(78%, 720px);
}

.message.user {
  justify-self: end;
}

.message.assistant {
  justify-self: start;
}

.message .meta,
.message-role {
  color: var(--subtle);
  font-size: 12px;
}

.message-role {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 8px;
  font-weight: 800;
}

.message-role .message-time {
  color: var(--subtle);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.message.user .meta,
.message.user .message-role {
  justify-content: flex-end;
  text-align: right;
}

.message .bubble {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.reflection-message-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.reflection-message-toggle {
  margin-top: 4px;
}

.reflection-message-content {
  display: grid;
  gap: 6px;
  width: 100%;
}

.message.user .bubble {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.message.assistant .bubble {
  background: #fff;
}

.message.is-generating .bubble {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  width: fit-content;
}

.generating-text {
  color: var(--subtle);
}

.generating-dots {
  display: inline-flex;
  gap: 1px;
  min-width: 22px;
}

.generating-dots span {
  animation: dotPulse 1.1s ease-in-out infinite;
  opacity: 0.35;
}

.generating-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.generating-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes dotPulse {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.technical-details {
  color: var(--subtle);
  font-size: 12px;
}

.technical-details summary {
  cursor: pointer;
  width: fit-content;
}

.technical-details dl {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.technical-details div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
}

.technical-details dt,
.technical-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.technical-details dt {
  font-weight: 800;
  color: #40506a;
}

.composer {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.composer-label {
  font-weight: 800;
  font-size: 18px;
}

.composer textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  padding: 12px;
  color: var(--text);
  background: #fff;
}

.composer textarea:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(21, 94, 117, 0.14);
}

.provider-picker {
  display: grid;
  gap: 6px;
}

.provider-picker label {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 700;
}

.provider-controls {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(140px, 220px) minmax(180px, 1fr);
}

.provider-controls select {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
}

.provider-controls select:disabled {
  opacity: 0.72;
}

.intent-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.intent-option {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}

.intent-option:hover,
.intent-option:focus-visible {
  border-color: var(--brand);
  outline: 3px solid rgba(21, 94, 117, 0.14);
}

.intent-option.is-selected {
  border-color: var(--brand);
  background: #e6f6f8;
  color: var(--brand-strong);
}

.quick-prompts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-prompts button {
  min-height: 34px;
  border: 1px solid #d7b56d;
  border-radius: 8px;
  background: #fff8e8;
  color: #5f4300;
  cursor: pointer;
  padding: 6px 10px;
  font-size: 13px;
}

.quick-prompts button:focus-visible,
.quick-prompts button:hover {
  border-color: #8a5a00;
  outline: none;
}

.subtle {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.empty {
  margin: 0;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  line-height: 1.6;
}

.sidebar-notes-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.sidebar-notes-panel strong,
.sidebar-notes-panel p {
  overflow-wrap: anywhere;
}

.sidebar-notes-panel strong {
  display: block;
  line-height: 1.4;
}

.sidebar-notes-panel p {
  min-height: 42px;
  margin: 0;
  color: var(--subtle);
  font-size: 13px;
  line-height: 1.55;
}

.loop-list {
  margin-top: 12px;
}

.work-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.work-actions button {
  width: 100%;
  min-width: 0;
}

.action-hidden {
  display: none;
}

.loop-list ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.sidebar-notes-panel .loop-list {
  max-height: 220px;
  overflow: auto;
}

.loop-list li,
.evidence-detail,
.loop-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 10px;
}

.loop-list li {
  display: grid;
  gap: 4px;
}

.record-button {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 4px;
  text-align: left;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
}

.record-button:hover,
.record-button:focus-visible,
.record-button.is-selected {
  outline: 2px solid rgba(21, 94, 117, 0.24);
  outline-offset: 4px;
}

.record-button.is-selected {
  color: var(--brand-strong);
}

.record-button.compact {
  font-size: 12px;
}

.loop-list li strong,
.loop-list li span,
.loop-list li small,
.evidence-detail span,
.evidence-detail small {
  overflow-wrap: anywhere;
}

.loop-list li span,
.loop-list li small,
.evidence-detail,
.loop-empty {
  color: var(--subtle);
  font-size: 12px;
  line-height: 1.45;
}

.evidence-detail {
  margin-top: 8px;
  display: grid;
  gap: 10px;
}

.work-panel {
  margin-top: 8px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-title strong,
.panel-title span {
  overflow-wrap: anywhere;
}

.panel-title span,
.loop-note {
  color: var(--subtle);
  font-size: 12px;
}

.loop-note {
  margin: 0;
  min-height: auto;
}

.diff-list li {
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: start;
}

.diff-list li span {
  min-width: 72px;
  color: var(--brand-strong);
  font-weight: 700;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.evidence-grid span {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  color: var(--text);
  font-size: 12px;
}

.evidence-grid small {
  color: var(--subtle);
  text-transform: uppercase;
}

.evidence-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.evidence-columns > div {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
}

.access-log-detail {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.evidence-detail details {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.evidence-detail pre,
.access-log-detail pre {
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 920px) {
  .chat-root {
    padding: 14px;
  }

  .top-bar,
  .hero-panel,
  .chat-layout,
  .work-actions,
  .evidence-grid,
  .evidence-columns {
    grid-template-columns: 1fr;
  }

  .top-bar,
  .conversation-toolbar,
  .composer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-panel {
    padding: 22px;
  }

  .hero-actions {
    position: static;
    grid-column: 1 / -1;
    order: -1;
    justify-content: flex-start;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }

  .hero-logo-stage {
    min-height: auto;
    justify-items: start;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 16px;
  }

  .hero-logo {
    width: 104px;
    max-height: 104px;
  }

  .session-sidebar,
  .chat-card {
    min-height: auto;
  }

  .chat-card {
    order: 1;
  }

  .session-sidebar {
    order: 2;
  }

  .session-list {
    height: min(460px, 64vh);
    max-height: 460px;
  }

  .folder-list {
    max-height: min(620px, 70vh);
  }

  .message {
    max-width: 100%;
  }

  .messages {
    height: min(460px, 64vh);
    max-height: 460px;
  }
}

/* Chat-first student workspace. Keep this block last so it wins over legacy hero/card rules. */
body {
  height: 100vh;
  overflow: hidden;
  background: #ffffff;
}

.chat-root {
  height: 100vh;
  padding: 0;
  gap: 0;
  grid-template-columns: 280px minmax(0, 1fr);
  background: #ffffff;
  transition: grid-template-columns 180ms ease;
}

.sidebar-floating-toggle {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 40;
  width: 42px;
  height: 42px;
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #d9d9e3;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: #202123;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.sidebar-floating-toggle:hover,
.sidebar-floating-toggle:focus-visible {
  background: #ececf1;
  outline: none;
}

.sidebar-floating-toggle svg,
.sidebar-collapse-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.session-sidebar {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  background: #f7f7f8;
  border-right: 1px solid #e5e5e5;
  color: #202123;
  overflow: hidden;
  transition: padding 180ms ease, width 180ms ease;
}

.sidebar-brand {
  display: grid;
  gap: 12px;
}

.brand-row {
  min-height: 52px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px 40px;
  align-items: center;
  gap: 8px;
}

.brand-lockup {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.brand-lockup strong {
  display: block;
  font-size: 16px;
  line-height: 1.25;
}

.brand-lockup .eyebrow {
  font-size: 12px;
}

.sidebar-collapse-toggle {
  width: 40px;
  min-width: 40px;
  height: 40px;
}

body.is-student-sidebar-collapsed .chat-root {
  grid-template-columns: 64px minmax(0, 1fr);
}

body.is-student-sidebar-collapsed .session-sidebar {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  padding: 10px 8px;
  overflow: hidden;
}

body.is-student-sidebar-collapsed .chat-card {
  grid-column: 2;
}

body.is-student-sidebar-collapsed .brand-row {
  min-height: auto;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 6px;
}

body.is-student-sidebar-collapsed .brand-lockup {
  min-height: 38px;
  justify-content: center;
  padding: 0;
}

body.is-student-sidebar-collapsed .brand-lockup > div,
body.is-student-sidebar-collapsed .theme-toggle strong,
body.is-student-sidebar-collapsed .sidebar-primary-action span,
body.is-student-sidebar-collapsed .sidebar-section-head .eyebrow,
body.is-student-sidebar-collapsed .folder-section-title > span,
body.is-student-sidebar-collapsed .topic-info-icon,
body.is-student-sidebar-collapsed .teacher-topic-info,
body.is-student-sidebar-collapsed .folder-section-count,
body.is-student-sidebar-collapsed .folder-section-empty,
body.is-student-sidebar-collapsed .folder-item span,
body.is-student-sidebar-collapsed .folder-item strong {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body.is-student-sidebar-collapsed .brand-logo {
  width: 36px;
  height: 36px;
}

body.is-student-sidebar-collapsed .theme-toggle,
body.is-student-sidebar-collapsed .sidebar-collapse-toggle,
body.is-student-sidebar-collapsed .sidebar-primary-action,
body.is-student-sidebar-collapsed .sidebar-section-head .icon-text-btn {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  height: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  justify-content: center;
}

body.is-student-sidebar-collapsed .folder-item {
  width: 48px;
  min-width: 48px;
  min-height: 56px;
  height: 56px;
  padding: 5px 3px 4px;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 21px minmax(0, auto);
  place-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid transparent;
}

body.is-student-sidebar-collapsed .folder-item::after {
  content: attr(data-collapsed-label);
  max-width: 42px;
  display: block;
  overflow: hidden;
  color: #4b5563;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-student-sidebar-collapsed .sidebar-primary-action svg,
body.is-student-sidebar-collapsed .folder-item svg {
  width: 19px;
  height: 19px;
}

body.is-student-sidebar-collapsed .sidebar-sessions-panel {
  align-items: center;
}

body.is-student-sidebar-collapsed .sidebar-section-head {
  justify-content: center;
}

body.is-student-sidebar-collapsed .folder-section-title {
  width: 48px;
  justify-content: center;
}

body.is-student-sidebar-collapsed .dialogue-section .folder-section-title > span {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  color: #4b5563;
  font-size: 10px;
  line-height: 1.1;
  text-align: center;
  white-space: normal;
}

body.is-student-sidebar-collapsed .folder-list {
  width: 100%;
  align-content: start;
  justify-items: center;
  gap: 8px;
  border-bottom: 0;
  padding: 0 0 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

body.is-student-sidebar-collapsed .folder-section,
body.is-student-sidebar-collapsed .folder-tree-node,
body.is-student-sidebar-collapsed .folder-row {
  width: 48px;
  display: grid;
  justify-items: center;
}

body.is-student-sidebar-collapsed .folder-section {
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
}

body.is-student-sidebar-collapsed .folder-row {
  grid-template-columns: 1fr;
}

body.is-student-sidebar-collapsed .folder-session-tree,
body.is-student-sidebar-collapsed .folder-edit,
body.is-student-sidebar-collapsed .folder-delete,
body.is-student-sidebar-collapsed .sidebar-notes-panel,
body.is-student-sidebar-collapsed .sidebar-links,
body.is-student-sidebar-collapsed .archived-session-toggle {
  display: none;
}

.sidebar-sessions-panel,
.sidebar-notes-panel {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.sidebar-sessions-panel {
  display: flex;
  flex-direction: column;
  align-content: stretch;
  overflow: hidden;
}

.sidebar-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.icon-text-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #202123;
  cursor: pointer;
}

.icon-text-btn:hover,
.icon-text-btn:focus-visible {
  background: #ececf1;
  outline: none;
}

.icon-text-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.folder-list {
  min-height: 0;
  flex: 1 1 360px;
  max-height: none;
  display: grid;
  align-content: start;
  gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e5e5;
  overflow: auto;
  padding-right: 2px;
}

.mobile-folder-nav {
  display: none;
}

.folder-section {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid #e6e9ec;
  border-radius: 8px;
  background: #ffffff;
}

.folder-section-title {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #6b6c70;
  font-size: 13px;
  font-weight: 800;
}

.folder-section-content { min-width: 0; display: grid; gap: 6px; }
.folder-section-content[hidden] { display: none; }
.folder-section-actions { display: inline-flex; align-items: center; gap: 6px; }
.folder-section-toggle {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid #cddbd5;
  border-radius: 7px;
  background: #f5faf8;
  color: #245542;
  font-size: 17px;
  line-height: 1;
}
.folder-section-toggle > span {
  display: inline-grid;
  place-items: center;
  transform: translateY(-1px);
}
.folder-section-toggle[aria-expanded="true"] > span {
  transform: translateY(-3px);
}
.folder-section.is-section-collapsed { align-content: start; }
body.is-student-sidebar-collapsed .folder-section-toggle { display: none; }

.folder-create-btn {
  width: 30px;
  min-width: 30px;
  height: 30px;
  color: var(--brand-strong);
  border-color: #d7ece7;
  background: #f6fbfa;
}

.folder-section-count {
  min-width: 20px;
  color: #6b6c70;
  font-size: 12px;
  text-align: right;
}

.folder-section-empty {
  margin: 0;
  padding: 6px 8px 8px 26px;
  color: #6b6c70;
  font-size: 12px;
}

.topic-info-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid #c5c5d2;
  color: #4b5563;
  font-size: 11px;
}

.teacher-topic-info {
  margin: 0 0 4px;
  color: #6b6c70;
  font-size: 12px;
  line-height: 1.45;
}

.folder-item {
  width: 100%;
  min-height: 36px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #202123;
  cursor: pointer;
  padding: 7px 8px;
  text-align: left;
}

.folder-item:hover,
.folder-item:focus-visible,
.folder-item.is-active {
  background: #ececf1;
  outline: none;
}

.folder-item[data-drop-folder-id],
.folder-item[data-drop-topic-id] {
  outline-offset: 2px;
}

.folder-item[data-drop-folder-id]:hover,
.folder-item[data-drop-topic-id]:hover {
  outline: 2px solid rgba(16, 185, 129, 0.24);
}

.folder-item svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.folder-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-item strong {
  min-width: 20px;
  color: #6b6c70;
  font-size: 12px;
  text-align: right;
}

.folder-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 4px;
}

.topic-row {
  grid-template-columns: minmax(0, 1fr);
}

.folder-edit,
.folder-delete {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #e4e4ea;
  border-radius: 8px;
  background: #f7f7fa;
  color: #5f6368;
  cursor: pointer;
}

.folder-edit svg,
.folder-delete svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.folder-edit:hover,
.folder-edit:focus-visible {
  border-color: #83b79f;
  background: #e5f4ec;
  color: #176b4b;
  outline: none;
}

.folder-delete:hover,
.folder-delete:focus-visible {
  border-color: #fecaca;
  background: #fee2e2;
  color: #991b1b;
  outline: none;
}

.folder-tree-node {
  display: grid;
  gap: 2px;
}

.folder-tree-node.is-active > .folder-row > .folder-item {
  background: #ececf1;
}

.folder-session-tree {
  display: grid;
  gap: 2px;
  margin-left: 12px;
  padding-left: 10px;
  border-left: 1px solid #e5e5e5;
}

.dialogue-session-list {
  margin-left: 0;
  padding-left: 0;
  border-left: 0;
}

.student-auth-panel {
  width: min(420px, calc(100% - 32px));
  align-self: center;
  justify-self: center;
  display: grid;
  gap: 12px;
  grid-area: 1 / 1;
  padding: 18px;
  border: 1px solid #f0c36d;
  border-radius: 10px;
  background: #fff8e8;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.16);
  text-align: center;
}

.student-start-panel {
  width: min(680px, calc(100% - 32px));
  display: grid;
  gap: 10px;
  justify-items: center;
  align-self: start;
  justify-self: center;
  margin-top: calc(20vh + 96px);
  padding: 0 clamp(18px, 4vw, 40px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

.auth-status {
  margin: 0;
  color: #5f4300;
  font-size: 15px;
  line-height: 1.5;
}

.start-session-summary {
  margin: 0;
  color: #5f6f65;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.student-start-panel .auth-actions {
  width: min(560px, 100%);
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.student-start-panel .auth-actions .primary-btn,
.student-start-panel .auth-actions .ghost-btn {
  min-height: 46px;
}

.student-start-panel .auth-actions .ghost-btn {
  border: 1.5px solid #8fb4a3;
  background: rgba(255, 255, 255, 0.72);
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #1f3529;
  line-height: 1.25;
  text-align: center;
}

.student-start-panel .auth-actions .ghost-btn:hover,
.student-start-panel .auth-actions .ghost-btn:focus-visible {
  border-color: #4f8068;
  background: #f2fbf7;
  color: #14271e;
}

.student-start-panel .auth-actions .ghost-btn strong {
  max-width: 100%;
  display: block;
  overflow: hidden;
  color: #314437;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-start-panel .auth-actions .ghost-btn[hidden] {
  display: none !important;
}

.student-start-panel .auth-actions:has(.ghost-btn[hidden]) {
  grid-template-columns: 1fr;
}

.auth-login-field,
.auth-token-field {
  display: grid;
  gap: 5px;
  color: #5f4300;
  font-size: 12px;
  font-weight: 700;
}

.auth-login-field input,
.auth-token-field input {
  min-height: 36px;
  width: 100%;
  border: 1px solid #d7b56d;
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: #202123;
}

.auth-login-field input:focus,
.auth-token-field input:focus {
  border-color: #8a5a00;
  outline: 3px solid rgba(138, 90, 0, 0.14);
}

.auth-actions {
  display: grid;
  gap: 10px;
}

.auth-actions .primary-btn,
.auth-actions .ghost-btn {
  width: 100%;
  justify-content: center;
  min-height: 44px;
}

.sidebar-links {
  display: grid;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid #e5e5e5;
}

.eyebrow,
.summary-label {
  margin: 0 0 8px;
  color: #6b6c70;
  font-size: 11px;
}

.ghost-link,
.ghost-btn,
.primary-btn {
  min-height: 38px;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}

.ghost-link,
.ghost-btn {
  color: #202123;
  background: transparent;
  border: 1px solid transparent;
}

.ghost-link:hover,
.ghost-link:focus-visible,
.ghost-btn:hover,
.ghost-btn:focus-visible {
  background: #ececf1;
  border-color: #ececf1;
  outline: none;
}

.primary-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  border: 1px solid #d9d9e3;
  background: #ffffff;
  color: #202123;
}

.sidebar-primary-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.primary-btn:hover,
.primary-btn:focus-visible {
  background: #ececf1;
  outline: none;
}

.session-list {
  height: auto;
  flex: 1 1 180px;
  min-height: 150px;
  max-height: none;
  align-content: start;
  justify-content: stretch;
  align-items: start;
  grid-auto-rows: max-content;
  gap: 3px;
  overflow: auto;
  padding-right: 2px;
}

.session-list-legacy {
  display: none;
}

.session-item {
  align-self: start;
  align-content: start;
  align-items: start;
  grid-template-columns: minmax(0, 1fr) 32px;
  min-height: 44px;
  gap: 4px;
  padding: 6px 6px 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.tree-session-item {
  min-height: 42px;
}

.session-open {
  align-self: start;
  grid-column: 1;
  display: grid;
  align-content: start;
  justify-items: start;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.session-drag-handle {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
  min-width: 36px;
  min-height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #6b6c70;
  font-size: 11px;
  cursor: grab;
}

.session-list .empty {
  align-self: start;
  margin-top: 4px;
}

.session-item:hover,
.session-item:focus-within,
.session-item.is-active {
  background: #ececf1;
  border-color: transparent;
  box-shadow: none;
}

.session-title {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
}

.session-more {
  grid-column: 2;
  width: 30px;
  height: 30px;
  align-self: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6b6c70;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.session-more:hover,
.session-more:focus-visible {
  background: #e2e2e8;
  outline: none;
}

.session-meta,
.session-folder-name,
.session-topic-name,
.session-preview {
  margin-top: 2px;
  color: #6b6c70;
  font-size: 12px;
  line-height: 1.4;
}

.session-folder-name {
  color: #0f766e;
  font-weight: 700;
}

.session-topic-name {
  color: #2563eb;
  font-weight: 800;
}

.session-item.is-generating .session-meta {
  color: #0f766e;
  font-weight: 800;
}

.session-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.session-primary-label {
  margin-top: 6px;
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
}

.session-archive {
  min-height: 28px;
  border: 0;
  background: transparent;
}

.session-actions-row {
  grid-column: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.session-action-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.session-action-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.58);
  backdrop-filter: blur(2px);
}

.session-action-dialog {
  position: relative;
  width: min(440px, 100%);
  max-height: min(640px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 28px 80px rgba(23, 32, 51, 0.24);
}

.session-action-head {
  min-height: 56px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--brand-soft);
}

.session-action-head h2 {
  margin: 0;
  color: var(--brand-strong);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.35;
}

.session-action-head .eyebrow {
  color: var(--subtle);
  font-weight: 900;
}

.session-action-head .icon-text-btn {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--brand-strong);
  font-size: 24px;
  font-weight: 700;
}

.session-action-head .icon-text-btn:hover,
.session-action-head .icon-text-btn:focus-visible {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
  outline: 3px solid rgba(21, 94, 117, 0.18);
}

.session-action-summary,
.session-action-form {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
}

.session-action-summary p,
.session-action-meta {
  margin: 0;
  color: #6b6c70;
  font-size: 14px;
  line-height: 1.5;
}

.session-action-topic-status {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #d6e5dc;
  border-radius: 8px;
  background: #f4fbf7;
}

.session-action-topic-status span {
  color: #5f7268;
  font-size: 13px;
  font-weight: 800;
}

.session-action-topic-status strong {
  color: #173b2d;
  font-size: 15px;
  line-height: 1.45;
}

.session-action-topic-status.is-empty {
  border-color: #e5e7eb;
  background: #f7f7f8;
}

.session-action-topic-status.is-empty strong {
  color: #6b7280;
}

.session-action-form {
  gap: 14px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
}

.session-action-form label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.session-action-form .primary-btn,
.session-action-form .danger-btn,
.session-action-form .ghost-btn {
  width: 100%;
  justify-content: center;
  min-height: 46px;
  border-width: 2px;
  font-size: 14px;
  font-weight: 900;
}

.session-action-form .danger-btn {
  border-color: #c56a6a;
  background: #fff7f7;
  color: #8f2929;
}

.session-action-form .danger-btn:hover,
.session-action-form .danger-btn:focus-visible {
  border-color: #9f3d3d;
  background: #fde8e8;
  color: #741f1f;
  outline: 3px solid rgba(159, 61, 61, 0.18);
}

.session-action-form .primary-btn {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 5px 14px rgba(21, 94, 117, 0.22);
}

.session-action-form .primary-btn:hover,
.session-action-form .primary-btn:focus-visible {
  border-color: var(--brand-strong);
  background: var(--brand-strong);
  color: #ffffff;
  outline: 3px solid rgba(21, 94, 117, 0.2);
}

.session-action-form .ghost-btn {
  border-color: #7d9186;
  background: #ffffff;
  color: #294838;
}

.session-action-form .ghost-btn:hover,
.session-action-form .ghost-btn:focus-visible {
  border-color: #4d685a;
  background: #eaf3ee;
  color: #173b2d;
  outline: 3px solid rgba(77, 104, 90, 0.18);
}

.session-action-form .ghost-btn[data-action="archive-session"] {
  border-color: #c56a6a;
  background: #fff7f7;
  color: #8f2929;
}

.session-action-form .ghost-btn[data-action="archive-session"]:hover,
.session-action-form .ghost-btn[data-action="archive-session"]:focus-visible {
  border-color: #9f3d3d;
  background: #fde8e8;
  color: #741f1f;
  outline: 3px solid rgba(159, 61, 61, 0.18);
}

.session-topic-select,
.session-folder-select,
.session-assignment-select,
.session-action-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 11px;
  font-size: 15px;
  box-shadow: inset 0 1px 2px rgba(17, 24, 39, 0.06);
}

.session-action-input::placeholder {
  color: #727b76;
  opacity: 1;
}

.session-topic-select:focus,
.session-folder-select:focus,
.session-assignment-select:focus,
.session-action-input:focus {
  border-color: #176b4b;
  outline: 3px solid rgba(23, 107, 75, 0.18);
}

.session-topic-remove {
  min-height: 28px;
  border: 0;
  border-radius: 8px;
  background: #e8f0ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

.archived-session-toggle {
  width: 100%;
  margin-top: 8px;
  justify-content: center;
}

.archived-session-toggle.is-active,
.session-item.is-archived {
  background: #ececf1;
}

.chat-card {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr) auto;
  gap: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.conversation-toolbar {
  min-height: 56px;
  padding: 0 20px;
  border-bottom: 1px solid #ececf1;
}

body.is-student-sidebar-collapsed .conversation-toolbar {
  padding-left: 66px;
}

.conversation-toolbar h1 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.conversation-toolbar > .conversation-toolbar-title {
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.conversation-toolbar-title .ghost-btn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 6px 10px;
  border-color: #dfe3e8;
  background: #ffffff;
  white-space: nowrap;
}

.student-topbar-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.student-topbar-actions .ghost-link,
.student-topbar-actions .ghost-btn {
  flex: 0 0 auto;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-color: #dfe3e8;
  background: #ffffff;
  white-space: nowrap;
}

.conversation-panel {
  min-height: 0;
  display: grid;
  overflow: hidden;
  position: relative;
}

.conversation-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("./assets/img/logo.png") center / min(360px, 42vw) auto no-repeat;
  opacity: 0.065;
  pointer-events: none;
  z-index: 0;
}

.conversation-panel > * {
  position: relative;
  z-index: 1;
}

.conversation-panel > .student-start-panel,
.conversation-panel > .messages {
  grid-area: 1 / 1;
}

.messages {
  width: 100%;
  height: 100%;
  max-height: none;
  min-height: 0;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding: 28px clamp(20px, 3vw, 48px) 32px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.empty {
  max-width: none;
  margin: 20vh auto 0;
  border: 0;
  background: transparent;
  color: #6b6c70;
  text-align: center;
  font-size: 16px;
}

.message {
  width: 100%;
  max-width: none;
  margin: 0;
  gap: 4px;
}

.message.user {
  justify-self: stretch;
}

.message.assistant {
  justify-self: stretch;
}

.message.user .message-role {
  text-align: right;
}

.message .bubble {
  border: 0;
  border-radius: 18px;
  padding: 12px 16px;
}

.message.user .bubble {
  width: fit-content;
  max-width: min(78%, 920px);
  margin-left: auto;
  background: #f4f4f4;
  color: #202123;
}

.message.assistant .bubble {
  padding-left: 0;
  background: transparent;
}

.markdown-body {
  line-height: 1.72;
}

.markdown-body > * {
  margin: 0 0 10px;
}

.markdown-body > *:last-child {
  margin-bottom: 0;
}

.markdown-body h3,
.markdown-body h4,
.markdown-body h5 {
  margin-top: 14px;
  margin-bottom: 8px;
  color: #1f2937;
  font-size: 16px;
  line-height: 1.35;
}

.markdown-body ul {
  padding-left: 22px;
}

.markdown-body li + li {
  margin-top: 4px;
}

.markdown-body code {
  padding: 2px 5px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #172033;
  font-size: 0.94em;
}

.markdown-body pre {
  overflow-x: auto;
  padding: 12px;
  border-radius: 8px;
  background: #111827;
  color: #f8fafc;
}

.markdown-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

body[data-theme='dark'] .markdown-body h3,
body[data-theme='dark'] .markdown-body h4,
body[data-theme='dark'] .markdown-body h5 {
  color: #f8fafc;
}

body[data-theme='dark'] .markdown-body code {
  background: rgba(148, 163, 184, 0.18);
  color: #f8fafc;
}

body[data-theme='dark'] .markdown-body pre {
  background: #020617;
}

.reflection-message-line {
  gap: 8px;
}

.reflection-message-toggle {
  margin-top: 30px;
}

.technical-details {
  margin-top: 2px;
}

.composer {
  box-sizing: border-box;
  width: calc(100% - clamp(40px, 6vw, 96px));
  margin: 0 clamp(20px, 3vw, 48px) 18px;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d9d9e3;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.composer textarea {
  min-height: 52px;
  max-height: 180px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  resize: vertical;
  transition: background-color 0.18s ease, box-shadow 0.18s ease;
}

.composer textarea:focus {
  border-color: transparent;
  outline: none;
}

.composer textarea.is-voice-listening {
  background: #edf7f3;
  box-shadow: inset 0 0 0 1px #b7d7c8;
}

.composer-actions {
  justify-content: flex-end;
}

.icon-btn {
  width: 38px;
  min-width: 38px;
  padding: 8px;
  justify-content: center;
  font-weight: 800;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.multimodal-btn:disabled,
.voice-input-btn:disabled {
  opacity: 0.45;
}

.voice-input-btn {
  justify-content: center;
}

.voice-input-btn .icon-stop {
  display: none;
}

.voice-input-btn.is-listening .icon-mic {
  display: none;
}

.voice-input-btn.is-listening .icon-stop {
  display: block;
  fill: currentColor;
}

.voice-input-btn.is-listening {
  border-color: #0f766e;
  background: #e6fffa;
  color: #0f766e;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 2px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border: 1px solid #d9d9e3;
  border-radius: 999px;
  padding: 4px 8px;
  background: #f7f7f8;
  color: #202123;
  font-size: 12px;
}

.attachment-chip button {
  min-height: 20px;
  border: 0;
  background: transparent;
  color: #6b6c70;
  cursor: pointer;
  font-size: 14px;
}

.message-attachments {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  max-width: min(520px, 100%);
}

.message-attachment-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid #d9d9e3;
  border-radius: 12px;
  background: #ffffff;
  color: #202123;
}

.message-attachment-card.image {
  grid-template-columns: 86px minmax(0, 1fr) auto;
}

.message-attachment-card strong,
.message-attachment-card small {
  display: block;
  overflow-wrap: anywhere;
}

.message-attachment-card small {
  color: #6b6c70;
  font-size: 12px;
}

.attachment-preview-button {
  width: 86px;
  height: 64px;
  min-height: 64px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #ececf1;
  border-radius: 10px;
  background: #f7f7f8;
}

.attachment-preview-button img,
.attachment-preview-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  object-fit: cover;
  color: #6b6c70;
  font-size: 12px;
}

.attachment-file-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 11px;
  font-weight: 900;
}

.attachment-card-actions {
  display: flex;
  gap: 6px;
}

.attachment-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.72);
}

.attachment-preview-overlay.image-preview-overlay {
  padding: 12px;
  background: rgba(8, 12, 18, 0.88);
}

.attachment-preview-modal {
  width: min(1100px, 96vw);
  height: min(760px, 92vh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 14px;
  background: #ffffff;
  color: #202123;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.attachment-preview-modal.image-preview-modal {
  width: min(1680px, 98vw);
  height: min(1080px, 96vh);
  border-radius: 10px;
  background: #0f141d;
  color: #f8fafc;
}

.attachment-preview-head {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #ececf1;
}

.image-preview-modal .attachment-preview-head {
  border-bottom: 0;
}

.attachment-preview-head button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
}

.attachment-preview-body {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  background: #f7f7f8;
}

.image-preview-modal .attachment-preview-body {
  padding: 0;
  background: #05070a;
}

.attachment-preview-body img,
.attachment-preview-body iframe {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
  background: #ffffff;
}

.image-preview-modal .attachment-preview-body img {
  display: block;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: transparent;
}

.composer-actions .primary-btn {
  width: auto;
  min-width: 76px;
  justify-content: center;
  border-color: #10a37f;
  background: #10a37f;
  color: #ffffff;
}

.intent-picker,
.quick-prompts,
.reflection-toolbar {
  padding: 0 2px;
}

.sidebar-notes-panel {
  padding-top: 10px;
  border-top: 1px solid #e5e5e5;
}

.sidebar-notes-panel p {
  min-height: 0;
}

.work-actions {
  gap: 4px;
}

.work-actions .ghost-btn {
  width: 100%;
  justify-content: flex-start;
}

.sidebar-links .ghost-link,
.sidebar-links .ghost-btn {
  width: 100%;
  justify-content: flex-start;
}

.theme-toggle {
  gap: 8px;
}

.brand-theme-toggle {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
}

.theme-toggle span {
  width: 18px;
  min-width: 18px;
  display: inline-grid;
  place-items: center;
  font-size: 16px;
}

.theme-toggle strong {
  font-size: 14px;
}

.brand-theme-toggle strong {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body[data-theme="dark"] {
  background:
    radial-gradient(circle at 76% 16%, rgba(158, 215, 194, 0.11), transparent 30%),
    linear-gradient(180deg, #141912 0%, #0d100c 100%);
  color: var(--text);
}

body[data-theme="dark"] .chat-root {
  background:
    linear-gradient(180deg, rgba(28, 35, 26, 0.94), rgba(13, 16, 12, 0.98)),
    #0d100c;
}

body[data-theme="dark"] .session-sidebar {
  background: #161b14;
  border-right-color: #3f4a3a;
  color: var(--text);
}

body[data-theme="dark"] .sidebar-floating-toggle {
  border-color: #4a5745;
  background: rgba(29, 35, 26, 0.97);
  color: var(--text);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.36);
}

body[data-theme="dark"] .sidebar-floating-toggle:hover,
body[data-theme="dark"] .sidebar-floating-toggle:focus-visible {
  background: #263020;
}

body[data-theme="dark"] .sidebar-sessions-panel,
body[data-theme="dark"] .sidebar-notes-panel,
body[data-theme="dark"] .sidebar-links {
  border-color: #3f4a3a;
}

body[data-theme="dark"] .chat-card {
  background: #11150f;
  color: var(--text);
}

body[data-theme="dark"] .conversation-toolbar {
  border-bottom-color: #3e4939;
  background: rgba(20, 25, 18, 0.94);
}

body[data-theme="dark"] .conversation-panel::before {
  opacity: 0.035;
  filter: saturate(0.7) brightness(1.35);
}

body[data-theme="dark"] .empty,
body[data-theme="dark"] .eyebrow,
body[data-theme="dark"] .summary-label,
body[data-theme="dark"] .session-meta,
body[data-theme="dark"] .session-preview,
body[data-theme="dark"] .toolbar-status,
body[data-theme="dark"] .message .meta,
body[data-theme="dark"] .message-role,
body[data-theme="dark"] .generating-text,
body[data-theme="dark"] .subtle,
body[data-theme="dark"] .teacher-topic-info,
body[data-theme="dark"] .folder-section-title,
body[data-theme="dark"] .folder-section-count,
body[data-theme="dark"] .folder-section-empty,
body[data-theme="dark"] .session-drag-handle {
  color: var(--subtle);
}

body[data-theme="dark"] .folder-list,
body[data-theme="dark"] .sidebar-links,
body[data-theme="dark"] .sidebar-sessions-panel {
  border-color: #3f4a3a;
}

body[data-theme="dark"] .folder-section {
  border-color: #424d3c;
  background: #1a2017;
}

body[data-theme="dark"] .folder-section.is-mobile-active .folder-section-title {
  background: #222a1f;
}

body[data-theme="dark"] .mobile-folder-nav {
  border-color: #3f4a3a;
  background: rgba(22, 27, 20, 0.96);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
}

body[data-theme="dark"] .mobile-folder-nav button {
  border-color: #4b5a44;
  background: #1b2118;
  color: var(--text);
}

body[data-theme="dark"] .mobile-folder-nav button.is-active {
  border-color: #84c9af;
  background: #20392f;
  color: #f4fff9;
}

body[data-theme="dark"] .folder-session-tree {
  border-left-color: #3f4a3a;
}

body[data-theme="dark"] .folder-item,
body[data-theme="dark"] .session-item,
body[data-theme="dark"] .session-open,
body[data-theme="dark"] .icon-text-btn,
body[data-theme="dark"] .ghost-link,
body[data-theme="dark"] .ghost-btn {
  color: var(--text);
}

body[data-theme="dark"] .folder-create-btn {
  border-color: #486255;
  background: #20392f;
  color: var(--brand-strong);
}

body[data-theme="dark"] .folder-item:hover,
body[data-theme="dark"] .folder-item:focus-visible,
body[data-theme="dark"] .icon-text-btn:hover,
body[data-theme="dark"] .icon-text-btn:focus-visible,
body[data-theme="dark"] .folder-item.is-active,
body[data-theme="dark"] .folder-tree-node.is-active > .folder-row > .folder-item,
body[data-theme="dark"] .session-item:hover,
body[data-theme="dark"] .session-item:focus-within,
body[data-theme="dark"] .session-item.is-active,
body[data-theme="dark"] .archived-session-toggle.is-active,
body[data-theme="dark"] .session-item.is-archived,
body[data-theme="dark"] .ghost-link:hover,
body[data-theme="dark"] .ghost-link:focus-visible,
body[data-theme="dark"] .ghost-btn:hover,
body[data-theme="dark"] .ghost-btn:focus-visible {
  background: #283322;
  border-color: #516047;
  color: #ffffff;
}

body[data-theme="dark"] .icon-text-btn,
body[data-theme="dark"] .brand-theme-toggle,
body[data-theme="dark"] .sidebar-collapse-toggle,
body[data-theme="dark"] .sidebar-section-head .icon-text-btn,
body[data-theme="dark"] .icon-btn {
  border-color: #5f7157;
  background: #263020;
  color: #f7f3ea;
}

body[data-theme="dark"].is-student-sidebar-collapsed .folder-item::after {
  color: #f2f6ec;
}

body[data-theme="dark"].is-student-sidebar-collapsed .teacher-topic-item::after {
  color: #d7f7e9;
}

body[data-theme="dark"].is-student-sidebar-collapsed .folder-item.is-active::after,
body[data-theme="dark"].is-student-sidebar-collapsed .folder-tree-node.is-active > .folder-row > .folder-item::after {
  color: #ffffff;
}

body[data-theme="dark"] .icon-text-btn svg,
body[data-theme="dark"] .brand-theme-toggle svg,
body[data-theme="dark"] .sidebar-collapse-toggle svg,
body[data-theme="dark"] .icon-btn svg {
  stroke-width: 2.15;
}

body[data-theme="dark"] .brand-theme-toggle span {
  color: #f9e7a7;
}

body[data-theme="dark"] .icon-text-btn:focus-visible,
body[data-theme="dark"] .brand-theme-toggle:focus-visible,
body[data-theme="dark"] .sidebar-collapse-toggle:focus-visible,
body[data-theme="dark"] .icon-btn:focus-visible {
  outline: 3px solid rgba(198, 243, 223, 0.28);
  outline-offset: 2px;
}

body[data-theme="dark"] .folder-item[data-drop-folder-id]:hover,
body[data-theme="dark"] .folder-item[data-drop-topic-id]:hover {
  outline-color: rgba(138, 183, 167, 0.34);
}

body[data-theme="dark"] .folder-item strong,
body[data-theme="dark"] .folder-edit,
body[data-theme="dark"] .folder-delete,
body[data-theme="dark"] .attachment-chip button {
  color: #d1dacb;
}

body[data-theme="dark"] .folder-edit,
body[data-theme="dark"] .folder-delete {
  background: #222a1f;
  border-color: #4a5745;
}

body[data-theme="dark"] .folder-edit:hover,
body[data-theme="dark"] .folder-edit:focus-visible {
  border-color: #689b82;
  background: #254233;
  color: #c6f3df;
}

body[data-theme="dark"] .folder-delete:hover,
body[data-theme="dark"] .folder-delete:focus-visible {
  border-color: #7f1d1d;
  background: #4b2424;
  color: #fecaca;
}

body[data-theme="dark"] .primary-btn,
body[data-theme="dark"] .composer-actions .primary-btn {
  border-color: #9ed7c2;
  background: #9ed7c2;
  color: #0b120f;
}

body[data-theme="dark"] .primary-btn:hover,
body[data-theme="dark"] .primary-btn:focus-visible,
body[data-theme="dark"] .composer-actions .primary-btn:hover,
body[data-theme="dark"] .composer-actions .primary-btn:focus-visible {
  border-color: #c6f3df;
  background: #c6f3df;
  color: #06100c;
}

body[data-theme="dark"] .ghost-link,
body[data-theme="dark"] .ghost-btn {
  border-color: transparent;
  background: transparent;
}

body[data-theme="dark"] .status-pill,
body[data-theme="dark"] .student-auth-panel {
  border-color: #b99548;
  background: #3a2c14;
  color: #ffe8a9;
}

body[data-theme="dark"] .student-start-panel {
  border-color: transparent;
  background: transparent;
  color: #dff7ea;
  box-shadow: none;
}

body[data-theme="dark"] .auth-status,
body[data-theme="dark"] .auth-login-field,
body[data-theme="dark"] .auth-token-field {
  color: #ffe8a9;
}

body[data-theme="dark"] .start-session-summary {
  color: #cfe7da;
}

body[data-theme="dark"] .student-auth-panel .ghost-btn,
body[data-theme="dark"] .student-start-panel .ghost-btn {
  border-color: #8e7440;
  background: #271f12;
  color: #fff2c7;
}

body[data-theme="dark"] .student-auth-panel .ghost-btn:hover,
body[data-theme="dark"] .student-auth-panel .ghost-btn:focus-visible,
body[data-theme="dark"] .student-start-panel .ghost-btn:hover,
body[data-theme="dark"] .student-start-panel .ghost-btn:focus-visible {
  border-color: #d9b55d;
  background: #4a3719;
  color: #fff9e8;
}

body[data-theme="dark"] .student-start-panel .ghost-btn strong {
  color: #dff7ea;
}

body[data-theme="dark"] .message.user .bubble {
  border-color: #58715e;
  background: #24382e;
  color: var(--text);
}

body[data-theme="dark"] .message.assistant .bubble {
  border-color: #46523f;
  background: #1b2118;
  color: var(--text);
}

body[data-theme="dark"] .technical-details dt {
  color: #d9e3d2;
}

body[data-theme="dark"] .technical-details dl,
body[data-theme="dark"] .feedback,
body[data-theme="dark"] .reflection-selection,
body[data-theme="dark"] .audit-panel,
body[data-theme="dark"] .loop-list {
  border-color: #45513f;
  background: #1a2017;
  color: var(--text);
}

body[data-theme="dark"] .composer {
  border-color: #485440;
  background: #1a2118;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
}

body[data-theme="dark"] .composer textarea,
body[data-theme="dark"] .session-topic-select,
body[data-theme="dark"] .session-folder-select,
body[data-theme="dark"] .session-assignment-select,
body[data-theme="dark"] .session-action-input,
body[data-theme="dark"] .auth-login-field input,
body[data-theme="dark"] .auth-token-field input {
  background: #10150f;
  color: var(--text);
  border-color: #53614b;
}

body[data-theme="dark"] .composer textarea:focus,
body[data-theme="dark"] .session-topic-select:focus,
body[data-theme="dark"] .session-folder-select:focus,
body[data-theme="dark"] .session-assignment-select:focus,
body[data-theme="dark"] .session-action-input:focus,
body[data-theme="dark"] .auth-login-field input:focus,
body[data-theme="dark"] .auth-token-field input:focus {
  border-color: #9ed7c2;
  outline: 3px solid rgba(158, 215, 194, 0.22);
}

body[data-theme="dark"] .composer textarea::placeholder {
  color: #aab5a4;
}

body[data-theme="dark"] .icon-btn,
body[data-theme="dark"] .intent-option,
body[data-theme="dark"] .attachment-chip {
  border-color: #4a5745;
  background: #222b20;
  color: var(--text);
}

body[data-theme="dark"] .message-attachment-card,
body[data-theme="dark"] .attachment-preview-modal {
  border-color: #4a5745;
  background: #1d251b;
  color: var(--text);
}

body[data-theme="dark"] .message-attachment-card small,
body[data-theme="dark"] .attachment-preview-placeholder {
  color: #c8d0c1;
}

body[data-theme="dark"] .attachment-preview-button,
body[data-theme="dark"] .attachment-preview-body {
  border-color: #4a5745;
  background: #151b14;
}

body[data-theme="dark"] .attachment-file-icon {
  background: #243d33;
  color: #def7eb;
}

body[data-theme="dark"] .attachment-preview-head {
  border-bottom-color: #4a5745;
}

body[data-theme="dark"] .image-preview-modal .attachment-preview-head {
  border-bottom-color: transparent;
}

body[data-theme="dark"] .intent-option:hover,
body[data-theme="dark"] .intent-option:focus-visible,
body[data-theme="dark"] .intent-option.is-selected {
  border-color: #9ed7c2;
  background: #243d33;
  color: #effbf5;
}

body[data-theme="dark"] .voice-input-btn.is-listening {
  border-color: #9bd4bd;
  background: #1f3c34;
  color: #c8f2df;
}

body[data-theme="dark"] .composer textarea.is-voice-listening {
  background: #182820;
  box-shadow: inset 0 0 0 1px #557b68;
}

body[data-theme="dark"] .session-folder-name {
  color: #b9efd8;
}

body[data-theme="dark"] .session-topic-name,
body[data-theme="dark"] .session-topic-remove {
  color: #c8ddff;
}

body[data-theme="dark"] .session-topic-remove {
  background: #243550;
}

body[data-theme="dark"] .session-more {
  color: #d0d8c9;
}

body[data-theme="dark"] .session-more:hover,
body[data-theme="dark"] .session-more:focus-visible {
  background: #303a2b;
  color: #ffffff;
}

body[data-theme="dark"] .session-action-backdrop {
  background: rgba(3, 7, 5, 0.68);
}

body[data-theme="dark"] .session-action-dialog {
  border-color: #799081;
  background: #1a2118;
  color: var(--text);
  box-shadow: 0 24px 76px rgba(0, 0, 0, 0.52);
}

body[data-theme="dark"] .session-action-head,
body[data-theme="dark"] .session-action-form {
  border-color: #52634f;
}

body[data-theme="dark"] .session-action-head {
  background: #222c20;
}

body[data-theme="dark"] .session-action-form {
  background: #181f16;
}

body[data-theme="dark"] .session-action-head h2 {
  color: #effff7;
}

body[data-theme="dark"] .session-action-head .eyebrow {
  color: #b7d9c8;
}

body[data-theme="dark"] .session-action-head .icon-text-btn {
  border-color: #71836c;
  background: #11170f;
  color: #effff7;
}

body[data-theme="dark"] .session-action-head .icon-text-btn:hover,
body[data-theme="dark"] .session-action-head .icon-text-btn:focus-visible {
  border-color: #9ed7c2;
  background: #294437;
  color: #ffffff;
}

body[data-theme="dark"] .session-action-summary p,
body[data-theme="dark"] .session-action-meta,
body[data-theme="dark"] .session-action-form label {
  color: #d8e8dc;
}

body[data-theme="dark"] .session-action-form .primary-btn {
  border-color: #a9e8cf;
  background: #a9e8cf;
  color: #102219;
}

body[data-theme="dark"] .session-action-form .primary-btn:hover,
body[data-theme="dark"] .session-action-form .primary-btn:focus-visible {
  border-color: #d6f7e9;
  background: #d6f7e9;
  color: #0a1811;
}

body[data-theme="dark"] .session-action-form .ghost-btn {
  border-color: #82927d;
  background: #20291e;
  color: #f0f6ed;
}

body[data-theme="dark"] .session-action-form .ghost-btn:hover,
body[data-theme="dark"] .session-action-form .ghost-btn:focus-visible {
  border-color: #b3c7ad;
  background: #303d2d;
  color: #ffffff;
}

body[data-theme="dark"] .session-action-form .ghost-btn[data-action="archive-session"] {
  border-color: #e58a8a;
  background: #3a2020;
  color: #ffd7d7;
}

body[data-theme="dark"] .session-action-form .danger-btn {
  border-color: #e58a8a;
  background: #3a2020;
  color: #ffd7d7;
}

body[data-theme="dark"] .session-action-form .danger-btn:hover,
body[data-theme="dark"] .session-action-form .danger-btn:focus-visible {
  border-color: #ffb4b4;
  background: #562a2a;
  color: #ffffff;
}

body[data-theme="dark"] .session-action-input::placeholder {
  color: #b6c0b2;
}

body[data-theme="dark"] .session-action-topic-status {
  border-color: #4f755f;
  background: #1d3328;
}

body[data-theme="dark"] .session-action-topic-status span {
  color: #b7e7d0;
}

body[data-theme="dark"] .session-action-topic-status strong {
  color: #ecfff6;
}

body[data-theme="dark"] .session-action-topic-status.is-empty {
  border-color: #4a5745;
  background: #20291e;
}

body[data-theme="dark"] .session-action-topic-status.is-empty strong {
  color: #d4dece;
}

@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .session-action-modal {
    align-items: end;
    padding: 12px;
  }

  .session-action-dialog {
    width: 100%;
    max-height: calc(100vh - 24px);
    border-radius: 18px 18px 12px 12px;
  }

  .session-action-form {
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .chat-root {
    min-height: 100vh;
    height: auto;
    grid-template-columns: 1fr;
    padding: 0;
  }

  .sidebar-floating-toggle {
    display: none;
  }

  .sidebar-collapse-toggle {
    display: none;
  }

  body.is-student-sidebar-collapsed .chat-root {
    grid-template-columns: 1fr;
  }

  body.is-student-sidebar-collapsed .session-sidebar {
    pointer-events: auto;
    opacity: 1;
    transform: none;
  }

  body.is-student-sidebar-collapsed .conversation-toolbar {
    padding-left: 0;
  }

  .session-sidebar {
    height: auto;
    min-height: 0;
    order: 0;
    grid-template-rows: auto;
    padding: 6px 12px 8px;
    border-right: 0;
    border-bottom: 1px solid #e5e5e5;
  }

  .sidebar-brand {
    gap: 6px;
  }

  .brand-row {
    min-height: 38px;
    grid-template-columns: minmax(0, 1fr) 38px;
  }

  .brand-lockup {
    min-height: 36px;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
  }

  .sidebar-primary-action {
    min-height: 36px;
  }

  .sidebar-sessions-panel {
    position: fixed;
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    left: 10px;
    z-index: 50;
    display: grid;
    gap: 8px;
    overflow: visible;
    pointer-events: none;
  }

  .folder-list {
    max-height: none;
    display: grid;
    gap: 8px;
    border-bottom: 0;
    padding: 0;
    overflow: visible;
    pointer-events: none;
  }

  .folder-section {
    display: none;
    max-height: min(42vh, 360px);
    overflow: auto;
    padding: 10px;
    border: 1px solid rgba(205, 213, 220, 0.92);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 20px 44px rgba(15, 23, 42, 0.22);
    pointer-events: auto;
  }

  .folder-section.is-mobile-active {
    position: fixed;
    top: var(--mobile-sidebar-panel-top, 124px);
    left: var(--mobile-sidebar-panel-left, 50%);
    width: min(80vw, 720px);
    transform: translateX(var(--mobile-sidebar-panel-translate-x, -50%));
    z-index: 60;
    display: grid;
    touch-action: none;
  }

  .folder-section.is-mobile-active .folder-section-title {
    min-height: 38px;
    margin: -2px -2px 4px;
    padding: 7px 9px;
    border-radius: 10px;
    background: #f3f6f4;
    cursor: grab;
    user-select: none;
    touch-action: none;
  }

  .folder-section.is-mobile-active .folder-section-title:active {
    cursor: grabbing;
  }

  .folder-section.is-mobile-active .folder-section-toggle {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    display: inline-grid;
    padding: 0;
    border-color: transparent;
    border-radius: 10px;
    background: transparent;
    font-size: 19px;
  }

  .folder-section.is-mobile-active .folder-section-toggle > span {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #cddbd5;
    border-radius: 7px;
    background: #f5faf8;
  }

  .mobile-folder-nav {
    min-height: 56px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    border: 1px solid #dfe3e8;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
    pointer-events: auto;
  }

  .mobile-folder-nav button {
    min-height: 42px;
    border: 1px solid #d7dce2;
    border-radius: 10px;
    background: #ffffff;
    color: #202123;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.2;
  }

  .mobile-folder-nav button.is-active {
    border-color: #9fd9c6;
    background: #e9f8f2;
    color: #17382a;
  }

  .sidebar-notes-panel,
  .sidebar-links {
    display: none;
  }

  .sidebar-links {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .chat-card {
    order: 1;
    height: calc(100vh - 116px);
    min-height: 500px;
    grid-template-rows: 52px minmax(0, 1fr) auto;
    padding-bottom: 68px;
  }

  .conversation-toolbar {
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
  }

  .conversation-toolbar-title {
    flex: 0 0 auto;
  }

  .conversation-toolbar-title .ghost-btn { min-height: 44px; }

  .student-topbar-actions {
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  .student-topbar-actions .ghost-link,
  .student-topbar-actions .ghost-btn {
    min-height: 44px;
    padding: 7px 10px;
  }

  .messages {
    padding: 14px 16px 24px;
    gap: 8px;
  }

  .composer {
    width: calc(100% - 20px);
    margin: 0 10px calc(env(safe-area-inset-bottom, 0px) + 12px);
  }

  .composer-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }

  .composer-actions .student-composer-helper {
    flex: 1 0 100%;
  }

  .composer-actions .icon-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 8px;
  }

  .composer-actions .primary-btn {
    min-width: 72px;
    flex: 0 0 auto;
  }
}
