:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --soft: #f7faff;
  --ink: #152033;
  --muted: #66758b;
  --line: #dce5f1;
  --blue: #1f63ee;
  --teal: #008f8c;
  --red: #c73535;
  --amber: #b56a00;
  --shadow: 0 14px 36px rgba(21, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 8px 12px 12px;
}

.topbar {
  height: 56px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.brand h1,
h2,
h3,
p {
  margin: 0;
}

.eyebrow,
.panel-kicker,
.card-head p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.25;
}

.view-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(21, 32, 51, 0.05);
}

.view-tab,
.icon-link,
.file-button,
.secondary-button,
.quick-actions button {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.view-tab {
  border: 0;
  min-width: 118px;
}

.view-tab.active {
  background: var(--blue);
  color: #fff;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.file-button input {
  display: none;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.dashboard-full {
  height: calc(100vh - 76px);
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}

iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.agent-workspace {
  display: grid;
  grid-template-columns: minmax(720px, 1fr) 420px;
  gap: 12px;
  align-items: start;
}

.agent-main,
.chat-card,
.report-panel,
.analysis-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.agent-main {
  padding: 12px;
}

.agent-hero,
.chat-card-head,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.agent-title h2,
.chat-card h2,
.panel-head h2 {
  font-size: 17px;
}

.agent-avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--blue), var(--teal));
  color: #fff;
  font-weight: 700;
}

.agent-filters {
  display: flex;
  gap: 8px;
}

select {
  height: 34px;
  min-width: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.metric span {
  display: block;
  font-size: 24px;
  font-weight: 700;
}

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

.metric.danger span {
  color: var(--red);
}

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

.analysis-card {
  padding: 14px;
  min-height: 190px;
}

.card-head {
  margin-bottom: 10px;
}

.card-head h3 {
  font-size: 16px;
  line-height: 1.4;
}

.analysis-output,
.report-output {
  color: #29364b;
  font-size: 14px;
  line-height: 1.65;
}

.analysis-output ul,
.report-output ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.analysis-output li,
.report-output li {
  margin: 4px 0;
}

.pill-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  border-radius: 999px;
  background: #eef5ff;
  color: #214e91;
  padding: 0 9px;
  font-size: 12px;
}

.report-panel {
  margin-top: 10px;
}

.panel-head.compact {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.report-output {
  min-height: 220px;
  padding: 14px;
}

.chat-card {
  padding: 12px;
  position: sticky;
  top: 8px;
}

.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.quick-actions button {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  background: #f8fbff;
}

.chat-log {
  height: calc(100vh - 360px);
  min-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
}

.message {
  width: fit-content;
  max-width: 94%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.55;
  font-size: 14px;
  white-space: pre-wrap;
}

.message.user {
  margin-left: auto;
  background: #e8f0ff;
  color: #123a88;
}

.message.agent {
  background: #fff;
  border: 1px solid var(--line);
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  margin-top: 10px;
}

.chat-form input {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.chat-form button {
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
}

@media (max-width: 1280px) {
  body {
    min-width: 1020px;
  }

  .agent-workspace {
    grid-template-columns: minmax(620px, 1fr) 380px;
  }
}
