:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --panel-soft: #f0f5ef;
  --ink: #17201b;
  --muted: #657067;
  --line: #d9dfd8;
  --accent: #1f7a5a;
  --accent-strong: #155d45;
  --blue: #2869a6;
  --amber: #b46a20;
  --danger: #b23b3b;
  --shadow: 0 16px 40px rgba(31, 42, 35, 0.08);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.12;
}

.system-pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.system-pill.ok,
.status-badge.ok {
  border-color: rgba(31, 122, 90, 0.24);
  background: #eaf5ef;
  color: var(--accent-strong);
}

.system-pill.error,
.status-badge.error {
  border-color: rgba(178, 59, 59, 0.24);
  background: #fbebeb;
  color: var(--danger);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  gap: 18px;
  max-width: 1440px;
  margin: 0 auto;
}

.control-panel,
.result-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.control-panel {
  align-self: start;
  padding: 16px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(106px, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8f5;
}

.tab-button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab-button.active {
  background: var(--ink);
  color: #fff;
}

.panel-section {
  display: none;
  padding-top: 16px;
}

.panel-section.active {
  display: block;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
}

.field span {
  color: #344039;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input {
  height: 42px;
  padding: 0 12px;
}

select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 156px;
  resize: vertical;
  padding: 12px;
  line-height: 1.58;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(31, 122, 90, 0.52);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 122, 90, 0.12);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 14px;
}

.ghost-button,
.icon-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #334038;
}

.ghost-button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.icon-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.primary-button {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled,
.ghost-button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.recent-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.section-heading,
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2,
.result-header h2 {
  margin: 0;
  font-size: 20px;
}

.section-heading h3 {
  margin: 0;
}

.muted-label {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.recent-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.recent-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  text-align: left;
}

.recent-item.active {
  border-color: rgba(31, 122, 90, 0.5);
  background: #edf7f1;
}

.recent-item strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.result-panel {
  min-height: calc(100vh - 112px);
  padding: 18px;
}

.result-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.empty-state {
  display: grid;
  place-content: center;
  min-height: 420px;
  color: var(--muted);
  text-align: center;
}

.empty-state h3 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 24px;
}

.empty-state p {
  max-width: 520px;
  margin-bottom: 0;
  line-height: 1.7;
}

.hidden {
  display: none !important;
}

.result-content {
  display: grid;
  gap: 14px;
  padding-top: 16px;
}

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

.metric {
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

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

.block h3 {
  margin-bottom: 10px;
  font-size: 17px;
}

.block p,
.block li {
  color: #354139;
  line-height: 1.72;
}

.progress-block {
  overflow: hidden;
}

.progress-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.progress-hero .eyebrow,
.progress-hero h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.36;
  text-transform: none;
}

.progress-hero p {
  margin-bottom: 0;
}

.progress-hero strong {
  display: inline-grid;
  place-items: center;
  min-width: 64px;
  min-height: 42px;
  border: 1px solid rgba(31, 122, 90, 0.24);
  border-radius: 999px;
  background: #eaf5ef;
  color: var(--accent-strong);
  font-size: 18px;
}

.progress-track {
  height: 7px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebe5;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #5aa67e);
  transition: width 0.32s ease;
}

.task-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.live-indicator::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(31, 122, 90, 0.38);
  animation: pulse 1.4s ease-out infinite;
}

.live-indicator.error {
  color: var(--danger);
}

.live-indicator.error::before {
  background: var(--danger);
  animation: none;
}

.progress-timeline {
  display: grid;
  gap: 0;
  margin-top: 12px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  padding: 0 0 16px;
}

.timeline-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 18px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 13px;
  height: 13px;
  margin-top: 4px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.timeline-item.done .timeline-dot {
  border-color: var(--accent);
  background: var(--accent);
}

.timeline-item.running .timeline-dot {
  border-color: var(--accent);
  box-shadow: 0 0 0 5px rgba(31, 122, 90, 0.10);
}

.timeline-item.error .timeline-dot {
  border-color: var(--danger);
  background: var(--danger);
}

.timeline-item.active .timeline-dot {
  animation: pulse-dot 1.2s ease-out infinite;
}

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

.timeline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.timeline-head strong {
  font-size: 14px;
}

.timeline-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.timeline-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(31, 122, 90, 0.38);
  }
  100% {
    box-shadow: 0 0 0 10px rgba(31, 122, 90, 0);
  }
}

@keyframes pulse-dot {
  0% {
    box-shadow: 0 0 0 0 rgba(31, 122, 90, 0.28);
  }
  100% {
    box-shadow: 0 0 0 8px rgba(31, 122, 90, 0);
  }
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: #2b4d3c;
  font-size: 13px;
}

.module-list {
  display: grid;
  gap: 12px;
}

.module {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.module-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: #f7f8f5;
}

.phase {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.module-head h4 {
  margin: 0;
  font-size: 16px;
}

.module-head span:last-child {
  color: var(--amber);
  font-size: 13px;
  white-space: nowrap;
}

.module-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.course-card {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.course-card strong {
  display: block;
  margin-bottom: 6px;
}

.course-meta {
  color: var(--blue);
  font-size: 12px;
  line-height: 1.6;
}

.recommend-course-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.recommend-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.recommend-course-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.recommend-course-card.selected {
  border-color: rgba(40, 105, 166, 0.42);
  box-shadow: 0 0 0 2px rgba(40, 105, 166, 0.1);
}

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

.recommend-selector {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
}

.recommend-selector input {
  width: 16px;
  height: 16px;
}

.rank-badge {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.recommend-course-head h4 {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 1.42;
}

.recommend-course-body {
  display: grid;
  gap: 6px;
}

.recommend-course-body p {
  margin: 0;
  color: #354139;
  font-size: 14px;
  line-height: 1.68;
}

.recommend-course-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recommend-course-foot span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid rgba(40, 105, 166, 0.18);
  border-radius: 999px;
  background: #eef5fb;
  color: var(--blue);
  font-size: 12px;
}

.recommend-id-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.recommend-id-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: #2f3a33;
}

.recommend-id-item.selected {
  border-color: rgba(40, 105, 166, 0.42);
  box-shadow: 0 0 0 2px rgba(40, 105, 166, 0.1);
}

.artifact-frame {
  width: 100%;
  height: min(64vh, 620px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.error-box {
  border-color: rgba(178, 59, 59, 0.3);
  background: #fff5f5;
  color: var(--danger);
}

@media (max-width: 980px) {
  .app-shell {
    padding: 14px;
  }

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

  .workspace {
    grid-template-columns: 1fr;
  }

  .result-panel {
    min-height: 520px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .field-grid,
  .module-head,
  .progress-hero,
  .timeline-head {
    grid-template-columns: 1fr;
  }

  .timeline-head {
    display: grid;
    gap: 4px;
  }

  .module-head span:last-child {
    white-space: normal;
  }
}
