* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #fafafa;
  --surface: #fff;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text-secondary: #666;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --green: #16a34a;
  --yellow: #ca8a04;
  --red: #dc2626;
  --radius: 6px;
  --mono: "SF Mono", "Cascadia Code", "Fira Code", monospace;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

header nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
}

#breadcrumb {
  color: var(--text-secondary);
  font-size: 14px;
}

#breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

#breadcrumb a:hover { text-decoration: underline; }

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.connected { background: var(--green); }
.status-dot.disconnected { background: #999; }

main {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 24px;
}

.loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 48px 0;
}

/* Namespace list */
.namespace-list { display: flex; flex-direction: column; gap: 8px; }

.namespace-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
}

.namespace-card:hover { border-color: var(--accent); }

.namespace-card h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.namespace-card .meta {
  font-size: 13px;
  color: var(--text-secondary);
}

.namespace-card .key {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 8px;
}

/* Item list */
.item-list { display: flex; flex-direction: column; gap: 4px; }

.item-row {
  display: grid;
  grid-template-columns: 90px 1fr auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s;
}

.item-row:hover { border-color: var(--accent); }

.item-row .callsign {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.item-row .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-status { background: #e0f2fe; color: #0369a1; }
.badge-status[data-value="done"] { background: #dcfce7; color: #15803d; }
.badge-status[data-value="in_progress"] { background: #fef9c3; color: #854d0e; }
.badge-status[data-value="cancelled"] { background: #fee2e2; color: #991b1b; }
.badge-priority { background: #f3f4f6; color: #4b5563; }
.badge-priority[data-value="urgent"] { background: #fee2e2; color: #991b1b; }
.badge-priority[data-value="high"] { background: #ffedd5; color: #9a3412; }
.badge-type { background: #f3f4f6; color: #4b5563; }

.item-row .date {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--surface);
}

/* Item detail */
.item-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.item-detail h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

.item-detail .meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  font-size: 13px;
}

.item-detail .body {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-bottom: 24px;
  line-height: 1.7;
}

.item-detail .body h1 { font-size: 22px; margin: 16px 0 8px; }
.item-detail .body h2 { font-size: 18px; margin: 14px 0 6px; }
.item-detail .body h3 { font-size: 15px; margin: 12px 0 4px; }
.item-detail .body p { margin-bottom: 10px; }
.item-detail .body pre {
  background: var(--bg);
  padding: 12px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  margin-bottom: 10px;
}
.item-detail .body code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg);
  padding: 1px 4px;
  border-radius: 3px;
}
.item-detail .body pre code { background: none; padding: 0; }
.item-detail .body ul, .item-detail .body ol { margin: 0 0 10px 20px; }
.item-detail .body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
  font-size: 14px;
}
.item-detail .body th, .item-detail .body td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}
.item-detail .body th { background: var(--bg); font-weight: 600; }

/* Activity log */
.activity-section h3 {
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.activity-entry {
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

.activity-entry .author {
  font-weight: 600;
  margin-right: 8px;
}

.activity-entry .timestamp {
  font-size: 12px;
  color: var(--text-secondary);
}

.activity-entry .entry-body {
  margin-top: 4px;
  white-space: pre-wrap;
}

.load-more-btn {
  display: block;
  margin: 12px auto 0;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
}

.load-more-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Artifacts list */
.artifacts-section { margin-top: 24px; }

.artifacts-section h3 {
  font-size: 15px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.artifact-wrapper {
  border-top: 1px solid var(--border);
}

.artifact-item-clickable {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.artifact-item-clickable:hover { color: var(--accent); }

.artifact-chevron {
  font-size: 10px;
  color: var(--text-secondary);
  width: 14px;
  flex-shrink: 0;
}

.artifact-item-clickable .artifact-type {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
}

.artifact-content {
  padding: 0 0 12px 22px;
  line-height: 1.7;
}

.artifact-content h1 { font-size: 20px; margin: 12px 0 6px; }
.artifact-content h2 { font-size: 17px; margin: 10px 0 4px; }
.artifact-content h3 { font-size: 14px; margin: 8px 0 4px; }
.artifact-content p { margin-bottom: 8px; }
.artifact-content pre {
  background: var(--bg);
  padding: 10px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  margin-bottom: 8px;
}
.artifact-content code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg);
  padding: 1px 4px;
  border-radius: 3px;
}
.artifact-content pre code { background: none; padding: 0; }
.artifact-content ul, .artifact-content ol { margin: 0 0 8px 20px; }
.artifact-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
  font-size: 13px;
}
.artifact-content th, .artifact-content td {
  border: 1px solid var(--border);
  padding: 4px 8px;
  text-align: left;
}
.artifact-content th { background: var(--bg); font-weight: 600; }

/* Keep .artifact-item for backward compat if referenced elsewhere */
.artifact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 14px;
}

.artifact-item .artifact-type {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
}

/* Copy button */
.copy-btn {
  margin-left: auto;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  transition: border-color 0.15s, color 0.15s;
}

.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.copied { border-color: var(--green); color: var(--green); }

/* All items link */
.all-items-link {
  display: block;
  text-align: center;
  padding: 10px 16px;
  margin-bottom: 12px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, background 0.15s;
}

.all-items-link:hover {
  border-color: var(--accent);
  background: #f0f4ff;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state h3 { margin-bottom: 8px; color: var(--text); }
