:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-strong: #eef3f8;
  --text: #18202a;
  --muted: #667085;
  --line: #d9e1ea;
  --accent: #1b6fd8;
  --accent-dark: #144f9b;
  --success: #18794e;
  --warning: #a15c00;
  --danger: #b42318;
  --critical: #7a271a;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button {
  font: inherit;
}

.app-shell {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 820px;
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.08rem;
}

h3 {
  margin-bottom: 10px;
  font-size: 0.9rem;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.workspace-chip {
  min-width: 180px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.workspace-chip span,
.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.workspace-chip strong {
  display: block;
  margin-top: 2px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.status-grid article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.status-grid article {
  padding: 14px 16px;
}

.status-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 1.28rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(420px, 1fr) minmax(300px, 380px);
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 16px;
}

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

.panel-heading p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.catalog-list,
.tool-list,
.activity-list,
.side-stack {
  display: grid;
  gap: 10px;
}

.catalog-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.catalog-item:hover,
.catalog-item.is-selected {
  border-color: var(--accent);
  background: #f0f6ff;
}

.catalog-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.status-pill,
.risk-chip,
.tag-row span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.installed {
  background: #e6f4ee;
  color: var(--success);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.detail-header h2 {
  margin-bottom: 8px;
  font-size: 1.8rem;
}

.description {
  margin-bottom: 18px;
}

.risk-badge {
  height: fit-content;
  border-radius: 8px;
  padding: 8px 10px;
  background: #eef3f8;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.risk-badge.medium {
  background: #fff4e5;
  color: var(--warning);
}

.risk-badge.high {
  background: #fee4e2;
  color: var(--danger);
}

.risk-badge.critical {
  background: #fecdca;
  color: var(--critical);
}

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

.metadata-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-size: 0.88rem;
}

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

ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

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

.declared-tools {
  display: grid;
  gap: 10px;
}

.declared-tools article,
.tool-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.declared-tools p,
.tool-item p {
  margin: 5px 0 10px;
  font-size: 0.88rem;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.action-row p {
  margin-bottom: 0;
  font-size: 0.88rem;
}

.primary-action {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.primary-action:hover {
  background: var(--accent-dark);
}

.tool-item {
  display: grid;
  gap: 6px;
}

.tool-item span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.activity-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-dot {
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.activity-item p {
  margin: 3px 0 0;
  font-size: 0.82rem;
}

.empty-state {
  margin-bottom: 0;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

@media (max-width: 1180px) {
  .dashboard-grid {
    grid-template-columns: 300px 1fr;
  }

  .side-stack {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 24px, 720px);
    padding-top: 18px;
  }

  .topbar,
  .detail-header,
  .action-row {
    flex-direction: column;
  }

  .status-grid,
  .dashboard-grid,
  .side-stack,
  .metadata-grid {
    grid-template-columns: 1fr;
  }
}

