:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #111827;
  --muted: #64748b;
  --line: #e2e8f0;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --cyan: #06b6d4;
  --green: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
  --purple: #8b5cf6;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
  min-height: 68px;
  padding: 14px clamp(18px, 3vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.nav-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 22px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #52637a;
  font-size: 17px;
  font-weight: 700;
}

.nav-tab.is-active {
  background: #eaf1ff;
  color: var(--blue);
}

.nav-icon {
  font-size: 20px;
  line-height: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.model-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--cyan);
  color: #032232;
  font-size: 13px;
  font-weight: 800;
}

.avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
}

.workspace {
  padding: 22px clamp(18px, 3vw, 48px) 34px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.hero {
  min-height: 230px;
  display: flex;
  align-items: center;
  padding: clamp(26px, 5vw, 54px);
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
}

.hero h1,
.view-head h1,
.staff-head h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.15;
  letter-spacing: 0;
}

.hero p {
  max-width: 760px;
  margin: 14px 0 26px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 18px;
  line-height: 1.55;
}

.topic-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.topic-row span {
  padding: 8px 18px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 700;
}

.qa-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  margin-top: 28px;
}

.chat-shell,
.side-card,
.metric-card,
.chart-card,
.ask-card,
.staff-card,
.recommend-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chat-shell {
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr) auto;
  min-height: 640px;
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.bot-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  font-weight: 900;
}

.chat-head h2,
.card-title h2,
.side-card h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.chat-head p,
.card-title span {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.online-dot {
  margin-left: auto;
  color: var(--green);
  font-weight: 700;
}

.online-dot::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--green);
}

.answer {
  overflow: auto;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  color: #142033;
  white-space: pre-wrap;
  font: 14px/1.72 "Microsoft YaHei", "PingFang SC", sans-serif;
}

.chat-answer {
  border: 0;
  border-radius: 0;
  padding: 30px 34px;
  background:
    linear-gradient(#fff, #fff) padding-box,
    radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.08), transparent 32%) border-box;
  font-size: 16px;
}

.chat-message {
  display: grid;
  gap: 8px;
  max-width: 82%;
  margin-bottom: 18px;
}

.chat-message--user {
  margin-left: auto;
}

.message-role {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.chat-message--user .message-role {
  text-align: right;
}

.message-content {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #142033;
  line-height: 1.72;
  white-space: pre-wrap;
}

.chat-message--user .message-content {
  border-color: rgba(37, 99, 235, 0.4);
  background: #eaf1ff;
}

.chat-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 12px;
  padding: 22px 26px;
  border-top: 1px solid var(--line);
  background: #fff;
}

textarea {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  border: 1px solid #d8e1ed;
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
  color: var(--text);
  line-height: 1.55;
}

.chat-compose textarea {
  min-height: 58px;
  max-height: 160px;
}

textarea:focus,
input:focus,
button:focus {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

.send-button,
.ask-card button,
.recommend-card button {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

.send-button {
  min-height: 58px;
  font-size: 22px;
}

button:disabled {
  cursor: wait;
  opacity: 0.75;
}

.side-stack {
  display: grid;
  gap: 22px;
  align-content: start;
}

.side-card {
  padding: 24px;
}

.side-card h3 {
  margin-bottom: 16px;
}

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

.history-title h3 {
  margin: 0;
}

.history-title button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(37, 99, 235, 0.35);
  border-radius: 8px;
  background: #edf4ff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

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

.session-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  background: #f8fafc;
  color: var(--text);
  text-align: left;
}

.session-item:hover {
  border-color: rgba(37, 99, 235, 0.5);
}

.session-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-item span,
.empty-history {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.quick-question {
  display: block;
  width: 100%;
  min-height: 46px;
  margin-top: 10px;
  padding: 0 16px;
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  background: #f8fafc;
  color: var(--text);
  text-align: left;
  font-weight: 700;
}

.quick-question:hover {
  border-color: rgba(37, 99, 235, 0.5);
  color: var(--blue);
}

.progress-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  margin-top: 16px;
  color: var(--muted);
}

.progress-row strong {
  color: var(--blue);
}

.progress-row i {
  grid-column: 1 / -1;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue) var(--value), #e2e8f0 var(--value));
}

.view-head,
.staff-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 10px 0 24px;
}

.period-tabs {
  display: flex;
  gap: 10px;
}

.period-tabs span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}

.period-tabs .is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.metric-card {
  min-height: 168px;
  padding: 24px;
}

.metric-card span {
  color: var(--muted);
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin: 14px 0 8px;
  font-size: 36px;
  line-height: 1;
}

.metric-card p {
  margin: 0 0 12px;
  color: var(--muted);
}

.metric-card em {
  font-style: normal;
  font-weight: 800;
}

.trend-up,
.trend-ok {
  color: var(--green);
}

.trend-warn {
  color: var(--orange);
}

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

.chart-card,
.ask-card {
  padding: 24px;
}

.chart-card--wide {
  min-height: 360px;
}

.card-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.bar-chart {
  display: grid;
  gap: 18px;
  padding-top: 8px;
}

.bar-chart div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 86px;
  gap: 14px;
  align-items: center;
}

.bar-chart span,
.bar-chart strong {
  color: var(--muted);
  font-weight: 800;
}

.bar-chart i {
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--bar) var(--value), #edf2f7 var(--value));
}

.donut {
  width: 210px;
  height: 210px;
  margin: 12px auto 20px;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0 61%, var(--blue) 61% 91%, var(--orange) 91% 100%);
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 42px;
  border-radius: 50%;
  background: #fff;
}

.legend {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.legend b {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 8px;
  border-radius: 3px;
}

.legend .green {
  background: var(--green);
}

.legend .blue {
  background: var(--blue);
}

.legend .orange {
  background: var(--orange);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
}

.ask-card,
.recommend-card {
  display: grid;
  gap: 14px;
  align-content: start;
}

.ask-card textarea,
.recommend-card textarea {
  min-height: 120px;
}

.ask-card .answer,
.recommend-card .answer {
  min-height: 230px;
}

.staff-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: min(420px, 100%);
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid #d8e1ed;
  border-radius: 12px;
  background: #fff;
}

.staff-search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
}

.staff-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 22px;
  align-items: start;
}

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

.staff-card {
  min-height: 220px;
  padding: 24px;
}

.staff-card > span {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #fff;
  font-size: 26px;
  font-weight: 900;
}

.staff-card h2 {
  margin: 16px 0 4px;
  font-size: 20px;
}

.staff-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 700;
}

.staff-card strong {
  display: block;
  margin-bottom: 10px;
  color: var(--green);
}

.staff-card div {
  display: inline-flex;
  margin: 0 6px 8px 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: #edf4ff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.footer-note {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(18px, 3vw, 48px) 28px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .qa-layout,
  .dashboard-grid,
  .staff-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .app-header,
  .view-head,
  .staff-head,
  .footer-note {
    display: block;
  }

  .nav-tabs {
    justify-content: start;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .header-right,
  .period-tabs,
  .staff-search {
    margin-top: 14px;
  }

  .hero {
    padding: 24px;
  }

  .metric-grid,
  .staff-grid {
    grid-template-columns: 1fr;
  }

  .chat-shell {
    min-height: auto;
    grid-template-rows: auto minmax(300px, 1fr) auto;
  }

  .chat-compose {
    grid-template-columns: 1fr;
  }

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