:root {
  color-scheme: light;

  /* toB orange theme (mobile demo design guidelines) */
  --app-bg: #eeedf3;
  --surface: #ffffff;
  --maincolor: #ff5900;
  --maincolor-strong: #e64f00;
  --semantic-active: #2f80ed;
  --success: #2fc798;
  --danger: #f02425;
  --soft-theme: #fff4ec;
  --theme-focus: #ffe2cf;
  --soft-border: #ffe8da;
  --neutral-surface: rgba(0, 0, 0, 0.04);
  --line: #ededed;

  --text-primary: rgba(0, 0, 0, 0.9);
  --text-secondary: rgba(0, 0, 0, 0.6);
  --text-tertiary: rgba(0, 0, 0, 0.4);

  /* legacy aliases: existing rules keep referencing these names */
  --ink: var(--text-primary);
  --muted: var(--text-secondary);
  --soft: var(--neutral-surface);
  --canvas: var(--app-bg);
  --paper: var(--app-bg);
  --teal: var(--maincolor);
  --green: var(--maincolor);
  --orange: var(--maincolor);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --radius: 20px;

  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", "SF Pro Text", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

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

body.knowledge-overlay-open { overflow: hidden; }

button {
  font: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255, 89, 0, 0.16);
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 50;
  padding: 8px 11px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--teal);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.18);
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus-visible { transform: translateY(0); }

#main-content { scroll-margin-top: 12px; }

button:focus-visible {
  outline: 3px solid #ff5900;
  outline-offset: 3px;
}

input:focus-visible,
select:focus-visible {
  outline: 3px solid #ff5900;
  outline-offset: 2px;
}

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 375px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--app-bg);
  box-shadow: none;
}

/* The real layout wrapper: #app renders .app-background inside .app-shell, and
   it is this element the page column must stretch from so a docked composer can
   sit at the bottom of the viewport. */
.app-background {
  display: flex;
  flex-direction: column;
  /* dvh keeps the bottom nav on screen when mobile browser chrome is showing;
     the vh line is the fallback for engines that do not know dvh yet. */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.page-hero {
  position: relative;
  padding: 12px 16px 4px;
  color: var(--text-primary);
  background: var(--app-bg);
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 12px;
}

.brand-mark {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: var(--maincolor);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.hero-row {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 10px;
}

.hero-kicker,
.section-kicker {
  margin: 0 0 2px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.page-hero h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  line-height: 24px;
}

.hero-summary {
  margin: 2px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 20px;
}

.hero-badge,
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
}

.hero-badge {
  padding: 4px 10px;
  color: var(--text-secondary);
  background: var(--neutral-surface);
  border: 0;
  font-size: 11px;
}

.bottom-nav {
  position: fixed;
  right: auto;
  bottom: 0;
  left: 50%;
  z-index: 20;
  display: flex;
  width: 100%;
  max-width: 375px;
  gap: 2px;
  padding: 6px 8px max(6px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: none;
}

.bottom-nav > [role="tablist"] {
  display: flex;
  width: 100%;
  gap: 2px;
}

.nav-item {
  display: inline-flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  padding: 6px 2px;
  border: 0;
  border-radius: 8px;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  white-space: nowrap;
  transition: color 160ms ease, background 160ms ease;
}

.nav-item:hover { color: var(--teal); background: var(--neutral-surface); }
.nav-item:active { transform: translateY(1px); }
.nav-item.active { color: #ff5900; background: #fff4ec; font-weight: 700; }
.nav-icon { color: currentColor; font-size: 18px; line-height: 1; }

.content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  margin: 0;
  padding: 12px 16px calc(72px + env(safe-area-inset-bottom, 0px));
  /* The shell is a fixed-height column, so the page body scrolls inside itself
     instead of the window scrolling. Without this the taller pages (学术大脑,
     我的) are clipped by .app-background's overflow with no way to reach them. */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.page-panel { animation: page-in 180ms ease-out; }

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

.section-heading {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 22px;
}

.section-kicker { color: var(--green); }


.section-heading h2 {
  max-width: none;
  margin: 0;
  color: var(--ink);
  font-size: clamp(25px, 7vw, 30px);
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.section-description {
  max-width: none;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.85;
}

.knowledge-search {
  margin-bottom: 14px;
}

.knowledge-search label,
.knowledge-filters label,
.knowledge-label {
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.knowledge-search label {
  display: block;
  margin-bottom: 8px;
}

.knowledge-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
}

.knowledge-search input {
  width: 100%;
  min-width: 0;
  padding: 9px 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}

.knowledge-search input::placeholder { color: #b2b6d6; }

.knowledge-search button,
.knowledge-action {
  flex-shrink: 0;
  padding: 10px 14px;
  border: 0;
  border-radius: 9px;
  color: #ffffff;
  background: var(--orange);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.hero-search {
  margin: 16px 0 0;
}

.hero-search .knowledge-search-row {
  gap: 7px;
  padding: 4px 6px 4px 12px;
  border: 0;
  border-radius: 11px;
}

.hero-search .search-icon {
  flex-shrink: 0;
  color: rgba(0, 0, 0, 0.4);
  font-size: 22px;
  line-height: 1;
}

.hero-search input {
  padding: 10px 0;
  font-size: 13px;
}

.hero-search button {
  width: 35px;
  height: 35px;
  padding: 0;
  border-radius: 9px;
  color: #ffffff;
  background: var(--teal);
  font-size: 19px;
  line-height: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.knowledge-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.knowledge-filters label { color: var(--muted); letter-spacing: 0.04em; }

.knowledge-filters select {
  padding: 8px 28px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
}

.knowledge-clear,
.knowledge-more {
  border: 0;
  color: var(--green);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
}

.knowledge-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.knowledge-section-heading h3 {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.3;
}

.knowledge-page-heading {
  align-items: center;
  margin: 1px 0 13px;
}

.knowledge-page-heading h2 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.03em;
}

.knowledge-count {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 11px;
}

.knowledge-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.knowledge-section {
  display: flex;
  min-height: 86px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
}

.knowledge-section:hover { border-color: #ffd0b8; background: #ffffff; }
.knowledge-section.active { border-color: var(--orange); color: var(--ink); background: #fff4ec; box-shadow: inset 0 0 0 1px rgba(255, 89, 0, 0.08); }
.knowledge-section-icon { color: var(--green); font-size: 17px; line-height: 1; }
.knowledge-section strong { font-size: 12px; white-space: normal; overflow-wrap: anywhere; }
.knowledge-section small { color: var(--muted); font-size: 10px; }

.knowledge-results-heading { margin-top: 4px; }

.knowledge-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.knowledge-card {
  display: block;
  width: 100%;
  padding: 13px 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: none;
  cursor: pointer;
  text-align: left;
}

.knowledge-card:hover { background: #ffffff; }
.knowledge-card-meta { display: block; margin-bottom: 5px; color: var(--green); font-size: 10px; letter-spacing: 0.06em; }
.knowledge-card strong { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; font-size: 14px; line-height: 1.45; }
.knowledge-card strong span { flex-shrink: 0; color: rgba(0, 0, 0, 0.4); font-size: 20px; font-weight: 400; line-height: 0.9; }
.knowledge-card-summary { display: -webkit-box; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 1; }

.knowledge-more {
  display: block;
  margin: 15px auto 0;
  padding: 8px 10px;
  text-decoration: none;
}

.knowledge-detail-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  background: rgba(0, 0, 0, 0.46);
  animation: overlay-in 180ms ease-out;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.knowledge-detail {
  display: flex;
  width: min(100%, 430px);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
}

.knowledge-detail-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 16px 28px;
}

.knowledge-detail-body:focus-visible {
  outline: 3px solid #ff5900;
  outline-offset: -3px;
}

.knowledge-detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 16px 16px 12px;
}

.detail-close {
  padding: 4px 0;
  border: 0;
  color: var(--green);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
}

.knowledge-detail h3 { margin: 11px 0 14px; color: var(--ink); font-size: 20px; line-height: 1.45; }
.knowledge-detail-content p, .knowledge-context p { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.85; }
.knowledge-context { margin-top: 15px; padding: 12px; border-left: 3px solid #ff5900; background: #fff4ec; }
.knowledge-context strong { display: block; margin-bottom: 5px; color: rgba(0, 0, 0, 0.6); font-size: 12px; }
.knowledge-context p { margin-bottom: 0; }
.knowledge-sources { margin-top: 18px; }
.knowledge-sources h4 { margin: 0 0 8px; color: var(--ink); font-size: 12px; }
.knowledge-sources ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.knowledge-sources li { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.knowledge-sources li span { flex-shrink: 0; min-width: 27px; color: var(--green); font-variant-numeric: tabular-nums; font-weight: 700; }

.knowledge-loading,
.knowledge-empty {
  padding: 34px 18px;
  border: 1px dashed #ededed;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.04);
  text-align: center;
}

.knowledge-loading .loading-mark { display: block; margin-bottom: 9px; color: var(--green); font-size: 26px; }
.knowledge-loading strong, .knowledge-empty strong { display: block; color: var(--ink); font-size: 14px; }
.knowledge-loading p, .knowledge-empty p { margin: 7px 0 0; font-size: 12px; line-height: 1.7; }
.knowledge-empty .knowledge-action { margin-top: 16px; }
.status-chip-error { color: #f02425; background: #fef2f2; }

.drill-empty,
.drill-loading {
  padding: 38px 18px;
  border: 1px dashed #ededed;
  border-radius: 14px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.04);
  text-align: center;
}

.drill-empty-mark,
.drill-loading-mark {
  display: block;
  margin-bottom: 10px;
  color: var(--orange);
  font-size: 28px;
  line-height: 1;
}

.drill-loading-mark { color: var(--green); }
.drill-empty strong, .drill-loading strong { display: block; color: var(--ink); font-size: 15px; }
.drill-empty p, .drill-loading p { margin: 8px 0 0; font-size: 12px; line-height: 1.75; }

.drill-action,
.drill-secondary-action {
  padding: 11px 15px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.drill-action {
  color: #ffffff;
  background: #e64f00;
  box-shadow: 0 6px 14px rgba(255, 89, 0, 0.16);
}

.drill-empty .drill-action { margin-top: 18px; }
.drill-action:hover { background: #e64f00; }
.drill-action:disabled { cursor: wait; opacity: 0.62; }

.drill-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.drill-progress-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 13px 14px;
  border: 1px solid #ededed;
  border-radius: 12px;
  background: #ffffff;
}

.drill-progress-row > div { display: grid; gap: 5px; }
.drill-progress-row strong { color: var(--ink); font-size: 14px; }
.drill-progress-note { color: var(--muted); font-size: 11px; white-space: nowrap; }

.drill-alert {
  margin-bottom: 14px;
  padding: 13px 14px;
  border: 1px solid #fbd5d5;
  border-radius: 12px;
  color: #f02425;
  background: #fef2f2;
}

.drill-alert strong { display: block; color: #f02425; font-size: 13px; }
.drill-alert p { margin: 5px 0 0; font-size: 12px; line-height: 1.65; }

.drill-question {
  min-width: 0;
  margin: 0;
  padding: 16px 13px 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.04);
}

.drill-question legend {
  /* A legend is laid out on the fieldset border by default, which pushed the
     question number outside the card. Floating it puts it back in normal flow. */
  float: left;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  margin: 0 0 12px;
  padding: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.65;
}

.drill-question legend + * { clear: both; }

.drill-question-number {
  display: inline-grid;
  width: 31px;
  height: 31px;
  flex-shrink: 0;
  place-items: center;
  border-radius: 9px;
  color: #ffffff;
  background: var(--teal);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.drill-question-category {
  display: block;
  margin-bottom: 3px;
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.drill-options {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.drill-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 11px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #ffffff;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.65;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.drill-option:hover { border-color: #ffd0b8; color: var(--ink); transform: translateY(-1px); }
.drill-option:focus-within { outline: 3px solid #ff5900; outline-offset: 2px; }
.drill-option.selected { border-color: var(--orange); color: var(--ink); background: #fff4ec; box-shadow: inset 0 0 0 1px rgba(255, 89, 0, 0.08); }
.drill-option input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }

.drill-option-letter {
  display: inline-grid;
  width: 23px;
  height: 23px;
  flex-shrink: 0;
  place-items: center;
  border: 1px solid #ededed;
  border-radius: 7px;
  color: var(--green);
  background: var(--surface);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.drill-option.selected .drill-option-letter { border-color: var(--orange); color: #ffffff; background: var(--orange); }
.drill-option-text { min-width: 0; }

.drill-secondary-action {
  color: #1f9c76;
  background: #fff4ec;
}

.drill-secondary-action:hover { background: #ffe8da; }
.drill-alert .drill-secondary-action { margin-top: 10px; }

.drill-score-card {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid #ededed;
  border-radius: 20px;
  background: #ffffff;
}

.drill-score-card > div:first-child { display: grid; gap: 8px; }
.drill-score-card strong { color: var(--teal); font-size: 35px; font-variant-numeric: tabular-nums; line-height: 1; }
.drill-score-card strong small { color: var(--muted); font-size: 14px; font-weight: 500; }
.drill-score-detail { display: grid; gap: 5px; color: var(--muted); font-size: 11px; text-align: right; }

.drill-topic-summary {
  margin: 16px 0 20px;
  padding: 13px 14px;
  border: 1px solid #ffe8da;
  border-radius: 12px;
  background: #fff4ec;
}

.drill-topic-summary > p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.drill-topic-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.drill-topic-list span { padding: 5px 8px; border-radius: 999px; color: rgba(0, 0, 0, 0.6); background: #fff4ec; font-size: 11px; font-weight: 700; }

.drill-result-list { display: grid; gap: 10px; }

.drill-result-item {
  padding: 15px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid #ff5900;
  border-radius: 12px;
  background: var(--surface);
}

.drill-result-item.correct { border-left-color: var(--green); }
.drill-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 10px; letter-spacing: 0.06em; }
.drill-result-heading strong { color: #ff5900; font-size: 11px; letter-spacing: 0; }
.drill-result-item.correct .drill-result-heading strong { color: var(--green); }
.drill-result-item h3 { margin: 9px 0 12px; color: var(--ink); font-size: 14px; line-height: 1.65; }
.drill-answer-grid { display: grid; gap: 7px; margin: 0; }
.drill-answer-grid > div { padding: 8px 9px; border-radius: 8px; background: #ffffff; }
.drill-answer-grid dt { color: var(--muted); font-size: 10px; }
.drill-answer-grid dd { margin: 3px 0 0; color: var(--ink); font-size: 12px; line-height: 1.6; }
.drill-explanation { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.75; }
.drill-result-refs { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.drill-result-refs span { margin-right: 2px; color: var(--green); font-weight: 700; }
.drill-result-refs b { padding: 3px 6px; border-radius: 5px; color: #1f9c76; background: var(--soft); font-size: 10px; font-weight: 700; }
.drill-new-action { display: block; width: 100%; margin-top: 16px; }

.drill-single-question {
  display: block;
  animation: drill-question-in 180ms ease-out;
}

@keyframes drill-question-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.drill-single-question.drill-transition-out {
  pointer-events: none;
  animation: drill-question-out 140ms ease-in forwards;
}

@keyframes drill-question-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-5px); }
}

.drill-question-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.drill-question-nav ol {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.drill-question-jump {
  display: inline-grid;
  width: 25px;
  height: 25px;
  place-items: center;
  padding: 0;
  border: 1px solid #ededed;
  border-radius: 7px;
  color: var(--muted);
  background: #ffffff;
  cursor: pointer;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.drill-question-jump:hover { border-color: #ffd0b8; color: var(--ink); }
.drill-question-jump.current { border-color: var(--teal); color: #ffffff; background: var(--teal); }
.drill-question-jump.answered { border-color: #a8e6cd; color: var(--green); background: #eefaf5; }
.drill-question-jump.skipped { border-color: #ededed; color: rgba(0, 0, 0, 0.6); background: #ffffff; }
.drill-question-jump.current.answered { color: #ffffff; background: var(--green); }
.drill-question-jump.current.skipped { color: #ffffff; background: rgba(0, 0, 0, 0.6); }
.drill-question-jump:disabled { cursor: wait; opacity: 0.62; }

.drill-current-state {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.drill-option.correct-answer {
  border-color: #2fc798;
  color: #1f9c76;
  background: #eefaf5;
}

.drill-option.correct-answer .drill-option-letter {
  border-color: #2fc798;
  color: #ffffff;
  background: #2fc798;
}

.drill-option.incorrect-answer {
  border-color: #f02425;
  color: #f02425;
  background: #fef2f2;
}

.drill-option.incorrect-answer .drill-option-letter {
  border-color: #f02425;
  color: #ffffff;
  background: #f02425;
}

.drill-option:has(input:disabled) { cursor: default; }
.drill-option:has(input:disabled):hover { transform: none; }

.drill-feedback {
  margin-top: 14px;
  scroll-margin-top: 18px;
  padding: 13px;
  border: 1px solid #a8e6cd;
  border-radius: 20px;
  background: #f0fbf6;
}

.drill-feedback.incorrect {
  border-color: #f02425;
  background: #fef2f2;
}

.drill-feedback-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}

.drill-feedback-heading > div { display: grid; gap: 3px; }
.drill-feedback-heading strong { color: #1f9c76; font-size: 14px; }
.drill-feedback-heading > div > span { color: var(--muted); font-size: 11px; }
.drill-feedback.incorrect .drill-feedback-heading strong { color: #f02425; }

.drill-feedback-icon {
  display: inline-grid;
  width: 27px;
  height: 27px;
  flex-shrink: 0;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: #2fc798;
  font-size: 16px;
  font-weight: 700;
}

.drill-feedback.incorrect .drill-feedback-icon { background: #f02425; }

.drill-feedback-answers {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
}

.drill-feedback-answers > div {
  padding: 8px 9px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
}

.drill-feedback-answers dt { color: var(--muted); font-size: 10px; }
.drill-feedback-answers dd { margin: 3px 0 0; color: var(--ink); font-size: 12px; line-height: 1.55; }
.drill-feedback-explanation { margin: 12px 0 0; color: var(--ink); font-size: 12px; line-height: 1.75; }

.drill-source-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.drill-source-list-label { color: var(--green); font-size: 10px; font-weight: 700; }
.drill-source { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 7px 8px; border-radius: 7px; background: rgba(0, 0, 0, 0.04); }
.drill-source strong { min-width: 0; color: var(--ink); font-size: 11px; font-weight: 600; line-height: 1.5; }
.drill-source span { flex-shrink: 0; color: var(--green); font-size: 10px; font-variant-numeric: tabular-nums; font-weight: 700; }

.drill-next-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 14px 2px 2px;
  border-top: 1px solid var(--line);
}

.drill-next-bar > div { display: grid; min-width: 0; gap: 4px; }
.drill-next-bar strong { color: var(--ink); font-size: 13px; }
.drill-next-bar small { color: var(--muted); font-size: 10px; line-height: 1.55; }
.drill-next-bar .drill-action,
.drill-next-bar .drill-secondary-action { flex-shrink: 0; }
.drill-next-status { flex-shrink: 0; color: var(--muted); font-size: 11px; }

.drill-review-toggle {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 12px 13px;
  border: 1px solid #ededed;
  border-radius: 10px;
  color: #1f9c76;
  background: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.drill-review-toggle:hover { border-color: #ffd0b8; color: #ff5900; background: #fff4ec; }
.drill-result-list[hidden] { display: none; }

.status-chip {
  padding: 9px 12px;
  color: rgba(0, 0, 0, 0.6);
  background: var(--soft);
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2f80ed;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.14);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 76px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.04);
}

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

.stat-card strong {
  color: var(--teal);
  font-size: 17px;
  font-weight: 700;
}

.module-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.module-card {
  position: relative;
  min-height: 150px;
  padding: 20px 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.module-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  content: "";
  background: var(--green);
}

.module-card.accent-2::before { background: #ff5900; }
.module-card.accent-3::before { background: var(--orange); }

.card-index {
  display: block;
  margin-bottom: 16px;
  color: rgba(0, 0, 0, 0.4);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
}

.module-card h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 17px;
}

.module-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.pending-entry {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.04);
}

.page-panel-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.coach-entry {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.coach-entry-copy {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.75;
}

.coach-action {
  justify-self: start;
  padding: 11px 16px;
  border: 0;
  border-radius: 9px;
  color: #ffffff;
  background: var(--orange);
  box-shadow: 0 6px 14px rgba(255, 89, 0, 0.16);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.coach-action-hero {
  padding: 16px 46px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #ff8a3d 0%, var(--orange) 52%, #f02425 100%);
  box-shadow:
    0 12px 26px rgba(255, 89, 0, 0.28),
    0 2px 6px rgba(255, 89, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.coach-action-hero:hover {
  background: linear-gradient(135deg, #ff8a3d 0%, var(--orange) 52%, #f02425 100%);
  filter: brightness(1.05);
}

.coach-action-hero:active {
  transform: translateY(1px);
  box-shadow:
    0 6px 16px rgba(255, 89, 0, 0.26),
    inset 0 1px 0 rgba(0, 0, 0, 0.12);
}

.coach-action:hover { background: #e64f00; }
.coach-action:disabled { cursor: wait; opacity: 0.62; }

.coach-error {
  margin: 0;
  color: #f02425;
  font-size: 12px;
  line-height: 1.6;
}

.coach-session-entry {
  padding: 12px;
  border: 1px solid #ededed;
  border-radius: 20px;
  background: #ffffff;
}

.coach-opening {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.75;
}

.coach-session {
  display: grid;
  gap: 16px;
  padding: 12px;
  border: 1px solid #ededed;
  border-radius: 20px;
  background: #ffffff;
}

.coach-session-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.coach-turn-count {
  color: var(--muted);
  font-size: 12px;
}

.coach-transcript {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.coach-turn {
  display: grid;
  gap: 5px;
  max-width: 88%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.coach-turn-doctor {
  justify-self: start;
  border-left: 3px solid var(--teal);
}

.coach-turn-representative {
  justify-self: end;
  border-right: 3px solid var(--orange);
  background: #fff4ec;
}

.coach-turn-pending p {
  color: var(--muted);
}

.coach-speaker {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.coach-turn p {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.coach-composer {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}

.coach-composer textarea {
  width: 100%;
  min-height: 76px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
}

.coach-composer textarea:focus {
  outline: 2px solid rgba(255, 89, 0, 0.35);
  outline-offset: 1px;
}

.coach-composer textarea:disabled { background: rgba(0, 0, 0, 0.04); color: var(--muted); }

.coach-composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.coach-action-secondary {
  color: var(--green);
  background: var(--soft-theme);
  box-shadow: none;
}

.coach-action-secondary:hover { background: #ffe8da; }

.coach-review {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  padding: 22px 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.coach-review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.coach-review-score {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.coach-review-score strong {
  color: var(--ink);
  font-size: 34px;
  line-height: 1;
}

.coach-review-score small {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.coach-compliance {
  margin: 0;
  padding: 9px 13px;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.6;
}

.coach-compliance.is-clear { color: #1f9c76; background: #eefaf5; }
.coach-compliance.is-neutral { color: var(--muted); background: var(--soft); }

.coach-dimension-total {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.coach-failures {
  padding: 14px 16px;
  border: 1px solid #fbd5d5;
  border-left: 4px solid var(--orange);
  border-radius: 10px;
  background: #fef2f2;
}

.coach-failures strong { color: #f02425; font-size: 13px; }
.coach-failures ul { margin: 8px 0 0; padding-left: 18px; }
.coach-failures li { color: var(--ink); font-size: 13px; line-height: 1.7; }
.coach-failures p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.coach-review-summary {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.8;
}

.coach-dimensions ul,
.coach-notes ul {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.coach-dimensions li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  font-size: 13px;
}

.coach-dimensions li span { color: var(--ink); }
.coach-dimensions li strong { color: var(--green); font-size: 14px; }
.coach-dimensions li small { color: var(--muted); font-size: 11px; font-weight: 500; }

.coach-notes strong { color: var(--ink); font-size: 13px; }
.coach-notes li {
  padding-left: 14px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.75;
  position: relative;
}

.coach-notes li::before {
  content: "·";
  position: absolute;
  left: 2px;
  color: var(--orange);
}

.coach-reference {
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--soft);
}

.coach-reference strong { color: var(--ink); font-size: 13px; }
.coach-reference p { margin: 8px 0 0; color: var(--ink); font-size: 14px; line-height: 1.8; }

@media (max-width: 560px) {
  .coach-turn { max-width: 100%; }
  .coach-review-score strong { font-size: 28px; }
}

/* Representative context in the hero's top-right corner. */
.hero-tags {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.hero-tag {
  padding: 3px 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.04);
  font-size: 11px;
  line-height: 1.6;
}

/* A topic that is planned but has no content yet. */
.knowledge-section.is-pending {
  cursor: not-allowed;
  border-style: dashed;
  border-color: #ededed;
  color: rgba(0, 0, 0, 0.4);
  background: #f7f7f9;
}

.knowledge-section.is-pending strong,
.knowledge-section.is-pending small { color: rgba(0, 0, 0, 0.4); }
.knowledge-section.is-pending .knowledge-section-icon { opacity: 0.5; filter: grayscale(1); }
.knowledge-section.is-pending:hover { border-color: #ededed; background: #f7f7f9; }

/* Optional question-bank scope selector. */
.drill-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.drill-scope { display: inline-flex; align-items: center; gap: 8px; }

/* Question banks, listed by product on the drill entry screen. */
.drill-bank__lead {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.drill-bank {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.drill-bank__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  text-align: left;
  transition: border-color 140ms ease, transform 140ms ease;
}

.drill-bank__item:hover { border-color: #ffd0b8; transform: translateY(-1px); }

.drill-bank__name { color: var(--ink); font-size: 15px; font-weight: 600; }
.drill-bank__note { color: var(--muted); font-size: 12px; }

.drill-bank__item.is-pending {
  cursor: not-allowed;
  border-style: dashed;
  border-color: #ededed;
  background: #f7f7f9;
  box-shadow: none;
}

.drill-bank__item.is-pending:hover { border-color: #ededed; transform: none; }
.drill-bank__item.is-pending .drill-bank__name { color: rgba(0, 0, 0, 0.4); }
.drill-bank__item.is-pending .drill-bank__note { color: rgba(0, 0, 0, 0.4); }

.drill-scope strong { color: var(--ink); font-size: 12px; font-weight: 600; }

.drill-scope select {
  padding: 6px 26px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
}

/* Fixed scenario entry. */
/* Sub-view exit row: present at the top of every running/finished sub-view. */
.view-back { margin-bottom: 10px; }

.view-back__button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 6px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--green);
  cursor: pointer;
  font-size: 12px;
}

.view-back__button:hover { background: var(--soft-theme); }

.scene-picker__lead {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.scene-picker__status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.scene-picker__error { display: grid; justify-items: center; gap: 10px; }
.scene-picker__error p { margin: 0; color: #f02425; font-size: 13px; }

.scene-picker {
  display: grid;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scene-pick {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  text-align: left;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.scene-pick:hover {
  border-color: #ffd0b8;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.scene-pick:disabled { cursor: wait; opacity: 0.6; }

/* The scenario name is the card's title, so it reads as one: primary ink, larger
   than the quoted opening beneath it. The eyebrow label that follows it stays a
   quiet caption marking which voice the quote belongs to. */
.scene-pick__name {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}

.scene-pick__label {
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.scene-pick__text {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
}

/* Demo sign-in gate. Purely a threshold for demonstrations. */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  min-height: 100vh;
  padding: 32px 16px;
  background: var(--app-bg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

.login-mark {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--maincolor);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.login-card {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 343px;
  padding: 24px 20px;
  border-radius: 20px;
  background: var(--surface);
}

.login-card h1 {
  margin: 0;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
}

.login-hint {
  margin: 0;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 20px;
}

.login-field { display: grid; gap: 6px; }
.login-field span { color: var(--text-secondary); font-size: 12px; }

.login-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 15px;
}

.login-field input:focus {
  outline: none;
  border-color: var(--maincolor);
  box-shadow: 0 0 0 3px rgba(255, 89, 0, 0.12);
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-size: 12px;
  line-height: 20px;
}

.login-submit {
  min-height: 48px;
  margin-top: 4px;
  border: 0;
  border-radius: 12px;
  background: var(--maincolor);
  color: #ffffff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}

.login-submit:hover { background: var(--maincolor-strong); }

.pending-entry h2 {
  margin: 5px 0 10px;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.35;
  letter-spacing: -0.03em;
}

.pending-entry p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.app-footer {
  padding: 0 20px 30px;
  color: rgba(0, 0, 0, 0.4);
  font-size: 11px;
  text-align: center;
}

.speaker-entry {
  display: grid;
  gap: 16px;
  padding: 12px;
  border: 1px solid #ededed;
  border-radius: 20px;
  background: #ffffff;
}

.speaker-scenario {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.8;
}

.speaker-modes {
  display: flex;
  gap: 10px;
}

.speaker-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.speaker-mode.is-active {
  border-color: var(--orange);
  color: var(--orange);
  background: #fff4ec;
  font-weight: 700;
}

.speaker-mode[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.speaker-composer {
  display: grid;
  gap: 8px;
}

.speaker-composer textarea {
  width: 100%;
  min-height: 150px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.75;
  resize: vertical;
}

.speaker-composer textarea:focus {
  outline: 2px solid rgba(255, 89, 0, 0.35);
  outline-offset: 1px;
}

.speaker-composer textarea:disabled { background: rgba(0, 0, 0, 0.04); color: var(--muted); }

.speaker-result {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  padding: 22px 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.speaker-result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.speaker-result-head strong {
  color: var(--ink);
  font-size: 32px;
  line-height: 1;
}

.speaker-result-head small { color: var(--muted); font-size: 13px; font-weight: 500; }

.speaker-feedback {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.85;
}

.profile-card {
  display: grid;
  gap: 16px;
  padding: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.04);
}

/* The learner's own page leads with who they are, so the identity takes the
   heading slot the other tabs give to the tab name. */
.profile-hero-id {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.profile-hero-id .profile-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  font-size: 21px;
}

.page-hero .profile-id-name h1 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
}

.profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 50%;
  background: var(--soft);
  font-size: 22px;
}

.profile-id-text { display: grid; gap: 3px; min-width: 0; }

/* Representative name with its region / product tags beside it. */
.profile-id-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-id-tag {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.7;
}

/* On the header the chips sit on --app-bg, which is exactly the fill they use
   inside a card, so the pill dissolved into the background and read as plain
   text. Darken the fill and the outline instead, matching the region / product
   chips already used on the other tabs' headers. */
.page-hero .profile-id-tag {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.04);
}


.profile-id-text > span:last-child { color: var(--muted); font-size: 11px; }
.profile-id-text span { color: var(--muted); font-size: 11px; }

.profile-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.profile-kpi {
  display: grid;
  gap: 3px;
  padding: 10px 6px;
  border-radius: 10px;
  background: var(--paper);
  text-align: center;
}

.profile-kpi strong { color: var(--green); font-size: 19px; line-height: 1.1; }
.profile-kpi strong small { color: var(--muted); font-size: 10px; font-weight: 500; margin-left: 1px; }
.profile-kpi span { color: var(--muted); font-size: 10px; }

.profile-week { display: grid; gap: 8px; }

.profile-heat { display: flex; gap: 6px; }

.profile-heat-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 34px;
  border-radius: 8px;
  background: var(--soft);
  color: rgba(0, 0, 0, 0.4);
  font-size: 11px;
}

.profile-heat-cell.is-1 { background: #ffe2cf; color: #ffffff; }
.profile-heat-cell.is-2 { background: #ffc39a; color: #ffffff; }
.profile-heat-cell.is-3 { background: #ff5900; color: #ffffff; }

@media (max-width: 370px) {
  .profile-kpi strong { font-size: 17px; }
  .profile-heat { gap: 4px; }
}

.profile-summary,
.profile-section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.04);
}

.profile-section { margin-top: 14px; }

.profile-summary-head,
.profile-history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.profile-summary-note,
.profile-history-count {
  color: var(--muted);
  font-size: 11px;
}

.profile-radar-figure { margin: 14px 0 8px; }

.profile-radar {
  display: block;
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
}

.profile-radar-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
}

.profile-capability {
  display: grid;
  gap: 12px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.profile-capability li { display: grid; gap: 5px; }

.profile-capability-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--ink);
}

.profile-capability-head strong { color: var(--green); font-size: 14px; }
.profile-capability-head small { color: var(--muted); font-size: 11px; font-weight: 500; }

.profile-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.profile-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--orange));
}

.profile-capability-note { color: var(--muted); font-size: 10px; }

.profile-history-groups { display: grid; gap: 14px; margin-top: 10px; }

.profile-history-group { display: grid; gap: 8px; }

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

.profile-history li {
  display: grid;
  gap: 8px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.profile-record-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-history li div { display: grid; gap: 3px; min-width: 0; }
.profile-history li strong { color: var(--ink); font-size: 13px; font-weight: 600; }
.profile-history li div span { color: var(--muted); font-size: 10px; }

.profile-history li .profile-record-score { color: var(--green); font-size: 16px; font-weight: 700; white-space: nowrap; }
.profile-history li .profile-record-score small { color: var(--muted); font-size: 10px; font-weight: 500; }

.profile-record-detail summary {
  color: var(--green);
  cursor: pointer;
  font-size: 11px;
}

.profile-record-detail ul {
  display: grid;
  gap: 5px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.profile-record-detail li {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.profile-topics {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.profile-topics li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
}

.profile-topics li strong { color: var(--orange); font-size: 14px; }
.profile-topics li small { color: var(--muted); font-size: 10px; font-weight: 500; }

.profile-recommendation {
  margin: 10px 0 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.8;
}

.profile-recommendation + .coach-action { margin-top: 12px; }

.profile-empty {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

/* Conversation surface, modelled on the ChatGPT / DeepSeek mobile pattern:
   the assistant speaks from the left with an avatar, the user from the right in
   a filled bubble, and the composer stays docked above the bottom navigation. */

.page-panel-chat {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 0;
}

/* After the review lands the composer is gone, so the transcript stops being the
   scroll container and the column scrolls as a whole. Otherwise the log keeps
   flexing to fill and the report is pushed past .app-background's clipped edge. */
.page-panel-chat.is-reviewing .chat-log {
  flex: 0 0 auto;
  overflow: visible;
}

.chat-log {
  flex: 1;
  align-content: start;
  display: grid;
  gap: 12px;
  min-height: 0;
  margin: 0;
  padding: 4px 0 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  list-style: none;
}

.chat-msg { display: flex; align-items: flex-start; gap: 8px; }
/* The Doctor's row stacks: avatar on top, bubble flush at the left content edge. */
.chat-msg-assistant { flex-direction: column; align-items: flex-start; gap: 5px; }
.chat-msg-user { justify-content: flex-end; }

.chat-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 999px;
  background: var(--maincolor);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
}

.chat-bubble {
  max-width: 291px;
  padding: 10px 12px;
  border-radius: 20px;
  font-size: 14px;
  line-height: 22px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-msg-assistant .chat-bubble {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-primary);
}

.chat-msg-user .chat-bubble {
  border-radius: 20px;
  background: var(--maincolor);
  color: #ffffff;
}

/* The wait reads as a small caption line under the Doctor's side, not a bubble. */
.chat-msg-thinking { align-items: center; }

.chat-thinking {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.chat-dots { display: inline-flex; gap: 2px; margin-left: 3px; vertical-align: 1px; }
.chat-dots i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  animation: chat-pulse 1.1s infinite ease-in-out;
}
.chat-dots i:nth-child(2) { animation-delay: 0.18s; }
.chat-dots i:nth-child(3) { animation-delay: 0.36s; }

@keyframes chat-pulse {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

.chat-dock {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  padding: 10px 0 0;
  background: none;
}

/* Suggested approach: a round button that stays put, with the panel expanding
   out of it to the right. Opt-in, because generating one costs a model call. */
.hint-dock {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.hint-fab {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--soft-border);
  border-radius: 50%;
  background: var(--soft-theme);
  color: var(--maincolor);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.hint-fab:hover { background: var(--theme-focus); }
.hint-fab:active { transform: scale(0.94); }
.hint-fab.is-open { box-shadow: 0 0 0 3px rgba(255, 89, 0, 0.14); }
.hint-fab.is-error { border-color: var(--line); background: var(--neutral-surface); color: var(--text-tertiary); }
.hint-fab:disabled { opacity: 0.45; cursor: not-allowed; }
.hint-fab__icon { display: block; }
.hint-fab.is-loading .hint-fab__icon { animation: hint-spin 900ms linear infinite; }

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

.hint-panel {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--soft-border);
  border-radius: 12px;
  background: var(--soft-theme);
  /* Reads as sliding out of the button rather than appearing all at once. */
  animation: hint-panel-in 160ms ease-out;
}

@keyframes hint-panel-in {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}

.hint-panel__label {
  display: block;
  margin-bottom: 2px;
  color: var(--maincolor);
  font-size: 12px;
  font-weight: 600;
}

.hint-panel__state { color: var(--text-tertiary); font-size: 12px; }

.hint-panel__text {
  margin: 0;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 21px;
}

.chat-dock-static {
  position: static;
  width: auto;
  padding: 0;
  transform: none;
  background: none;
}

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 50px;
  padding: 4px 4px 4px 16px;
  border: 0;
  border-radius: 360px;
  background: var(--surface);
  box-shadow: inset 0 -2px 14px rgba(255, 89, 0, 0.06), inset 0 6px 14px rgba(255, 89, 0, 0.08);
}

.chat-composer-tall {
  border: 1px solid var(--line);
  box-shadow: none;
}

.chat-composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 132px;
  padding: 13px 0;
  border: 0;
  background: none;
  color: var(--text-primary);
  font: inherit;
  font-size: 15px;
  line-height: 24px;
  resize: none;
}

.chat-composer textarea:focus { outline: none; }
.chat-composer textarea:disabled { color: var(--muted); }
/* Speaker composer: a multi-line block, not a single-line pill. */
.chat-composer-tall {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  min-height: 132px;
  padding: 12px 12px 12px 16px;
  border-radius: 20px;
}

.chat-composer-tall textarea {
  min-height: 108px;
  padding: 4px 0;
}

.chat-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 0;
  border-radius: 999px;
  background: var(--maincolor);
  color: #ffffff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.chat-send:hover { background: var(--maincolor-strong); }
.chat-send:disabled { background: #b2b6d6; cursor: not-allowed; }

.chat-secondary {
  justify-self: center;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--green);
  cursor: pointer;
  font-size: 12px;
}

.chat-secondary:hover { background: var(--soft-theme); }
.chat-secondary:disabled { color: #b2b6d6; cursor: not-allowed; }

.chat-restart {
  display: grid;
  justify-items: center;
  padding: 16px 0 6px;
}

.chat-hint {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

@media (max-width: 370px) {
  .chat-bubble { max-width: 84%; font-size: 14px; }
}

@media (max-width: 370px) {
  .page-hero,
  .content { padding-left: 16px; padding-right: 16px; }
  .bottom-nav { padding-left: 6px; padding-right: 6px; }
  .nav-item { font-size: 9px; }
  .nav-icon { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .drill-single-question.drill-transition-out { animation: none; }
}
