:root {
  --ink: #172033;
  --muted: #667085;
  --line: #d9e0ea;
  --soft: #f3f6f9;
  --panel: #ffffff;
  --blue: #1f4e79;
  --blue-2: #2b6b95;
  --cyan: #0f766e;
  --green: #28724f;
  --amber: #a15c05;
  --red: #a33a3a;
  --shadow: 0 18px 48px rgba(21, 42, 70, 0.12);
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #eef3f7;
}

button,
input {
  font: inherit;
}

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

.sidebar {
  background: #163a59;
  color: #fff;
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: #e9f3f8;
  color: #163a59;
  border-radius: 8px;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.brand p,
.side-note p,
.eyebrow,
.metric-card p,
.portfolio-card p,
.detail-panel p,
.tool-card p,
.roadmap p {
  margin: 0;
  color: inherit;
}

.brand p {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

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

.nav-item {
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.82);
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: #ffffff;
  color: #163a59;
}

.side-note {
  margin-top: auto;
  padding: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.note-label {
  display: block;
  margin-bottom: 8px;
  color: #b7d7eb;
  font-size: 12px;
  font-weight: 700;
}

.side-note p {
  line-height: 1.55;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
}

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

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

.eyebrow {
  color: var(--blue-2);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 7px;
}

.topbar h2,
.section-head h3,
.detail-panel h3,
.roadmap h3 {
  margin: 0;
}

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

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

.primary-btn,
.ghost-btn,
.segment,
.icon-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

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

.ghost-btn,
.segment,
.icon-btn {
  background: #fff;
  color: var(--ink);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric-card,
.portfolio-card,
.detail-panel,
.tool-card,
.roadmap article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(21, 42, 70, 0.06);
}

.metric-card {
  padding: 18px;
}

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

.metric-card strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 34px;
  color: var(--blue);
}

.metric-card p {
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.section-head.compact {
  align-items: center;
}

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

.segment {
  border: 0;
  height: 32px;
}

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

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

.portfolio-card {
  padding: 18px;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
}

.portfolio-card:hover,
.stack-card:hover,
.tool-card:hover {
  border-color: #9bbbd1;
  box-shadow: var(--shadow);
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.type-pill,
.status-pill,
.security-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.type-agent {
  color: var(--blue);
  background: #e7f0f7;
}

.type-tool {
  color: var(--cyan);
  background: #e5f4f2;
}

.type-skill {
  color: var(--green);
  background: #eaf6ef;
}

.type-kb {
  color: #6f4bb3;
  background: #efe9fb;
}

.status-pill {
  background: #f5f7fa;
  color: var(--muted);
}

.portfolio-card h4,
.stack-card h4,
.tool-card h4 {
  margin: 0;
  font-size: 17px;
}

.portfolio-card p,
.tool-card p {
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.mini-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.mini-list span {
  padding: 5px 7px;
  border-radius: 6px;
  background: var(--soft);
  color: #46566a;
  font-size: 12px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
}

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

.stack-card {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
}

.stack-card p {
  margin: 8px 0 12px;
  color: var(--muted);
  line-height: 1.5;
}

.detail-panel {
  padding: 20px;
  position: sticky;
  top: 24px;
  min-height: 480px;
}

.panel-kicker {
  color: var(--blue-2);
  font-size: 12px;
  font-weight: 800;
}

.detail-panel h3 {
  margin-top: 8px;
  margin-bottom: 10px;
}

.detail-section {
  margin-top: 18px;
}

.detail-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.detail-section ul {
  margin: 0;
  padding-left: 18px;
  color: #344054;
  line-height: 1.6;
}

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

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

.tool-card {
  padding: 18px;
}

.knowledge-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 6px 20px rgba(21, 42, 70, 0.06);
  cursor: pointer;
}

.knowledge-card:hover {
  border-color: #9bbbd1;
  box-shadow: var(--shadow);
}

.knowledge-card h4 {
  margin: 12px 0 8px;
  font-size: 18px;
}

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

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

.kb-meta span {
  min-height: 42px;
  padding: 8px;
  border-radius: 6px;
  background: var(--soft);
  color: #46566a;
  font-size: 12px;
  line-height: 1.35;
}

.tool-card .security-pill {
  margin-top: 12px;
}

.security-low {
  color: var(--green);
  background: #eaf6ef;
}

.security-mid {
  color: var(--amber);
  background: #fff4df;
}

.security-high {
  color: var(--red);
  background: #fdecec;
}

.search {
  width: min(360px, 100%);
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}

.skill-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

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

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

.skill-table td {
  line-height: 1.48;
}

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

.roadmap article {
  padding: 18px;
  min-height: 220px;
}

.roadmap span {
  color: var(--blue-2);
  font-weight: 800;
  font-size: 13px;
}

.roadmap h3 {
  margin: 12px 0;
  font-size: 18px;
}

.roadmap p {
  color: var(--muted);
  line-height: 1.6;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.24);
  z-index: 20;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 94vw);
  background: #fff;
  box-shadow: -22px 0 60px rgba(21, 42, 70, 0.18);
  padding: 28px;
  z-index: 21;
  transform: translateX(104%);
  transition: transform 160ms ease;
  overflow: auto;
}

.drawer.open {
  transform: translateX(0);
}

.close {
  position: absolute;
  right: 18px;
  top: 18px;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 22px;
}

.drawer h3 {
  margin: 10px 44px 8px 0;
  font-size: 24px;
}

.drawer p {
  color: var(--muted);
  line-height: 1.6;
}

.drawer-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.drawer-item {
  padding: 13px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.drawer-item strong {
  display: block;
  margin-bottom: 6px;
}

.drawer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  text-decoration: none;
  font-weight: 700;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.drawer-link.secondary {
  color: var(--blue);
  background: #e7f0f7;
}

.card-link,
.inline-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--blue);
  background: #e7f0f7;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.card-link {
  margin-top: 2px;
  width: fit-content;
}

.inline-link {
  margin-top: 12px;
}

@media (max-width: 1180px) {
  .metric-grid,
  .card-grid,
  .tool-board,
  .knowledge-grid,
  .roadmap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

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

  .sidebar {
    position: static;
  }

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

  .main {
    padding: 20px;
  }

  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .metric-grid,
  .card-grid,
  .tool-board,
  .knowledge-grid,
  .roadmap {
    grid-template-columns: 1fr;
  }

  .kb-meta {
    grid-template-columns: 1fr;
  }
}
