:root {
  color-scheme: light;
  --bg: #eef2f3;
  --paper: #ffffff;
  --paper-2: #f7faf9;
  --ink: #18201e;
  --muted: #63706d;
  --line: #d4dddc;
  --line-strong: #b9c7c4;
  --green: #16735a;
  --green-soft: #dff2ea;
  --blue: #286f9f;
  --blue-soft: #e0eef7;
  --amber: #a2630a;
  --amber-soft: #fff0cf;
  --red: #a43d3d;
  --red-soft: #fbe2df;
  --violet: #625a9f;
  --violet-soft: #ebe9f7;
  --shadow: 0 18px 42px rgba(26, 39, 37, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(238, 242, 243, 0.96), rgba(238, 242, 243, 1)),
    repeating-linear-gradient(90deg, rgba(31, 48, 45, 0.045) 0 1px, transparent 1px 88px);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1540px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 44px;
}

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(2rem, 4vw, 4.1rem);
  line-height: 0.98;
  font-weight: 880;
}

.sync-meta {
  flex: 0 0 auto;
  max-width: 280px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  font-size: 0.82rem;
  box-shadow: var(--shadow);
}

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

.metric {
  min-height: 88px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.metric.accent {
  background: #20332e;
  color: #fff;
  border-color: #20332e;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.metric.accent .metric-label {
  color: #dceee8;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
  line-height: 1;
}

.ops-board {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.control-plane {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 12px;
  align-items: start;
}

.control-grid.lower {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
}

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

.health-card,
.board-panel,
.platform-card,
.queue-card,
.workflow-step,
.task-lane,
.task-card,
.memory-card,
.funnel-stage,
.catalog-card,
.bus-node,
.skill-card,
.filters,
.results {
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.health-card {
  min-height: 112px;
  padding: 14px;
  border-left-width: 5px;
}

.health-card.ok {
  border-left-color: var(--green);
}

.health-card.warn {
  border-left-color: var(--amber);
}

.health-card.info {
  border-left-color: var(--blue);
}

.health-card span,
.panel-head span,
.platform-top p,
.queue-item small,
.workflow-step p,
.results-head p,
.card-meta,
.status-line {
  color: var(--muted);
}

.health-card span {
  font-size: 0.78rem;
  font-weight: 820;
}

.health-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.9rem;
  line-height: 1;
}

.health-card p {
  margin-top: 10px;
  font-size: 0.84rem;
  line-height: 1.42;
}

.board-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.9fr);
  gap: 12px;
  align-items: start;
}

.board-panel {
  padding: 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  margin-bottom: 12px;
}

.panel-head h2 {
  font-size: 1rem;
  font-weight: 850;
}

.panel-head span {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 760;
}

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

.task-lane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 360px;
  padding: 10px;
  background: #fbfcfc;
  box-shadow: none;
}

.lane-head,
.task-top,
.memory-top,
.funnel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.lane-head {
  min-height: 30px;
  margin-bottom: 8px;
}

.lane-head h3 {
  font-size: 0.84rem;
  font-weight: 850;
}

.lane-head strong {
  min-width: 30px;
  padding: 3px 7px;
  background: #fff;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.lane-body {
  display: grid;
  align-content: start;
  gap: 8px;
}

.task-card {
  display: grid;
  gap: 9px;
  min-height: 142px;
  padding: 10px;
  border-left-width: 4px;
  box-shadow: none;
}

.task-card.priority-p1 {
  border-left-color: var(--red);
}

.task-card.priority-p2 {
  border-left-color: var(--amber);
}

.task-card.priority-p3 {
  border-left-color: var(--line-strong);
}

.task-top h4 {
  min-width: 0;
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.task-top span {
  flex: 0 0 auto;
  padding: 2px 6px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 0.68rem;
  font-weight: 850;
}

.priority-p2 .task-top span {
  background: var(--amber-soft);
  color: var(--amber);
}

.priority-p3 .task-top span {
  background: var(--paper-2);
  color: var(--muted);
}

.task-card p {
  color: #33403d;
  font-size: 0.76rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.task-meta,
.artifact-list,
.memory-signals,
.funnel-items {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.task-meta span,
.artifact-list span,
.memory-signals span,
.funnel-items span {
  max-width: 100%;
  padding: 3px 6px;
  background: var(--paper-2);
  color: var(--muted);
  font-size: 0.68rem;
  overflow-wrap: anywhere;
}

.task-meta span:first-child {
  color: #273733;
  font-weight: 760;
}

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

.memory-card {
  display: grid;
  gap: 10px;
  min-height: 186px;
  padding: 12px;
  border-left-width: 4px;
  box-shadow: none;
}

.memory-live {
  border-left-color: var(--green);
}

.memory-seeded {
  border-left-color: var(--blue);
}

.memory-top h3,
.funnel-top h3 {
  font-size: 0.9rem;
  font-weight: 850;
}

.memory-top p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.memory-top strong,
.funnel-top strong {
  min-width: 40px;
  padding: 4px 8px;
  background: var(--paper-2);
  font-size: 0.86rem;
  text-align: center;
}

.memory-card ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 16px;
  color: #34433f;
  font-size: 0.76rem;
  line-height: 1.42;
}

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

.funnel-stage {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 174px;
  padding: 12px;
  border-top-width: 5px;
  box-shadow: none;
}

.funnel-ok {
  border-top-color: var(--green);
}

.funnel-warn {
  border-top-color: var(--amber);
}

.funnel-info {
  border-top-color: var(--blue);
}

.funnel-boundary {
  border-top-color: var(--violet);
}

.funnel-stage p {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.42;
}

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

.catalog-card {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 12px;
  color: inherit;
  text-decoration: none;
  box-shadow: none;
}

.catalog-card:hover {
  border-color: var(--line-strong);
}

.catalog-card span {
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.72rem;
  font-weight: 850;
}

.catalog-card strong {
  font-size: 0.92rem;
}

.catalog-card p {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.agent-bus-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.bus-node {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  min-height: 92px;
  padding: 10px;
  box-shadow: none;
}

.bus-node > span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: #20332e;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 850;
}

.bus-node h3 {
  font-size: 0.82rem;
  font-weight: 850;
}

.bus-node p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.38;
}

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

.platform-card {
  display: grid;
  gap: 12px;
  min-height: 158px;
  padding: 12px;
  border-left-width: 5px;
  box-shadow: none;
}

.platform-active {
  border-left-color: var(--green);
}

.platform-observed {
  border-left-color: var(--blue);
}

.platform-boundary {
  border-left-color: var(--violet);
}

.platform-planned {
  border-left-color: var(--line-strong);
}

.platform-attention {
  border-left-color: var(--red);
}

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

.platform-top h3,
.queue-head h3,
.workflow-step h3 {
  font-size: 0.92rem;
  font-weight: 850;
  line-height: 1.2;
}

.platform-top p {
  margin-top: 3px;
  font-size: 0.76rem;
}

.platform-top span {
  flex: 0 0 auto;
  padding: 3px 7px;
  background: var(--paper-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
}

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

.platform-stats span {
  min-width: 0;
  padding: 7px 6px;
  background: var(--paper-2);
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.platform-stats strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 1rem;
}

.platform-path {
  min-height: 30px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: #46514e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.queue-board {
  display: grid;
  gap: 10px;
}

.queue-card {
  min-height: 116px;
  padding: 12px;
  box-shadow: none;
}

.queue-card.empty {
  background: #fbfcfc;
}

.queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.queue-head strong {
  min-width: 42px;
  padding: 4px 8px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 0.86rem;
  text-align: center;
}

.queue-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
}

.queue-item,
.queue-more,
.queue-empty {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 27px;
  padding: 4px 7px;
  background: var(--paper-2);
  color: #2b3532;
  font-size: 0.74rem;
}

.queue-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.queue-item small {
  font-size: 0.68rem;
}

.queue-item em,
.queue-item b {
  flex: 0 0 auto;
  padding: 1px 5px;
  background: #fff;
  color: var(--amber);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 800;
}

.queue-more,
.queue-empty {
  color: var(--muted);
}

.workflow-panel {
  padding-bottom: 12px;
}

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

.workflow-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  min-height: 92px;
  padding: 12px;
  box-shadow: none;
}

.workflow-step > span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: #20332e;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 820;
}

.workflow-step p {
  margin-top: 4px;
  font-size: 0.78rem;
  line-height: 1.42;
}

.workspace {
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.filters {
  position: sticky;
  top: 14px;
  display: grid;
  gap: 18px;
  padding: 14px;
}

.filters h2,
.results-head h2 {
  font-size: 0.95rem;
  font-weight: 850;
}

.search-box {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: center;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
}

.search-box svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
  stroke-linecap: round;
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.filter-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.filter-pill {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.filter-pill:hover {
  border-color: var(--line-strong);
}

.filter-pill[aria-pressed="true"] {
  border-color: var(--green);
  background: var(--green-soft);
}

.filter-pill span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-pill .count {
  min-width: 28px;
  padding: 2px 6px;
  background: #fff;
  color: var(--muted);
  text-align: center;
  font-size: 0.75rem;
}

.compact {
  max-height: 360px;
  overflow: auto;
  padding-right: 2px;
}

.results {
  min-height: 640px;
  padding: 14px;
}

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

.results-head p {
  margin-top: 3px;
  font-size: 0.84rem;
}

select {
  min-width: 150px;
  height: 38px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
}

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

.skill-card {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  min-height: 256px;
  padding: 14px;
  border-left-width: 5px;
  box-shadow: none;
}

.skill-card:hover {
  border-color: var(--line-strong);
}

.skill-card.status-managed {
  border-left-color: var(--green);
}

.skill-card.status-adoption {
  border-left-color: var(--amber);
}

.skill-card.status-duplicate {
  border-left-color: var(--blue);
}

.skill-card.status-collision {
  border-left-color: var(--red);
}

.skill-card.status-boundary {
  border-left-color: var(--violet);
}

.skill-card.status-local {
  border-left-color: var(--line-strong);
}

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

.skill-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.02rem;
  font-weight: 850;
  line-height: 1.2;
}

.sync-badge,
.category {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 4px 7px;
  font-size: 0.72rem;
  font-weight: 780;
}

.sync-badge {
  justify-content: center;
  white-space: nowrap;
}

.status-managed {
  background: var(--green-soft);
  color: #0f5944;
}

.status-adoption {
  background: var(--amber-soft);
  color: #704504;
}

.status-duplicate {
  background: var(--blue-soft);
  color: #18567f;
}

.status-collision {
  background: var(--red-soft);
  color: #853030;
}

.status-boundary {
  background: var(--violet-soft);
  color: #4b4582;
}

.status-local {
  background: #e9eeee;
  color: #46514e;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.74rem;
}

.category {
  background: #e8f1ed;
  color: #1c5b49;
}

.card-meta > span:last-child {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 7px;
  background: var(--paper-2);
}

.purpose {
  margin-top: 10px;
  color: #33403d;
  font-size: 0.89rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.host-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
  margin-top: 12px;
}

.host-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 4px 7px;
  background: #eef3f0;
  color: #26332e;
  font-size: 0.72rem;
  font-weight: 760;
}

.host-badge.codex {
  background: var(--green-soft);
  color: #154d3d;
}

.host-badge.claude {
  background: #f3e7dc;
  color: #75431e;
}

.host-badge.agent {
  background: var(--blue-soft);
  color: #24576a;
}

.host-badge.source {
  background: var(--amber-soft);
  color: #65440e;
}

.host-badge.plugin {
  background: var(--violet-soft);
  color: #4b4582;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  font-size: 0.76rem;
}

.status-line span {
  padding: 3px 6px;
  border: 1px solid var(--line);
  background: var(--paper-2);
}

.empty-state {
  padding: 60px 16px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1280px) {
  .control-grid,
  .control-grid.lower {
    grid-template-columns: 1fr;
  }

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

  .skill-funnel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .workflow-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .app-shell {
    width: min(100% - 20px, 760px);
    padding-top: 18px;
  }

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

  .sync-meta {
    max-width: none;
    width: 100%;
  }

  .overview,
  .sync-health,
  .platform-board,
  .memory-board,
  .machine-catalog,
  .agent-bus-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .filters {
    position: static;
  }
}

@media (max-width: 620px) {
  .overview,
  .sync-health,
  .platform-board,
  .agent-workbench,
  .memory-board,
  .skill-funnel,
  .machine-catalog,
  .agent-bus-flow,
  .workflow-rail,
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .results-head {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-head span,
  select {
    width: 100%;
  }

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

  .card-head {
    grid-template-columns: 1fr;
  }

  .sync-badge {
    justify-self: start;
    white-space: normal;
  }
}
