:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #f0f4f4;
  --ink: #17212b;
  --muted: #5d6875;
  --subtle: #89939f;
  --line: #dce4e7;
  --line-strong: #c3d0d4;
  --teal: #0f766e;
  --teal-dark: #0b5f59;
  --teal-soft: #e3f4f1;
  --amber: #b7791f;
  --amber-soft: #fff4dd;
  --red: #b42318;
  --red-soft: #fde8e7;
  --green: #257a4b;
  --green-soft: #e4f5eb;
  --shadow: 0 18px 50px rgba(23, 33, 43, 0.08);
  --radius: 6px;
  --sidebar: 264px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  color: inherit;
  text-decoration: none;
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 48px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--teal);
  display: grid;
  place-items: center;
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 20px;
  font-weight: 760;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  border: 0;
  width: 100%;
  min-height: 42px;
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 680;
  text-align: left;
}

.nav-item svg {
  color: var(--subtle);
}

.nav-item:hover,
.nav-item.active {
  color: var(--ink);
  background: var(--surface-soft);
}

.nav-item.active svg {
  color: var(--teal);
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfc;
}

.sidebar-footer p,
.sidebar-footer span {
  margin: 0;
  color: var(--subtle);
  font-size: 12px;
  line-height: 18px;
}

.sidebar-footer strong {
  display: block;
  margin: 4px 0 6px;
  font-size: 14px;
  line-height: 20px;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  min-height: 62px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.topbar h1,
.panel-head h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 28px;
  line-height: 34px;
  font-weight: 780;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

.project-switcher {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.project-switcher label {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  gap: 6px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  outline: none;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

select,
input {
  min-height: 40px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 10px 12px;
  line-height: 1.55;
}

.ghost-btn,
.primary-btn,
.text-btn {
  border: 0;
  border-radius: var(--radius);
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 720;
}

.ghost-btn {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

.ghost-btn:hover {
  border-color: var(--line-strong);
  background: #fbfcfc;
}

.primary-btn {
  color: #fff;
  background: var(--teal);
}

.primary-btn:hover {
  background: var(--teal-dark);
}

.text-btn {
  min-height: 32px;
  padding: 0 8px;
  color: var(--teal);
  background: transparent;
}

.icon-only {
  width: 40px;
  padding: 0;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card {
  min-height: 104px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric-card.strong {
  background: var(--teal-soft);
  border-color: rgba(15, 118, 110, 0.22);
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.metric-card strong {
  display: block;
  margin: 9px 0 4px;
  font-size: 28px;
  line-height: 34px;
  font-weight: 780;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(360px, 1.25fr) minmax(310px, 1fr);
  gap: 14px;
  align-items: start;
}

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

.panel {
  min-width: 0;
}

.panel-head {
  min-height: 66px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-head > div:first-child {
  min-width: 0;
}

.index {
  display: block;
  color: var(--teal);
  font-size: 12px;
  font-weight: 780;
  line-height: 16px;
}

.panel-head h2 {
  margin-top: 2px;
  font-size: 18px;
  line-height: 24px;
  font-weight: 760;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.input-panel form {
  padding: 16px 18px 18px;
  display: grid;
  gap: 13px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.evidence-tags legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.evidence-tags {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
}

.evidence-tags legend {
  padding: 0 6px;
}

.evidence-tags label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.evidence-tags input {
  width: 15px;
  min-height: auto;
  accent-color: var(--teal);
}

.flow-panel {
  display: grid;
  gap: 0;
}

.skill-map {
  padding: 18px;
  display: grid;
  gap: 10px;
}

.skill-node {
  position: relative;
  min-height: 70px;
  padding: 13px 14px 13px 56px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfc;
}

.skill-node::before {
  content: attr(data-step);
  position: absolute;
  left: 14px;
  top: 16px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 780;
}

.skill-node::after {
  content: "";
  position: absolute;
  left: 27px;
  top: 52px;
  bottom: -14px;
  width: 2px;
  background: var(--line);
}

.skill-node:last-child::after {
  display: none;
}

.skill-node h3 {
  margin: 0;
  font-size: 15px;
  line-height: 20px;
}

.skill-node p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.skill-node.done {
  border-color: rgba(15, 118, 110, 0.28);
  background: var(--teal-soft);
}

.skill-node.done::before {
  color: #fff;
  background: var(--teal);
}

.skill-node.active {
  border-color: rgba(183, 121, 31, 0.42);
  background: var(--amber-soft);
}

.skill-node.active::before {
  color: #fff;
  background: var(--amber);
}

.agent-card {
  margin: 0 18px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfc;
  overflow: hidden;
}

.agent-head {
  min-height: 58px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.agent-head span {
  color: var(--subtle);
  font-size: 12px;
  line-height: 16px;
}

.agent-head strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  line-height: 20px;
}

.status-dot {
  min-width: 58px;
  min-height: 24px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 12px;
  font-weight: 760;
}

.status-dot.busy {
  color: var(--amber);
  background: var(--amber-soft);
}

.chat-log {
  min-height: 150px;
  max-height: 220px;
  overflow: auto;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.message {
  width: fit-content;
  max-width: 92%;
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.message.user {
  margin-left: auto;
  color: #fff;
  background: var(--teal);
}

.message.agent {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

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

.output-panel {
  min-height: 600px;
}

.report-stack {
  padding: 16px 18px 8px;
  display: grid;
  gap: 10px;
}

.report-card {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfc;
}

.report-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 20px;
}

.report-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.report-card .marker {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  margin-top: 10px;
  padding: 0 8px;
  border-radius: 99px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 12px;
  font-weight: 760;
}

.report-card.risk .marker {
  color: var(--amber);
  background: var(--amber-soft);
}

.report-card.danger .marker {
  color: var(--red);
  background: var(--red-soft);
}

.report-text {
  margin: 8px 18px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.report-toolbar {
  min-height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fbfcfc;
}

.report-toolbar strong {
  font-size: 13px;
}

.report-toolbar span {
  color: var(--subtle);
  font-size: 12px;
}

.report-text textarea {
  border: 0;
  border-radius: 0;
  min-height: 188px;
  background: var(--surface);
  font-size: 13px;
}

.validation-panel {
  margin-top: 14px;
}

.validation-grid {
  padding: 16px 18px 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

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

.week-card strong,
.week-card span {
  display: block;
}

.week-card span {
  color: var(--teal);
  font-size: 12px;
  line-height: 16px;
  font-weight: 780;
}

.week-card strong {
  margin: 5px 0 10px;
  font-size: 15px;
  line-height: 20px;
}

.week-card label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.week-card input {
  width: 15px;
  min-height: auto;
  margin-top: 2px;
  accent-color: var(--teal);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(24px);
  opacity: 0;
  pointer-events: none;
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 720;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .workbench {
    grid-template-columns: minmax(280px, 0.95fr) minmax(360px, 1.25fr);
  }

  .output-panel {
    grid-column: 1 / -1;
  }

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

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow-x: auto;
  }

  .nav-item {
    justify-content: center;
    min-width: 96px;
    padding: 0 10px;
  }

  .nav-item svg {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .workspace {
    padding: 14px;
  }

  .topbar {
    display: grid;
  }

  .project-switcher {
    justify-content: stretch;
  }

  .project-switcher label {
    width: 100%;
  }

  .dashboard,
  .workbench,
  .validation-grid {
    grid-template-columns: 1fr;
  }

  .panel-head {
    align-items: flex-start;
    display: grid;
  }
}
