:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #172033;
  --muted: #6b7280;
  --line: #dfe5ec;
  --blue: #1f3a5f;
  --teal: #0f766e;
  --gold: #b98200;
  --red: #b84220;
  --green: #1c7c4d;
  --violet: #635b8f;
  --shadow: 0 10px 30px rgba(23, 32, 51, 0.08);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  color: #fff;
  background: #172033;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f0b429;
  color: #172033;
  font-weight: 800;
}

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

.brand h1 {
  font-size: 18px;
}

.brand p {
  color: #b8c1cc;
  font-size: 12px;
  margin-top: 3px;
}

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

.nav-item {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 8px;
  color: #dbe3ec;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-icon {
  width: 22px;
  text-align: center;
  color: #f0b429;
}

.side-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.side-note p {
  margin: 4px 0 0;
  color: #c9d2dc;
  font-size: 12px;
  line-height: 1.55;
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: #38b66b;
  box-shadow: 0 0 0 4px rgba(56, 182, 107, 0.18);
  flex: 0 0 auto;
}

.main {
  min-width: 0;
  padding: 24px;
}

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

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

.topbar h2 {
  font-size: 26px;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-box {
  height: 40px;
  min-width: 270px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

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

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

.metric-card {
  min-height: 122px;
  padding: 16px;
  display: grid;
  align-content: space-between;
}

.metric-label,
.meta,
.task-note {
  color: var(--muted);
  font-size: 13px;
}

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

.metric-card small {
  color: var(--muted);
  line-height: 1.45;
}

.view-section {
  display: none;
}

.view-section.is-visible {
  display: block;
}

.content-grid.is-visible {
  display: grid;
}

.content-grid {
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr);
  gap: 14px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-wide {
  min-height: 290px;
}

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

.panel-heading.compact {
  align-items: flex-start;
}

.panel h3 {
  font-size: 18px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.segment {
  height: 30px;
  min-width: 62px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

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

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

.agent-card {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.agent-top,
.row-between {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.agent-title {
  margin: 0;
  font-size: 15px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.badge.active {
  color: #0f5132;
  background: #dff4e8;
}

.badge.waiting {
  color: #794c00;
  background: #fff0c2;
}

.badge.paused {
  color: #7a2a17;
  background: #ffe2d6;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #e8edf2;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: var(--value);
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

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

.task-item {
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.task-item strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

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

.project-item {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 56px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.project-name {
  font-weight: 700;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  position: relative;
  padding-left: 18px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}

.timeline-item strong {
  display: block;
  font-size: 14px;
}

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

.data-table {
  overflow: auto;
}

.table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.table th {
  color: #fff;
  background: var(--blue);
  position: sticky;
  top: 0;
}

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

.stage-card,
.file-card {
  min-height: 130px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.stage-card h4,
.file-card h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.stage-card p,
.file-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.file-card a {
  display: inline-block;
  margin-top: 12px;
  color: var(--teal);
  font-weight: 700;
  text-decoration: none;
}

.file-note {
  display: inline-block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .stage-board,
  .file-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .topbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .search-box {
    width: 100%;
    min-width: 0;
  }

  .agent-grid,
  .metrics,
  .stage-board,
  .file-grid {
    grid-template-columns: 1fr;
  }

  .project-item {
    grid-template-columns: 1fr;
  }
}
