:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-soft: #f2f4f7;
  --surface-hover: #eceff3;
  --ink: #111827;
  --ink-soft: #334155;
  --muted: #6b7280;
  --faint: #9ca3af;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #0f766e;
  --accent-strong: #0f5f59;
  --accent-soft: #e6f4f1;
  --amber: #d97706;
  --amber-soft: #fff7ed;
  --red: #b42318;
  --red-soft: #fef2f2;
  --yellow: #8a5a00;
  --yellow-soft: #fffbeb;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.08);
  --content-max: 980px;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  outline: 0;
}

input:focus,
select:focus {
  border-color: #9ccfca;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.11);
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.auth-screen {
  height: 100vh;
  min-height: 560px;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 18%, rgba(15, 118, 110, 0.11), transparent 34%),
    linear-gradient(135deg, rgba(248, 250, 252, 0.98), rgba(238, 243, 247, 0.96)),
    repeating-linear-gradient(90deg, rgba(15, 23, 42, 0.035) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(0deg, rgba(15, 23, 42, 0.03) 0 1px, transparent 1px 72px),
    #f3f6f8;
}

.login-shell {
  width: min(420px, 100%);
}

.login-card {
  width: 100%;
  display: grid;
  gap: 18px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 8px;
  padding: 30px;
  align-content: center;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(18px);
}

.login-card-head {
  display: grid;
  gap: 18px;
  margin-bottom: 2px;
}

.login-brand {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.94);
}

.login-card h1 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: 0;
}

.login-card input {
  min-height: 46px;
  border-color: #d9e0e8;
  background: #f8fafc;
  font-size: 15px;
}

.login-card input:focus {
  background: white;
}

.login-submit {
  width: 100%;
  min-height: 46px;
  margin-top: 2px;
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.login-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
  line-height: 1.55;
}

.login-security-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.app-shell {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
  background: var(--bg);
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
  position: relative;
  z-index: 5;
  min-width: 0;
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  color: var(--ink);
  background: #fbfcfd;
  border-right: 1px solid var(--line);
  transition: width 180ms ease, padding 180ms ease, transform 180ms ease;
}

.sidebar.collapsed {
  width: 76px;
  padding: 16px 12px;
}

.sidebar.collapsed .sidebar-header {
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
}

.sidebar.collapsed .brand-mark {
  width: 34px;
  flex-basis: 34px;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .new-probe-button,
.sidebar.collapsed .sidebar-section {
  display: none;
}

.sidebar-header,
.topbar,
.sidebar-title,
.composer-footer,
.choice-heading {
  display: flex;
  align-items: center;
}

.sidebar-header {
  min-height: 40px;
  justify-content: space-between;
  gap: 10px;
}

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

.brand-text {
  min-width: 0;
}

.brand-lockup strong {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  color: var(--ink);
  font-size: 16px;
  letter-spacing: 0;
}

.brand-lockup em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 650;
}

.brand-mark {
  width: 36px;
  height: 18px;
  flex: 0 0 36px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 9px 50%, #f18f2f 0 7px, transparent 8px),
    radial-gradient(circle at 27px 50%, #1f9d72 0 7px, transparent 8px);
}

.icon-button,
.text-button,
.new-probe-button,
.send-button,
.choice-chip,
.copy-button,
.history-item,
.history-open,
.history-delete {
  border: 0;
  border-radius: 8px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--muted);
  background: transparent;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.new-probe-button {
  min-height: 42px;
  padding: 0 14px;
  color: white;
  background: #111827;
  box-shadow: var(--shadow-sm);
}

.new-probe-button:hover {
  background: #0b1220;
}

.sidebar-section {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
}

.sidebar-title {
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.text-button {
  color: var(--muted);
  background: transparent;
  padding: 6px 8px;
}

.text-button:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.history-list {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.history-list::-webkit-scrollbar {
  width: 8px;
}

.history-list::-webkit-scrollbar-track {
  background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #cbd5e1;
}

.history-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.history-item {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  min-height: 112px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  overflow: hidden;
}

.history-item:hover {
  background: var(--surface-soft);
  border-color: var(--line);
}

.history-open {
  width: 100%;
  min-height: 112px;
  display: grid;
  gap: 7px;
  padding: 13px 42px 13px 13px;
  color: inherit;
  text-align: left;
  background: transparent;
}

.history-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--faint);
  background: transparent;
  font-size: 18px;
  line-height: 1;
  opacity: 0;
}

.history-item:hover .history-delete {
  opacity: 1;
}

.history-delete:focus-visible {
  opacity: 1;
  outline: 2px solid #99d4cb;
  outline-offset: 2px;
}

.history-delete:hover {
  color: var(--red);
  background: var(--red-soft);
}

.history-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--ink);
  line-height: 1.45;
  font-size: 14px;
  font-weight: 560;
}

.history-meta,
.history-empty {
  color: var(--muted);
  font-size: 12.5px;
}

.main-panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}

.main-panel > * {
  min-width: 0;
}

.topbar {
  gap: 16px;
  justify-content: space-between;
  padding: 16px 30px 10px;
  border-bottom: 1px solid rgba(229, 231, 235, 0.6);
  background: rgba(247, 248, 250, 0.86);
  backdrop-filter: blur(18px);
}

.topbar > div {
  min-width: 0;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.user-badge {
  min-height: 30px;
  max-width: 220px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  color: var(--ink-soft);
  background: var(--surface);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
}

.admin-entry {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: 0;
}

.health-badge {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
}

.health-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.stage-strip {
  width: min(var(--content-max), calc(100% - 60px));
  margin: 14px auto 2px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stage-dots {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.stage-dot {
  min-width: 0;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.stage-dot span {
  width: 20px;
  height: 20px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 750;
}

.stage-dot em {
  position: absolute;
  width: 1px;
  height: 1px;
  font-style: normal;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.stage-dot.active {
  color: var(--ink);
  border-color: #b7dcd4;
  background: var(--accent-soft);
}

.stage-dot.active span,
.stage-dot.done span {
  color: white;
  background: var(--accent);
}

.stage-dot:disabled {
  cursor: default;
}

.stage-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.term-guide {
  width: min(var(--content-max), calc(100% - 60px));
  margin: 8px auto 0;
  overflow: hidden;
  border: 1px solid rgba(209, 213, 219, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-sm);
}

.term-guide summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  color: var(--ink);
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.term-guide summary::-webkit-details-marker {
  display: none;
}

.term-guide summary::after {
  content: "展开";
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.term-guide[open] summary::after {
  content: "收起";
}

.term-guide-title {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 760;
}

.term-guide-kicker {
  min-width: 0;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

.term-guide-pills {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.term-guide-pills span {
  min-width: max-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11.5px;
  font-weight: 650;
}

.term-guide-body {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
}

.advisor-bar {
  width: min(var(--content-max), calc(100% - 60px));
  min-height: 48px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  margin: 8px auto 0;
  border: 1px solid #d8e3e1;
  border-radius: 8px;
  padding: 7px 10px;
  background: #f9fcfb;
}

.advisor-bar[hidden] {
  display: none;
}

.advisor-bar-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #0f766e;
  font-size: 12px;
  font-weight: 800;
}

.advisor-bar-copy {
  min-width: 0;
}

.advisor-bar-copy span,
.advisor-bar-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.advisor-bar-copy span {
  color: var(--muted);
  font-size: 11.5px;
}

.advisor-bar-copy strong {
  margin-top: 1px;
  color: var(--ink);
  font-size: 13px;
}

.advisor-change {
  min-width: max-content;
}

.term-group {
  min-width: 0;
}

.term-group h2 {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.35;
  letter-spacing: 0;
}

.term-list {
  display: grid;
  gap: 7px;
}

.term-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 12.8px;
  line-height: 1.55;
}

.term-badge {
  min-width: 42px;
  display: inline-flex;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 760;
  line-height: 1.45;
  white-space: nowrap;
}

.level-a,
.signal-green {
  color: #047857;
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.level-b {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.level-c,
.signal-yellow {
  color: #92400e;
  border-color: #fde68a;
  background: #fffbeb;
}

.level-d,
.signal-red {
  color: #be123c;
  border-color: #fecdd3;
  background: #fff1f2;
}

.conversation {
  min-height: 0;
  overflow: auto;
  padding: 16px 30px 28px;
  scroll-behavior: smooth;
}

.conversation::before,
.conversation::after {
  content: "";
  display: block;
  height: 4px;
}

.message {
  width: min(var(--content-max), 100%);
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  margin: 14px auto;
}

.message.user {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.message.user .avatar {
  grid-column: 2;
  color: white;
  background: #111827;
}

.message.user .message-body {
  grid-row: 1;
  justify-self: end;
  max-width: min(720px, 86%);
  color: var(--ink);
  background: #eef0f3;
  border-color: #e1e5ea;
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: #0f766e;
  font-size: 11px;
  font-weight: 800;
}

.avatar.accent-jade,
.advisor-bar-avatar.accent-jade {
  background: #287a68;
}

.avatar.accent-emerald,
.advisor-bar-avatar.accent-emerald {
  background: #177245;
}

.avatar.accent-amber,
.advisor-bar-avatar.accent-amber {
  color: #1f2937;
  background: #e8b94f;
}

.avatar.accent-indigo,
.advisor-bar-avatar.accent-indigo {
  background: #4757a6;
}

.avatar.accent-graphite,
.advisor-bar-avatar.accent-graphite {
  background: #343a40;
}

.message-body {
  width: fit-content;
  max-width: min(850px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 15px;
  color: var(--ink-soft);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.message.assistant:not(.result-message) .message-body {
  box-shadow: none;
}

.message-meta {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.message-speaker {
  color: var(--ink);
  font-weight: 720;
}

.message-context::before {
  content: " · ";
}

.advisor-handoff-message .message-body {
  width: min(760px, 100%);
  border-color: #cbded9;
  background: #f8fcfb;
}

.handoff-kicker {
  color: #0f766e;
  font-size: 11.5px;
  font-weight: 750;
  text-transform: uppercase;
}

.handoff-title {
  margin: 5px 0 4px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.35;
}

.handoff-copy {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.7;
}

.handoff-domains {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.handoff-domains span {
  border: 1px solid #cfe0dc;
  border-radius: 999px;
  padding: 3px 8px;
  color: #315e55;
  background: #fff;
  font-size: 11.5px;
}

.advisor-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 20px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
}

.advisor-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
}

.advisor-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.advisor-dialog-head h2 {
  margin: 2px 0 0;
  font-size: 20px;
}

.advisor-dialog-note {
  margin: 10px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

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

.advisor-option {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  color: var(--ink);
  text-align: left;
  background: #fbfcfd;
  cursor: pointer;
}

.advisor-option:hover,
.advisor-option.active {
  border-color: #92bbb2;
  background: #f5faf8;
}

.advisor-option-copy {
  min-width: 0;
}

.advisor-option strong,
.advisor-option span,
.advisor-option small {
  display: block;
}

.advisor-option span {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.45;
}

.advisor-option small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.message.user .message-meta {
  color: var(--muted);
}

.message-content p {
  margin: 0;
  line-height: 1.78;
}

.message-content p + p {
  margin-top: 8px;
}

.thinking-message .message-body {
  border-color: #d7e5e2;
  background: #fbfefe;
}

.thinking-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
  color: var(--muted);
  line-height: 1.6;
}

.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.thinking-dots i {
  width: 6px;
  height: 6px;
  display: block;
  border-radius: 50%;
  background: var(--accent);
  animation: thinking-pulse 1.1s ease-in-out infinite;
}

.thinking-dots i:nth-child(2) {
  animation-delay: 160ms;
}

.thinking-dots i:nth-child(3) {
  animation-delay: 320ms;
}

.typing-output {
  position: relative;
}

.typing-caret {
  width: 7px;
  height: 1.1em;
  display: inline-block;
  margin-left: 3px;
  vertical-align: -0.15em;
  border-radius: 1px;
  background: var(--accent);
  animation: typing-caret-blink 900ms steps(1) infinite;
}

@keyframes thinking-pulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

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

@keyframes typing-caret-blink {
  0%,
  48% {
    opacity: 1;
  }

  49%,
  100% {
    opacity: 0;
  }
}

.subtle {
  color: var(--muted);
}

.composer-shell {
  width: min(var(--content-max), calc(100% - 60px));
  margin: 0 auto 22px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.choice-panel {
  padding: 12px 12px 0;
}

.choice-heading {
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
}

.choice-heading strong {
  color: var(--accent);
  white-space: nowrap;
}

.choice-heading.followup-heading {
  align-items: flex-start;
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

.choice-heading.followup-heading span {
  max-width: 760px;
  line-height: 1.6;
}

.choice-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.choice-grid::-webkit-scrollbar {
  height: 6px;
}

.choice-grid::-webkit-scrollbar-track {
  background: transparent;
}

.choice-grid::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #cbd5e1;
}

.choice-chip {
  flex: 0 0 auto;
  max-width: 260px;
  min-height: 34px;
  padding: 7px 11px;
  overflow: hidden;
  color: var(--ink-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--surface-soft);
  border: 1px solid transparent;
}

.choice-chip:hover,
.choice-chip.selected {
  color: var(--accent-strong);
  border-color: #b7dcd4;
  background: var(--accent-soft);
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 12px;
}

textarea {
  width: 100%;
  min-height: 54px;
  max-height: 180px;
  resize: vertical;
  border: 0;
  outline: 0;
  border-radius: 8px;
  padding: 13px 12px;
  color: var(--ink);
  background: var(--surface-soft);
  line-height: 1.55;
}

textarea:focus {
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px #cbd5e1;
}

.send-button {
  align-self: end;
  min-width: 94px;
  min-height: 46px;
  color: white;
  background: #111827;
}

.send-button:hover:not(:disabled) {
  background: #0f172a;
}

.send-button:disabled,
.text-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.composer-footer {
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 12px;
}

.diagnosis-card {
  width: min(880px, 100%);
}

.diagnosis-hero,
.initial-diagnosis .diagnosis-hero {
  padding: 18px;
  border: 1px solid #dbe3ea;
  border-radius: 8px;
  color: var(--ink);
  background: #f8fafc;
}

.diagnosis-hero h2 {
  margin: 10px 0 8px;
  color: var(--ink);
  font-size: 22px;
  letter-spacing: 0;
}

.diagnosis-hero p {
  margin: 0;
  line-height: 1.75;
  color: var(--ink-soft);
}

.level-badge,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.level-badge.green,
.pill.green {
  color: #0f6b4f;
  background: #dff5eb;
}

.level-badge.yellow,
.pill.yellow {
  color: var(--yellow);
  background: var(--yellow-soft);
}

.level-badge.red,
.pill.red {
  color: var(--red);
  background: var(--red-soft);
}

.pill {
  color: var(--muted);
  background: #eef2f7;
  font-weight: 650;
  font-size: 12.5px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.result-grid,
.two-column {
  display: grid;
  gap: 10px;
}

.result-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 12px 0;
}

.two-column {
  grid-template-columns: 1fr 1fr;
}

.metric,
.block,
.warning-box,
.report-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric {
  padding: 13px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.metric strong {
  color: var(--ink);
  font-size: 19px;
}

.block {
  padding: 14px;
}

.block h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 15px;
}

.block h3:not(:first-child) {
  margin-top: 16px;
}

.block p,
.block ul {
  margin: 0;
  line-height: 1.72;
}

.block ul {
  padding-left: 20px;
}

.block-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.block-title-row h3 {
  margin: 0;
}

.mini-badge {
  flex: 0 0 auto;
  border: 1px solid #c7d8d4;
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.goal-function-block {
  margin: 12px 0;
  border-color: #cbded9;
  background: #fbfefd;
}

.goal-function-block p + p,
.goal-function-block p + .compact-list {
  margin-top: 8px;
}

.compact-list {
  color: var(--ink-soft);
  font-size: 13px;
}

.goal-clarification {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.goal-clarification span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.followup-answer-block {
  margin-bottom: 12px;
  background: #fbfcfe;
  border-color: #dbe3ea;
}

.followup-answer-block li + li {
  margin-top: 10px;
}

.followup-answer-block strong {
  color: var(--ink);
}

.warning-box {
  margin: 12px 0;
  padding: 12px 14px;
  color: var(--yellow);
  background: var(--yellow-soft);
  border-color: #fde68a;
}

.warning-box.red {
  color: var(--red);
  background: var(--red-soft);
  border-color: #fecaca;
}

.report-details {
  margin-top: 12px;
  padding: 14px;
}

.report-details summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
}

.copy-button {
  min-height: 34px;
  margin: 12px 0;
  padding: 0 12px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.copy-button:hover {
  background: #d8eee9;
}

.report-box {
  max-height: 420px;
  overflow: auto;
  margin: 0;
  border-radius: 8px;
  padding: 14px;
  white-space: pre-wrap;
  color: #e5edf5;
  background: #111827;
  line-height: 1.65;
  font-size: 13px;
}

.admin-panel {
  height: 100vh;
  overflow: auto;
  padding: 28px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(247, 248, 250, 0.94), rgba(239, 244, 247, 0.94)),
    var(--bg);
}

.admin-shell {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.22fr);
  gap: 18px;
  margin: 0 auto;
}

.admin-header {
  grid-column: 1 / -1;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.admin-header h1,
.admin-create h2,
.admin-section-title h2 {
  margin: 0;
  color: var(--ink);
  line-height: 1.3;
  letter-spacing: 0;
}

.admin-header h1 {
  font-size: 24px;
}

.admin-create,
.admin-users {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.admin-create {
  align-self: start;
  padding: 18px;
}

.admin-create h2,
.admin-section-title h2 {
  font-size: 16px;
}

.admin-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.admin-form .send-button {
  width: 100%;
}

.admin-users {
  display: flex;
  min-height: 520px;
  flex-direction: column;
  overflow: hidden;
}

.admin-section-title {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.admin-user-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.admin-user-list::-webkit-scrollbar {
  width: 8px;
}

.admin-user-list::-webkit-scrollbar-track {
  background: transparent;
}

.admin-user-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #cbd5e1;
}

.admin-user-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: #fbfcfd;
}

.admin-user-row strong {
  display: block;
  max-width: 360px;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
}

.admin-user-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.loading {
  cursor: progress;
}

.mobile-only {
  display: none;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    overflow: hidden;
  }

  .main-panel {
    width: 100vw;
    max-width: 100vw;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    transform: translateX(-105%);
    box-shadow: 24px 0 60px rgba(15, 23, 42, 0.18);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-only {
    display: inline-grid;
    color: var(--ink);
    background: var(--surface);
  }

  .topbar,
  .conversation {
    width: 100%;
    max-width: 100vw;
    padding-left: 18px;
    padding-right: 18px;
  }

  .stage-strip,
  .term-guide,
  .advisor-bar,
  .composer-shell {
    width: calc(100vw - 36px);
    max-width: calc(100vw - 36px);
  }

  .term-guide-body {
    grid-template-columns: 1fr;
  }

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

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

  .stage-dots {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .stage-dot em {
    white-space: normal;
  }

  .composer,
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .user-badge {
    max-width: 100%;
  }

  .health-badge {
    justify-content: center;
  }

  .admin-panel {
    padding: 18px;
  }

  .login-shell {
    width: min(420px, 100%);
  }

  .login-card {
    padding: 34px;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-users {
    min-height: 420px;
  }
}

@media (max-width: 640px) {
  .advisor-options {
    grid-template-columns: 1fr;
  }

  .advisor-bar {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .advisor-change {
    grid-column: 2;
    justify-self: start;
  }

  .message,
  .message.user {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .message.user .avatar {
    grid-column: 1;
  }

  .message.user .message-body {
    grid-column: 2;
    justify-self: stretch;
    max-width: 100%;
  }

  .avatar {
    width: 30px;
    height: 30px;
  }

  .message-body,
  .diagnosis-card {
    width: 100%;
  }

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

  .send-button {
    width: auto;
    min-width: 82px;
  }

  .composer-footer,
  .choice-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .choice-grid {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .choice-chip {
    max-width: 260px;
    white-space: nowrap;
  }

  .term-guide summary {
    flex-wrap: wrap;
  }

  .term-guide summary::after {
    margin-left: 0;
  }

  .term-guide-kicker {
    white-space: normal;
  }

  .term-guide-pills {
    order: 3;
    width: 100%;
  }

  .auth-screen {
    min-height: 100vh;
    height: auto;
    overflow: auto;
    padding: 16px;
  }

  .login-card {
    padding: 22px;
  }

  .admin-panel {
    padding: 14px;
  }

  .admin-header,
  .admin-user-row,
  .admin-user-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-user-actions .text-button {
    width: 100%;
    min-height: 36px;
  }
}
.v5-dimension-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.v5-dimension-grid span {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(15, 118, 101, 0.14);
  background: #f7faf8;
  border-radius: 6px;
}

.v5-dimension-grid em,
.v5-dimension-grid strong {
  display: block;
  font-style: normal;
}

.v5-dimension-grid em {
  margin-bottom: 3px;
  color: #718078;
  font-size: 12px;
}

.v5-final-card .benchmark-block {
  border-left: 3px solid #159b78;
  background: #f3faf7;
}

.v5-final-card .advisor-perspective {
  border-left: 3px solid var(--accent-strong);
  background: #fbfefd;
}

.v5-final-card .advisor-perspective p + p {
  margin-top: 9px;
}

.international-case-analysis-section {
  margin: 12px 0;
  border-top: 1px solid rgba(50, 63, 72, 0.18);
  border-bottom: 1px solid rgba(50, 63, 72, 0.18);
  background: #fafbfc;
}

.international-case-analysis-heading {
  padding: 14px 14px 10px;
  border-left: 3px solid #ee9630;
}

.international-case-analysis-heading h3,
.international-case-analysis-heading p {
  margin: 0;
}

.international-case-analysis-heading h3 {
  color: var(--ink);
  font-size: 15px;
}

.international-case-analysis-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.international-case-reference {
  border-top: 1px solid rgba(50, 63, 72, 0.12);
}

.international-case-reference summary {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  color: var(--ink);
  cursor: pointer;
}

.international-case-reference summary span {
  font-size: 14px;
  font-weight: 750;
}

.international-case-reference summary small {
  color: var(--muted);
  font-size: 11px;
}

.international-case-reference-body {
  padding: 0 14px 14px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.68;
}

.international-case-reference-body p,
.international-case-reference-body ul {
  margin: 0;
}

.international-case-reference-body p + p,
.international-case-reference-body p + div,
.international-case-reference-body div + p,
.international-case-reference-body div + div {
  margin-top: 10px;
}

.international-case-reference-body strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 12px;
}

.international-case-reference-body ul {
  padding-left: 18px;
}

.international-case-limit {
  padding-left: 10px;
  border-left: 2px solid #ee9630;
}

.international-case-source {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(50, 63, 72, 0.18);
}

.international-case-source a,
.international-case-source span {
  color: #176f8a;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.benchmark-analysis-section {
  margin: 12px 0;
  border-top: 1px solid rgba(15, 118, 101, 0.2);
  border-bottom: 1px solid rgba(15, 118, 101, 0.2);
  background: #f7fbf9;
}

.benchmark-analysis-heading {
  padding: 14px 14px 10px;
}

.benchmark-analysis-heading h3,
.benchmark-analysis-heading p {
  margin: 0;
}

.benchmark-analysis-heading h3 {
  color: var(--ink);
  font-size: 15px;
}

.benchmark-analysis-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.benchmark-reference {
  border-top: 1px solid rgba(15, 118, 101, 0.14);
}

.benchmark-reference summary {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  color: var(--ink);
  cursor: pointer;
}

.benchmark-reference summary span {
  font-size: 14px;
  font-weight: 750;
}

.benchmark-reference summary small {
  color: var(--muted);
  font-size: 11px;
}

.benchmark-reference-body {
  padding: 0 14px 14px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.68;
}

.benchmark-reference-body p,
.benchmark-reference-body ul {
  margin: 0;
}

.benchmark-reference-body p + p,
.benchmark-reference-body p + div,
.benchmark-reference-body div + p {
  margin-top: 10px;
}

.benchmark-reference-body strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 12px;
}

.benchmark-reference-body ul {
  padding-left: 18px;
}

.benchmark-limit {
  padding-left: 10px;
  border-left: 2px solid #e0a34a;
}

.benchmark-sources {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(15, 118, 101, 0.22);
}

.benchmark-sources a,
.benchmark-sources span {
  color: var(--accent-strong);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.v5-feedback {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(32, 48, 42, 0.12);
}

.v5-feedback summary {
  color: #52635b;
  font-size: 13px;
  cursor: pointer;
}

.v5-feedback-options {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.v5-feedback-options button {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(15, 118, 101, 0.18);
  border-radius: 6px;
  background: #fff;
  color: #26352f;
  text-align: left;
  line-height: 1.5;
}

.v5-feedback-options button.selected {
  border-color: #0f7665;
  background: #edf8f4;
  color: #0f6658;
}
