:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: rgba(255, 255, 255, 0.88);
  --line: rgba(20, 20, 25, 0.1);
  --text: #17171d;
  --muted: #6e6e73;
  --blue: #0071e3;
  --blue-dark: #0057b8;
  --green: #34c759;
  --red: #ff3b30;
  --shadow: 0 24px 70px rgba(20, 20, 25, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(0, 113, 227, 0.16), transparent 30rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 38%);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  padding: 0 18px;
}

button:hover {
  background: var(--blue-dark);
}

button:disabled {
  background: #c7c7cc;
  cursor: not-allowed;
}

input,
textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  width: 100%;
}

input {
  min-height: 44px;
}

textarea {
  padding-bottom: 12px;
  padding-top: 12px;
}

.app-shell {
  margin: 0 auto;
  max-width: 1120px;
  min-height: 100vh;
  padding: 28px 20px 48px;
}

.portal-mode {
  background: #f5f5f7;
}

.portal-mode .app-shell {
  margin: 0;
  max-width: none;
  padding: 0;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 24px;
}

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

.brand-mark {
  align-items: center;
  background: #1d1d1f;
  border-radius: 14px;
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.brand strong,
.hero h1,
.panel h2,
.panel h3 {
  display: block;
}

.brand span,
.kicker,
.muted {
  color: var(--muted);
}

.language {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  color: var(--text);
}

.hero {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.7fr);
  margin-bottom: 24px;
}

.hero-copy {
  padding: 18px 0;
}

.kicker {
  font-size: 13px;
  font-weight: 800;
  margin: 0 0 10px;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.02;
  margin: 0 0 14px;
}

.hero p {
  color: #424248;
  font-size: 18px;
  line-height: 1.55;
  margin: 0;
  max-width: 700px;
}

.status-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.status-card {
  align-self: end;
  padding: 18px;
}

.status-row {
  align-items: center;
  display: flex;
  gap: 12px;
  padding: 12px 0;
}

.status-dot {
  background: var(--green);
  border-radius: 999px;
  height: 10px;
  width: 10px;
}

.layout {
  display: grid;
  gap: 18px;
  grid-template-columns: 300px minmax(0, 1fr);
}

.panel {
  padding: 20px;
}

.steps {
  display: grid;
  gap: 10px;
}

.step {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.step.current {
  border-color: rgba(0, 113, 227, 0.45);
  box-shadow: 0 12px 28px rgba(0, 113, 227, 0.12);
}

.step.done {
  color: var(--muted);
}

.chapter-body,
.result-box,
.login-grid {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}

.chapter-body {
  line-height: 1.7;
  margin: 18px 0;
  min-height: 160px;
}

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

.secondary {
  background: #eef5ff;
  color: var(--blue);
}

.secondary:hover {
  background: #dfedff;
}

.notice {
  border-radius: 14px;
  margin-bottom: 14px;
  padding: 12px 14px;
}

.notice.warn {
  background: #fff4d7;
  color: #7a4c00;
}

.notice.error {
  background: #ffe7e5;
  color: #8a1f19;
}

.notice.ok {
  background: #e9f9ee;
  color: #146c2e;
}

.question-list {
  display: grid;
  gap: 14px;
}

.question {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}

.option {
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
}

.option input {
  margin-top: 3px;
  min-height: auto;
  width: auto;
}

.exam-bar {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 12px 14px;
  position: sticky;
  top: 10px;
  z-index: 2;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.result-box {
  text-align: center;
}

.score {
  font-size: clamp(58px, 18vw, 104px);
  font-weight: 800;
  line-height: 1;
  margin: 18px 0 6px;
}

.pass {
  color: var(--green);
}

.fail {
  color: var(--red);
}

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

.business-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}

.business-item strong {
  display: block;
  margin-bottom: 8px;
}

.business-wide {
  grid-column: span 2;
}

.knowledge-list,
.ai-box {
  display: grid;
  gap: 10px;
}

.knowledge-row {
  align-items: center;
  background: #f5f5f7;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  gap: 12px;
  padding: 12px;
}

.knowledge-row span {
  align-items: center;
  background: #1d1d1f;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 26px;
  justify-content: center;
  width: 26px;
}

.knowledge-row small,
.ai-answer {
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

.business-item a {
  color: var(--blue);
  overflow-wrap: anywhere;
}

.business-tabs {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: inline-flex;
  gap: 6px;
  margin-bottom: 16px;
  padding: 6px;
}

.business-tabs button {
  background: transparent;
  color: var(--muted);
  min-height: 38px;
}

.business-tabs button.active {
  background: #1d1d1f;
  color: #fff;
}

.portal-shell {
  display: grid;
  gap: 0;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100vh;
  margin: 0;
  overflow: hidden;
}

.portal-sidebar {
  background: #ffffff;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 22px 18px;
}

.portal-brand {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.portal-brand small {
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.mobile-portal-head,
.mobile-tabbar {
  display: none;
}

.portal-nav {
  background: transparent;
  color: var(--text);
  display: block;
  margin-bottom: 8px;
  min-height: auto;
  padding: 13px 14px;
  text-align: left;
  width: 100%;
}

.portal-nav-home {
  display: none;
}

.portal-nav.active {
  background: #1d1d1f;
  color: #fff;
}

.portal-nav span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.portal-nav.active span {
  color: rgba(255, 255, 255, 0.72);
}

.portal-side-card {
  background: #f5f5f7;
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-top: 24px;
  padding: 14px;
}

.portal-side-card a,
.portal-side-card p {
  color: var(--muted);
  display: block;
  font-size: 13px;
  line-height: 1.45;
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

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

.portal-top {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

.portal-top h1 {
  font-size: 30px;
  line-height: 1.1;
  margin: 0;
}

.support-workspace,
.learning-workspace {
  display: grid;
  gap: 0;
  grid-template-columns: 260px minmax(520px, 1fr) 320px;
  min-height: 0;
  overflow: hidden;
}

.learning-workspace {
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
}

.account-workspace {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 0;
  overflow: hidden;
}

.home-workspace {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 0;
}

.mobile-promotion-card,
.today-card,
.mobile-status-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.mobile-promotion-card {
  display: grid;
  gap: 18px;
  grid-column: 1 / -1;
}

.mobile-promotion-card span,
.mobile-status-card span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
}

.mobile-promotion-card strong {
  display: block;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.promotion-actions {
  display: flex;
  gap: 10px;
}

.button-link {
  align-items: center;
  background: #f5f5f7;
  border-radius: 12px;
  color: var(--text);
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  text-decoration: none;
}

.task-row {
  align-items: center;
  background: #f5f5f7;
  border: 1px solid var(--line);
  color: var(--text);
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding: 14px;
  text-align: left;
  width: 100%;
}

.task-row:hover {
  background: #eeeeef;
}

.task-row.static {
  border-radius: 12px;
}

.task-row span {
  color: var(--muted);
  font-size: 13px;
}

.mobile-status-card {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.mobile-status-card button {
  min-height: 38px;
}

.support-workspace {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.support-context,
.knowledge-panel,
.support-chat,
.support-directory,
.support-inspector {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.support-context {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.support-context .business-item {
  box-shadow: none;
}

.support-directory,
.support-inspector {
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.support-directory {
  border-right: 1px solid var(--line);
}

.support-inspector {
  background: #fafafa;
  border-left: 1px solid var(--line);
}

.directory-title,
.inspector-card {
  margin-bottom: 12px;
}

.directory-title span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.support-category,
.inspector-prompt {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  display: block;
  margin-bottom: 8px;
  min-height: auto;
  padding: 12px;
  text-align: left;
  width: 100%;
}

.support-category.active {
  background: #eef5ff;
  border-color: rgba(0, 113, 227, 0.45);
  box-shadow: none;
}

.support-category span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.inspector-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.inspector-card.primary {
  background: #1d1d1f;
  color: #fff;
}

.inspector-card.primary h3 {
  font-size: 22px;
  margin: 8px 0 6px;
}

.inspector-card.primary p {
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.55;
  margin: 0;
}

.inspector-prompt {
  background: #f5f5f7;
  margin-top: 8px;
}

.support-chat {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
}

.chat-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 18px;
}

.chat-head span,
.panel-title span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.online-dot {
  background: var(--green);
  border-radius: 999px;
  height: 12px;
  width: 12px;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px 0;
}

.prompt-chip {
  background: #eef5ff;
  color: var(--blue);
  min-height: 34px;
  padding: 0 12px;
}

.message-list {
  background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.message {
  border-radius: 18px;
  line-height: 1.6;
  max-width: 82%;
  padding: 12px 14px;
}

.message p {
  margin: 0;
}

.message small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 6px;
}

.message.assistant {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--line);
}

.message.user {
  align-self: flex-end;
  background: #0071e3;
  color: #fff;
}

.message.user small {
  color: rgba(255, 255, 255, 0.72);
}

.chat-input {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px 16px;
}

.knowledge-panel {
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

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

.account-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
}

.account-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.account-metrics div,
.risk-rules div {
  background: #f5f5f7;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.account-metrics span,
.risk-rules span,
.appeal-form span {
  color: var(--muted);
  display: block;
  font-size: 13px;
}

.account-metrics strong {
  display: block;
  font-size: 18px;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.risk-rules {
  display: grid;
  gap: 12px;
}

.risk-rules b {
  display: block;
  margin-bottom: 6px;
}

.account-inspector {
  background: transparent;
  border-left: 0;
  padding: 0;
}

.appeal-form {
  display: grid;
  gap: 12px;
}

.appeal-form label {
  display: grid;
  gap: 6px;
}

.appeal-form textarea {
  min-height: 118px;
  resize: vertical;
}

@media (max-width: 760px) {
  body.portal-mode {
    height: 100svh;
    overflow: hidden;
  }

  .app-shell {
    height: 100svh;
    overflow: hidden;
    padding: 0;
  }

  .topbar,
  .hero,
  .layout,
  .business-grid,
  .support-workspace,
  .learning-workspace,
  .account-workspace,
  .account-metrics,
  .home-workspace {
    grid-template-columns: 1fr;
  }

  .portal-shell {
    display: block;
    height: 100svh;
    margin: 0;
    min-height: 0;
    overflow: hidden;
  }

  .portal-sidebar {
    display: none;
  }

  .mobile-portal-head {
    background: rgba(245, 245, 247, 0.96);
    border-bottom: 1px solid var(--line);
    display: block;
    flex: 0 0 auto;
    margin: -12px -12px 10px;
    padding: 12px;
    z-index: 5;
  }

  .mobile-head-row {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .mobile-portal-head .portal-brand {
    margin-bottom: 0;
  }

  .mobile-head-title {
    min-width: 0;
  }

  .mobile-head-title .kicker {
    font-size: 11px;
    margin-bottom: 3px;
  }

  .mobile-head-title h1 {
    font-size: 24px;
    line-height: 1;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .portal-main {
    display: flex;
    flex-direction: column;
    height: 100svh;
    min-height: 0;
    overflow: hidden;
    padding: 12px;
  }

  .portal-top {
    display: none;
  }

  .mobile-tabbar {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: none;
    display: grid;
    flex: 0 0 auto;
    gap: 6px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 12px;
    padding: 5px;
  }

  .mobile-tabbar button {
    background: transparent;
    border-radius: 14px;
    color: var(--muted);
    font-size: 12px;
    min-height: 40px;
    padding: 0 4px;
  }

  .mobile-tabbar button.active {
    background: #1d1d1f;
    color: #fff;
  }

  .home-workspace {
    flex: 1 1 auto;
    gap: 12px;
    min-height: 0;
    overflow-y: auto;
  }

  .mobile-promotion-card,
  .today-card,
  .mobile-status-card,
  .account-panel,
  .inspector-card {
    border-radius: 18px;
    box-shadow: none;
    padding: 14px;
  }

  .mobile-promotion-card strong {
    font-size: 18px;
  }

  .promotion-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .business-wide {
    grid-column: auto;
  }

  .support-workspace {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  .support-directory {
    border-right: 0;
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    margin: 0 -12px 10px;
    overflow-x: auto;
    padding: 0 12px 4px;
  }

  .directory-title,
  .support-inspector {
    display: none;
  }

  .support-category {
    flex: 0 0 150px;
    margin-bottom: 0;
    min-height: 62px;
  }

  .support-chat {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 18px;
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    overflow: hidden;
  }

  .quick-prompts {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .message-list {
    padding: 14px;
  }

  .chat-input {
    grid-template-columns: 1fr;
    padding: 10px 14px 14px;
  }

  .learning-workspace,
  .account-workspace {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }

  .learning-workspace .support-inspector,
  .account-inspector {
    display: block;
    margin-top: 12px;
  }

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

  .hero h1 {
    font-size: 36px;
  }

  .layout {
    display: block;
  }

  .steps {
    margin-bottom: 14px;
  }

  .exam-bar {
    align-items: flex-start;
    flex-direction: column;
  }
}
