/* Swiss Red tutor layout, using the shared brand tokens at their source. */
body.tutor-workspace {
  --ink: var(--emh-ink);
  --muted: var(--emh-muted);
  --paper: var(--emh-paper);
  --surface: var(--emh-surface);
  --surface-raised: var(--emh-surface);
  --surface-soft: var(--emh-soft);
  --line: var(--emh-line);
  --lav: var(--emh-selected);
  --violet: var(--emh-primary-text);
  --violet-strong: var(--emh-primary-text);
  --orange: var(--emh-primary);
  --user-bubble: var(--emh-selected);
  --user-ink: var(--emh-ink);
  --shadow: transparent;
  background: var(--emh-surface);
  font-family: var(--emh-font-sans);
}
:root[data-theme='dark'] body.tutor-workspace {
  --ink: var(--emh-ink);
  --muted: var(--emh-muted);
  --paper: var(--emh-paper);
  --surface: var(--emh-surface);
  --surface-raised: var(--emh-surface);
  --surface-soft: var(--emh-soft);
  --line: var(--emh-line);
  --lav: var(--emh-selected);
  --violet: var(--emh-primary-text);
  --violet-strong: var(--emh-primary-text);
  --orange: var(--emh-primary);
  --user-bubble: var(--emh-selected);
  --user-ink: var(--emh-ink);
}
body.tutor-workspace :is(button, input, select, textarea, summary, a):focus-visible {
  outline: 2px solid var(--emh-primary-text);
  outline-offset: 3px;
}
body.tutor-workspace :is(button, summary) { touch-action: manipulation; }
body.tutor-workspace :is(h1, h2, h3, h4, .markdown-body h1, .markdown-body h2, .markdown-body h3) {
  font-family: var(--emh-font-sans);
  letter-spacing: -.025em;
}
body.tutor-workspace .whiteboard-app,
body.tutor-workspace .whiteboard-app:has(.whiteboard-workspace:not(.board-disabled.code-disabled)) {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: calc(100dvh - var(--app-header-height, 64px));
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
body.tutor-workspace .whiteboard-intro { margin: -1px; }
body.tutor-workspace .homework-auth-gate {
  width: min(560px, calc(100% - 32px));
  margin: 64px auto;
  padding: 24px;
  border-color: var(--emh-line);
  background: var(--emh-soft);
}
body.tutor-workspace .homework-auth-gate h3 { font-size: 1.25rem; }
body.tutor-workspace .auth-gate-action { background: var(--emh-primary); }
body.tutor-workspace .workspace-review-status:not([hidden]) { margin: 8px 12px 0; }
body.tutor-workspace .whiteboard-workspace,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled),
body.tutor-workspace .whiteboard-workspace.board-disabled.code-disabled {
  display: grid;
  flex: 1 1 0;
  grid-template-columns: minmax(340px, .42fr) minmax(0, .58fr);
  align-items: stretch;
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--emh-surface);
  box-shadow: none;
}
body.tutor-workspace .whiteboard-workspace.board-disabled.code-disabled { grid-template-columns: minmax(0, 1fr); }
body.tutor-workspace .whiteboard-workspace .chat-panel,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .chat-panel,
body.tutor-workspace .whiteboard-workspace.board-disabled.code-disabled .chat-panel {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  height: 100%;
  max-width: none;
  min-height: 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 0;
  border: 0;
  border-right: 1px solid var(--emh-line);
  background: var(--emh-surface);
  container-type: normal;
}
body.tutor-workspace .whiteboard-workspace .board-panel,
body.tutor-workspace .whiteboard-workspace .code-panel,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled) .board-panel,
body.tutor-workspace .whiteboard-workspace:not(.code-disabled) .code-panel {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  top: auto;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--emh-surface);
}
body.tutor-workspace .whiteboard-workspace.board-disabled .board-panel,
body.tutor-workspace .whiteboard-workspace.code-disabled .code-panel { display: none; }
body.tutor-workspace .whiteboard-workspace:not(.board-disabled):not(.code-disabled)[data-active-surface='board'] .code-panel,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled):not(.code-disabled)[data-active-surface='code'] .board-panel { display: none; }
body.tutor-workspace .whiteboard-chat-heading,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .whiteboard-chat-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 12px;
  margin: 0;
  padding: 12px 20px;
  border-bottom: 1px solid var(--emh-line);
}
body.tutor-workspace .whiteboard-chat-heading h2,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .whiteboard-chat-heading h2 {
  margin: 0;
  color: var(--emh-ink);
  font-size: 1rem;
  font-weight: 700;
}
body.tutor-workspace .whiteboard-chat-heading > div:first-child { width: auto; min-width: 0; flex: 1; }
body.tutor-workspace .chat-heading-actions,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .chat-heading-actions {
  display: flex;
  flex: 0 0 auto;
  width: auto;
  gap: 6px;
}
body.tutor-workspace .whiteboard-chat-heading .new-chat,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .whiteboard-chat-heading .new-chat {
  width: auto;
  min-width: 0;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--emh-line);
  border-radius: 8px;
  background: var(--emh-surface);
  color: var(--emh-ink);
  font-size: .8rem;
  white-space: nowrap;
  box-shadow: none;
}
body.tutor-workspace .conversation-actions-menu { position: relative; }
body.tutor-workspace :is(.conversation-actions-menu, .board-file-menu) > summary,
body.tutor-workspace .composer-toolbar > details > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--emh-line);
  border-radius: 8px;
  background: var(--emh-surface);
  color: var(--emh-ink);
  font-size: .8rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  white-space: nowrap;
}
body.tutor-workspace summary::-webkit-details-marker { display: none; }
body.tutor-workspace .conversation-actions-content,
body.tutor-workspace .board-file-menu-content {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  display: grid;
  gap: 4px;
  width: 190px;
  padding: 8px;
  border: 1px solid var(--emh-line);
  border-radius: 12px;
  background: var(--emh-surface);
  box-shadow: 0 8px 26px rgb(0 0 0 / .12);
}
body.tutor-workspace .conversation-actions-content .new-chat { justify-content: flex-start; width: 100%; border: 0; }
body.tutor-workspace .whiteboard-conversation,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .whiteboard-conversation,
body.tutor-workspace .whiteboard-workspace.board-disabled.code-disabled .whiteboard-conversation {
  display: flex;
  flex: 1 1 0;
  gap: 20px;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 26px 22px;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  background: var(--emh-surface);
  scroll-padding: 20px;
}
body.tutor-workspace .message { max-width: min(88%, 660px); border: 0; border-radius: 12px; box-shadow: none; padding: 14px 16px; background: var(--emh-soft); }
body.tutor-workspace .message--user { color: var(--emh-ink); background: var(--emh-selected); }
body.tutor-workspace .message-speaker { color: var(--emh-muted); font-family: inherit; font-size: .7rem; font-weight: 700; letter-spacing: 0; text-transform: none; }
body.tutor-workspace .message--user .message-speaker { color: var(--emh-primary-text); }
body.tutor-workspace .message-body { font-size: .94rem; line-height: 1.65; }
body.tutor-workspace .message--error { color: var(--emh-danger); background: var(--emh-danger-soft); }
body.tutor-workspace .load-earlier-messages { align-self: center; min-height: 44px; padding: 9px 14px; border: 1px solid var(--emh-line); border-radius: 8px; color: var(--emh-primary-text); background: var(--emh-surface); font: inherit; font-size: .8rem; }
body.tutor-workspace .whiteboard-composer,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .whiteboard-composer {
  position: relative;
  flex: 0 0 auto;
  margin: 0 14px 16px;
  overflow: visible;
  border: 1px solid var(--emh-line);
  border-radius: 12px;
  background: var(--emh-surface);
  box-shadow: 0 3px 14px rgb(0 0 0 / .035);
}
body.tutor-workspace .whiteboard-composer textarea,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .whiteboard-composer textarea,
body.tutor-workspace .whiteboard-workspace.board-disabled.code-disabled .whiteboard-composer textarea {
  min-height: 72px;
  max-height: 150px;
  padding: 14px 14px 8px;
  border: 0;
  border-radius: 12px 12px 0 0;
  background: transparent;
  color: var(--emh-ink);
  font-size: .9rem;
  line-height: 1.5;
  resize: vertical;
}
body.tutor-workspace .whiteboard-composer textarea::placeholder { color: var(--emh-muted); opacity: 1; }
body.tutor-workspace .composer-toolbar { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; }
body.tutor-workspace .composer-toolbar > details { position: static; border: 0; background: transparent; border-radius: 0; }
body.tutor-workspace .attach-homework { min-height: 44px; min-width: 0; padding: 8px 10px; border: 1px solid var(--emh-line); border-radius: 8px; background: var(--emh-surface); color: var(--emh-ink); font-size: .8rem; font-weight: 600; }
body.tutor-workspace .composer-toolbar .send,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .send {
  display: inline-flex;
  min-width: 70px;
  min-height: 44px;
  margin-left: auto;
  padding: 9px 12px;
  gap: 8px;
  border: 1px solid var(--emh-primary);
  border-radius: 8px;
  background: var(--emh-primary);
  color: var(--emh-primary-label);
  font-size: .85rem;
  box-shadow: none;
}
body.tutor-workspace .composer-toolbar .send:disabled { opacity: .55; }
body.tutor-workspace .composer-tools-content,
body.tutor-workspace .composer-intelligence-menu > .chat-settings-content {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  width: min(360px, calc(100vw - 32px));
  max-height: min(65dvh, 560px);
  padding: 14px;
  overflow-y: auto;
  border: 1px solid var(--emh-line);
  border-radius: 12px;
  background: var(--emh-surface);
  box-shadow: 0 8px 28px rgb(0 0 0 / .13);
}
body.tutor-workspace .composer-intelligence-menu > .chat-settings-content {
  position: fixed; left: auto; right: 16px; bottom: var(--tutor-selector-bottom, 100px); z-index: 100;
  width: min(540px, calc(100vw - 32px)); padding: 20px;
  max-height: min(680px, calc(100dvh - var(--tutor-selector-bottom, 100px) - 12px)); overscroll-behavior: contain; scrollbar-gutter: stable;
  container: answer-options / inline-size;
}
body.tutor-workspace .composer-intelligence-menu > summary {
  border-color: color-mix(in srgb, var(--emh-primary-text) 45%, var(--emh-line));
  background: var(--emh-selected); color: var(--emh-primary-text);
}
body.tutor-workspace .composer-intelligence-menu[open] > summary { border-color: var(--emh-primary-text); }
body.tutor-workspace .composer-toolbar > .composer-option-menu > summary { width: 44px; height: 44px; min-width: 44px; padding: 10px; justify-content: center; }
body.tutor-workspace .composer-option-menu > summary::after { content: none; }
body.tutor-workspace .tutor-answer-options-heading {
  position: sticky; top: -20px; z-index: 2; display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; gap: 6px 16px; margin: -20px -20px 18px; padding: 18px 20px;
  border-bottom: 1px solid var(--emh-line); background: var(--emh-surface);
}
body.tutor-workspace .tutor-answer-options-heading h3 { grid-column: 1; margin: 0; font-size: 1.05rem; }
body.tutor-workspace .tutor-answer-options-heading p { grid-column: 1; margin: 0; color: var(--emh-muted); font-size: .8rem; line-height: 1.5; }
body.tutor-workspace .tutor-option-done { grid-column: 2; grid-row: 1; min-height: 44px; padding: 8px 12px; border: 1px solid var(--emh-line); border-radius: 8px; background: var(--emh-surface); color: var(--emh-ink); font: 600 .8rem/1.3 'Inter', system-ui, sans-serif; cursor: pointer; }
body.tutor-workspace .tutor-option-done:hover { background: var(--emh-selected); }
body.tutor-workspace .workspace-launchers,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .workspace-launchers { display: grid; grid-template-columns: 1fr; margin: 0 0 8px; gap: 6px; }
body.tutor-workspace .workspace-launcher { width: 100%; justify-content: flex-start; border-color: var(--emh-line); background: var(--emh-surface); }
body.tutor-workspace .composer-tools-content > .attach-homework { width: 100%; justify-content: flex-start; margin-bottom: 10px; }
body.tutor-workspace .composer-tools-content #call-settings { border: 1px solid var(--emh-line); }
body.tutor-workspace .chat-settings-content :is(.tutor-call-panel, .intelligence-picker) { margin: 0; padding: 0; border: 0; background: transparent; }
body.tutor-workspace .tutor-call-description { margin: 0 0 10px; font-size: .82rem; line-height: 1.6; }
body.tutor-workspace .tutor-call-controls { margin: 10px 0 0; }
body.tutor-workspace .tutor-call-controls .call-action--primary { width: 100%; background: var(--emh-primary); color: var(--emh-primary-label); border-color: var(--emh-primary); }
body.tutor-workspace .tutor-recording-notice { margin-top: 10px; }
body.tutor-workspace .intelligence-picker { min-width: 0; }
body.tutor-workspace .intelligence-picker legend:not(.sr-only) { width: auto; margin: 0 0 12px; padding: 0; }
body.tutor-workspace .intelligence-picker legend .board-kicker { display: none; }
body.tutor-workspace .intelligence-title { font: 700 .9rem/1.3 var(--emh-font-sans); letter-spacing: 0; }
body.tutor-workspace .intelligence-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0; border: 0; background: transparent; }
body.tutor-workspace .intelligence-option {
  display: grid; grid-template-columns: minmax(0, 1fr) 18px; align-content: start; align-items: center;
  gap: 8px; min-height: 118px; padding: 12px; text-align: left; border: 1px solid var(--emh-line);
  border-radius: 10px; color: var(--emh-ink); background: var(--emh-surface); box-shadow: none;
}
body.tutor-workspace .intelligence-option input {
  position: static; grid-column: 2; grid-row: 1; width: 18px; height: 18px; margin: 0;
  overflow: visible; clip: auto; clip-path: none; accent-color: var(--emh-primary);
}
body.tutor-workspace .intelligence-option-name { grid-column: 1; grid-row: 1; font-size: .82rem; }
body.tutor-workspace .intelligence-option-description { display: block; grid-column: 1 / -1; margin: 0; overflow: visible; font-size: .75rem; line-height: 1.4; color: var(--emh-muted); }
body.tutor-workspace .intelligence-option-cost {
  grid-column: 1 / -1; justify-self: start; margin: 0; padding: 4px 7px; border-radius: 5px;
  color: var(--emh-primary-text); background: var(--emh-selected); font: 600 .7rem/1.35 var(--emh-font-sans);
}
body.tutor-workspace .intelligence-option:has(input:checked) { border-color: var(--emh-primary-text); background: var(--emh-selected); box-shadow: inset 0 0 0 1px var(--emh-primary-text); }
body.tutor-workspace .intelligence-option:has(input:checked) .intelligence-option-cost { background: var(--emh-surface); }
body.tutor-workspace .intelligence-option[data-locked='true'] { opacity: 1; color: var(--emh-muted); background: var(--emh-soft); cursor: not-allowed; }
body.tutor-workspace .intelligence-option[data-locked='true'] .intelligence-option-cost { background: var(--emh-surface); color: var(--emh-muted); }
body.tutor-workspace .intelligence-meta { margin-top: 12px; gap: 6px; }
body.tutor-workspace .intelligence-meta p { font-size: .75rem; line-height: 1.5; }
body.tutor-workspace #intelligence-status { color: var(--emh-muted); font-weight: 500; }
body.tutor-workspace .attachment-status { padding: 0 12px 8px; margin: 0; font-size: .68rem; }
body.tutor-workspace .attachment-status:empty { display: none; }
body.tutor-workspace .attachment-retry { margin: 0 12px 10px; }
body.tutor-workspace .homework-attachments { margin: 0 10px 6px; }
body.tutor-workspace .composer-notice { margin: 0; padding: 0 12px; font-size: .75rem; }
body.tutor-workspace .composer-notice:empty { display: none; }
body.tutor-workspace .active-call-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--emh-line); background: var(--emh-selected); }
body.tutor-workspace .active-call-bar .tutor-call-status { flex: 1 1 120px; margin: 0; font-size: .78rem; }
body.tutor-workspace .active-call-bar .call-action { min-height: 40px; padding: 7px 9px; font-size: .75rem; }
body.tutor-workspace .tutor-call-recovery-area { padding: 0 16px; }
body.tutor-workspace .tutor-call-recovery-area p:not([hidden]) { margin: 10px 0; color: var(--emh-danger); font-size: .82rem; }
body.tutor-workspace .tutor-call-recovery-area :is(button,a):not([hidden]) { display:inline-flex; align-items:center; min-height:44px; margin-bottom:10px; }
body.tutor-workspace .tutor-call-conflict { margin: 8px 16px; }
body.tutor-workspace .board-heading,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled) .board-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 68px;
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--emh-line);
}
body.tutor-workspace .board-kicker { display: none; }
body.tutor-workspace .board-heading h2 { font-size: 1rem; }
body.tutor-workspace .board-heading > div:first-child { flex: 1; }
body.tutor-workspace .board-heading-actions { display: flex; flex: 0 0 auto; width: auto; gap: 6px; }
body.tutor-workspace .board-heading-actions > .board-action { flex: 0 0 auto; }
body.tutor-workspace .board-file-menu { position: relative; }
body.tutor-workspace .board-file-menu-content .board-upload { border: 0; justify-content: flex-start; }
body.tutor-workspace .board-file-menu-content #export-board { width: 100%; justify-content: flex-start; border: 0; }
body.tutor-workspace .board-toolbar {
  display: grid;
  grid-template-columns: minmax(44px, 1fr) auto auto;
  align-items: start;
  gap: 6px 12px;
  min-height: 60px;
  max-width: 100%;
  margin: 0;
  padding: 8px 12px;
  overflow: visible;
  border: 0;
  border-bottom: 1px solid var(--emh-line);
  border-radius: 0;
  background: var(--emh-surface);
}
/* Override the legacy whiteboard container query that spans tools across every column. */
body.tutor-workspace .board-toolbar > .drawing-tools { grid-column: 1; grid-row: 1; display: flex; min-width: 0; max-width: 100%; flex-wrap: nowrap; gap: 4px; overflow-x: auto; overscroll-behavior: contain; scrollbar-width: thin; }
body.tutor-workspace .board-tool { flex: 0 0 44px; min-width: 44px; min-height: 44px; padding: 6px; border-radius: 8px; }
body.tutor-workspace .board-tool > span:last-child { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); }
body.tutor-workspace .board-tool > span:first-child { font-size: 1.15rem; }
body.tutor-workspace .board-style-tools { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 8px; }
body.tutor-workspace .color-control { width: 44px; height: 44px; }
body.tutor-workspace .width-control { display: grid; align-items: center; min-height: 44px; min-width: 105px; grid-template-columns: auto 72px; gap: 8px; }
body.tutor-workspace .history-tools { grid-column: 3; grid-row: 1; display: flex; flex-wrap: nowrap; align-items: center; gap: 4px; padding: 0; border: 0; }
body.tutor-workspace .history-tools .board-action { width: 44px; min-height: 44px; min-width: 44px; padding: 6px; border: 0; }
body.tutor-workspace .history-tools .board-action > span:last-child { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
body.tutor-workspace .board-stage,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled) .board-stage { display: block; position: relative; flex: 1 1 0; min-height: 0; width: 100%; aspect-ratio: auto; margin: 0; overflow: hidden; border: 0; border-radius: 0; background: var(--emh-soft); container-type: size; }
body.tutor-workspace .board-page-bar,
body.tutor-workspace .whiteboard-workspace:not(.board-disabled) .board-page-bar { display: flex; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; min-height: 54px; gap: 4px; margin: 0; padding: 6px 12px; border: 0; border-top: 1px solid var(--emh-line); border-radius: 0; background: var(--emh-surface); }
body.tutor-workspace .page-nav-group, body.tutor-workspace .page-nav-actions { display: flex; width: auto; gap: 4px; }
body.tutor-workspace .page-indicator { border: 0; background: transparent; min-width: 70px; padding: 4px; font: .75rem var(--emh-font-sans); }
body.tutor-workspace .page-action { min-width: 40px; min-height: 44px; padding: 7px; border: 0; background: transparent; }
body.tutor-workspace .page-nav-actions .board-action { min-height: 44px; padding: 7px 8px; border: 0; }
body.tutor-workspace .board-footer { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 0 14px 4px; }
body.tutor-workspace .board-footer .board-legend { margin-left: auto; font-size: .65rem; }
body.tutor-workspace .board-status { padding: 0 14px 6px; min-height: 20px; font-size: .65rem; }
body.tutor-workspace #board-objects-panel { position: relative; flex: 0 0 auto; margin: 0; padding: 0 14px; color: var(--emh-muted); font-size: .75rem; }
body.tutor-workspace #board-objects-panel[hidden] { display: none; }
body.tutor-workspace #board-objects-panel .board-object-list { position: absolute; z-index: 12; right: 12px; bottom: calc(100% + 4px); display: grid; gap: 8px; width: min(340px, calc(100vw - 32px)); max-height: 50dvh; overflow-y: auto; padding: 14px; border: 1px solid var(--emh-line); border-radius: 12px; background: var(--emh-surface); box-shadow: 0 8px 28px rgb(0 0 0 / .13); }
body.tutor-workspace .board-object-list :is(select, input) { width: 100%; min-height: 44px; padding: 8px; border: 1px solid var(--emh-line); border-radius: 8px; background: var(--emh-surface); color: var(--emh-ink); font: inherit; }
body.tutor-workspace .board-object-actions { display: flex; flex-wrap: wrap; gap: 6px; }
body.tutor-workspace .board-object-actions button { min-height: 44px; padding: 8px; border: 1px solid var(--emh-line); border-radius: 8px; background: var(--emh-surface); color: var(--emh-ink); font: inherit; }
body.tutor-workspace #code-workspace-root, body.tutor-workspace .code-workspace { flex: 1; min-height: 0; height: 100%; }
body.tutor-workspace .code-workspace { --code-bg: var(--emh-soft); --code-panel: var(--emh-surface); --code-ink: var(--emh-ink); --code-muted: var(--emh-muted); --code-line: var(--emh-line); --code-accent: var(--emh-primary-text); --code-accent-strong: var(--emh-primary); --code-accent-soft: var(--emh-selected); }
body.tutor-workspace .whiteboard-workspace:not(.code-disabled) .code-workspace-panel { display: flex; flex-direction: column; height: 100%; min-height: 0; border: 0; border-radius: 0; }
body.tutor-workspace .code-workspace-header { flex: 0 0 auto; min-height: 68px; padding: 10px 14px; gap: 8px; }
body.tutor-workspace .code-workspace-header h2 { font-size: 1rem; }
body.tutor-workspace .code-workspace-header p:last-child { display: none; }
body.tutor-workspace .code-workspace-grid { flex: 1; min-height: 0; overflow: auto; }
body.tutor-workspace .code-workspace-editor-pane { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
body.tutor-workspace .code-workspace-result-pane { min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
body.tutor-workspace .code-workspace [data-code-source-panel] { display: flex; flex-direction: column; flex: 1 0 100px; min-height: 100px; }
body.tutor-workspace .code-workspace .code-workspace-source-shell { display: grid; flex: 1; min-height: 100px; height: 0; grid-template-rows: minmax(0, 1fr); }
body.tutor-workspace .code-workspace-source-surface,
body.tutor-workspace .code-workspace .code-workspace-line-numbers { height: 100%; min-height: 0; }
body.tutor-workspace .code-workspace-preview-shell,
body.tutor-workspace .code-workspace-console-pane { min-height: 0; height: 100%; }
body.tutor-workspace .code-workspace-output { min-height: 0; height: auto; max-height: none; }
body.tutor-workspace .code-workspace-runtime-note { font-size: .68rem; }
body.tutor-workspace .code-workspace-mobile-tabs { display: none; }
body.tutor-workspace .code-workspace-button-primary { background: var(--emh-primary); }
body.tutor-workspace .code-workspace-draft { max-height: 35dvh; overflow-y: auto; }
body.tutor-workspace .text-tool-row { margin: 0; padding: 8px 12px; border-radius: 0; }
body.tutor-workspace .text-tool-row > span { display: none; }
body.tutor-workspace #board-panel:fullscreen { position: fixed; inset: 0; height: 100dvh; width: 100%; padding: 0; }
body.tutor-workspace #board-panel:fullscreen .board-stage { min-height: 120px; }
body.tutor-workspace #board-panel:fullscreen .board-heading { min-height: 56px; }
body.tutor-workspace #board-panel:fullscreen .board-footer { display: none; }
:root.research-embedded body.tutor-workspace { padding: 0 !important; }
:root.research-embedded body.tutor-workspace .app-topbar,
:root.research-embedded body.tutor-workspace .site-nav { display: none !important; }
:root.research-embedded body.tutor-workspace .whiteboard-app { height: 100dvh; padding: 0; }
@media (min-width: 1181px) {
  body.tutor-workspace .whiteboard-workspace.board-disabled.code-disabled .chat-panel { padding-inline: 0; border-right: 0; }
  body.tutor-workspace .mobile-view-tabs { display: none !important; }
}
@media (max-width: 1180px) {
  body.tutor-workspace .whiteboard-workspace,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) { display: block; }
  body.tutor-workspace .mobile-view-tabs { flex: 0 0 auto; display: flex; min-height: 52px; margin: 0; padding: 4px 12px; gap: 6px; border: 0; border-bottom: 1px solid var(--emh-line); border-radius: 0; background: var(--emh-surface); }
  body.tutor-workspace .mobile-view-tab { flex: 1; min-height: 44px; padding: 7px 12px; border-radius: 8px; font-size: .82rem; }
  body.tutor-workspace .mobile-view-tab.active { color: var(--emh-primary-text); background: var(--emh-selected); box-shadow: none; }
  body.tutor-workspace .whiteboard-workspace .board-panel,
  body.tutor-workspace .whiteboard-workspace .code-panel,
  body.tutor-workspace .whiteboard-workspace .chat-panel,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled) .board-panel,
  body.tutor-workspace .whiteboard-workspace:not(.code-disabled) .code-panel,
  body.tutor-workspace .whiteboard-workspace.board-disabled.code-disabled .chat-panel,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .chat-panel { height: 100%; min-height: 0; }
  body.tutor-workspace .whiteboard-workspace[data-mobile-view='board'] :is(.chat-panel, .code-panel),
  body.tutor-workspace .whiteboard-workspace[data-mobile-view='code'] :is(.board-panel, .chat-panel),
  body.tutor-workspace .whiteboard-workspace[data-mobile-view='chat'] :is(.board-panel, .code-panel) { display: none !important; }
  body.tutor-workspace .code-workspace-mobile-tabs { display: flex; flex: 0 0 auto; gap: 4px; padding: 6px 12px; border-bottom: 1px solid var(--emh-line); }
  body.tutor-workspace .code-workspace-mobile-tabs button { flex: 1; min-height: 44px; border: 0; border-radius: 8px; padding: 8px; background: transparent; color: var(--emh-muted); font: inherit; font-size: .8rem; }
  body.tutor-workspace .code-workspace-mobile-tabs button[aria-selected='true'] { background: var(--emh-selected); color: var(--emh-primary-text); font-weight: 700; }
  body.tutor-workspace .code-workspace-grid { display: flex; flex-direction: column; overflow: hidden; }
  body.tutor-workspace .code-workspace-editor-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; border: 0; }
  body.tutor-workspace .code-workspace-result-pane { flex: 1; min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
  body.tutor-workspace .code-workspace[data-code-view='editor'] .code-workspace-result-pane { display: none; }
  body.tutor-workspace .code-workspace:not([data-code-view='editor']) .code-workspace-editor-pane { display: none; }
  body.tutor-workspace .code-workspace .code-workspace-source-shell { flex: 1; min-height: 100px; }
  body.tutor-workspace .code-workspace-source-surface, body.tutor-workspace .code-workspace .code-workspace-line-numbers { height: 100%; }
  body.tutor-workspace .code-workspace-result-tabs { display: none; }
  body.tutor-workspace .code-workspace-preview-shell, body.tutor-workspace .code-workspace-console-pane { min-height: 0; height: 100%; }
  body.tutor-workspace .code-workspace-output { min-height: 0; height: auto; max-height: none; }
  body.tutor-workspace .code-workspace-runtime-note { display: none; }
  body.tutor-workspace .code-workspace-editor-meta > span:last-child { display: none; }
}
@media (max-width: 600px) {
  body.tutor-workspace .whiteboard-chat-heading,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .whiteboard-chat-heading { min-height: 58px; padding: 8px 14px; }
  body.tutor-workspace .whiteboard-conversation,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .whiteboard-conversation,
  body.tutor-workspace .whiteboard-workspace.board-disabled.code-disabled .whiteboard-conversation { padding: 18px 14px; }
  body.tutor-workspace .whiteboard-composer,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .whiteboard-composer { margin: 0 10px 12px; }
  body.tutor-workspace .composer-toolbar { gap: 5px; padding: 6px; }
  body.tutor-workspace .composer-toolbar > details > summary,
  body.tutor-workspace .attach-homework { font-size: .75rem; padding-inline: 8px; }
  body.tutor-workspace .composer-toolbar .send { min-width: 64px; padding-inline: 9px; font-size: .8rem; }
  body.tutor-workspace .board-heading,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled) .board-heading { min-height: 58px; padding: 7px 10px; }
  body.tutor-workspace .board-toolbar { grid-template-columns: minmax(0, 1fr) auto; padding: 6px; gap: 4px; }
  body.tutor-workspace .history-tools { gap: 0; }
  body.tutor-workspace .history-tools .board-action { width: 44px; }
  body.tutor-workspace .board-page-bar,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled) .board-page-bar { padding-inline: 5px; }
  body.tutor-workspace .page-nav-actions .board-action { font-size: .7rem; padding-inline: 6px; }
  body.tutor-workspace .board-footer { display: none; }
  body.tutor-workspace .board-status { min-height: 20px; padding: 2px 10px; }
  body.tutor-workspace .code-workspace-header { flex-wrap: nowrap; }
  body.tutor-workspace .code-workspace-header-actions { flex-wrap: nowrap; }
  body.tutor-workspace .code-workspace-header h2 { font-size: .95rem; }
  body.tutor-workspace .code-workspace-header-actions button { padding-inline: 9px; font-size: .75rem; }
}
@media (max-width: 359px) {
  body.tutor-workspace .composer-toolbar > .composer-intelligence-menu { order: 0; }
  body.tutor-workspace .composer-toolbar > .send { order: 0; }
  body.tutor-workspace .board-heading .board-action { padding-inline: 7px; font-size: .7rem; }
  body.tutor-workspace .board-page-bar { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  body.tutor-workspace *, body.tutor-workspace *::before, body.tutor-workspace *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
body.tutor-workspace .diamond-tool-icon { transform: rotate(45deg); }
body.tutor-workspace .composer-toolbar .app-icon { width: 17px; height: 17px; }
body.tutor-workspace .conversation-actions-menu > summary { font-size: 0; min-width: 40px; min-height: 40px; }
body.tutor-workspace .conversation-actions-menu > summary .app-icon { width: 19px; height: 19px; }
body.tutor-workspace .board-file-menu > summary .app-icon { width: 16px; height: 16px; }
body.tutor-workspace .active-call-bar .app-icon { width: 16px; height: 16px; }
@media (max-width:600px) {
  body.tutor-workspace .drawing-tools { grid-column: 1; grid-row: 1; }
  body.tutor-workspace .board-style-tools { grid-column: 2; grid-row: 1; }
  body.tutor-workspace .history-tools { grid-column: 1 / -1; grid-row: 2; justify-self: end; }
}
body.tutor-workspace .whiteboard-chat-heading { flex-direction: row; }
body.tutor-workspace .code-workspace { display: flex; flex-direction: column; }
body.tutor-workspace .code-workspace-grid { height: 0; }
:root[data-theme='dark'] body.tutor-workspace .code-workspace {
  --code-bg: var(--emh-soft);
  --code-panel: var(--emh-surface);
  --code-panel-strong: var(--emh-soft);
  --code-ink: var(--emh-ink);
  --code-muted: var(--emh-muted);
  --code-line: var(--emh-line);
  --code-accent: var(--emh-primary-text);
  --code-accent-strong: var(--emh-primary);
  --code-accent-soft: var(--emh-selected);
}
@media (max-width:1180px) {
  body.tutor-workspace .code-workspace-source-shell { height: 0; grid-template-rows: minmax(0, 1fr); }
  body.tutor-workspace .code-workspace-source-surface,
  body.tutor-workspace .code-workspace .code-workspace-line-numbers { min-height: 0; }
}
@media (max-width:1180px) {
  body.tutor-workspace .code-workspace [data-code-source-panel] { display: flex; flex-direction: column; flex: 1 1 0; min-height: 100px; }
}
body.tutor-workspace .board-heading { flex-direction: row; }
body.tutor-workspace .board-panel:not(:fullscreen) .board-heading-actions { display: flex; flex-direction: row; width: auto; max-width: 100%; }
/* A narrow desktop workspace scrolls as normal document flow. Shrinking grid
   rows below the editor's intrinsic height would place the preview over its actions. */
@media (min-width:1181px) {
  @container (max-width:740px) {
    body.tutor-workspace .code-workspace-grid { display: block; overflow-y: auto; }
    body.tutor-workspace .code-workspace-editor-pane { min-height: max(400px, 100%); }
    body.tutor-workspace .code-workspace-result-pane { min-height: 390px; }
  }
}

/* Keep the working area inside short browser windows. Content scrolls within
   its panel; the composer, drawing strip, and Run control retain their place. */
@media (max-height: 600px) {
  body.tutor-workspace .whiteboard-chat-heading,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .whiteboard-chat-heading,
  body.tutor-workspace .board-heading,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled) .board-heading,
  body.tutor-workspace .code-workspace-header { flex: 0 0 auto; min-height: 52px; padding: 4px 12px; }
  body.tutor-workspace .whiteboard-composer,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .whiteboard-composer { margin-bottom: 6px; }
  body.tutor-workspace .whiteboard-composer textarea,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .whiteboard-composer textarea,
  body.tutor-workspace .whiteboard-workspace.board-disabled.code-disabled .whiteboard-composer textarea { min-height: 44px; max-height: 80px; padding-block: 8px 4px; }
  body.tutor-workspace .composer-toolbar { padding-block: 4px; }
  body.tutor-workspace .whiteboard-conversation,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .whiteboard-conversation,
  body.tutor-workspace .whiteboard-workspace.board-disabled.code-disabled .whiteboard-conversation { padding-block: 10px; }
  body.tutor-workspace .board-toolbar { flex: 0 0 auto; grid-template-columns: minmax(0, 1fr) auto auto; min-height: 52px; padding: 4px 6px; gap: 6px; }
  body.tutor-workspace .drawing-tools { grid-column: 1; grid-row: 1; }
  body.tutor-workspace .board-style-tools { grid-column: 2; grid-row: 1; gap: 6px; }
  body.tutor-workspace .color-control { width: 44px; height: 44px; }
  body.tutor-workspace .width-control { min-width: 90px; grid-template-columns: auto 54px; gap: 4px; }
  body.tutor-workspace .history-tools { grid-column: 3; grid-row: 1; }
  body.tutor-workspace .board-page-bar,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled) .board-page-bar { flex: 0 0 auto; min-height: 48px; padding-block: 2px; }
  body.tutor-workspace .board-footer { flex: 0 0 auto; padding-bottom: 0; }
  body.tutor-workspace .board-footer .board-legend { display: none; }
  body.tutor-workspace .board-status { flex: 0 0 auto; min-height: 18px; padding-bottom: 2px; }
  body.tutor-workspace .code-workspace-editor-pane { padding: 6px; }
  body.tutor-workspace .code-workspace-language-row { margin-block: 4px; }
  body.tutor-workspace .code-workspace-editor-meta { margin-block: 4px; }
  body.tutor-workspace .code-workspace-editor-meta > span:last-child,
  body.tutor-workspace .code-workspace-runtime-note { display: none; }
}
body.tutor-workspace :is(.composer-toolbar .send, .call-action--primary, .code-workspace-button-primary, .auth-gate-action):hover { background: var(--emh-primary); border-color: var(--emh-primary);  text-decoration: underline;}
@media (max-height: 600px) {
  body.tutor-workspace .composer-tools-content,
  body.tutor-workspace .composer-intelligence-menu > .chat-settings-content { max-height: max(90px, calc(100dvh - 280px)); }
}

body.tutor-workspace .document-upload-pending { max-height:88px; overflow-y:auto; margin:0 10px 6px; font-size:.75rem; }
body.tutor-workspace .document-upload-pending > div { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:3px 0; }
body.tutor-workspace .document-upload-pending span { min-width:0; overflow-wrap:anywhere; }
body.tutor-workspace .document-upload-pending button { flex:0 0 auto; min-height:44px; padding:6px 9px; border:1px solid var(--emh-line); border-radius:8px; color:var(--emh-ink); background:var(--emh-surface); font:inherit; }
@media (max-height:600px) { body.tutor-workspace .document-upload-pending { max-height:48px; } }

/* The board and voice call are primary tutor controls, in either panel view. */
body.tutor-workspace .tutor-primary-actions {
  display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 64px; padding: 10px 18px; border-bottom: 1px solid var(--emh-line);
  background: var(--emh-surface);
}
body.tutor-workspace .tutor-primary-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
body.tutor-workspace .tutor-primary-action {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border: 1px solid var(--emh-primary-text); border-radius: 9px;
  background: var(--emh-selected); color: var(--emh-primary-text); font: inherit; font-size: .9rem; font-weight: 650;
  cursor: pointer; white-space: nowrap;
}
body.tutor-workspace .tutor-primary-action--call { background: var(--emh-primary); border-color: var(--emh-primary); color: var(--emh-primary-label); }
:root[data-theme='dark'] body.tutor-workspace .tutor-primary-action--call { background: var(--emh-surface); border-color: var(--emh-primary-text); color: var(--emh-primary-text); }
:root[data-theme='dark'] body.tutor-workspace .tutor-primary-action--call:is(:hover, [aria-expanded='true']) { background: var(--emh-selected); }
body.tutor-workspace .tutor-primary-action .app-icon { width: 19px; height: 19px; }
body.tutor-workspace .tutor-primary-action:hover { text-decoration: underline; }
body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) { grid-template-columns: minmax(0, 1fr) clamp(340px, 34vw, 460px); }
body.tutor-workspace .whiteboard-workspace:not(.board-disabled) .board-panel { grid-column: 1; }
body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .chat-panel { grid-column: 2; border-right: 0; border-left: 1px solid var(--emh-line); }
body.tutor-workspace .whiteboard-workspace.board-disabled.code-disabled .chat-panel { grid-column: 1; border: 0; }
body.tutor-workspace .tutor-call-dialog { width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; overflow-y: auto; background: var(--emh-surface); color: var(--emh-ink); border-color: var(--emh-line); }
body.tutor-workspace .tutor-call-dialog::backdrop { background: rgb(0 0 0 / .48); }
body.tutor-workspace .tutor-call-dialog .saved-chats-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--emh-line); }
body.tutor-workspace .tutor-call-dialog h2 { margin: 0; font-size: 1.25rem; }
body.tutor-workspace .tutor-call-dialog-content { padding: 20px 22px; }
body.tutor-workspace .tutor-call-dialog .tutor-call-panel { margin: 0; padding: 0; border: 0; background: transparent; }
body.tutor-workspace .tutor-call-dialog .tutor-call-description { font-size: .9rem; }
body.tutor-workspace .tutor-call-dialog :is(.tutor-call-usage, .tutor-recording-status) { color: var(--emh-muted); line-height: 1.5; }
body.tutor-workspace .tutor-call-dialog .tutor-call-secondary {
  display: inline-flex; align-items: center; min-height: 44px; color: var(--emh-primary-text);
}
body.tutor-workspace .tutor-call-dialog .tutor-recording-notice { padding: 12px; border-radius: 9px; background: var(--emh-selected); color: var(--emh-ink); }
body.tutor-workspace .tutor-call-dialog .tutor-call-controls { margin-top: 20px; }
body.tutor-workspace .tutor-call-dialog .tutor-call-controls button { min-height: 48px; }
@media (max-width: 1180px) {
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) { display: block; }
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled.code-disabled) .chat-panel { border-left: 0; }
}
@media (max-width: 600px) {
  body.tutor-workspace .tutor-primary-actions { min-height: 60px; padding: 8px 12px; }
  body.tutor-workspace .tutor-primary-title { display: none; }
  body.tutor-workspace .tutor-primary-buttons { display: grid; width: 100%; grid-template-columns: 1fr 1fr; gap: 8px; }
  body.tutor-workspace .tutor-primary-action { min-width: 0; padding-inline: 9px; font-size: .85rem; }
}
@media (max-height: 600px) {
  body.tutor-workspace .tutor-primary-actions { min-height: 52px; padding-block: 4px; }
}
body.tutor-workspace .tutor-compact-chat { display: none; }
@media (max-width: 1180px) and (max-height: 480px) {
  body.tutor-workspace .mobile-view-tabs { display: none !important; }
  body.tutor-workspace .tutor-compact-chat { display: inline-flex; }
  body.tutor-workspace .tutor-primary-title { display: none; }
  body.tutor-workspace .tutor-primary-buttons { display: grid; width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.tutor-workspace .tutor-primary-action { min-width: 0; padding-inline: 6px; font-size: .8rem; }
  body.tutor-workspace .board-heading,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled) .board-heading { min-height: 44px; padding: 0 8px; }
  body.tutor-workspace .board-page-bar,
  body.tutor-workspace .whiteboard-workspace:not(.board-disabled) .board-page-bar { min-height: 44px; padding-block: 0; }
}
body.tutor-workspace .tutor-speed-settings { margin: 0; padding: 0; }
body.tutor-workspace .tutor-speed-settings fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
body.tutor-workspace .tutor-speed-settings legend { font-size: .9rem; font-weight: 700; }
body.tutor-workspace .tutor-speed-settings p { margin: 8px 0; color: var(--emh-muted); font-size: .78rem; line-height: 1.5; }
body.tutor-workspace .tutor-speed-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-block: 12px; }
body.tutor-workspace .tutor-speed-choice { display:flex; flex-direction:column; gap:4px; min-width:0; }
body.tutor-workspace .tutor-speed-choice > .tutor-speed-option { flex:1; }
body.tutor-workspace .tutor-speed-upgrade:not([hidden]) { display:flex; align-items:center; justify-content:center; min-height:44px; padding:4px 8px; color:var(--emh-primary-text); font-size:.8rem; font-weight:600; text-underline-offset:3px; }
body.tutor-workspace .tutor-speed-upgrade:focus-visible { outline:2px solid var(--emh-primary-text); outline-offset:2px; border-radius:var(--radius,.625rem); }
body.tutor-workspace .tutor-speed-option {
  display: grid; grid-template-columns: minmax(0, 1fr) 18px; align-content: start; align-items: center;
  gap: 8px; min-width: 0; min-height: 150px; padding: 12px; border: 1px solid var(--emh-line);
  border-radius: 10px; background: var(--emh-surface); color: var(--emh-ink); cursor: pointer;
}
body.tutor-workspace .tutor-speed-option > span { grid-column: 1; grid-row: 1; font-size: .82rem; font-weight: 700; }
body.tutor-workspace .tutor-speed-option small { grid-column: 1 / -1; color: var(--emh-muted); font-size: .73rem; line-height: 1.4; }
body.tutor-workspace .tutor-speed-option [data-speed-reason] { justify-self: start; padding: 4px 7px; border-radius: 5px; background: var(--emh-selected); color: var(--emh-primary-text); font-weight: 600; }
body.tutor-workspace .tutor-speed-option:has(input:checked) { border-color: var(--emh-primary-text); background: var(--emh-selected); box-shadow: inset 0 0 0 1px var(--emh-primary-text); }
body.tutor-workspace .tutor-speed-option:has(input:checked) [data-speed-reason] { background: var(--emh-surface); }
body.tutor-workspace .tutor-speed-option:has(input:disabled) { background: var(--emh-soft); cursor: not-allowed; }
body.tutor-workspace .tutor-speed-option:has(input:disabled) [data-speed-reason] { background: var(--emh-surface); color: var(--emh-muted); }
body.tutor-workspace .tutor-speed-option:has(input:focus-visible) { outline: 2px solid var(--emh-primary-text); outline-offset: 3px; }
body.tutor-workspace .tutor-speed-option input { grid-column: 2; grid-row: 1; width: 18px; height: 18px; margin: 0; accent-color: var(--emh-primary); }
body.tutor-workspace .tutor-speed-warning { margin: 4px 10px 8px; padding: 9px 10px; border: 1px solid var(--emh-primary-text); border-radius: 8px; background: var(--emh-selected); color: var(--emh-ink); font-size: .75rem; line-height: 1.5; }
body.tutor-workspace .tutor-speed-dialog { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px; border: 1px solid var(--emh-line); border-radius: 14px; background: var(--emh-surface); color: var(--emh-ink); }
body.tutor-workspace .tutor-speed-dialog::backdrop { background: rgb(0 0 0 / .48); }
body.tutor-workspace .tutor-speed-dialog h2 { margin: 0 0 12px; font-size: 1.2rem; }
body.tutor-workspace .tutor-speed-dialog p { font-size: .9rem; line-height: 1.6; }
body.tutor-workspace .tutor-speed-dialog label { display: flex; align-items: flex-start; gap: 10px; margin: 18px 0; line-height: 1.5; }
body.tutor-workspace .tutor-speed-dialog input { flex: 0 0 auto; width: 20px; height: 20px; accent-color: var(--emh-primary); }
body.tutor-workspace .tutor-speed-dialog button { min-height: 44px; padding: 9px 14px; border: 1px solid var(--emh-line); border-radius: 8px; background: var(--emh-surface); color: var(--emh-ink); font: inherit; cursor: pointer; }
body.tutor-workspace .tutor-speed-dialog button[type='submit'] { border-color: var(--emh-primary); background: var(--emh-primary); color: var(--emh-primary-label); }
body.tutor-workspace .tutor-speed-dialog button:disabled { opacity: .5; cursor: default; }
body.tutor-workspace .tutor-speed-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
body.tutor-workspace #confirm-tutor-speed { background: var(--emh-primary); border-color: var(--emh-primary); color: var(--emh-primary-label); }
body.tutor-workspace .tutor-speed-models { margin: 12px 0; padding-top: 8px; border-top: 1px solid var(--emh-line); }
body.tutor-workspace .tutor-speed-models p { display: grid; grid-template-columns: 75px minmax(0, 1fr); gap: 8px; font-size: .74rem; }
body.tutor-workspace .tutor-speed-models strong { color: var(--emh-ink); }
body.tutor-workspace .tutor-speed-models span { overflow-wrap: anywhere; }
body.tutor-workspace #retry-intelligence-access { min-height: 44px; margin-top: 4px; }
body.tutor-workspace .study-tools-menu { position: relative; min-width: 0; }
body.tutor-workspace .study-tools-menu > summary { list-style: none; width: 100%; }
body.tutor-workspace .study-tools-menu > summary::-webkit-details-marker { display: none; }
body.tutor-workspace .study-tools-menu[open] > summary { background: var(--emh-selected); border-color: var(--emh-primary-text); }
body.tutor-workspace .study-tools-content {
  position: fixed; z-index: 100; inset: var(--study-tools-top, 132px) auto auto var(--study-tools-left, 12px);
  box-sizing: border-box; width: var(--study-tools-width, min(360px, calc(100vw - 24px)));
  max-height: var(--study-tools-max-height, calc(100dvh - 156px)); padding: 16px; overflow-y: auto; overscroll-behavior: contain;
}
body.tutor-workspace .study-tools-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 14px; }
body.tutor-workspace .study-tools-heading h3 { margin: 0; font-size: 1rem; }
body.tutor-workspace .study-tools-content select { box-sizing: border-box; width: 100%; min-height: 44px; padding: 8px; border: 1px solid var(--emh-line); border-radius: 8px; background: var(--emh-surface); color: var(--emh-ink); font: inherit; }
body.tutor-workspace .study-tools-content button { min-height: 44px; white-space: normal; }
body.tutor-workspace .study-tools-content > p { margin: 10px 0 0; color: var(--emh-muted); font-size: .8rem; line-height: 1.5; }

body.tutor-workspace .user-textbook-upload { margin-top: 6px; padding-top: 18px; border-top: 1px solid var(--emh-line); }
body.tutor-workspace .user-textbook-upload :is(h3, h4) { margin: 0 0 10px; }
body.tutor-workspace .user-textbook-notice { margin: 8px 0 12px; color: var(--emh-muted); font-size: .82rem; line-height: 1.55; overflow-wrap: anywhere; }
body.tutor-workspace .user-textbook-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
body.tutor-workspace .user-textbook-field { display: grid; gap: 7px; min-width: 0; font-size: .82rem; font-weight: 600; }
body.tutor-workspace .user-textbook-field--wide { grid-column: 1 / -1; }
body.tutor-workspace .user-textbook-field :is(input, textarea) {
  box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; padding: 10px;
  border: 1px solid var(--emh-line); border-radius: 8px; background: var(--emh-surface); color: var(--emh-ink); font: inherit; font-weight: 400;
}
body.tutor-workspace .user-textbook-field textarea { resize: vertical; }
body.tutor-workspace .user-textbook-field input[type='file'] { padding: 8px; }
body.tutor-workspace .user-textbook-field :is(input, textarea):focus-visible,
body.tutor-workspace .user-textbook-sharing input:focus-visible { outline: 2px solid var(--emh-primary-text); outline-offset: 2px; }
body.tutor-workspace .user-textbook-upload-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
body.tutor-workspace .user-textbook-upload-actions button { min-height: 44px; white-space: normal; }
body.tutor-workspace :is(#read-user-textbook, #save-user-textbook):not(:disabled) { background: var(--emh-primary); border-color: var(--emh-primary); color: var(--emh-primary-label); }
body.tutor-workspace .user-textbook-sharing { display: grid; gap: 12px; min-width: 0; margin: 18px 0; padding: 14px; border: 1px solid var(--emh-line); border-radius: 10px; }
body.tutor-workspace .user-textbook-sharing legend { padding: 0 6px; font-size: .9rem; font-weight: 700; }
body.tutor-workspace .user-textbook-sharing label { display: flex; align-items: flex-start; gap: 10px; font-size: .85rem; line-height: 1.5; }
body.tutor-workspace .user-textbook-sharing input { flex: 0 0 auto; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--emh-primary); }
body.tutor-workspace .user-textbook-owned-list { display: grid; gap: 10px; max-height: 280px; overflow-y: auto; }
body.tutor-workspace .user-textbook-upload [hidden] { display: none !important; }
@media (max-width: 600px) {
  body.tutor-workspace .user-textbook-fields { grid-template-columns: minmax(0, 1fr); }
  body.tutor-workspace .user-textbook-upload-actions > button { flex: 1 1 140px; }
}
@media (max-width: 600px) {
  body.tutor-workspace .composer-intelligence-menu > .chat-settings-content {
    position: fixed; inset: auto 12px 12px; width: auto; max-height: calc(100dvh - 24px); padding: 18px;
  }
  body.tutor-workspace .tutor-answer-options-heading { top: -18px; margin: -18px -18px 16px; padding: 16px 18px; gap: 6px 10px; }
}
@media (min-width: 601px) and (max-height: 600px) {
  body.tutor-workspace .composer-intelligence-menu > .chat-settings-content {
    position: fixed; top: 12px; right: 12px; bottom: auto; width: min(540px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
  }
}
@container answer-options (max-width: 30rem) {
  body.tutor-workspace .intelligence-options,
  body.tutor-workspace .tutor-speed-options { grid-template-columns: minmax(0, 1fr); }
  body.tutor-workspace .intelligence-option,
  body.tutor-workspace .tutor-speed-option { grid-template-columns: 18px minmax(0, 1fr) minmax(74px, 95px); min-height: 76px; gap: 5px 10px; }
  body.tutor-workspace .intelligence-option input,
  body.tutor-workspace .tutor-speed-option input { grid-column: 1; grid-row: 1 / 3; }
  body.tutor-workspace .intelligence-option-name,
  body.tutor-workspace .tutor-speed-option > span { grid-column: 2; grid-row: 1; }
  body.tutor-workspace .intelligence-option-description,
  body.tutor-workspace .tutor-speed-option [data-speed-performance] { grid-column: 2; grid-row: 2; }
  body.tutor-workspace .intelligence-option-cost,
  body.tutor-workspace .tutor-speed-option [data-speed-reason] { grid-column: 3; grid-row: 1 / 3; align-self: center; justify-self: end; max-width: 100%; }
}
@container answer-options (max-width: 19rem) {
  body.tutor-workspace .intelligence-option,
  body.tutor-workspace .tutor-speed-option { grid-template-columns: 18px minmax(0, 1fr); }
  body.tutor-workspace .intelligence-option input,
  body.tutor-workspace .tutor-speed-option input { grid-column: 1; grid-row: 1 / 4; }
  body.tutor-workspace .intelligence-option-cost,
  body.tutor-workspace .tutor-speed-option [data-speed-reason] { grid-column: 2; grid-row: 3; justify-self: start; }
}
@media (max-width: 600px) {
  body.tutor-workspace .tutor-primary-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.tutor-workspace .tutor-primary-action { padding-inline: 6px; font-size: .8rem; }
}
@media (max-width: 380px) {
  body.tutor-workspace .tutor-primary-action .app-icon { display: none; }
}
@media (max-width: 1180px) and (max-height: 480px) {
  body.tutor-workspace .tutor-primary-buttons { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  body.tutor-workspace .tutor-primary-action { font-size: .75rem; }
}
/* A live call adds essential controls. In short windows, scroll the working
   panel instead of squeezing the drawing canvas or message composer to zero. */
@media (max-width: 1180px) and (max-height: 480px) {
  body.tutor-workspace:has(.active-call-bar:not([hidden])) .whiteboard-workspace {
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }
  body.tutor-workspace:has(.active-call-bar:not([hidden])) .whiteboard-workspace:not(.board-disabled) .board-panel:not(:fullscreen) {
    height: max(340px, 100%);
    min-height: 340px;
  }
  body.tutor-workspace:has(.active-call-bar:not([hidden])) .board-panel:not(:fullscreen) .board-stage {
    min-height: 120px;
  }
  body.tutor-workspace:has(.active-call-bar:not([hidden])) .whiteboard-workspace .chat-panel {
    height: max(320px, 100%);
    min-height: 320px;
  }
}
/* Keep color and stroke size beside the drawing tools on compact boards. */
@media (max-width: 600px) {
  body.tutor-workspace .board-toolbar { grid-template-columns: minmax(44px, 1fr) auto; }
  body.tutor-workspace .drawing-tools { grid-column: 1; grid-row: 1; }
  body.tutor-workspace .board-style-tools { grid-column: 2; grid-row: 1; }
  body.tutor-workspace .history-tools { grid-column: 1 / -1; grid-row: 2; justify-self: end; }
}
