:root {
  --ink: #172033;
  --muted: #66758a;
  --soft-text: #98a2b3;
  --line: #e5ecf5;
  --line-strong: #cbd9ea;
  --page: #f4f7fb;
  --panel: #ffffff;
  --accent: #2f6fec;
  --accent-strong: #2457c5;
  --accent-soft: #edf4ff;
  --accent-hover: #e3efff;
  --accent-line: #bdd5ff;
  --indigo: #4f46e5;
  --indigo-soft: #eef2ff;
  --green: #20b486;
  --amber: #f5a524;
  --red: #f05252;
  --shadow: 0 24px 60px rgba(24, 58, 118, 0.12);
  --shadow-soft: 0 12px 30px rgba(24, 58, 118, 0.08);
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--page);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 18% 10%, rgba(47, 111, 236, 0.1), transparent 30%),
    radial-gradient(circle at 82% 16%, rgba(125, 165, 232, 0.1), transparent 28%);
  content: "";
  pointer-events: none;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(560px, 1fr) 302px;
  gap: 18px;
  min-height: 100vh;
  padding: 22px;
}

.agent-sidebar,
.utility-panel {
  position: sticky;
  top: 22px;
  height: calc(100vh - 44px);
  min-width: 0;
  overflow-y: auto;
}

.agent-sidebar,
.utility-card,
.chat-panel,
.context-banner {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.agent-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border-radius: var(--radius-lg);
  animation: surfaceIn 0.42s ease both;
}

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

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border: 1px solid var(--accent-line);
  border-radius: 15px;
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 1px 0 #fff, 0 10px 24px rgba(24, 58, 118, 0.08);
  font-weight: 900;
}

.eyebrow,
.section-label {
  margin: 0 0 6px;
  color: #607da8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand h1,
.chat-topbar h2,
.context-banner h3,
.composer-top h3,
.utility-card h2 {
  margin: 0;
}

.brand h1 {
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.sidebar-section {
  display: grid;
  gap: 10px;
}

.feature-nav {
  display: grid;
  gap: 10px;
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 13px 13px 13px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  text-align: left;
  background: #fff;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.nav-item:hover,
.nav-item.active {
  transform: translateY(-2px);
  border-color: var(--accent-line);
  background: #f8fbff;
  box-shadow: 0 14px 28px rgba(24, 58, 118, 0.1);
}

.nav-item.active::before {
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: -1px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.nav-icon,
.soft-icon {
  display: grid;
  place-items: center;
  border: 1px solid var(--accent-line);
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.nav-item.active .nav-icon {
  color: #fff;
  border-color: transparent;
  background: var(--accent);
}

.nav-item strong,
.tool-item strong {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
  letter-spacing: 0.005em;
}

.nav-item small,
.tool-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.chat-shell {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
  animation: surfaceIn 0.46s ease 0.04s both;
}

.chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}

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

.chat-topbar h2 {
  font-size: 27px;
  letter-spacing: 0.01em;
}

.title-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid var(--accent-line);
  border-radius: 15px;
  color: var(--accent);
  background: var(--accent-soft);
}

.title-icon.compact {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  border-radius: 12px;
}

.primary-button,
.ghost-button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 11px;
  font-weight: 800;
}

.primary-button {
  border: 1px solid var(--accent);
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 22px rgba(47, 111, 236, 0.18);
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.primary-button:hover {
  background: var(--accent-strong);
  box-shadow: 0 12px 26px rgba(47, 111, 236, 0.22);
  transform: translateY(-1px);
}

.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 96px;
}

.send-button svg {
  width: 18px;
  height: 18px;
}

.ghost-button {
  border: 1px solid var(--line-strong);
  color: var(--accent);
  background: rgba(255, 255, 255, 0.86);
}

.context-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 18px 20px 18px 18px;
  border-radius: var(--radius-lg);
  background: #fff;
}

.context-banner h3 {
  font-size: 24px;
  line-height: 1.32;
  letter-spacing: 0.005em;
}

.context-banner p:not(.eyebrow) {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.chat-panel {
  display: flex;
  min-height: 668px;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.chat-window {
  display: grid;
  gap: 16px;
  flex: 1;
  align-content: start;
  padding: 24px;
  overflow-y: auto;
  background: #fbfcfe;
}

.message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.user-message {
  justify-content: flex-end;
}

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid var(--accent-line);
  border-radius: 14px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 900;
}

.user-avatar {
  color: #5b6472;
  background: #f2f4f7;
}

.bubble {
  max-width: min(780px, calc(100% - 52px));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(24, 58, 118, 0.07);
}

.assistant-bubble {
  padding: 15px 17px;
  background: #fff;
}

.user-bubble {
  padding: 15px 17px;
  color: var(--ink);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.bubble p {
  margin: 0;
  line-height: 1.75;
}

.output-message .bubble {
  width: min(980px, calc(100% - 52px));
  max-width: none;
}

.output-bubble {
  overflow: hidden;
  background: #fff;
}

.composer {
  display: grid;
  gap: 12px;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.composer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.composer-top h3 {
  font-size: 18px;
}

.composer-top span,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 14px 15px;
  color: #24364b;
  line-height: 1.7;
  background: #fff;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  align-items: end;
  gap: 10px;
}

.input-row textarea {
  min-height: 92px;
}

.input-row .send-button {
  width: 46px;
  min-width: 46px;
  min-height: 46px;
  align-self: end;
  padding: 0;
  border-radius: 15px;
}

.input-row .send-button span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-row span {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #4d6883;
  background: #f9fbff;
  font-size: 12px;
}

.utility-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: surfaceIn 0.42s ease 0.08s both;
}

.utility-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: #fff;
}

.card-title {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.soft-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
}

.utility-card h2 {
  font-size: 18px;
}

.stage-strip {
  display: grid;
  gap: 8px;
}

.stage {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  text-align: left;
  background: #fff;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.stage:hover,
.stage.active {
  transform: translateY(-2px);
  border-color: var(--accent-line);
  background: #f8fbff;
  box-shadow: 0 12px 22px rgba(24, 58, 118, 0.08);
}

.stage-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
}

.stage-icon svg {
  width: 18px;
  height: 18px;
}

.stage.active .stage-icon {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.stage-copy {
  min-width: 0;
}

.stage-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.stage strong {
  color: var(--ink);
  font-size: 14px;
}

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

.signal-cell {
  display: flex;
  min-height: 84px;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

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

.signal-cell strong {
  color: var(--accent);
  font-size: 22px;
}

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

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

.main-panel {
  padding: 18px;
}

.panel-topline {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding-left: 12px;
}

.panel-topline::before {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.panel-topline h3 {
  margin: 0;
  font-size: 21px;
}

.panel-topline p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.case-list,
.question-list,
.risk-list {
  display: grid;
  gap: 12px;
}

.case-item,
.question-item,
.risk-item,
.insight-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(24, 58, 118, 0.04);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.case-item:hover,
.question-item:hover,
.risk-item:hover,
.insight-card:hover {
  transform: translateY(-1px);
  border-color: var(--accent-line);
  box-shadow: 0 12px 24px rgba(24, 58, 118, 0.08);
}

.case-item {
  display: grid;
  grid-template-columns: 1fr 86px;
  gap: 14px;
}

.case-item h4,
.question-item h4,
.risk-item h4,
.insight-card h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.case-item p,
.question-item p,
.risk-item p,
.insight-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.match-score {
  display: grid;
  place-items: center;
  align-self: stretch;
  border-radius: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 20px;
  font-weight: 900;
}

.scheme-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.scheme-table th,
.scheme-table td {
  padding: 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.scheme-table th {
  color: #456480;
  background: #f8fafc;
  font-size: 13px;
}

.scheme-table tr:last-child td {
  border-bottom: 0;
}

.scheme-table tbody tr {
  transition: background 0.16s ease;
}

.scheme-table tbody tr:hover {
  background: #f8fbff;
}

.score {
  font-weight: 900;
}

.score.good {
  color: var(--green);
}

.score.mid {
  color: var(--amber);
}

.score.risk {
  color: var(--red);
}

.question-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 13px;
}

.question-index {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 900;
}

.risk-item {
  display: grid;
  grid-template-columns: 120px 1fr 64px;
  gap: 14px;
  align-items: center;
}

.risk-level {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4eef8;
}

.risk-level span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.risk-level.low span {
  width: 38%;
  background: var(--green);
}

.risk-level.medium span {
  width: 64%;
  background: var(--amber);
}

.risk-level.high span {
  width: 82%;
  background: var(--red);
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

@keyframes surfaceIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1240px) {
  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .utility-panel {
    position: static;
    grid-column: 1 / -1;
    height: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .agent-sidebar,
  .utility-panel {
    position: static;
    height: auto;
  }

  .utility-panel,
  .feature-nav,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .chat-topbar,
  .panel-topline {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .top-actions,
  .top-actions button,
  .input-row button {
    width: 100%;
  }

  .input-row .send-button {
    width: 46px;
    min-height: 46px;
  }

  .signal-board {
    grid-template-columns: 1fr;
  }

  .context-banner h3 {
    font-size: 21px;
  }

  .bubble,
  .output-message .bubble {
    width: calc(100% - 50px);
    max-width: calc(100% - 50px);
  }

  .case-item,
  .risk-item {
    grid-template-columns: 1fr;
  }

  .scheme-table {
    display: block;
    overflow-x: auto;
  }
}
