:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --surface-strong: #eef3f1;
  --text: #1e2524;
  --muted: #687270;
  --line: #dce3e1;
  --line-strong: #c5d0cd;
  --accent: #126e65;
  --accent-strong: #0b544d;
  --accent-soft: #e1f1ed;
  --amber: #9b5b0b;
  --amber-soft: #fff1d8;
  --danger: #a53f3f;
  --danger-soft: #fbe8e7;
  --ink-blue: #315b78;
  --shadow: 0 8px 22px rgba(20, 42, 38, 0.08);
  --radius: 6px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(18, 110, 101, 0.22);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand-block,
.topbar-actions,
.question-meta-row,
.editor-toolbar,
.editor-footer,
.editor-actions,
.results-heading,
.memory-heading,
.tool-heading,
.modal-actions {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  background: var(--text);
  color: white;
  font-weight: 800;
  font-size: 17px;
}

.brand-block h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  white-space: nowrap;
}

.brand-block p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(58vw, 620px);
}

.topbar-actions {
  gap: 10px;
}

.codex-status {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a5aeac;
}

.codex-status.ready .status-dot {
  background: #19866f;
}

.codex-status.warning .status-dot {
  background: #d28b22;
}

.workspace {
  height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: 112px minmax(300px, 360px) minmax(0, 1fr);
}

.sidebar {
  padding: 14px 10px;
  background: #202827;
  border-right: 1px solid #202827;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-button {
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #bfc9c7;
  text-align: left;
  font-size: 13px;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: white;
}

.nav-button.active {
  background: #e8f2ef;
  color: #164f49;
}

.nav-button svg {
  width: 19px;
  height: 19px;
}

.nav-button strong {
  min-width: 22px;
  text-align: right;
  font-size: 11px;
}

.question-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.pane-header {
  min-height: 84px;
  padding: 17px 18px 10px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.pane-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  flex-direction: column;
  gap: 7px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.pane-header h2,
.question-heading h2,
.empty-state h2,
.modal h2 {
  margin: 0;
}

.pane-header h2 {
  font-size: 19px;
}

.result-count {
  color: var(--muted);
  font-size: 12px;
  padding-bottom: 2px;
}

.search-box {
  height: 42px;
  margin: 0 14px 11px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.search-box:focus-within {
  border-color: var(--accent);
  background: white;
}

.search-box svg {
  width: 16px;
  color: var(--muted);
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.search-box kbd {
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 4px;
  padding: 2px 5px;
  color: var(--muted);
  background: white;
  font-size: 10px;
}

.type-filter-wrap {
  min-width: 0;
  padding: 0 14px 11px;
  overflow: hidden;
}

.type-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-bottom: 2px;
}

.type-filter-button {
  min-height: 31px;
  flex: 0 0 auto;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.type-filter-button:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: white;
}

.type-filter-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.course-filter-wrap {
  min-height: 39px;
  margin: 0 14px 11px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.course-filter-wrap span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.course-filter-wrap select {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.question-list {
  min-height: 0;
  flex: 1;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.question-item {
  width: 100%;
  display: block;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  color: var(--text);
  text-align: left;
}

.question-item:hover {
  background: var(--surface-soft);
}

.question-item.active {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 var(--accent);
}

.question-item-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.5;
}

.question-item-meta {
  margin-top: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.question-item-meta span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-pill,
.pending-pill,
.due-pill {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.score-pill {
  background: #e7edf3;
  color: var(--ink-blue);
}

.pending-pill {
  background: var(--amber-soft);
  color: var(--amber);
}

.due-pill {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.list-empty,
.list-loading {
  padding: 38px 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.practice-pane {
  min-width: 0;
  overflow: auto;
  background: var(--bg);
}

.empty-state {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 30px;
  text-align: center;
}

.empty-icon,
.modal-icon {
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.empty-icon svg {
  width: 27px;
  height: 27px;
}

.empty-state h2 {
  font-size: 20px;
}

.empty-state p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.practice-content {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 26px 30px 70px;
}

.question-heading {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.question-heading-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.question-heading-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.question-meta-row {
  min-width: 0;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.history-entry {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 10px;
  color: var(--accent-strong);
  font-size: 12px;
}

.source-badge,
.round-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.source-badge {
  background: #e7edf3;
  color: var(--ink-blue);
}

.round-badge {
  background: var(--surface-strong);
  color: var(--muted);
}

.question-heading h2 {
  max-width: 880px;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.35;
}

#questionTitle {
  cursor: text;
  border-radius: 6px;
  outline: 2px solid transparent;
  outline-offset: 4px;
}

#questionTitle:hover {
  background: var(--surface-soft);
}

#questionTitle.editing {
  background: var(--surface);
  outline-color: var(--accent);
}

#questionTitle.saving {
  cursor: progress;
  opacity: 0.68;
}

.source-path {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.memory-strip,
.answer-editor,
.evaluation-progress,
.evaluation-error,
.results {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.memory-strip {
  padding: 16px 18px;
}

.memory-heading,
.tool-heading,
.results-heading {
  justify-content: space-between;
  gap: 14px;
}

.result-heading-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.memory-heading h3,
.editor-toolbar h3,
.results-heading h3,
.tool-heading h4,
.band-title h4 {
  margin: 0;
}

.memory-heading h3,
.editor-toolbar h3,
.results-heading h3 {
  font-size: 17px;
}

.memory-content {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.keyword-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.keyword {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid #b9d4ce;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.tool-actions,
.keyword-editor-footer,
.keyword-editor-footer > div {
  display: flex;
  align-items: center;
}

.tool-actions {
  gap: 7px;
}

.compact-icon-button {
  width: 34px;
  height: 34px;
}

.keyword-editor {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.keyword-editor-list {
  display: grid;
  gap: 8px;
}

.keyword-editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 7px;
}

.keyword-editor-row input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: 0;
  color: var(--text);
  background: white;
  font-size: 13px;
}

.keyword-editor-row input:focus {
  border-color: var(--accent);
}

.keyword-remove-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-soft);
}

.keyword-remove-button:hover {
  border-color: #efc8c5;
  color: var(--danger);
  background: var(--danger-soft);
}

.keyword-remove-button svg {
  width: 15px;
  height: 15px;
}

.add-keyword-button {
  margin-top: 9px;
}

.keyword-editor-footer {
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.keyword-editor-footer > span {
  color: var(--muted);
  font-size: 11px;
}

.keyword-editor-footer > div {
  flex: 0 0 auto;
  gap: 7px;
}

.skeleton-line {
  margin: 13px 0 0;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 8px;
  align-items: baseline;
  font-size: 13px;
}

.skeleton-line span {
  color: var(--muted);
}

.action-line {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.text-button {
  margin-top: 12px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.text-button svg {
  width: 15px;
}

.reference-script,
.generated-script {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.8;
  color: #35403e;
}

.reference-script {
  margin-top: 12px;
  padding: 14px;
  background: var(--surface-soft);
  border-left: 3px solid var(--accent);
  font-size: 13px;
}

.answer-editor {
  overflow: hidden;
}

.editor-toolbar {
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.answer-editor textarea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  padding: 18px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: white;
  font-size: 15px;
  line-height: 1.75;
}

.answer-editor textarea::placeholder {
  color: #9ba4a2;
}

.editor-footer {
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  padding: 10px 14px 10px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.editor-actions {
  gap: 8px;
}

.primary-button,
.secondary-button,
.icon-button {
  border-radius: var(--radius);
  font-weight: 700;
}

.primary-button,
.secondary-button {
  min-height: 38px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  font-size: 13px;
}

.primary-button {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.primary-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.secondary-button {
  color: var(--text);
  background: white;
  border-color: var(--line-strong);
}

.secondary-button:hover {
  border-color: #9eaaa7;
  background: var(--surface-soft);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.primary-button svg,
.secondary-button svg {
  width: 16px;
  height: 16px;
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.icon-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.badge-button {
  position: relative;
}

.icon-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border: 2px solid white;
  border-radius: 9px;
  background: var(--danger);
  color: white;
  font-size: 9px;
  line-height: 1;
}

.evaluation-progress,
.evaluation-error {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 18px;
}

.evaluation-progress {
  border-color: #b9d4ce;
  background: var(--accent-soft);
}

.evaluation-progress strong,
.evaluation-error strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.evaluation-progress p,
.evaluation-error p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.spinner {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 3px solid rgba(18, 110, 101, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.evaluation-error {
  border-color: #efc8c5;
  background: var(--danger-soft);
}

.evaluation-error > svg {
  width: 22px;
  color: var(--danger);
  flex: 0 0 auto;
}

.evaluation-error > div {
  min-width: 0;
  flex: 1;
}

.results {
  padding: 20px;
}

.unsaved-draft-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.overall-score {
  min-width: 102px;
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 4px;
  color: var(--accent);
}

.overall-score strong {
  font-size: 34px;
  line-height: 1;
}

.overall-score span {
  color: var(--muted);
  font-size: 12px;
}

.dimension-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.dimension-item {
  min-height: 148px;
  padding: 14px;
  background: white;
}

.dimension-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dimension-score-row h4 {
  margin: 0;
  font-size: 13px;
}

.dimension-score {
  color: var(--accent);
  font-size: 20px;
  font-weight: 800;
}

.estimate-label {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 10px;
  font-weight: 700;
}

.dimension-item p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.dimension-item .diagnosis {
  color: #394541;
}

.result-band {
  margin-top: 18px;
  padding: 15px 17px;
  border: 1px solid #ecd19e;
  border-radius: var(--radius);
  background: var(--amber-soft);
}

.band-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6e430d;
}

.band-title svg {
  width: 18px;
}

.band-title h4 {
  font-size: 14px;
}

.result-band ol {
  margin: 10px 0 0;
  padding-left: 22px;
  color: #5f461f;
  font-size: 13px;
  line-height: 1.65;
}

.result-columns {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
}

.result-tool {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.tool-heading {
  margin-bottom: 14px;
}

.tool-heading h4 {
  font-size: 15px;
}

.compact-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.generated-script {
  max-height: 340px;
  overflow: auto;
  padding-right: 4px;
  font-size: 13px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: flex;
  justify-content: flex-end;
  background: rgba(24, 31, 30, 0.42);
}

.history-drawer {
  width: min(460px, 100vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: white;
  box-shadow: -10px 0 28px rgba(20, 42, 38, 0.12);
  animation: drawer-in 0.18s ease-out;
}

.history-drawer-header {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.history-drawer-header h2 {
  margin: 0;
  font-size: 19px;
}

.history-round-list {
  display: flex;
  gap: 7px;
  padding: 12px 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.history-round-button {
  min-width: 112px;
  min-height: 54px;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: white;
  text-align: left;
}

.history-round-button:hover {
  border-color: var(--line-strong);
}

.history-round-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.history-round-button strong {
  font-size: 12px;
}

.history-round-button span {
  color: var(--muted);
  font-size: 10px;
}

.history-round-button b {
  grid-row: 1 / span 2;
  grid-column: 2;
  color: var(--accent);
  font-size: 18px;
}

.history-detail {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 18px 20px 32px;
}

.history-score-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.history-score-header h3 {
  margin: 0;
  font-size: 16px;
}

.history-score-meta {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.history-overall-score {
  min-width: 76px;
  text-align: right;
  color: var(--accent);
}

.history-overall-score strong {
  font-size: 30px;
  line-height: 1;
}

.history-overall-score span {
  color: var(--muted);
  font-size: 11px;
}

.history-section {
  margin-top: 20px;
}

.history-section h4 {
  margin: 0 0 9px;
  font-size: 13px;
}

.history-dimensions {
  border-top: 1px solid var(--line);
}

.issue-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.issue-chip {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font: inherit;
  font-size: 10.5px;
  line-height: 18px;
  cursor: default;
}

.issue-chip:hover,
.issue-chip.is-open {
  border-color: var(--accent-strong);
}

.issue-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.issue-chip.caution {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.issue-chip .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-strong);
}

.pop {
  position: absolute;
  z-index: 50;
  width: 292px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
}

.pop.caution {
  border-color: var(--danger);
}

.pop-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.pop-head b {
  color: var(--accent-strong);
  font-family: var(--heading-font);
  font-size: 13px;
  font-weight: 400;
}

.pop.caution .pop-head b {
  color: var(--danger);
}

.pop-head span,
.pop-key {
  color: var(--muted);
  font-size: 10px;
}

.pop-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.pop-key,
.pop-val {
  line-height: 1.65;
}

.pop-val {
  margin: 0;
  font-size: 11px;
}

.pop-val.q {
  font-style: italic;
}

.pop-val.q.none {
  color: var(--muted);
  font-style: normal;
}

.pop-val.fix {
  color: var(--accent-strong);
}

.pop-clamp,
.pop-clamp-6 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pop-clamp {
  -webkit-line-clamp: 3;
}

.pop-clamp-6 {
  -webkit-line-clamp: 6;
}

.history-section .issue-chip {
  font-size: 11px;
}

.skeleton-label {
  color: var(--accent-strong);
  font-weight: 700;
}

.history-dimension {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.history-dimension-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  font-weight: 700;
}

.history-dimension-title strong {
  color: var(--accent);
  font-size: 16px;
}

.history-dimension p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.history-actions {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
}

.history-follow-up {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px;
  align-items: start;
  gap: 8px;
}

.history-follow-up p {
  margin: 0;
  color: #4b5754;
  font-size: 12px;
  line-height: 1.65;
}

.history-follow-up.is-adopted p {
  opacity: 0.6;
}

.history-follow-up .follow-up-add-button {
  width: 26px;
  min-height: 26px;
  padding: 0;
}

.history-edit-button {
  margin-top: 14px;
}

@keyframes drawer-in {
  from { transform: translateX(22px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(24, 31, 30, 0.55);
}

.modal {
  width: min(100%, 480px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
}

.evaluation-editor-modal {
  width: min(760px, calc(100vw - 36px));
  height: min(860px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.evaluation-editor-header {
  flex: 0 0 auto;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.evaluation-editor-body {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 18px 20px 24px;
}

.evaluation-editor-note {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  line-height: 1.6;
}

.evaluation-edit-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.evaluation-edit-section:first-of-type {
  margin-top: 18px;
  padding-top: 0;
  border-top: 0;
}

.evaluation-edit-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.evaluation-edit-section-title > span {
  width: 24px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.evaluation-edit-section-title h3 {
  margin: 0;
  font-size: 15px;
}

.evaluation-edit-section-title strong {
  margin-left: auto;
  color: var(--accent);
  font-size: 13px;
}

.evaluation-edit-field {
  margin-top: 12px;
}

.evaluation-editor-modal .form-field textarea {
  min-height: 0;
  padding: 10px 11px;
  line-height: 1.6;
}

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

.evaluation-dimension-editor {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.evaluation-dimension-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.evaluation-dimension-editor-header h4 {
  margin: 0;
  font-size: 13px;
}

.evaluation-score-input {
  width: 58px;
  height: 34px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--accent-strong);
  background: white;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
}

.evaluation-estimate-toggle {
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.evaluation-estimate-toggle input {
  accent-color: var(--accent);
}

.evaluation-dimension-editor textarea {
  width: 100%;
  min-height: 78px;
  margin-top: 9px;
  padding: 8px 9px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: 0;
  color: var(--text);
  background: white;
  font-size: 12px;
  line-height: 1.55;
}

.evaluation-dimension-short-fields {
  display: grid;
  grid-template-columns: minmax(120px, 0.4fr) minmax(0, 1fr);
  gap: 8px;
  margin-top: 9px;
}

.evaluation-dimension-short-fields input {
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: 0;
  color: var(--text);
  background: white;
  font-size: 12px;
}

.evaluation-dimension-short-fields label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.evaluation-dimension-editor textarea:focus,
.evaluation-dimension-short-fields input:focus,
.evaluation-score-input:focus {
  border-color: var(--accent);
}

.evaluation-coverage-editor {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.evaluation-coverage-editor h4,
.evaluation-coverage-editor p {
  margin: 0;
}

.evaluation-coverage-editor h4 {
  font-size: 13px;
}

.evaluation-coverage-editor > p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.evaluation-coverage-list {
  display: grid;
  gap: 9px;
  margin-top: 11px;
}

.evaluation-coverage-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(108px, 0.45fr) minmax(0, 1.3fr);
  gap: 8px;
}

.evaluation-coverage-row input,
.evaluation-coverage-row select,
.evaluation-coverage-row textarea {
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: 0;
  color: var(--text);
  background: white;
  font-size: 12px;
}

.evaluation-coverage-row textarea {
  min-height: 58px;
  resize: vertical;
  line-height: 1.5;
}

.evaluation-coverage-row input:focus,
.evaluation-coverage-row select:focus,
.evaluation-coverage-row textarea:focus {
  border-color: var(--accent);
}

.evaluation-editor-actions {
  flex: 0 0 auto;
  justify-content: space-between;
  margin: 0;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: white;
}

.evaluation-editor-actions > span {
  color: var(--muted);
  font-size: 11px;
}

.evaluation-editor-actions > div {
  display: flex;
  gap: 8px;
}

.form-modal,
.hidden-modal {
  width: min(100%, 560px);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
}

.compact-form-modal {
  width: min(100%, 520px);
}

.compact-edit-field {
  margin-top: 20px;
}

.modal-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.modal-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal-title-row .eyebrow {
  margin-bottom: 4px;
}

.form-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.form-field {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: 0;
  background: white;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
}

.form-field input,
.form-field select {
  height: 40px;
  padding: 0 10px;
}

.form-field textarea {
  min-height: 180px;
  padding: 11px;
  resize: vertical;
  line-height: 1.65;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--accent);
}

.entry-mode {
  width: fit-content;
  margin: 18px 0 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.entry-mode-button {
  min-height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.entry-mode-button.active {
  background: white;
  color: var(--accent-strong);
  box-shadow: 0 1px 4px rgba(20, 42, 38, 0.12);
}

.file-drop {
  min-height: 188px;
  position: relative;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.file-drop:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.file-drop svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.file-drop strong {
  color: var(--text);
  font-size: 14px;
}

.file-drop span {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.hidden-question-list {
  min-height: 120px;
  max-height: min(560px, calc(100vh - 150px));
  margin-top: 18px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.hidden-question-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.hidden-question-row strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.5;
}

.hidden-question-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.question-context-menu {
  position: fixed;
  z-index: 50;
  min-width: 166px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
}

.question-context-menu button {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--danger);
  text-align: left;
  font-size: 12px;
  font-weight: 700;
}

.question-context-menu button:hover {
  background: var(--danger-soft);
}

.question-context-menu button:first-child {
  color: var(--text);
}

.question-context-menu button:first-child:hover {
  background: var(--surface-soft);
}

.question-context-menu svg {
  width: 16px;
}

.modal-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.modal-icon svg {
  width: 22px;
}

.modal h2 {
  font-size: 20px;
}

.modal > p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.privacy-list {
  margin: 16px 0;
  display: grid;
  gap: 8px;
  padding: 13px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.privacy-list span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #3e4a47;
  font-size: 12px;
}

.privacy-list svg {
  width: 15px;
  color: var(--accent);
}

.remember-consent {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.remember-consent input {
  accent-color: var(--accent);
}

.modal-actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 260px;
  max-width: 380px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #202827;
  color: white;
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: toast-in 0.2s ease-out;
}

.toast.error {
  background: #733535;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1060px) {
  .workspace {
    grid-template-columns: 86px minmax(270px, 330px) minmax(0, 1fr);
  }

  .nav-button {
    grid-template-columns: 20px 1fr;
  }

  .nav-button strong {
    display: none;
  }

  .dimension-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    height: 64px;
    padding: 0 14px;
  }

  .brand-block p {
    max-width: 46vw;
  }

  .codex-status span:last-child {
    display: none;
  }

  .workspace {
    height: auto;
    min-height: calc(100vh - 64px);
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(520px, auto);
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 8;
    padding: 7px;
    flex-direction: row;
    border-right: 0;
  }

  .nav-button {
    min-height: 44px;
    grid-template-columns: 20px 1fr auto;
  }

  .nav-button strong {
    display: block;
  }

  .question-pane {
    max-height: 44vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .type-filter-wrap {
    padding-right: 0;
  }

  .type-filter {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-right: 14px;
    scrollbar-width: thin;
    overscroll-behavior-inline: contain;
  }

  .pane-header {
    min-height: 68px;
    padding-top: 12px;
  }

  .pane-header-actions {
    align-items: flex-end;
  }

  .practice-pane {
    overflow: visible;
  }

  .practice-content {
    padding: 22px 16px 60px;
  }

  .question-heading h2 {
    font-size: 23px;
  }

  .question-heading-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .question-heading-actions {
    width: 100%;
    justify-content: space-between;
  }

  .editor-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .editor-actions {
    width: 100%;
  }

  .editor-actions button {
    flex: 1;
  }

  .dimension-grid {
    grid-template-columns: 1fr;
  }

  .evaluation-dimension-fields {
    grid-template-columns: 1fr;
  }

  .evaluation-coverage-row {
    grid-template-columns: 1fr;
  }

  .results {
    padding: 15px;
  }

  .evaluation-error {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .evaluation-error button {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .keyword-editor-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .keyword-editor-footer > div {
    width: 100%;
  }

  .keyword-editor-footer button {
    flex: 1;
  }

  .evaluation-editor-modal {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
  }

  .evaluation-editor-header,
  .evaluation-editor-body,
  .evaluation-editor-actions {
    padding-left: 14px;
    padding-right: 14px;
  }

  .evaluation-editor-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .evaluation-editor-actions > div {
    width: 100%;
  }

  .evaluation-editor-actions button {
    flex: 1;
  }
}

@media (max-width: 420px) {
  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-block h1 {
    font-size: 16px;
  }

  .brand-block p {
    display: none;
  }

  .nav-button {
    grid-template-columns: 18px 1fr;
    padding: 0 7px;
  }

  .nav-button strong {
    display: none;
  }

  .question-pane {
    max-height: 40vh;
  }

  .memory-heading,
  .editor-toolbar,
  .results-heading,
  .tool-heading {
    align-items: flex-start;
  }

  .question-heading h2 {
    font-size: 21px;
  }

  .question-heading-top {
    align-items: flex-start;
  }

  .question-heading-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .history-entry {
    width: 100%;
  }

  .history-entry {
    padding: 0 8px;
  }

  .history-drawer {
    width: 100%;
  }

  .result-heading-actions {
    align-items: flex-end;
    flex-direction: column-reverse;
    gap: 8px;
  }
}

/* Classical editorial redesign, adapted from the supplied design critique. */
:root {
  --bg: #f3f2f2;
  --surface: #f8f6f3;
  --surface-soft: #efede9;
  --surface-strong: #e7e3dc;
  --text: #201f1d;
  --muted: #6f6a63;
  --line: rgba(32, 31, 29, 0.16);
  --line-strong: rgba(32, 31, 29, 0.32);
  --accent: #b68235;
  --accent-strong: #7d5411;
  --accent-soft: #fff3e4;
  --amber: #8b5b17;
  --amber-soft: #fff3e4;
  --danger: #943f39;
  --danger-soft: #faece9;
  --ink-blue: #5f6a70;
  --shadow: 0 12px 32px rgba(45, 43, 43, 0.14);
  --radius: 4px;
  --heading-font: Georgia, "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --body-font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Segoe UI", sans-serif;
  font-family: var(--body-font);
}

body {
  background: var(--bg);
  font-family: var(--body-font);
  line-height: 1.58;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: rgba(182, 130, 53, 0.24);
}

.topbar {
  height: 64px;
  padding: 0 18px;
  background: var(--bg);
  border-color: var(--line);
}

.brand-block {
  gap: 10px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: transparent;
  color: var(--accent-strong);
  font-family: var(--heading-font);
  font-size: 16px;
  font-weight: 400;
}

.brand-block h1,
.pane-header h2,
.question-heading h2,
.empty-state h2,
.modal h2,
.results-heading h3,
.editor-toolbar h3,
.memory-heading h3,
.tool-heading h4,
.history-drawer h2,
.history-detail h3 {
  font-family: var(--heading-font);
  font-weight: 400;
  letter-spacing: 0;
}

.brand-block h1 {
  font-size: 18px;
}

.brand-block p {
  max-width: min(52vw, 680px);
  margin-top: 0;
  font-size: 11px;
}

.topbar-actions {
  gap: 8px;
}

.codex-status {
  height: 32px;
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.status-dot,
.codex-status.ready .status-dot {
  background: var(--accent);
}

.codex-status.warning .status-dot {
  background: var(--danger);
}

.workspace {
  height: calc(100vh - 64px);
  grid-template-columns: 116px minmax(320px, 370px) minmax(0, 1fr);
}

.sidebar {
  padding: 12px 8px;
  gap: 2px;
  background: var(--bg);
  border-right: 1px solid var(--line);
}

.nav-button {
  min-height: 50px;
  grid-template-columns: 19px 1fr;
  gap: 7px;
  padding: 0 9px;
  border-radius: 0;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
}

.nav-button:hover {
  background: rgba(32, 31, 29, 0.04);
  color: var(--text);
}

.nav-button.active {
  border-left-color: var(--accent);
  background: rgba(182, 130, 53, 0.09);
  color: var(--text);
}

.nav-button strong {
  grid-column: 2;
  min-width: 0;
  margin-top: -7px;
  color: var(--muted);
  font-family: var(--heading-font);
  font-size: 11px;
  font-weight: 400;
  text-align: left;
}

.nav-button svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.5;
}

.question-pane {
  background: transparent;
  border-color: var(--line);
}

.pane-header {
  min-height: 76px;
  padding: 14px 18px 9px;
}

.pane-header h2 {
  font-size: 23px;
  line-height: 1.15;
}

.eyebrow {
  margin-bottom: 3px;
  color: var(--muted);
  font-family: var(--heading-font);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.12em;
}

.result-count {
  color: var(--muted);
  font-family: var(--heading-font);
  font-variant-numeric: tabular-nums;
}

.search-box {
  min-height: 40px;
  margin: 0 18px 10px;
  padding: 0 11px;
  border-color: var(--line);
  border-radius: var(--radius);
  background: transparent;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: none;
}

.search-box input {
  background: transparent;
  color: var(--text);
}

.search-box input::placeholder {
  color: #928d86;
}

.search-box svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.5;
}

.search-box kbd {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-family: var(--heading-font);
}

.type-filter-wrap {
  padding: 0 18px 10px;
}

.type-filter {
  gap: 5px;
}

.type-filter-button,
.entry-mode-button {
  min-height: 31px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.type-filter-button:hover,
.entry-mode-button:hover {
  border-color: var(--line-strong);
  background: rgba(32, 31, 29, 0.04);
  color: var(--text);
}

.type-filter-button.active,
.entry-mode-button.active {
  border-color: var(--accent);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--accent-strong);
}

.course-filter-wrap {
  margin: 0 18px 10px;
  border-color: var(--line);
  background: transparent;
}

.course-filter-wrap select {
  background: transparent;
}

.question-list {
  border-top: 1px solid var(--line);
}

.question-item {
  min-height: 79px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent;
  background: transparent;
  color: var(--text);
}

.question-item:hover {
  background: rgba(32, 31, 29, 0.035);
}

.question-item.active {
  border-left-color: var(--accent);
  background: rgba(182, 130, 53, 0.085);
}

.question-item-title {
  font-family: var(--heading-font);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

.question-item-meta {
  margin-top: 6px;
  color: #8b857d;
  font-size: 10.5px;
}

.score-pill,
.pending-pill,
.due-pill,
.source-badge,
.round-badge,
.keyword,
.estimate-label {
  border: 1px solid rgba(182, 130, 53, 0.45);
  border-radius: 3px;
  background: transparent;
  color: var(--accent-strong);
}

.practice-pane {
  background: var(--bg);
}

.empty-state {
  color: var(--muted);
}

.empty-icon,
.modal-icon {
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--accent-strong);
}

.practice-content {
  width: min(100%, 980px);
  padding: 30px 38px 72px;
  gap: 22px;
}

.question-heading {
  padding-bottom: 21px;
  border-bottom: 1px solid var(--line);
}

.question-heading-top {
  align-items: flex-start;
}

.question-heading-actions {
  gap: 8px;
}

.question-meta-row {
  gap: 6px;
}

.source-badge,
.round-badge {
  min-height: 24px;
  padding: 3px 8px;
  border-color: var(--line);
  color: var(--muted);
  font-size: 10.5px;
}

.source-badge {
  border-color: rgba(182, 130, 53, 0.32);
  background: rgba(182, 130, 53, 0.06);
  color: var(--accent-strong);
}

.question-heading h2 {
  margin-top: 14px;
  font-size: clamp(27px, 3vw, 38px);
  font-weight: 400;
  line-height: 1.24;
  text-wrap: pretty;
}

.source-path {
  margin-top: 9px;
  color: #8b857d;
  font-size: 11px;
}

.memory-strip,
.answer-editor,
.results,
.result-tool,
.evaluation-progress,
.evaluation-error {
  border-color: var(--line);
  border-radius: var(--radius);
  background: transparent;
  box-shadow: none;
}

.memory-strip {
  padding: 17px 18px;
  border-left: 2px solid var(--accent);
}

.answer-editor {
  overflow: hidden;
}

.editor-toolbar {
  min-height: 72px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.editor-toolbar h3,
.memory-heading h3,
.results-heading h3 {
  font-size: 20px;
}

.answer-editor textarea {
  min-height: 265px;
  padding: 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: rgba(248, 246, 243, 0.28);
  color: var(--text);
  font-size: 15px;
  line-height: 1.9;
}

.answer-editor textarea:focus-visible {
  outline-offset: -3px;
}

.answer-editor textarea::placeholder {
  color: #969088;
}

.editor-footer {
  min-height: 58px;
  padding: 10px 16px;
  background: transparent;
}

#characterCount {
  color: var(--muted);
  font-family: var(--heading-font);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.primary-button,
.secondary-button,
.icon-button,
.text-button {
  border-radius: var(--radius);
  font-family: var(--heading-font);
  font-weight: 400;
}

.primary-button {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-strong);
}

.primary-button:hover {
  border-color: var(--accent-strong);
  background: rgba(182, 130, 53, 0.11);
  color: var(--accent-strong);
}

.secondary-button,
.icon-button {
  border-color: var(--line);
  background: transparent;
  color: var(--text);
}

.secondary-button:hover,
.icon-button:hover {
  border-color: var(--line-strong);
  background: rgba(32, 31, 29, 0.05);
  color: var(--text);
}

.primary-button:active,
.secondary-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.primary-button:disabled,
.secondary-button:disabled,
.icon-button:disabled {
  opacity: 0.44;
}

.text-button {
  color: var(--accent-strong);
}

.results {
  padding: 20px;
}

.results-heading {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.overall-score {
  color: var(--accent-strong);
}

.overall-score strong {
  font-family: var(--heading-font);
  font-size: 38px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.dimension-grid {
  gap: 0;
  border: 1px solid var(--line);
  border-right: 0;
  border-bottom: 0;
  background: transparent;
}

.dimension-item {
  min-height: 176px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.dimension-score {
  color: var(--accent-strong);
  font-family: var(--heading-font);
  font-size: 22px;
  font-weight: 400;
}

.dimension-score-row h4 {
  font-family: var(--heading-font);
  font-weight: 400;
}

.estimate-label {
  width: fit-content;
  border-color: rgba(182, 130, 53, 0.28);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.result-band {
  border-color: rgba(182, 130, 53, 0.5);
  border-radius: var(--radius);
  background: rgba(255, 243, 228, 0.58);
  color: var(--accent-strong);
}

.result-tool {
  padding: 16px;
}

.keyword {
  padding: 4px 9px;
  border-radius: 999px;
}

.skeleton-line {
  border-color: var(--line);
}

.generated-script,
.reference-script {
  color: var(--text);
  line-height: 1.85;
  text-align: justify;
}

.evaluation-progress {
  border-left: 2px solid var(--accent);
}

.spinner {
  border-color: var(--line);
  border-top-color: var(--accent);
}

.evaluation-error {
  border-left: 2px solid var(--danger);
  background: var(--danger-soft);
}

.drawer-backdrop,
.modal-backdrop {
  background: rgba(45, 43, 43, 0.46);
}

.history-drawer,
.modal,
.question-context-menu {
  border-color: var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.history-round-button,
.hidden-question-row,
.evaluation-edit-section,
.evaluation-dimension-editor,
.evaluation-coverage-row {
  border-color: var(--line);
  border-radius: 0;
  background: transparent;
}

.history-round-button.active {
  border-left-color: var(--accent);
  background: rgba(182, 130, 53, 0.08);
}

.evaluation-editor-note,
.modal-note {
  border-left: 2px solid var(--accent);
  border-radius: 0;
  background: rgba(255, 243, 228, 0.54);
}

.form-field input,
.form-field textarea,
.form-field select,
.keyword-editor-row input,
.evaluation-score-input,
.file-drop {
  border-color: var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus,
.keyword-editor-row input:focus,
.evaluation-score-input:focus {
  border-color: var(--accent);
  box-shadow: none;
}

.privacy-list {
  border-color: var(--line);
  background: transparent;
}

.toast {
  border-left: 2px solid var(--accent);
  background: #000;
  color: #fff;
}

.toast.error {
  border-left-color: var(--danger);
  background: #000;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 116px minmax(285px, 320px) minmax(0, 1fr);
  }

  .practice-content {
    padding-inline: 26px;
  }

  .nav-button {
    grid-template-columns: 18px 1fr;
    padding-inline: 7px;
  }
}

@media (max-width: 760px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 60px;
    padding: 0 12px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .workspace {
    min-height: calc(100vh - 60px);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(500px, auto);
  }

  .sidebar {
    position: static;
    padding: 0 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
  }

  .nav-button {
    min-height: 48px;
    grid-template-columns: 18px auto auto;
    justify-content: center;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .nav-button.active {
    border-bottom-color: var(--accent);
  }

  .nav-button strong {
    display: block;
    grid-column: auto;
    margin-top: 0;
    font-size: 10px;
  }

  .question-pane {
    max-height: 48vh;
  }

  .pane-header {
    min-height: 65px;
  }

  .practice-content {
    width: 100%;
    padding: 24px 16px 56px;
  }

  .question-heading h2 {
    font-size: 28px;
  }

  .dimension-grid {
    grid-template-columns: 1fr;
  }

  .dimension-item {
    min-height: 0;
  }

  .result-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .topbar-actions {
    gap: 5px;
  }

  .codex-status {
    width: 30px;
    padding: 0;
    justify-content: center;
  }

  .topbar .icon-button {
    width: 32px;
    height: 32px;
  }

  .workspace {
    grid-template-rows: auto auto minmax(460px, auto);
  }

  .nav-button {
    min-width: 0;
    padding-inline: 4px;
    font-size: 12px;
  }

  .question-pane {
    max-height: 46vh;
  }

  .pane-header {
    align-items: center;
    padding-inline: 14px;
  }

  .pane-header h2 {
    font-size: 21px;
  }

  .search-box {
    margin-inline: 14px;
  }

  .type-filter-wrap {
    padding-inline: 14px 0;
  }

  .type-filter {
    padding-right: 14px;
  }

  .question-item {
    padding-inline: 13px;
  }

  .practice-content {
    padding-inline: 13px;
  }

  .question-heading-actions,
  .editor-actions,
  .result-heading-actions {
    width: 100%;
  }

  .history-entry {
    width: 100%;
  }

  .question-heading h2 {
    font-size: 25px;
  }

  .editor-toolbar,
  .results-heading,
  .memory-heading,
  .tool-heading {
    gap: 10px;
  }

  .answer-editor textarea {
    min-height: 230px;
  }

  .results {
    padding: 14px;
  }
}

/* Collapsible saved draft and review queue. */
.pane-count-actions,
.current-draft-heading,
.current-draft-title-row {
  display: flex;
  align-items: center;
}

.pane-count-actions {
  justify-content: flex-end;
  gap: 7px;
}

.review-pane-toggle {
  width: 30px;
  height: 30px;
}

.review-pane-toggle svg {
  width: 15px;
  height: 15px;
}

.review-score-circle {
  display: none;
}

.current-draft {
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--line-strong);
}

.current-draft-heading {
  min-height: 28px;
  justify-content: space-between;
  gap: 14px;
}

.current-draft-title-row {
  align-items: baseline;
  gap: 9px;
}

.current-draft-label,
.current-draft-note {
  color: var(--muted);
  font-family: var(--heading-font);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.current-draft-label {
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.current-draft-toggle {
  min-height: 24px;
  padding: 0 8px 0 7px;
  gap: 4px;
  border: 1px solid rgba(182, 130, 53, 0.38);
  border-radius: 999px;
  background: rgba(255, 243, 228, 0.42);
  color: var(--accent-strong);
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.current-draft-toggle:hover {
  border-color: var(--accent);
  background: rgba(255, 243, 228, 0.82);
  color: var(--accent-strong);
}

.current-draft-toggle svg {
  width: 12px;
  height: 12px;
  stroke-width: 1.7;
}

.current-draft-text {
  max-width: 78ch;
  padding: 8px 12px 4px 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.85;
  text-align: justify;
  white-space: pre-wrap;
}

@media (min-width: 761px) {
  .workspace {
    transition: grid-template-columns 180ms ease;
  }

  .workspace.question-pane-collapsed {
    grid-template-columns: 174px 64px minmax(0, 1fr);
  }

  .question-pane-collapsed .question-pane {
    overflow: hidden;
  }

  .question-pane-collapsed .pane-header {
    min-height: 54px;
    padding: 11px 0;
    justify-content: center;
  }

  .question-pane-collapsed .pane-header > div:first-child,
  .question-pane-collapsed .result-count,
  .question-pane-collapsed .search-box,
  .question-pane-collapsed .type-filter-wrap,
  .question-pane-collapsed .course-filter-wrap {
    display: none;
  }

  .question-pane-collapsed .pane-header-actions,
  .question-pane-collapsed .pane-count-actions {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .question-pane-collapsed .question-list {
    border-top-color: var(--line);
  }

  .question-pane-collapsed .question-item {
    min-height: 62px;
    display: grid;
    place-items: center;
    padding: 10px;
    border-left: 0;
    text-align: center;
  }

  .question-pane-collapsed .question-item.active {
    box-shadow: inset 2px 0 var(--accent);
  }

  .question-pane-collapsed .question-item-title,
  .question-pane-collapsed .question-item-meta {
    display: none;
  }

  .review-pane-collapsed .review-score-circle {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid var(--accent);
    border-radius: 50%;
    color: var(--accent-strong);
    font-family: var(--heading-font);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
  }

  .review-pane-collapsed .review-score-circle.pending {
    border-color: var(--line-strong);
    color: var(--muted);
  }

  .question-pane-collapsed:not(.review-pane-collapsed) .question-list {
    display: none;
  }
}

@media (max-width: 760px) {
  .review-pane-toggle {
    display: none !important;
  }

  .current-draft-heading {
    align-items: flex-start;
  }
}

/* Supplied design direction: quiet paper tones, editorial hierarchy, and
   narrow ruled columns. These overrides keep the existing interaction
   components intact while bringing the shell closer to the reference. */
:root {
  --bg: #f3f2f2;
  --surface: #f8f6f3;
  --surface-soft: #efede9;
  --surface-strong: #e7e3dc;
  --text: #201f1d;
  --muted: #6f6a63;
  --line: rgba(32, 31, 29, 0.16);
  --line-strong: rgba(32, 31, 29, 0.32);
  --accent: #b68235;
  --accent-strong: #7d5411;
  --accent-soft: #fff3e4;
  --radius: 3px;
  --heading-font: Georgia, "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --body-font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Segoe UI", sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body-font);
}

.topbar {
  height: 52px;
  padding: 0 24px;
  background: var(--bg);
  border-color: var(--line);
}

.brand-block {
  gap: 10px;
}

.brand-mark {
  width: 27px;
  height: 27px;
  border-color: var(--line);
  border-radius: 3px;
  color: var(--accent-strong);
  font-family: var(--heading-font);
  font-size: 14px;
}

.brand-block h1 {
  color: var(--text);
  font-family: var(--heading-font);
  font-size: 16px;
  font-weight: 400;
}

.brand-block p {
  display: none;
}

.topbar-actions {
  gap: 6px;
}

.codex-status {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: transparent;
  border-color: var(--line);
  font-family: var(--body-font);
  font-size: 11px;
}

.icon-button {
  width: 29px;
  height: 29px;
  border-color: var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: rgba(32, 31, 29, 0.04);
  color: var(--text);
}

.workspace {
  height: calc(100vh - 52px);
  grid-template-columns: 174px minmax(300px, 342px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  padding: 20px 10px 12px;
  gap: 0;
  background: var(--bg);
  border-color: var(--line);
}

.sidebar-overview {
  padding: 0 8px 18px;
}

.sidebar-kicker {
  margin: 0 0 9px;
  color: var(--muted);
  font-family: var(--heading-font);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-progress-number {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.sidebar-progress-number strong {
  color: var(--text);
  font-family: var(--heading-font);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}

.sidebar-progress-track {
  height: 3px;
  margin-top: 10px;
  background: rgba(32, 31, 29, 0.1);
}

.sidebar-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

.sidebar-progress-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.sidebar-divider {
  height: 1px;
  margin: 0 8px 10px;
  background: var(--line);
}

.nav-button {
  min-height: 42px;
  grid-template-columns: 18px 1fr auto;
  gap: 8px;
  padding: 0 9px;
  border-left: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--body-font);
  font-size: 14px;
}

.nav-button:hover {
  background: rgba(32, 31, 29, 0.04);
  color: var(--text);
}

.nav-button.active {
  border-left-color: var(--accent);
  background: rgba(182, 130, 53, 0.09);
  color: var(--text);
}

.nav-button strong {
  grid-column: auto;
  min-width: 24px;
  margin-top: 0;
  color: var(--muted);
  font-family: var(--heading-font);
  font-size: 12px;
  font-weight: 400;
  text-align: right;
}

.nav-button svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.45;
}

.sidebar-account {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  margin: auto auto 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-family: var(--heading-font);
  font-size: 11px;
}

.question-pane {
  background: transparent;
  border-color: var(--line);
}

.pane-header {
  min-height: 76px;
  padding: 16px 18px 10px;
}

.pane-header h2 {
  font-family: var(--heading-font);
  font-size: 21px;
  font-weight: 400;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.status-filter {
  display: inline-flex;
  margin-top: 5px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.status-filter-button {
  min-height: 27px;
  padding: 0 8px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.status-filter-button:last-child { border-right: 0; }
.status-filter-button.active { background: rgba(182, 130, 53, 0.11); color: var(--accent-strong); }
.status-filter-button em { margin-left: 4px; font-style: normal; font-variant-numeric: tabular-nums; }

.search-box,
.course-filter-wrap {
  border-color: var(--line);
  border-radius: 3px;
  background: transparent;
}

.search-box {
  min-height: 38px;
  margin-inline: 18px;
}

.type-filter-wrap {
  padding-inline: 18px;
}

.type-filter-button {
  min-height: 28px;
  padding-inline: 9px;
  border-color: var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--body-font);
  font-size: 11px;
  font-weight: 400;
}

.type-filter-button.active {
  border-color: var(--accent);
  background: rgba(182, 130, 53, 0.08);
  box-shadow: inset 0 0 0 1px rgba(182, 130, 53, 0.32);
  color: var(--accent-strong);
}

.outline-bar {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.outline-bar .text-button {
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-size: 11px;
  cursor: pointer;
}

.section-group { border-bottom: 1px solid var(--line); }
.section-group-head {
  position: sticky;
  top: 0;
  z-index: 1;
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: 0;
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.section-group-caret { display: grid; place-items: center; transition: transform 150ms ease; }
.section-group.open .section-group-caret { transform: rotate(90deg); }
.section-group-caret svg { width: 14px; height: 14px; }
.section-group-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
}

.section-group-count { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.section-group-count em { color: var(--accent-strong); font-style: normal; }
.question-item-title.is-practiced { color: var(--muted); }
.question-item.is-context { cursor: default; opacity: 0.55; }
.question-item.is-follow { padding-left: 34px; border-left: 1px solid var(--line-strong); }
.follow-toggle-row { padding: 5px 16px 5px 28px; border-bottom: 1px solid var(--line); }
.follow-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--accent-strong);
  font-size: 10px;
  cursor: pointer;
}

.follow-toggle svg { width: 12px; height: 12px; transition: transform 150ms ease; }
.follow-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.parent-question-list { max-height: 360px; display: grid; gap: 4px; overflow: auto; }
.parent-question-list button {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.category-manager-modal {
  width: min(900px, calc(100vw - 36px));
  height: min(820px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.category-manager-header {
  flex: 0 0 auto;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.category-manager-body {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(288px, 320px) minmax(0, 1fr);
  overflow: hidden;
}

.category-warning {
  grid-column: 1 / -1;
  padding: 10px 16px;
  border-bottom: 1px solid #ead4aa;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
}

.category-editor-section {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.category-editor-section + .category-editor-section {
  border-left: 1px solid var(--line);
}

.category-section-heading {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.category-section-heading > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.category-section-heading span {
  font-size: 13px;
  font-weight: 700;
}

.category-section-heading strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.compact-button {
  min-height: 32px;
  padding: 0 9px;
  font-size: 12px;
}

.category-editor-list,
.section-mapping-list {
  min-height: 0;
  overflow: auto;
}

.category-editor-row {
  min-height: 50px;
  display: grid;
  grid-template-columns: 24px 24px minmax(0, 1fr) auto 28px 28px;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  transition: background-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.category-editor-row.dragging {
  opacity: 0.5;
  background: var(--surface-soft);
}

.category-editor-row.drag-over {
  background: var(--amber-soft);
  box-shadow: inset 0 2px 0 var(--accent);
}

.category-drag-handle {
  width: 24px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
}

.category-drag-handle:hover,
.category-drag-handle:focus-visible {
  background: var(--surface-soft);
  color: var(--text);
}

.category-drag-handle:active {
  cursor: grabbing;
}

.category-drag-handle svg {
  width: 17px;
  height: 17px;
}

.category-toggle {
  width: 24px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.category-toggle:hover,
.category-toggle:focus-visible {
  background: var(--surface-soft);
  color: var(--text);
}

.category-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform 140ms ease;
}

.category-toggle.is-open svg {
  transform: rotate(90deg);
}

.category-toggle.is-empty {
  visibility: hidden;
}

.category-editor-row input,
.section-mapping-row select,
.question-category-field select {
  width: 100%;
  height: 38px;
  min-width: 0;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.category-editor-row > span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.subcategory-editor-list {
  padding: 2px 12px 10px 72px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.subcategory-editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 28px;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
}

.subcategory-editor-row input {
  width: 100%;
  height: 36px;
  min-width: 0;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
}

.subcategory-editor-row > span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.category-remove-button {
  width: 28px;
  height: 28px;
  color: var(--danger);
}

.category-add-sub-button {
  width: 28px;
  height: 28px;
  color: var(--muted);
}

.category-add-sub-button:hover:not(:disabled) {
  color: var(--accent-strong);
}

.category-add-sub-button:disabled {
  color: var(--line-strong);
  cursor: not-allowed;
}

.category-remove-button:disabled {
  cursor: not-allowed;
  color: var(--line-strong);
}

.section-mapping-row {
  min-height: 92px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(126px, 170px);
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}

.section-mapping-header {
  display: contents;
}

.section-mapping-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.section-mapping-copy input {
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.section-mapping-copy .section-mapping-origin { color: var(--text); }
.section-scope-heading {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.section-merge-hint { color: var(--accent-strong) !important; }

.section-mapping-copy strong,
.section-mapping-copy span,
.section-mapping-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-mapping-copy strong {
  font-size: 13px;
}

.section-mapping-copy span,
.section-mapping-copy small {
  color: var(--muted);
  font-size: 11px;
}

.section-mapping-trigger {
  width: 100%;
  height: 38px;
  min-width: 0;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.section-mapping-trigger:hover,
.section-mapping-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.section-mapping-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 5;
  width: 180px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-mapping-menu.has-children {
  width: 338px;
  grid-template-columns: minmax(132px, 0.85fr) minmax(160px, 1.15fr);
}

.section-parent-options,
.section-child-options {
  min-width: 0;
  max-height: 268px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px;
  overflow: auto;
}

.section-parent-options {
  min-width: 132px;
}

.section-mapping-menu.has-children .section-parent-options {
  border-right: 1px solid var(--line);
}

.section-child-options[hidden] {
  display: none;
}

.section-parent-button,
.section-child-button {
  min-height: 30px;
  padding: 6px 10px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}

.section-parent-button:hover,
.section-child-button:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.section-parent-button[aria-pressed="true"],
.section-child-button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.section-mapping-trigger:focus-visible,
.section-parent-button:focus-visible,
.section-child-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.category-manager-actions {
  flex: 0 0 auto;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.category-manager-actions > span {
  color: var(--muted);
  font-size: 11px;
}

.category-manager-actions > div {
  display: flex;
  gap: 8px;
}

.question-category-field {
  margin: 20px 0;
}

@media (max-width: 720px) {
  .category-manager-modal {
    width: min(100%, 560px);
    height: min(900px, calc(100vh - 24px));
  }

  .category-manager-body {
    display: block;
    overflow: auto;
  }

  .category-editor-section {
    overflow: visible;
  }

  .category-editor-section + .category-editor-section {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .category-editor-list,
  .section-mapping-list {
    overflow: visible;
  }

  .section-mapping-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .category-manager-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .category-manager-actions > div,
  .category-manager-actions button {
    flex: 1;
  }
}

.question-item {
  min-height: 76px;
  padding: 12px 16px;
  border-color: var(--line);
  border-left: 2px solid transparent;
  background: transparent;
}

.question-item.active {
  border-left-color: var(--accent);
  background: rgba(182, 130, 53, 0.09);
  box-shadow: none;
}

.question-item-title {
  font-family: var(--body-font);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
}

.unread-evaluation-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 7px;
  border-radius: 50%;
  background: #3478f6;
  vertical-align: middle;
}

.question-item-meta {
  color: var(--muted);
  font-family: var(--body-font);
  font-size: 12px;
}

.score-pill,
.pending-pill,
.due-pill {
  border: 1px solid rgba(182, 130, 53, 0.45);
  border-radius: 3px;
  background: transparent;
  color: var(--accent-strong);
}

.practice-pane {
  background: var(--bg);
}

.practice-content {
  width: min(100%, 1080px);
  padding: 30px 38px 72px;
}

.question-heading h2 {
  margin-top: 14px;
  font-family: var(--heading-font);
  font-size: clamp(24px, 2.2vw, 28px);
  font-weight: 400;
  line-height: 1.45;
}

.source-path {
  color: var(--muted);
  font-family: var(--body-font);
  font-size: 12px;
}

.secondary-button,
.primary-button {
  border-radius: 3px;
  font-family: var(--body-font);
  font-size: 14px;
}

.history-entry {
  border-radius: 3px;
  font-family: var(--body-font);
  font-size: 12px;
}

.primary-button {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #fff;
}

.primary-button:hover {
  border-color: var(--text);
  background: var(--text);
}

.current-draft {
  padding: 13px 16px 14px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--line-strong);
  background: transparent;
}

.current-draft[data-kind="reference"] {
  border-color: rgba(182, 130, 53, 0.42);
  border-left-color: var(--accent);
  background: rgba(255, 243, 228, 0.34);
}

.current-draft-label,
.current-draft-note,
.current-draft-toggle {
  font-family: var(--body-font);
}

.current-draft-label {
  color: var(--accent-strong);
  font-size: 13px;
  letter-spacing: 0.05em;
}

.current-draft-note {
  color: var(--muted);
  font-size: 12px;
}

.current-draft-text {
  max-width: none;
  padding: 9px 0 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.75;
  text-align: left;
}

.answer-editor,
.results,
.result-tool,
.memory-strip {
  border-color: var(--line);
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
}

.answer-editor textarea {
  min-height: 180px;
  border-color: var(--line);
  border-radius: 3px;
  background: rgba(248, 246, 243, 0.65);
  font-size: 17px;
  line-height: 1.75;
}

.answer-editor textarea::placeholder {
  color: var(--muted);
}

.editor-toolbar {
  min-height: 66px;
  padding: 13px 18px;
  border-color: var(--line);
}

.editor-toolbar h3,
#answerInputTitle,
.memory-heading h3,
.results-heading h3 {
  display: block;
  font-family: var(--heading-font);
  font-size: 20px;
  font-weight: 400;
}

.results {
  padding: 20px;
}

.overall-score,
.dimension-score {
  color: var(--accent-strong);
  font-family: var(--heading-font);
  font-weight: 400;
}

.result-band {
  border-color: rgba(182, 130, 53, 0.42);
  border-radius: 3px;
  background: rgba(255, 243, 228, 0.48);
}

@media (max-width: 760px) {
  .topbar {
    height: 56px;
    padding-inline: 13px;
  }

  .workspace {
    height: auto;
    min-height: calc(100vh - 56px);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(500px, auto);
  }

  .sidebar {
    padding: 8px 8px 0;
  }

  .sidebar-overview,
  .sidebar-divider,
  .sidebar-account {
    display: none;
  }

  .nav-button {
    min-height: 46px;
    grid-template-columns: 18px auto auto;
    justify-content: center;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .nav-button.active {
    border-bottom-color: var(--accent);
  }

  .nav-button strong {
    display: block;
  }

  .practice-content {
    width: 100%;
    padding: 24px 16px 56px;
  }
}

@media (min-width: 761px) {
  .practice-pane {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    overflow: hidden;
  }

  .practice-pane.evaluation-visible {
    grid-template-columns: minmax(0, 1fr) 360px;
  }

  .practice-pane > .empty-state {
    grid-column: 1 / -1;
  }

  .practice-pane > .practice-content {
    width: 100%;
    min-width: 0;
    margin: 0;
    overflow: auto;
  }

  .evaluation-sidebar {
    min-width: 0;
    overflow: auto;
    border-left: 1px solid var(--line);
    padding: 30px 22px 42px;
    color: var(--text);
  }

  .evaluation-sidebar-empty {
    padding-top: 4px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.75;
  }

  .evaluation-sidebar-heading,
  .evaluation-sidebar-card-heading,
  .sidebar-dimension-heading,
  .evaluation-sidebar-next-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
  }

  .evaluation-sidebar-heading h3 {
    margin: 0;
    font-family: var(--heading-font);
    font-size: 20px;
    font-weight: 400;
  }

  .evaluation-sidebar-score {
    display: flex;
    align-items: baseline;
    gap: 3px;
    color: var(--accent-strong);
    font-family: var(--heading-font);
  }

  .evaluation-sidebar-score strong {
    font-size: 32px;
    font-weight: 400;
    line-height: 0.9;
  }

  .evaluation-sidebar-score span {
    color: var(--muted);
    font-size: 12px;
  }

  .evaluation-sidebar-section {
    margin-top: 20px;
  }

  .sidebar-dimension {
    margin-top: 14px;
  }

  .sidebar-dimension-heading {
    font-size: 14px;
  }

  .sidebar-dimension-heading strong {
    color: var(--accent-strong);
    font-family: var(--heading-font);
    font-size: 14px;
    font-weight: 400;
  }

  .sidebar-dimension-track {
    height: 2px;
    margin-top: 6px;
    background: rgba(32, 31, 29, 0.1);
  }

  .sidebar-dimension-track span {
    display: block;
    height: 100%;
    background: var(--accent);
  }

  .sidebar-dimension p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.7;
  }

  .sidebar-coverage-list {
    margin-top: 10px;
    border-top: 1px solid var(--line);
  }

  .sidebar-coverage-row {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
  }

  .sidebar-coverage-row strong {
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
  }

  .sidebar-coverage-row.covered strong { color: var(--accent-strong); }
  .sidebar-coverage-row.missed strong { color: var(--danger); }

  .evaluation-sidebar-card,
  .evaluation-sidebar-next {
    margin-top: 22px;
    padding: 14px 16px;
    border: 1px solid var(--line);
  }

  .evaluation-sidebar-card .keyword-row {
    margin-top: 9px;
    gap: 5px;
  }

  .evaluation-sidebar-card .keyword {
    min-height: 24px;
    padding: 3px 8px;
    border-color: rgba(182, 130, 53, 0.45);
    border-radius: 999px;
    background: transparent;
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 400;
  }

  .sidebar-skeleton {
    margin: 12px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    color: var(--text);
    font-size: 15px;
    line-height: 1.7;
  }

  .evaluation-sidebar-card-heading {
    align-items: flex-start;
  }

  .evaluation-sidebar-card-heading .eyebrow {
    margin-top: 6px;
  }

  .evaluation-sidebar-card-heading .icon-button {
    width: 24px;
    height: 24px;
  }

  .sidebar-reference-script {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.75;
  }

  .sidebar-script-button {
    width: 100%;
    min-height: 29px;
    margin-top: 8px;
    font-size: 14px;
  }

  .sidebar-reference-script {
    margin-top: 10px;
    color: var(--text);
    white-space: pre-wrap;
  }

  .evaluation-sidebar-next {
    border-color: rgba(182, 130, 53, 0.45);
    background: rgba(255, 243, 228, 0.48);
  }

  .evaluation-sidebar-next-title {
    color: var(--accent-strong);
    font-family: var(--heading-font);
    font-size: 13px;
  }

  .evaluation-sidebar-next-title svg {
    width: 13px;
    height: 13px;
  }

  .evaluation-follow-up-list {
    margin: 9px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    list-style: none;
  }

  .evaluation-follow-up {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 26px;
    align-items: start;
    gap: 8px;
  }

  .evaluation-follow-up p {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    line-height: 1.7;
  }

  .evaluation-follow-up.is-adopted p {
    opacity: 0.6;
  }

  .evaluation-follow-up .follow-up-add-button {
    width: 26px;
    min-height: 26px;
    padding: 0;
  }

  .evaluation-follow-up-empty {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.7;
  }
}

@media (max-width: 760px) {
  .practice-pane {
    display: block;
    overflow: visible;
  }

  .evaluation-sidebar {
    display: none !important;
  }
}

.connect-bank-button {
  min-height: 34px;
  padding: 0 11px;
  white-space: nowrap;
}

.connect-bank-modal {
  width: min(520px, calc(100vw - 32px));
}

.connect-bank-intro {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.connect-bank-drop {
  min-height: 138px;
}

.builtin-bank-entry {
  width: 100%;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  color: var(--text);
  text-align: left;
}

.builtin-bank-entry-label,
.builtin-bank-entry-action {
  display: inline-flex;
  align-items: center;
}

.builtin-bank-entry-label {
  gap: 6px;
  font-size: 13px;
}

.builtin-bank-entry-action {
  flex: 0 0 auto;
  gap: 3px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent-strong);
  font-size: 12px;
}

.builtin-bank-entry:hover .builtin-bank-entry-action {
  background: rgba(182, 130, 53, 0.11);
}

.builtin-bank-entry-action svg {
  width: 13px;
}

@media (max-width: 760px) {
  .connect-bank-button {
    max-width: 148px;
  }

  .connect-bank-button span {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .connect-bank-modal .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .connect-bank-modal .modal-actions button {
    width: 100%;
  }
}

.connect-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 2px 0 14px;
}

.connect-steps span {
  border-bottom: 2px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  padding: 0 0 8px;
  text-align: center;
}

.connect-steps span.active {
  border-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 700;
}

.folder-picker-panel {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 14px;
  min-height: 82px;
  padding: 16px;
}

.folder-picker-panel > svg {
  color: var(--accent);
  flex: 0 0 auto;
  height: 28px;
  width: 28px;
}

.folder-picker-panel div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.folder-picker-panel strong,
.folder-picker-panel span,
.connect-result strong,
.connect-result span {
  overflow-wrap: anywhere;
}

.folder-picker-panel span,
.connect-result span {
  color: var(--muted);
  font-size: 13px;
}

.question-file-picker {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.question-file-picker select {
  width: 100%;
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: 0;
  background: white;
  color: var(--text);
  font-size: 13px;
}

.question-file-picker select:focus {
  border-color: var(--accent);
}

.question-file-picker small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.55;
}

.connect-result {
  background: #eef8f3;
  border-left: 3px solid var(--accent);
  display: grid;
  gap: 5px;
  padding: 11px 13px;
}

.detection-warning {
  background: #fff6dc;
  border-left: 3px solid #c58a18;
  color: #65470d;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 6px;
  padding: 9px 11px;
}

.detection-groups {
  border-top: 1px solid rgba(39, 101, 80, 0.18);
  display: grid;
  gap: 0;
  margin-top: 4px;
  padding-top: 9px;
}

.detection-groups details {
  border-bottom: 1px solid rgba(39, 101, 80, 0.14);
}

.detection-groups summary {
  align-items: center;
  cursor: pointer;
  display: grid;
  font-size: 12px;
  gap: 8px;
  grid-template-columns: minmax(90px, 1fr) auto minmax(120px, auto);
  min-height: 38px;
  padding: 5px 2px;
}

.detection-groups summary small {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.detection-list {
  display: grid;
  max-height: 220px;
  overflow: auto;
  padding: 0 2px 8px 18px;
}

.detection-row {
  align-items: center;
  border-top: 1px solid rgba(39, 101, 80, 0.1);
  display: grid;
  gap: 8px;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  min-height: 38px;
  padding: 6px 0;
}

.detection-row:first-child {
  border-top: 0;
}

.detection-row .detection-line,
.detection-row .detection-reason {
  color: var(--muted);
  font-size: 11px;
}

.detection-row .detection-title {
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.detection-row.warning .detection-title {
  color: #8a4e00;
  font-weight: 700;
}

.detection-move-button {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--accent);
  cursor: pointer;
  font-size: 11px;
  min-height: 28px;
  padding: 4px 8px;
  white-space: nowrap;
}

.connect-bank-modal {
  max-height: calc(100vh - 48px);
  overflow: auto;
  width: min(760px, calc(100vw - 48px));
}

.connect-bank-modal .modal-actions {
  background: var(--surface);
  border-top: 1px solid var(--line);
  bottom: 0;
  margin: 16px -2px -2px;
  padding: 12px 2px 2px;
  position: sticky;
  z-index: 2;
}

.unsupported-browser {
  align-items: center;
  background: var(--bg);
  inset: 0;
  justify-content: center;
  padding: 32px;
  position: fixed;
  text-align: center;
  z-index: 1000;
}

.unsupported-browser:not(.hidden) {
  display: flex;
  flex-direction: column;
}

.unsupported-browser svg {
  color: var(--danger);
  height: 38px;
  margin-bottom: 14px;
  width: 38px;
}

.unsupported-browser h2 {
  font-size: 22px;
  margin: 0 0 8px;
}

.unsupported-browser p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  max-width: 520px;
}

body.points-mode .question-pane,
body.points-mode .practice-pane {
  display: none;
}

.points-pane {
  grid-column: 2 / -1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow-y: auto;
}

@media (max-width: 760px) {
  .points-pane {
    grid-column: 1 / -1;
  }
}

.points-pane.hidden {
  display: none;
}

.points-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.points-summary {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.points-drag-hint {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.points-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.points-warning {
  margin: 0 20px 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 13px;
}

.points-list {
  padding: 0 20px 24px;
}

.point-outline {
  display: block;
}

.point-group {
  border-top: 1px solid var(--line);
}

.point-group:last-child {
  border-bottom: 1px solid var(--line);
}

.point-group-head,
.point-subgroup-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.point-group-name {
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
}

.point-group-body {
  padding-bottom: 8px;
}

.point-subgroup {
  padding-left: 20px;
}

.point-subgroup-name {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.point-subgroup-body {
  padding-left: 20px;
}

.point-direct-body {
  padding-left: 20px;
}

.point-tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
}

.point-tree-toggle:hover,
.point-tree-toggle:focus-visible {
  background: var(--surface-soft);
  color: var(--text);
}

.point-tree-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 160ms ease;
}

.point-tree-toggle.is-open svg {
  transform: rotate(90deg);
}

.point-tree-count {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.point-tree-action {
  opacity: 0;
  transition: opacity 120ms ease;
}

.point-group-head:hover .point-tree-action:not(:disabled),
.point-group-head:focus-within .point-tree-action:not(:disabled),
.point-subgroup-head:hover .point-tree-action:not(:disabled),
.point-subgroup-head:focus-within .point-tree-action:not(:disabled),
.point-head:hover .point-tree-action:not(:disabled),
.point-head:focus-within .point-tree-action:not(:disabled) {
  opacity: 1;
}

.point-tree-action:disabled {
  opacity: .3;
  pointer-events: none;
}

.point-card-list {
  min-height: 18px;
  border-radius: var(--radius);
}

.point-card-list.point-drop-target,
.point-group-head.point-drop-target,
.point-subgroup-head.point-drop-target {
  background: var(--accent-soft);
}

.point-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--surface);
  overflow: hidden;
}

.point-card.is-dragging {
  opacity: .42;
}

.point-card.point-drop-before {
  box-shadow: inset 0 3px 0 var(--accent);
}

.point-card.point-drop-after {
  box-shadow: inset 0 -3px 0 var(--accent);
}

.point-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--text);
  cursor: grab;
}

.point-head:active {
  cursor: grabbing;
}

.point-head:hover {
  background: var(--surface-soft);
}

.point-title {
  font-weight: 600;
}

.point-drag-handle {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--muted);
}

.point-drag-handle svg {
  width: 16px;
  height: 16px;
}

.point-stat {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.point-delete-button {
  flex: 0 0 auto;
  color: var(--danger);
}

.point-body {
  border-top: 1px solid var(--line);
  padding: 14px;
  background: var(--surface-soft);
}

.point-answer-label {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
}

.point-answer {
  width: 100%;
  min-height: 60px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}

.point-question-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 13px;
}

.point-question-table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}

.point-question-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.point-question-link {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--accent-strong);
  text-align: left;
}

.point-question-link:hover {
  text-decoration: underline;
}

.point-score {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.point-empty {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.point-orphans {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #edd0cf;
  border-radius: var(--radius);
  background: var(--danger-soft);
}

.point-orphans p {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--danger);
}

.point-orphan-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 3px 0;
}

.point-mini-button {
  margin-left: auto;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 3px 9px;
  font-size: 12px;
  color: var(--text);
}

.point-mini-button.danger {
  color: var(--danger);
  border-color: #edd0cf;
}

.point-footer {
  display: flex;
  margin-top: 14px;
}

.point-tagger {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.point-tagger.hidden {
  display: none;
}

.point-tagger-heading h4 {
  margin: 0 0 3px;
  font-size: 13px;
}

.point-tagger-heading p {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.point-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.point-chips:not(:empty) {
  margin-bottom: 8px;
}

.point-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 12px;
  padding: 3px 6px 3px 10px;
  font-size: 12px;
  cursor: pointer;
}

.point-chip-remove {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  opacity: 0.6;
  padding: 0 3px;
  line-height: 1;
}

.point-answer-popover {
  position: fixed;
  z-index: 20;
  width: min(320px, calc(100vw - 32px));
  max-height: min(60vh, 420px);
  display: flex;
  flex-direction: column;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  overflow: hidden;
}

.point-answer-popover-head {
  display: flex;
  align-items: center;
}

.point-answer-popover strong {
  display: block;
  font-size: 12px;
  color: var(--accent-strong);
}

.point-answer-popover p {
  flex: 1 1 auto;
  min-height: 0;
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-y: auto;
}

.point-tag-field {
  position: relative;
}

.point-tag-field input {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.point-tag-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.point-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 5;
  border: 1px solid var(--line-strong);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.point-suggestions.hidden {
  display: none;
}

.point-suggestion {
  display: block;
  width: 100%;
  padding: 8px 11px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  font-size: 13px;
  color: var(--text);
}

.point-suggestion:first-child {
  border-top: 0;
}

.point-suggestion:hover {
  background: var(--surface-strong);
}

.point-suggestion.create {
  color: var(--accent-strong);
  font-weight: 600;
}

.onboarding-modal {
  position: relative;
  width: min(100%, 460px);
}

.onboarding-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.onboarding-page h2 {
  margin: 0;
  font-size: 20px;
}

.onboarding-page p {
  margin: 10px 0 0;
  min-height: 88px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.onboarding-prompt-page p {
  min-height: 0;
}

.onboarding-prompt-box {
  margin-top: 14px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.onboarding-prompt-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.onboarding-prompt-heading span,
.onboarding-prompt-note {
  color: var(--muted);
}

#onboardingPromptText {
  max-height: 230px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
  color: var(--text);
  font: 12px/1.65 var(--body-font);
}

.onboarding-prompt-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.onboarding-prompt-note {
  display: block;
  margin-top: 10px;
  font-size: 11px;
  line-height: 1.65;
}

.onboarding-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.onboarding-footer .modal-actions {
  display: flex;
  margin-top: 0;
}

.onboarding-progress {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.connect-hint {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

/* Language toggle button */
.question-title-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.language-toggle {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  opacity: 0.7;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.language-toggle:hover {
  opacity: 1;
}

.language-toggle:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.language-toggle i {
  width: 1rem;
  height: 1rem;
}

/* Language badge for history */
.language-badge {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--surface-2);
  border-radius: 0.25rem;
  vertical-align: middle;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-card {
  width: 420px;
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(20, 42, 38, 0.1);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.auth-brand h1,
.auth-brand p {
  margin: 0;
}

.auth-brand h1 {
  font-size: 18px;
}

.auth-brand p,
.auth-message {
  color: var(--muted);
  font-size: 13px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 28px 0 20px;
  padding: 4px;
  border-radius: 8px;
  background: var(--surface-strong);
}

.auth-tabs button {
  padding: 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.auth-tabs button.active {
  background: var(--surface);
  color: var(--accent-strong);
  font-weight: 700;
  box-shadow: var(--shadow);
}

.auth-card label {
  display: block;
  margin: 14px 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-card input {
  width: 100%;
  margin-top: 7px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
}

.auth-submit {
  width: 100%;
}

.auth-submit[aria-busy="true"] {
  opacity: 1;
}

.auth-submit[aria-busy="true"]::before {
  width: 14px;
  height: 14px;
  content: "";
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.auth-forgot {
  margin-top: 14px;
}

.auth-message {
  min-height: 20px;
  line-height: 1.5;
}

.auth-reset-dialog {
  padding: 0;
  border: 0;
  border-radius: 16px;
}

.auth-reset-dialog::backdrop {
  background: rgba(20, 33, 25, 0.4);
}

.sidebar-account {
  width: 100%;
  height: auto;
  display: grid;
  gap: 5px;
  margin-top: auto;
  padding-top: 12px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  text-align: center;
}

.sidebar-account span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
}

.sidebar-account button {
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-size: 11px;
}

.sidebar-account small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  text-overflow: ellipsis;
}

.sidebar-account-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.sidebar-account-actions #logoutButton {
  color: var(--muted);
}

.redeem-modal {
  width: min(620px, calc(100vw - 64px));
  max-height: calc(100vh - 64px);
  overflow: auto;
}

.modal-heading-row,
.redeem-input-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.modal-heading-row {
  justify-content: space-between;
}

.modal-heading-row p,
.redeem-account-card p,
.redeem-purchase-link-panel p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.redeem-account-card {
  display: grid;
  gap: 6px;
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.redeem-account-card small,
.redeem-footnote {
  color: var(--muted);
  font-size: 11px;
}

.redeem-input-row input {
  min-width: 0;
  flex: 1;
}

.redeem-input-row button {
  flex: 0 0 auto;
}

.redeem-message {
  min-height: 42px;
  margin: 12px 0;
  color: var(--accent-strong);
  font-size: 12px;
  line-height: 1.6;
}

.redeem-message.error {
  color: var(--danger);
}

.redeem-purchase {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.redeem-purchase summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 650;
}

.redeem-plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.redeem-plans > div {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.redeem-plans span,
.redeem-plans small {
  color: var(--muted);
  font-size: 11px;
}

.redeem-purchase-link-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.redeem-purchase-link-panel p {
  margin: 6px 0 0;
}

.redeem-purchase-link-panel .primary-button {
  text-decoration: none;
  white-space: nowrap;
}

.redeem-purchase-pending {
  padding: 9px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.redeem-footnote {
  margin: 18px 0 0;
}

.folder-picker-panel input[type="file"] {
  max-width: 220px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

/* 手机端优化（方案 v0.1） */
.mobile-back-bar {
  display: none;
}

@media (max-width: 460px) {
  .auth-page {
    padding: 24px 16px;
  }

  .auth-card {
    width: 100%;
    padding: 26px 20px;
  }
}

@media (max-width: 760px) {
  .topbar {
    gap: 8px;
  }

  .brand-block,
  .brand-block > div {
    min-width: 0;
  }

  .brand-block {
    flex: 1 1 auto;
  }

  .brand-block h1 {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .topbar-actions {
    flex: 0 0 auto;
  }

  .connect-bank-button {
    max-width: none;
    justify-content: center;
    padding: 0;
  }

  .connect-bank-button span {
    display: none;
  }

  .topbar .icon-button,
  .topbar .connect-bank-button {
    width: 36px;
    height: 36px;
  }

  .nav-button {
    width: auto;
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    grid-template-columns: auto auto auto;
    justify-content: center;
    gap: 5px;
    padding-inline: 2px;
    white-space: nowrap;
  }

  .nav-button strong {
    min-width: 0;
    margin-top: 0;
    text-align: left;
  }

  .sidebar {
    flex-wrap: wrap;
  }

  .sidebar-account {
    order: 9;
    flex: 1 0 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
    padding: 4px 4px 6px;
    border-top: 1px solid var(--line);
    text-align: left;
  }

  .sidebar-account button {
    flex: 0 0 auto;
    min-height: 28px;
    padding-inline: 6px;
  }

  .question-pane {
    max-height: none;
  }

  .question-list {
    overflow: visible;
  }

  body:not(.mobile-practice-open) .practice-pane {
    display: none;
  }

  body.mobile-practice-open .sidebar,
  body.mobile-practice-open .question-pane {
    display: none;
  }

  .mobile-back-bar {
    position: sticky;
    top: 56px;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-height: 44px;
    padding: 0 13px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    color: var(--muted);
    font-family: var(--body-font);
    font-size: 13px;
    text-align: left;
  }

  .mobile-back-bar svg {
    width: 15px;
    height: 15px;
  }

  .current-draft-heading {
    align-items: center;
  }

  #searchInput,
  #transcriptInput,
  #pointTagInput {
    font-size: 16px;
  }

  .type-filter-button {
    min-height: 36px;
  }

  .language-toggle,
  .current-draft-toggle {
    min-height: 32px;
  }
}

.builtin-bank-panel {
  display: grid;
  gap: 12px;
  margin: 4px 0 18px;
}

.builtin-bank-panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.final-answer-badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 6px;
  background: #e9f2eb;
  color: #326342;
  font-size: 12px;
  white-space: nowrap;
}

.final-answer-panel {
  padding: 24px;
  border: 1px solid #c9dacb;
  border-radius: 12px;
  background: #f8fbf7;
}

.final-answer-heading, .saved-answer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.final-answer-heading { justify-content: space-between; }
.final-answer-heading h3 { margin: 0; font-size: 19px; }
.final-answer-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; font-size: 17px; margin: 20px 0; }

.current-draft[data-kind="transcript"] {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.current-draft-title-row {
  align-items: center;
  flex-wrap: wrap;
}

.current-draft-toggle {
  min-height: 30px;
  padding: 0 10px;
  flex-shrink: 0;
  font-size: 12px;
}

.saved-answer-actions {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
}

.saved-answer-actions label {
  color: var(--muted);
  white-space: nowrap;
}

.saved-answer-actions select {
  width: auto;
  min-width: 112px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.saved-answer-actions .secondary-button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
}
