:root {
  --bg: #faf6f3;
  --bg-accent-a: rgba(237, 164, 124, 0.24);
  --bg-accent-b: rgba(215, 221, 255, 0.28);
  --surface: rgba(255, 252, 248, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --surface-soft: rgba(252, 242, 236, 0.84);
  --line: rgba(83, 54, 41, 0.12);
  --line-strong: rgba(128, 90, 64, 0.18);
  --ink: #2e1e18;
  --muted: #7a6a61;
  --accent: #8b4926;
  --accent-soft: #e9cdbd;
  --accent-soft-2: rgba(232, 191, 165, 0.3);
  --glow: 0 20px 60px rgba(147, 104, 77, 0.12);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --transition: 180ms ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: "Avenir Next", "Hiragino Sans GB", "PingFang SC", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 18%, var(--bg-accent-b), transparent 28%),
    radial-gradient(circle at 80% 22%, var(--bg-accent-a), transparent 32%),
    linear-gradient(180deg, #fffaf7 0%, #f7f2ee 100%);
}

body {
  position: relative;
  overflow-x: hidden;
}

html.aiot-embedded,
html.aiot-embedded body {
  min-height: 100%;
  background: var(--bg);
}

html.aiot-embedded .background-glow,
html.aiot-embedded .app-topbar {
  display: none;
}

html.aiot-embedded .exam-shell {
  min-height: 100dvh;
  padding-top: 16px;
}

html.aiot-embedded .exam-rail {
  top: 16px;
  min-height: calc(100dvh - 32px);
}

html.aiot-embedded .conversation-column {
  min-height: calc(100dvh - 46px);
}

@media (max-width: 920px) {
  html.aiot-embedded .exam-shell {
    min-height: 100dvh;
    padding: 14px;
  }

  html.aiot-embedded .exam-rail {
    min-height: auto;
    top: auto;
  }

  html.aiot-embedded .conversation-column {
    min-height: auto;
  }
}

.background-glow {
  position: fixed;
  width: 42rem;
  height: 42rem;
  border-radius: 999px;
  filter: blur(30px);
  pointer-events: none;
  opacity: 0.46;
}

.background-glow-a {
  top: 5rem;
  right: -10rem;
  background: rgba(255, 209, 185, 0.34);
}

.background-glow-b {
  bottom: -10rem;
  left: -12rem;
  background: rgba(214, 220, 255, 0.4);
}

.app-frame {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: var(--radius-xl);
  box-shadow: var(--glow);
  backdrop-filter: blur(22px);
}

.hidden {
  display: none !important;
}

.eyebrow,
.report-label,
.message-role {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--accent);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4.4rem);
  line-height: 0.98;
}

h2 {
  font-size: clamp(1.35rem, 2vw, 1.9rem);
  line-height: 1.15;
}

h3 {
  font-size: 1.2rem;
}

h4 {
  font-size: 1rem;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  padding: 14px 16px;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(139, 73, 38, 0.36);
  box-shadow: 0 0 0 4px rgba(139, 73, 38, 0.08);
  transform: translateY(-1px);
}

textarea {
  min-height: 94px;
  resize: vertical;
}

button {
  border: none;
  cursor: pointer;
  transition: transform var(--transition), opacity var(--transition), background var(--transition);
}

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

.primary-button,
.secondary-button {
  border-radius: 999px;
  font-weight: 700;
  padding: 14px 20px;
}

.primary-button {
  background: linear-gradient(135deg, #8c4a27 0%, #b25a2b 100%);
  color: #fffaf6;
  box-shadow: 0 18px 30px rgba(140, 74, 39, 0.22);
}

.secondary-button {
  background: rgba(68, 49, 39, 0.08);
  color: var(--ink);
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.rail-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.icon-button {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(55, 35, 28, 0.06);
}

.icon-button svg,
.rail-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.icon-button-ghost {
  background: rgba(255, 255, 255, 0.84);
}

.icon-button-soft {
  background: rgba(255, 243, 236, 0.92);
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 28px;
  background: rgba(255, 250, 247, 0.78);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(106, 72, 52, 0.08);
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-mark {
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  font-weight: 800;
  color: #6f2f13;
  white-space: nowrap;
}

.brand-divider {
  width: 1px;
  height: 34px;
  background: rgba(81, 49, 34, 0.14);
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.brand-kicker {
  color: var(--muted);
  font-size: 0.82rem;
}

.brand-copy strong {
  font-size: clamp(1rem, 1.8vw, 1.55rem);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.landing-screen {
  min-height: calc(100vh - 92px);
  display: grid;
  place-items: center;
  padding: 40px 24px 56px;
}

.landing-card {
  width: min(1520px, 100%);
  padding: 28px;
}

.landing-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(380px, 520px);
  gap: 28px;
  align-items: start;
}

.landing-info {
  min-width: 0;
  display: grid;
  gap: 22px;
}

.landing-config {
  display: grid;
  gap: 18px;
  padding: 24px;
  border-radius: 28px;
  background: rgba(255, 248, 243, 0.8);
  border: 1px solid rgba(141, 91, 59, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.landing-config-header {
  display: grid;
  gap: 8px;
}

.landing-config-header p {
  color: var(--muted);
  line-height: 1.6;
}

.landing-hero {
  display: grid;
  gap: 12px;
}

.landing-copy,
.landing-meta-note,
.landing-footnote,
.report-empty,
.report-comment,
#coach-feedback,
.coach-followup-copy,
.settings-copy,
.settings-note,
.settings-status {
  color: var(--muted);
  line-height: 1.68;
}

.landing-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.active-model-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.landing-highlight-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.landing-highlight {
  padding: 16px 18px 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 247, 241, 0.74);
  border: 1px solid rgba(154, 101, 69, 0.1);
  display: grid;
  gap: 6px;
}

.landing-highlight-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.landing-highlight strong {
  font-size: 1.04rem;
}

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

.landing-form label,
.settings-form label,
.composer,
.coach-followup-form {
  display: grid;
  gap: 8px;
}

.landing-form > label:nth-of-type(2),
.landing-form > .two-up,
.landing-start-button {
  grid-column: 1 / -1;
}

.landing-form span,
.settings-form span {
  font-size: 0.92rem;
  font-weight: 700;
}

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

.landing-start-button {
  width: 100%;
  justify-self: stretch;
  padding-block: 16px;
  font-size: 1rem;
}

.landing-footnote {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 245, 238, 0.7);
  border: 1px solid rgba(151, 101, 72, 0.1);
}

.exam-shell {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 24px;
  padding: 24px 24px 30px;
  align-items: start;
  position: relative;
}

.exam-rail {
  position: sticky;
  top: 106px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: calc(100dvh - 142px);
  padding: 10px 0;
}

.rail-button {
  width: 60px;
  height: 60px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.74);
  color: rgba(99, 63, 45, 0.72);
  border: 1px solid rgba(110, 78, 57, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 26px rgba(76, 48, 36, 0.06);
}

.rail-button-active {
  background: linear-gradient(180deg, #91522d 0%, #7b3f20 100%);
  color: #fff7f0;
}

.rail-spacer {
  flex: 1;
}

.history-panel {
  position: fixed;
  top: 112px;
  left: 118px;
  bottom: 24px;
  z-index: 7;
  width: min(340px, calc(100vw - 150px));
  padding: 22px;
  display: grid;
  gap: 14px;
  align-content: start;
  background: rgba(255, 251, 248, 0.94);
}

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

.history-panel-copy,
.history-panel-status,
.history-item-preview,
.history-item-time {
  color: var(--muted);
  line-height: 1.6;
}

.history-list {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 12px;
  padding-right: 4px;
}

.history-item {
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(109, 73, 52, 0.1);
  box-shadow: 0 10px 24px rgba(76, 48, 36, 0.05);
  display: grid;
  gap: 10px;
}

.history-item-current {
  border-color: rgba(139, 73, 38, 0.28);
  box-shadow: 0 16px 28px rgba(139, 73, 38, 0.1);
}

.history-item-top,
.history-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-item-status {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.history-item-status-active {
  background: rgba(255, 238, 226, 0.88);
  color: var(--accent);
}

.history-item-status-completed {
  background: rgba(227, 244, 235, 0.92);
  color: #2c7a55;
}

.history-item-title {
  font-size: 1rem;
  line-height: 1.4;
}

.history-item-meta {
  color: rgba(92, 66, 54, 0.8);
  font-size: 0.84rem;
}

.history-item-preview {
  font-size: 0.88rem;
  margin: 0;
}

.workspace-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 340px);
  gap: 24px;
  align-items: start;
}

.conversation-column {
  position: relative;
  isolation: isolate;
  min-width: 0;
  min-height: calc(100dvh - 150px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
}

.workspace-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.workspace-tab {
  min-width: 140px;
  padding: 12px 18px;
  border-radius: 18px 18px 0 0;
  background: rgba(255, 250, 246, 0.72);
  border: 1px solid rgba(132, 90, 66, 0.12);
  border-bottom: none;
  color: var(--muted);
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(55, 35, 28, 0.05);
}

.workspace-tab-active {
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent);
}

.workspace-panels {
  min-height: 0;
}

.workspace-panel {
  min-height: calc(100dvh - 230px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
}

.session-setup-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: clamp(20px, 4vw, 48px);
  border-radius: var(--radius-xl);
  background: rgba(250, 246, 243, 0.7);
  backdrop-filter: blur(12px);
}

.inline-session-setup {
  width: min(920px, 100%);
  max-height: calc(100% - 16px);
  overflow-y: auto;
  padding: 20px 22px;
  display: grid;
  gap: 16px;
  background:
    linear-gradient(135deg, rgba(255, 250, 245, 0.96), rgba(252, 239, 230, 0.9));
  border: 1px solid rgba(139, 73, 38, 0.12);
}

.inline-session-setup-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.inline-session-setup-header > div {
  display: grid;
  gap: 5px;
}

.inline-session-setup-header p {
  max-width: 560px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.88rem;
}

.inline-session-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.inline-session-form > label:nth-of-type(2),
.inline-session-form > .two-up,
.inline-session-form .landing-start-button {
  grid-column: auto;
}

.inline-session-form input,
.inline-session-form select {
  padding-block: 11px;
}

.inline-session-form .landing-start-button {
  align-self: end;
  min-height: 47px;
}

.scenario-banner {
  padding: 24px 28px;
  background:
    radial-gradient(circle at right center, rgba(255, 211, 189, 0.36), transparent 38%),
    rgba(255, 250, 246, 0.76);
  display: grid;
  gap: 12px;
}

.scenario-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.session-state-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 700;
}

.scenario-prompt {
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  line-height: 1.8;
  color: #3f2c24;
}

.scenario-hint {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  line-height: 1.6;
}

.chat-log {
  min-width: 0;
  min-height: 0;
  max-height: min(52dvh, 680px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 6px 34px 6px 56px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.message-card {
  max-width: min(78%, 760px);
  padding: 20px 22px;
  border-radius: 30px;
  line-height: 1.82;
  box-shadow: 0 18px 36px rgba(87, 57, 43, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.52);
  animation: messageIn 220ms ease both;
}

.message-role {
  margin-bottom: 8px;
  color: rgba(94, 64, 49, 0.68);
}

.message-text,
.coach-chat-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.message-client {
  align-self: flex-start;
  background: rgba(253, 240, 232, 0.88);
}

.message-teacher {
  align-self: flex-start;
  background: rgba(255, 247, 233, 0.94);
}

.message-candidate {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.94);
}

.message-system {
  align-self: center;
  max-width: min(92%, 720px);
  background: rgba(249, 236, 224, 0.84);
  text-align: center;
}

.composer-shell {
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.88);
}

.composer textarea,
.coach-followup-form textarea {
  border: none;
  background: transparent;
  padding: 8px 2px 2px;
  min-height: 74px;
  box-shadow: none;
}

.composer textarea:focus,
.coach-followup-form textarea:focus {
  box-shadow: none;
  transform: none;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 6px;
}

.composer-actions,
.coach-followup-actions,
.settings-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.send-pill {
  min-width: 110px;
}

.input-helper {
  color: var(--muted);
  font-size: 0.8rem;
}

.insight-column {
  min-width: 0;
  display: grid;
  gap: 18px;
  align-content: start;
}

.workflow-card,
.progress-card,
.session-info-card,
.report-panel {
  padding: 22px;
}

.workflow-steps {
  display: grid;
  gap: 12px;
}

.workflow-step {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(132, 90, 66, 0.08);
}

.workflow-marker {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 73, 38, 0.1);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
}

.workflow-step-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.workflow-step-body strong {
  font-size: 0.92rem;
}

.workflow-meta,
.workflow-step-body p {
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.78rem;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-title-row strong {
  color: var(--accent);
  font-size: 1.4rem;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(95, 61, 43, 0.12);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8c4a27 0%, #cb8a5d 100%);
  transition: width 220ms ease;
}

.progress-steps {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(108, 82, 68, 0.6);
  transition: color var(--transition);
}

.progress-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(140, 74, 39, 0.26);
  background: rgba(255, 255, 255, 0.76);
  flex: 0 0 auto;
}

.progress-step.is-active,
.progress-step.is-complete {
  color: var(--ink);
  font-weight: 600;
}

.progress-step.is-active .progress-dot {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(140, 74, 39, 0.1);
}

.progress-step.is-complete .progress-dot {
  border-color: var(--accent);
  background: radial-gradient(circle at center, var(--accent) 0 46%, transparent 48%);
}

.session-info-card {
  display: grid;
  gap: 12px;
}

.session-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(94, 61, 43, 0.08);
}

.session-info-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.session-info-row span {
  color: var(--muted);
}

.session-info-row strong {
  text-align: right;
  font-size: 1.02rem;
}

.report-panel {
  max-height: none;
  overflow: visible;
  display: grid;
  gap: 18px;
}

.report-content,
.domain-scores,
.bullet-list,
.coach-followup-section {
  display: grid;
  gap: 14px;
}

.review-tab-note {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 248, 240, 0.84);
  border: 1px solid rgba(109, 73, 52, 0.08);
  color: var(--muted);
  line-height: 1.68;
}

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

.report-summary > div,
.domain-score,
.bullet-item,
.coach-chat-card {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(109, 73, 52, 0.08);
}

.report-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 1.2rem;
}

.domain-score-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
}

.score-track {
  margin-top: 10px;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(22, 56, 49, 0.08);
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8c4a27 0%, #e1a26d 100%);
}

.coach-chat-log {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.coach-chat-role {
  margin-bottom: 6px;
  color: rgba(22, 56, 49, 0.72);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.coach-chat-teacher {
  background: rgba(255, 245, 229, 0.95);
}

.coach-chat-candidate {
  background: rgba(255, 255, 255, 0.95);
}

.coach-chat-system {
  background: rgba(243, 230, 215, 0.88);
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(28, 20, 17, 0.34);
  backdrop-filter: blur(10px);
}

.settings-dialog {
  width: min(760px, 100%);
  max-height: min(88dvh, 920px);
  overflow: auto;
  padding: 26px;
  display: grid;
  gap: 18px;
}

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

.settings-form {
  display: grid;
  gap: 14px;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .workspace-shell {
    grid-template-columns: 1fr;
  }

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

  .report-panel {
    grid-column: 1 / -1;
    max-height: none;
  }
}

@media (max-width: 920px) {
  .app-topbar {
    padding: 18px 18px 16px;
  }

  .brand-divider {
    display: none;
  }

  .brand-kicker {
    display: none;
  }

  .landing-screen {
    padding: 24px 16px 32px;
  }

  .landing-card {
    padding: 24px;
  }

  .landing-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .landing-config {
    padding: 20px;
  }

  .two-up,
  .report-summary,
  .insight-column {
    grid-template-columns: 1fr;
  }

  .landing-highlight-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }

  .landing-highlight {
    min-width: min(260px, 78vw);
    scroll-snap-align: start;
  }

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

  .inline-session-setup-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .session-setup-overlay {
    padding: 18px;
  }

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

  .landing-form > label:nth-of-type(2),
  .landing-form > .two-up,
  .landing-start-button {
    grid-column: auto;
  }

  .exam-shell {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .exam-rail {
    position: static;
    min-height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 4px 2px 6px;
  }

  .history-panel {
    top: 148px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }

  .rail-spacer {
    display: none;
  }

  .workspace-shell {
    gap: 18px;
  }

  .conversation-column {
    min-height: auto;
  }

  .chat-log {
    padding: 2px 2px 2px 6px;
    max-height: none;
    overflow: visible;
  }

  .message-card {
    max-width: 100%;
  }

  .composer-footer,
  .settings-header,
  .settings-actions,
  .coach-followup-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .send-pill,
  .landing-start-button {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .brand-copy strong {
    max-width: 42vw;
  }

  h1 {
    font-size: clamp(2.2rem, 11vw, 3.4rem);
  }

  .scenario-banner,
  .progress-card,
  .session-info-card,
  .report-panel,
  .composer-shell,
  .settings-dialog {
    padding: 18px;
  }

  .session-setup-overlay {
    padding: 12px;
  }

  .inline-session-setup {
    max-height: calc(100% - 8px);
    padding: 18px;
  }

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

  .session-info-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-log {
    gap: 16px;
  }

  .rail-button {
    width: 54px;
    height: 54px;
  }

  .history-panel {
    top: 138px;
    padding: 18px;
  }
}

/* === Lark Auth UI === */

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(34, 22, 16, 0.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.auth-overlay.hidden {
  display: none;
}

.auth-overlay-card {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: min(420px, 100%);
  box-shadow: var(--glow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.auth-overlay-card h2 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--ink);
}

.auth-overlay-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.auth-overlay-error {
  color: #c2410c;
  font-size: 0.85rem;
  min-height: 1.2em;
}

.auth-debug-panel {
  margin-top: 2px;
  border-top: 1px solid rgba(125, 103, 91, 0.16);
  padding-top: 10px;
  text-align: left;
}

.auth-debug-panel summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.84rem;
}

.auth-debug-log {
  margin: 10px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(246, 239, 233, 0.94);
  color: #5f473a;
  font-size: 0.76rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 14px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.85rem;
  max-width: 220px;
}

.user-chip.hidden {
  display: none;
}

#user-chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.user-chip-logout {
  border: none;
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  line-height: 1.1;
}

.user-chip-logout:hover {
  color: var(--accent);
  background: rgba(0, 0, 0, 0.08);
}

.profile-avatar-button {
  overflow: hidden;
}

.profile-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-image.hidden {
  display: none;
}

.profile-avatar-fallback {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}

.profile-avatar-fallback.hidden {
  display: none;
}

#open-settings-button.hidden {
  display: none;
}
