/* === Anthropic Design Tokens === */
:root {
  --bg: #faf9f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f4ed;
  --bg-input: #f0eee6;
  --bg-modal: #ffffff;
  --bg-code: #f0eee6;
  --text: #141413;
  --text-secondary: #30302e;
  --text-muted: #87867f;
  --border: #d1cfc5;
  --border-focus: #d97757;
  --accent: #d97757;
  --accent-hover: #c46849;
  --accent-soft: rgba(217, 119, 87, 0.1);
  --danger: #bf4d43;
  --danger-soft: rgba(191, 77, 67, 0.12);
  --danger-hover: #a8413a;
  --success: #788c5d;
  --success-soft: rgba(120, 140, 93, 0.12);
  --info: #6a9bcc;
  --info-soft: rgba(106, 155, 204, 0.12);
  --shadow-sm: 0 1px 3px rgba(20, 20, 19, 0.04);
  --shadow-md: 0 4px 16px rgba(20, 20, 19, 0.06);
  --shadow-lg: 0 8px 32px rgba(20, 20, 19, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #141413;
  --bg-card: #1f1e1d;
  --bg-card-hover: #262624;
  --bg-input: #30302e;
  --bg-modal: #1f1e1d;
  --bg-code: #262624;
  --text: #faf9f5;
  --text-secondary: #b0aea5;
  --text-muted: #73726c;
  --border: #3d3d3a;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.35);
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  font-size: 15px;
  display: grid;
  grid-template-columns: 220px 1fr;
}

/* === Sidebar === */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  padding: 20px 14px;
  z-index: 90;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  overflow: hidden;
}
.sidebar-brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.sidebar-brand-sub { font-size: 11px; color: var(--text-muted); }
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 14px;
  flex: 1;
  overflow-y: auto;
}
.sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}
.sb-link svg { flex-shrink: 0; color: currentColor; }
.sb-link .sb-label { flex: 1; }
.sb-link:hover { color: var(--text); background: var(--accent-soft); }
.sb-link.active { color: var(--text); background: var(--accent-soft); }
.sb-link.active svg { color: var(--accent); }
.sb-badge { margin-left: auto; }
.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-start;
}

/* === Header === */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.logo svg { color: var(--accent); }

nav { display: flex; gap: 4px; }

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition);
}
.nav-link:hover { color: var(--text); background: var(--accent-soft); }
.nav-link.active { color: var(--accent); background: var(--accent-soft); }

.updates-badge {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: #e53e3e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  vertical-align: middle;
}
.updates-badge[hidden] { display: none; }

.updates-summary {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--bg-input);
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.6;
}
.updates-summary.behind {
  border-left: 4px solid var(--accent);
}
.updates-summary.up-to-date {
  border-left: 4px solid #22c55e;
}
.updates-summary.error {
  border-left: 4px solid #e53e3e;
}
.updates-summary code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
}

.updates-commits { margin-top: 20px; }
.updates-commit-list { display: flex; flex-direction: column; gap: 8px; }
.updates-commit {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.updates-commit-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
}
.updates-commit-msg { font-size: 14px; color: var(--text); }

.team-graph {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
  padding: 24px 0;
}
.team-level {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.team-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 160px;
  max-width: 220px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}
.team-node:hover { border-color: var(--accent); transform: translateY(-1px); }
.team-node.main { background: var(--accent-soft); border-color: var(--accent); }
.team-node.leader { border-color: var(--accent); }
.team-node-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 8px;
  background: var(--bg-input);
}
.team-node-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.team-node-name { font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 2px; }
.team-node-meta { font-size: 12px; color: var(--text-muted); }
.team-connector {
  width: 2px;
  height: 16px;
  background: var(--border);
}
.team-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* === Main === */
main {
  max-width: 1200px;
  padding: 32px 32px 64px;
  width: 100%;
}

.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.subtitle { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* === Overview page === */
.overview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.overview-stat {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: border-color var(--transition);
}
.overview-stat:hover { border-color: var(--accent); }
.overview-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 6px;
}
.overview-stat-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.overview-stat-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.overview-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}
@media (max-width: 1000px) {
  .overview-grid { grid-template-columns: 1fr; }
}
.overview-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.overview-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.overview-card-head h3 { font-size: 16px; font-weight: 600; }
.overview-card-meta { font-size: 12px; color: var(--text-muted); }

.overview-team-graph {
  padding: 12px 0;
  gap: 14px;
}
.overview-team-graph .team-node {
  min-width: 120px;
  max-width: 160px;
  padding: 8px 10px;
}
.overview-team-graph .team-node-avatar { width: 40px; height: 40px; }
.overview-team-graph .team-node-name { font-size: 13px; }
.overview-team-graph .team-node-meta { font-size: 11px; }
.overview-agent {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: border-color var(--transition);
}
.overview-agent:hover { border-color: var(--accent); }
.overview-agent.main { background: var(--accent-soft); }
.overview-agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--bg-input);
  overflow: hidden;
  flex-shrink: 0;
}
.overview-agent-avatar img { width: 100%; height: 100%; object-fit: cover; }
.overview-agent-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.overview-agent-status { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.overview-agent-status .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  margin-right: 4px;
  vertical-align: middle;
}
.overview-agent-status.stopped .dot { background: #a0a0a0; }

.overview-activity {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.overview-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
}
.overview-activity-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.overview-activity-body { flex: 1; }
.overview-activity-title { color: var(--text); line-height: 1.4; }
.overview-activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* === Kanban Board === */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  min-height: calc(100vh - 160px);
}

.kanban-col {
  background: var(--bg-input);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px;
  position: sticky;
  top: 0;
}
.kanban-col-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}
.kanban-col-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border-radius: 10px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}
.kanban-add-btn {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  line-height: 1;
}
.kanban-add-btn:hover { background: var(--accent-soft); color: var(--accent); }

.kanban-col-body {
  flex: 1;
  padding: 4px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 60px;
}
.kanban-col-body.drag-over {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

/* === Kanban Card === */
.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: grab;
  transition: all var(--transition);
  user-select: none;
  position: relative;
}
.kanban-card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  opacity: 0;
  transition: opacity 0.15s;
}
.kanban-card:hover .kanban-card-actions {
  opacity: 1;
}
.card-breakdown-btn {
  background: color-mix(in oklch, var(--accent) 15%, transparent);
  border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent);
  border-radius: 5px;
  color: var(--accent);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 3px 5px;
  transition: background 0.15s;
}
.card-breakdown-btn:hover {
  background: color-mix(in oklch, var(--accent) 25%, transparent);
}
.card-breakdown-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.kanban-subtask-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in oklch, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in oklch, var(--accent) 25%, transparent);
  padding: 1px 7px;
  border-radius: 10px;
  cursor: pointer;
}
.kanban-subtask-badge:hover {
  background: color-mix(in oklch, var(--accent) 20%, transparent);
}
.kanban-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.kanban-card.dragging {
  opacity: 0.4;
  transform: rotate(2deg);
}
.kanban-card-project {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in oklch, var(--accent) 12%, transparent);
  padding: 1px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.kanban-card-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  line-height: 1.3;
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.kanban-card-assignee {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}
.assignee-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.assignee-dot.owner { background: var(--accent); }
.assignee-dot.bot { background: var(--info); }
.assignee-dot.agent { background: var(--success); }

.kanban-card-due {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
}
.kanban-card-due.overdue { color: var(--danger); font-weight: 600; }

.priority-bar {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  position: absolute;
  left: 0;
  top: 0;
}
.kanban-card {
  position: relative;
  overflow: hidden;
}
.kanban-card[data-priority="urgent"] { border-left: 3px solid var(--danger); }
.kanban-card[data-priority="high"] { border-left: 3px solid var(--accent); }
.kanban-card[data-priority="normal"] { border-left: 3px solid transparent; }
.kanban-card[data-priority="low"] { border-left: 3px solid var(--border); }

/* === Card detail === */
.card-detail-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.card-detail-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
  white-space: pre-wrap;
}
.card-detail-desc:empty { display: none; }

.card-detail-comments { margin-bottom: 20px; }
.card-detail-comments h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.comment-item {
  padding: 10px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}
.comment-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
}
.comment-date {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 8px;
  font-weight: 400;
}
.comment-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  white-space: pre-wrap;
}

.comment-form textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  resize: vertical;
  transition: all var(--transition);
}
.comment-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.comment-author-select {
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}

.form-row {
  display: flex;
  gap: 12px;
}
.form-half { flex: 1; }

/* === Page switching === */
.page[hidden] { display: none; }
#kanbanPage { max-width: none; }

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

/* === Agent Grid === */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* === Agent Card === */
.agent-card {
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 180px;
}
.agent-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.agent-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.agent-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 22px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}
.agent-avatar.gradient-1 { background: linear-gradient(135deg, rgba(217,119,87,0.15), rgba(217,119,87,0.35)); }
.agent-avatar.gradient-2 { background: linear-gradient(135deg, rgba(106,155,204,0.15), rgba(106,155,204,0.35)); color: var(--info); }
.agent-avatar.gradient-3 { background: linear-gradient(135deg, rgba(120,140,93,0.15), rgba(120,140,93,0.35)); color: var(--success); }
.agent-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-card-info {
  flex: 1;
  min-width: 0;
}

.agent-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.agent-desc {
  font-size: 13px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.agent-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}

.agent-model-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: var(--bg-input);
  color: var(--text-muted);
}
.agent-model-badge.opus { background: rgba(217,119,87,0.12); color: var(--accent); }
.agent-model-badge.sonnet { background: var(--info-soft); color: var(--info); }
.agent-model-badge.haiku { background: var(--success-soft); color: var(--success); }

.marveen-card { border-left: 3px solid var(--accent); }
.marveen-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

/* === Telegram status dot === */
.tg-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}
.tg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.tg-dot.connected { background: var(--success); }
.tg-dot.disconnected { background: var(--text-muted); }

/* === Process status === */
.process-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}
.process-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.process-dot.running {
  background: var(--success);
  box-shadow: 0 0 6px rgba(120, 140, 93, 0.6);
  animation: pulse-dot 2s ease-in-out infinite;
}
.process-dot.stopped { background: var(--text-muted); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.agent-process-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--bg-input);
  border-radius: var(--radius);
  margin-top: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.process-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}
.process-uptime {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
}
.process-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* === Add Card === */
.add-card {
  border: 2px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-family: inherit;
}
.add-card:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.add-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.add-card:hover .add-icon { background: var(--accent-soft); }

/* === Wizard === */
.wizard-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.wizard-step {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  transition: background var(--transition);
}
.wizard-step.active { background: var(--accent); }
.wizard-step.done { background: var(--success); }

.wizard-panel[hidden] { display: none; }

.wizard-generating {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}
.wizard-spinner-wrap {
  margin-bottom: 20px;
}
.wizard-spin {
  width: 36px;
  height: 36px;
  border-width: 3px;
  border-color: var(--border);
  border-top-color: var(--accent);
}
.wizard-gen-status {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}
.wizard-gen-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.wizard-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}
.wizard-actions .btn-secondary { width: auto; }

.code-textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
  resize: vertical;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.code-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* === Agent Detail Modal ===
   Needs a compound selector (`.modal.modal-agent-detail`) to outrank
   the later `.modal { max-width: 480px; }` rule below -- otherwise
   source order wins and the detail modal stays at 480px. */
.modal.modal-agent-detail {
  max-width: 900px;
}
/* At narrower widths, the five-tab nav still wouldn't fit -- tighten
   the tab paddings so everything stays on one row. The outer modal
   padding also drops a bit so the tab row actually has room. */
.modal.modal-agent-detail .tab-nav { padding: 0 16px; }
.modal.modal-agent-detail .tab-btn { padding: 12px 10px; }

/* === Tab Navigation === */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  padding: 0 24px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.tab-btn {
  padding: 12px 16px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel { padding: 0 24px 24px; }
.tab-panel[hidden] { display: none; }

/* === Agent Overview === */
.agent-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}
.agent-overview-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

/* === Agent Settings === */
.agent-save-section {
  margin-top: 8px;
  margin-bottom: 20px;
}

/* === Telegram Tab === */
.tg-instructions {
  margin-bottom: 20px;
}
.tg-instructions h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}
.tg-instructions ol {
  padding-left: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
}
.tg-instructions code {
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.tg-connected-info {
  margin-bottom: 20px;
}
.tg-bot-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
}
.tg-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 16px;
  background: rgba(217, 119, 87, 0.08);
  border: 1px solid rgba(217, 119, 87, 0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.tg-notice svg { flex-shrink: 0; margin-top: 1px; color: var(--accent); }
.tg-notice code {
  background: var(--bg-code);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}
.tg-notice-ok {
  background: rgba(120, 140, 93, 0.08);
  border-color: rgba(120, 140, 93, 0.2);
}
.tg-notice-ok svg { color: var(--success); }
.tg-notice-warn {
  background: rgba(200, 140, 40, 0.08);
  border-color: rgba(200, 140, 40, 0.3);
}
.tg-notice-warn svg { color: #c88c28; }

.tg-pairing-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.tg-pairing-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}
.tg-pairing-info {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}
.tg-pending-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tg-pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.tg-pending-code {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-weight: 600;
  color: var(--accent);
}
.tg-pending-sender {
  color: var(--text-muted);
  font-size: 12px;
}

.tg-connected-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.tg-allowed-section {
  margin-top: 16px;
}
.tg-allowed-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.tg-allowed-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 0;
  font-style: italic;
}
.tg-allowed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.tg-allowed-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tg-allowed-kind {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.15);
  color: rgb(70, 140, 240);
  text-transform: uppercase;
}
.tg-allowed-kind-group {
  background: rgba(0, 168, 132, 0.15);
  color: rgb(40, 170, 130);
}
.tg-allowed-id {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 12px;
  color: var(--text);
}
.btn-icon-danger {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s ease;
}
.btn-icon-danger:hover {
  background: rgba(220, 60, 70, 0.1);
  color: rgb(230, 90, 100);
  border-color: rgba(220, 60, 70, 0.3);
}

/* === Skills Tab === */
.skill-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.skill-header h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.skill-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skill-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.skill-item:hover {
  background: var(--bg-card-hover);
}
.skill-item-info {
  flex: 1;
  min-width: 0;
}
.skill-item-name {
  font-size: 14px;
  font-weight: 500;
}
.skill-item-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.skill-item-actions {
  flex-shrink: 0;
  margin-left: 12px;
}

.skill-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.skill-create-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.skill-tab-btn {
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.skill-tab-btn:hover { color: var(--text); }
.skill-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.skill-tab-panel[hidden] { display: none; }

.file-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  color: var(--text-muted);
}
.file-upload-area:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.file-upload-area p { font-size: 14px; }
.file-upload-area .hint { font-size: 12px; margin-top: 4px; }

/* === Agent detail bottom === */
.agent-detail-bottom {
  margin: 0 24px;
  padding-top: 16px;
  padding-bottom: 8px;
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 20, 19, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s ease;
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }

.modal-wide { max-width: 640px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--danger); color: white; }

.modal-body { padding: 24px; }

/* === Avatar Gallery === */
.avatar-gallery { margin-bottom: 20px; }
.form-label-sm {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}
.avatar-grid-item {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  overflow: hidden;
  transition: all var(--transition);
  background: var(--bg-input);
}
.avatar-grid-item:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}
.avatar-grid-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.avatar-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.avatar-change-btn {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--bg-modal);
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.avatar-change-btn:hover { background: var(--accent-hover); }

.detail-avatar-gallery {
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-input);
  border-radius: var(--radius);
}

/* === Form === */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.hint { font-weight: 400; color: var(--text-muted); }

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  transition: all var(--transition);
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-group textarea { resize: vertical; }

/* === Buttons === */
.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-compact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  padding: 10px 20px;
  font-size: 14px;
  margin-top: 0;
  white-space: nowrap;
}

.btn-secondary {
  padding: 10px 20px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  padding: 10px 20px;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-danger:hover { background: var(--danger); color: white; }

/* === Detail === */
.detail-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.detail-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--accent);
}
.detail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-info h3 { font-size: 18px; font-weight: 600; }
.detail-info p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

.detail-section { margin-bottom: 24px; }
.detail-section h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.code-block {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* === Spinner === */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
[data-theme="dark"] .btn-primary .spinner {
  border-color: rgba(20,20,19,0.3);
  border-top-color: #141413;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Toast === */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease;
  z-index: 300;
  white-space: nowrap;
}
.toast.visible { transform: translateX(-50%) translateY(0); }

/* === Tasks === */
.tasks-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}
.tasks-empty svg { margin-bottom: 16px; opacity: 0.4; }
.tasks-empty p { font-size: 15px; }
.text-muted { font-size: 13px !important; margin-top: 4px; }

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}
.task-row:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.task-status { flex-shrink: 0; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-active {
  background: var(--success-soft);
  color: var(--success);
}
.badge-paused {
  background: rgba(217, 119, 87, 0.12);
  color: var(--accent);
}
.badge-heartbeat {
  background: rgba(200, 80, 120, 0.12);
  color: #c85078;
}

.task-info {
  flex: 1;
  min-width: 0;
}

.task-prompt {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.task-schedule {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-schedule-cron {
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
  background: var(--bg-input);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.task-next {
  color: var(--text-muted);
}

.task-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition);
}
.task-row:hover .task-actions { opacity: 1; }

.btn-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
}
.btn-icon:hover { background: var(--accent-soft); color: var(--accent); }
.btn-icon-danger:hover { background: rgba(191, 77, 67, 0.1); color: var(--danger); }

/* === Task detail === */
.task-detail-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.meta-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.meta-value {
  font-size: 13px;
  color: var(--text-secondary);
}

.task-detail-result {
  margin-bottom: 20px;
}
.task-detail-result label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.task-detail-result .code-block {
  max-height: 200px;
  overflow-y: auto;
}

.task-detail-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}
.task-detail-buttons .btn-primary { width: auto; }

/* === Checkbox === */
.form-check {
  margin-bottom: 18px;
}
.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-secondary);
}
.check-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* === Memory page === */
/* === Memory Stats === */
.mem-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 100px;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.stat-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.2;
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* === Memory Toolbar === */
.mem-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.mem-search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.mem-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.mem-search {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: all var(--transition);
}
.mem-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.mem-agent-filter {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}
.mem-search-mode {
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}

/* === Memory Tabs === */
.mem-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.mem-tab {
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}
.mem-tab:hover { color: var(--text); }
.mem-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.mem-tier-view[hidden], .mem-log-view[hidden], .mem-graph-view[hidden] { display: none; }

/* === Memory Graph === */
.mem-graph-view {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: 600px;
}
#memGraphCanvas {
  width: 100%;
  height: 100%;
  cursor: grab;
}
#memGraphCanvas:active { cursor: grabbing; }
.graph-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
}
.graph-empty[hidden] { display: none; }

/* === Graph Detail Panel === */
.graph-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 300px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 10;
  padding: 16px;
  animation: graphPanelIn 0.18s ease;
}
.graph-panel[hidden] { display: none; }
@keyframes graphPanelIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}
.graph-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.graph-panel-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all var(--transition);
}
.graph-panel-close:hover {
  color: var(--text);
  background: var(--bg-input);
}
.graph-panel-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 12px;
  max-height: 200px;
  overflow-y: auto;
  padding: 10px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}
.graph-panel-agent {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}
.graph-panel-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.graph-panel-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.graph-panel-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Graph zoom indicator */
.graph-zoom-indicator {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.graph-zoom-indicator.visible { opacity: 1; }

/* Graph controls hint */
.graph-controls-hint {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 10px;
  color: var(--text-muted);
  z-index: 5;
  line-height: 1.6;
  opacity: 0.7;
  pointer-events: none;
}

/* === Tier Badges === */
.badge-hot { background: rgba(220, 60, 60, 0.12); color: #dc3c3c; }
.badge-warm { background: rgba(217, 119, 87, 0.12); color: var(--accent); }
.badge-cold { background: var(--info-soft); color: var(--info); }
.badge-shared { background: rgba(200, 180, 100, 0.18); color: #9a8a30; }

.mem-agent-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 7px;
  border-radius: 4px;
  margin-left: 4px;
}

.mem-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.mem-keyword-tag {
  font-size: 10px;
  padding: 1px 7px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

/* === Memory List === */
.mem-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mem-item {
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  cursor: pointer;
}
.mem-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.mem-item.expanded .mem-content-full { display: block; }
.mem-item.expanded .mem-content-short { display: none; }

.mem-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.mem-date {
  font-size: 11px;
  color: var(--text-muted);
}

.mem-salience {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

.mem-content-short,
.mem-content-full {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.mem-content-short {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mem-content-full {
  display: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.mem-item-footer {
  display: none;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.mem-item.expanded .mem-item-footer { display: flex; }

.mem-empty, .log-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

/* === Daily Log === */
.log-date-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}
.log-current-date {
  font-size: 16px;
  font-weight: 600;
  min-width: 140px;
  text-align: center;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-icon:hover {
  background: var(--bg-input);
  border-color: var(--accent);
  color: var(--accent);
}

.log-entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.log-entry {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
}
.log-entry-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  white-space: nowrap;
  padding-top: 2px;
}
.log-entry-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
  flex: 1;
}

/* === Schedule View Toggle === */
.schedule-view-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
}
.view-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.view-btn:hover { color: var(--text); border-color: var(--accent); }
.view-btn.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.schedule-view[hidden] { display: none; }

/* === Schedule List === */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pending-retries-banner {
  margin-bottom: 16px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid #e5a43a;
  border-radius: var(--radius);
}
.pending-retries-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.pending-retries-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.pending-retries-hint {
  font-size: 12px;
  color: var(--text-muted);
}
.pending-retries-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pending-retry-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
}
.pending-retry-info { flex: 1; min-width: 0; }
.pending-retry-title {
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pending-retry-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.schedule-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}
.schedule-row:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.schedule-agent-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--accent-soft);
}
.schedule-agent-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.schedule-info {
  flex: 1;
  min-width: 0;
}
.schedule-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.schedule-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.schedule-cron {
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
  background: var(--bg-input);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
}
.schedule-agent-name {
  color: var(--accent);
  font-weight: 500;
}

.schedule-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}
.schedule-row:hover .schedule-actions { opacity: 1; }

.schedule-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}
.schedule-empty svg { margin-bottom: 16px; opacity: 0.4; }

/* === Prompt Expand === */
.prompt-expand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.expand-questions {
  margin-top: 12px;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.expand-questions[hidden] { display: none; }
.expand-questions:not([hidden]) { display: flex; }
.expand-question {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.expand-question-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.expand-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.expand-option {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.expand-option:hover { border-color: var(--accent); color: var(--accent); }
.expand-option.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.expand-apply-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* === Timeline View === */
.timeline-header {
  position: sticky;
  top: 64px;
  z-index: 5;
  background: var(--bg);
  padding-bottom: 8px;
}
.timeline-hours {
  display: flex;
  height: 32px;
  border-bottom: 1px solid var(--border);
  margin-left: 100px;
}
.timeline-hour {
  flex: 1;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  border-left: 1px solid var(--border);
  padding-top: 8px;
  min-width: 0;
}
.timeline-hour:first-child { border-left: none; }

.timeline-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
}

.timeline-row {
  display: flex;
  align-items: center;
  height: 44px;
  position: relative;
}

.timeline-agent {
  width: 100px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding-right: 10px;
}
.timeline-agent-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--accent-soft);
}
.timeline-agent-avatar img { width: 100%; height: 100%; object-fit: cover; }
.timeline-agent-name {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-track {
  flex: 1;
  height: 100%;
  position: relative;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  overflow: visible;
}

.timeline-marker {
  position: absolute;
  top: 6px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: visible;
  border: 2px solid var(--accent);
  background: var(--bg-card);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  z-index: 2;
}
.timeline-marker:hover {
  transform: scale(1.2);
  z-index: 100;
  box-shadow: 0 0 12px var(--accent-soft);
}
.timeline-marker img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.timeline-marker.disabled {
  border-color: var(--text-muted);
  opacity: 0.5;
}

.timeline-marker-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: var(--text);
  color: var(--bg);
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}
.timeline-marker-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text);
}
.timeline-marker:hover .timeline-marker-tooltip { display: block; z-index: 101; }

.timeline-now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--danger);
  pointer-events: none;
  z-index: 5;
  pointer-events: none;
}
.timeline-now::before {
  content: 'most';
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--danger);
  font-weight: 600;
  white-space: nowrap;
}

/* === Week View === */
.week-grid {
  display: flex;
  gap: 4px;
  min-height: 300px;
}
.week-day {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  flex: 0 0 48px;
  overflow: hidden;
  cursor: pointer;
  transition: flex var(--transition), border-color var(--transition);
}
.week-day.week-day-expanded {
  flex: 1 1 auto;
  cursor: default;
  min-width: 200px;
}
.week-day:not(.week-day-expanded):hover {
  border-color: var(--accent);
}
.week-day-today {
  border-color: var(--accent);
}
.week-day-header {
  padding: 10px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
  flex-shrink: 0;
}
.week-day-expanded .week-day-header {
  padding: 10px 14px;
  font-size: 12px;
}
.week-day-today .week-day-header {
  color: var(--accent);
  background: var(--accent-soft);
}
.week-day-count {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  flex: 1;
}
.week-day-expanded .week-day-count { display: none; }
.week-day-count-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.week-day-today .week-day-count-num {
  background: var(--accent-soft);
  color: var(--accent);
}
.week-day-tasks {
  display: none;
  flex: 1;
  position: relative;
  min-height: 400px;
}
.week-day-expanded .week-day-tasks { display: block; }

/* Hour grid lines inside expanded day */
.week-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
  opacity: 0.4;
}
.week-hour-label {
  position: absolute;
  left: 4px;
  font-size: 9px;
  color: var(--text-muted);
  transform: translateY(-50%);
  font-family: 'JetBrains Mono', monospace;
}

.week-day-empty {
  flex: 1;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  min-height: 400px;
}
.week-day-expanded .week-day-empty { display: flex; }

.week-task-card {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 2;
  min-height: 36px;
  box-shadow: var(--shadow-sm);
}
.week-task-card:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  z-index: 10;
  box-shadow: var(--shadow-md);
  transform: scale(1.02);
}
.week-task-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.week-task-avatar img { width: 100%; height: 100%; object-fit: cover; }
.week-task-info { min-width: 0; flex: 1; }
.week-task-time {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}
.week-task-name {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .week-grid { flex-direction: column; }
  .week-day { flex: 0 0 auto !important; min-width: 0 !important; }
  .week-day-expanded { min-width: 0 !important; }
}

/* === Recall / Napló Page === */
.recall-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.recall-search-wrap {
  flex: 2;
  min-width: 200px;
  position: relative;
}
.recall-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.recall-search {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.recall-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.recall-date-wrap {
  position: relative;
  flex-shrink: 0;
}
.recall-date-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.recall-date {
  padding: 9px 12px 9px 34px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  width: 170px;
  transition: border-color var(--transition), box-shadow var(--transition);
  color-scheme: dark;
}
.recall-date:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.recall-expr {
  flex: 1;
  min-width: 160px;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.recall-expr:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.recall-expr::placeholder,
.recall-search::placeholder {
  color: var(--text-muted);
}
.recall-agent-filter {
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
  min-width: 130px;
}
.recall-agent-filter:focus {
  border-color: var(--accent);
}
.recall-summary {
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.recall-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (max-width: 640px) {
  .recall-toolbar { flex-direction: column; align-items: stretch; }
  .recall-search-wrap, .recall-date-wrap, .recall-expr, .recall-agent-filter { width: 100%; }
  .recall-date { width: 100%; }
}

.recall-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.recall-date-header {
  margin-top: 20px;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.recall-item {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.recall-memory {
  border-left: 3px solid var(--border);
}
.recall-memory[data-cat="hot"]    { border-left-color: #ef4444; }
.recall-memory[data-cat="warm"]   { border-left-color: #f59e0b; }
.recall-memory[data-cat="cold"]   { border-left-color: #3b82f6; }
.recall-memory[data-cat="shared"] { border-left-color: #8b5cf6; }
.recall-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.recall-item-label {
  font-size: 12px;
  color: var(--text-muted);
}
.recall-item-badges {
  display: flex;
  gap: 6px;
}
.recall-badge {
  font-size: 11px;
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
}
.recall-badge-agent { background: var(--accent); }
.recall-badge-cat { background: var(--text-muted); }
.recall-badge-cat[data-cat="hot"]    { background: #ef4444; }
.recall-badge-cat[data-cat="warm"]   { background: #f59e0b; }
.recall-badge-cat[data-cat="cold"]   { background: #3b82f6; }
.recall-badge-cat[data-cat="shared"] { background: #8b5cf6; }
.recall-item-content {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.5;
}
.recall-item-keywords {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.recall-loading, .recall-empty { font-size: 13px; color: var(--text-muted); }
.recall-error { font-size: 13px; color: var(--danger); }

/* === Connectors Page === */
.connector-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.connector-section-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  margin-top: 20px;
}
.connector-section-header:first-of-type { margin-top: 0; }

.connector-group-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-top: 24px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.connector-group-heading:first-child { margin-top: 0; }
.connector-scope-section { margin-bottom: 4px; }
.connector-scope-header {
  display: flex;
  align-items: center;
  gap: 6px;
}
.connector-scope-header.collapsible { cursor: pointer; user-select: none; }
.connector-scope-header.collapsible:hover { color: var(--text); }
.connector-scope-toggle {
  font-size: 10px;
  width: 12px;
  display: inline-block;
  transition: transform 0.15s;
}
.connector-scope-count {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 11px;
  margin-left: 4px;
}
.connector-scope-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.connector-scope-grid[hidden] { display: none; }

.connector-external-paths {
  margin-bottom: 12px;
}
.connector-external-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.connector-external-header:hover { color: var(--text); }
.connector-external-body[hidden] { display: none; }
.connector-external-body { margin-top: 10px; }
.connector-external-add { display: flex; gap: 8px; margin-top: 8px; }
.connector-external-add .input { flex: 1; }
.connector-external-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  font-size: 13px;
  font-family: monospace;
}
.connector-external-item button {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
}
.connector-external-item button:hover { opacity: 0.7; }

.connector-env-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.github-repo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.github-repo-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.github-repo-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.github-repo-date {
  font-size: 11px;
  color: var(--text-muted);
  font-family: inherit;
}
.github-repo-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.github-repo-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
}
.github-repo-update { color: var(--accent); }
.github-repo-update:hover { opacity: 0.7; }
.github-repo-delete { color: var(--danger); }
.github-repo-delete:hover { opacity: 0.7; }
.github-repo-status {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.github-repo-status.loading { background: var(--bg-card); color: var(--accent); border: 1px solid var(--accent); }
.github-repo-status.error { background: var(--bg-card); color: var(--danger); border: 1px solid var(--danger); }
.github-repo-status.success { background: var(--bg-card); color: var(--success); border: 1px solid var(--success); }
.github-repo-status[hidden] { display: none; }

/* Vault page */
.vault-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.vault-add-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  animation: slideDown 0.2s ease;
}
.vault-add-panel[hidden] { display: none; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.vault-add-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.vault-add-panel-header h3 { margin: 0; font-size: 15px; }
.vault-add-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.vault-add-fields .vault-field-group:last-child {
  grid-column: 1 / -1;
}
.vault-field-group { display: flex; flex-direction: column; gap: 4px; }
.vault-field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.vault-add-actions { display: flex; justify-content: flex-end; }
@media (max-width: 600px) {
  .vault-add-fields { grid-template-columns: 1fr; }
  .vault-add-fields .vault-field-group:last-child { grid-column: auto; }
}
.vault-search-wrap {
  position: relative;
  margin-bottom: 16px;
}
.vault-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.vault-search {
  width: 100%;
  padding: 10px 12px 10px 38px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}
.vault-search:focus { border-color: var(--accent); }
.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}
.vault-card {
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  gap: 8px;
}
.vault-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.vault-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.vault-card-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft, rgba(99, 102, 241, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.vault-card-title {
  flex: 1;
  min-width: 0;
}
.vault-card-id {
  font-family: monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}
.vault-card-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.vault-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  align-self: flex-start;
  margin-top: 2px;
}
.vault-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.vault-card-value {
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
  animation: slideDown 0.15s ease;
}
.vault-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.vault-empty[hidden] { display: none; }
.vault-empty svg { margin-bottom: 12px; opacity: 0.4; }
.vault-empty p { margin: 4px 0; font-size: 14px; }
.vault-empty-hint { font-size: 12px !important; opacity: 0.6; }

.vault-binding-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  vertical-align: middle;
  margin-left: 6px;
}

.vault-card-edit-form {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
  align-items: center;
}
.vault-card-edit-form .input { flex: 1; }

.vault-bind-status {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 8px;
}
.vault-bind-status.success { background: rgba(34,197,94,.12); color: var(--success); }
.vault-bind-status.error { background: rgba(239,68,68,.12); color: var(--danger); }

.vault-scan-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.vault-scan-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: var(--bg-card);
}
.vault-scan-check { flex-shrink: 0; }
.vault-scan-info { flex: 1; min-width: 0; }
.vault-scan-server {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.vault-scan-env {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
}
.vault-scan-env code {
  background: var(--bg);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
}
.vault-scan-targets {
  font-size: 11px;
  color: var(--text-muted);
}
.vault-scan-id { flex-shrink: 0; }

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay[hidden] { display: none; }
.modal-content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 480px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 15px; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 16px 20px; }
.modal-desc { font-size: 13px; color: var(--text-muted); margin: 0 0 12px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.env-var-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.env-var-label {
  font-size: 12px;
  font-weight: 600;
  font-family: monospace;
  color: var(--text);
}
.env-var-input { width: 100%; }
.connector-builtin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.connector-builtin {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.connector-builtin-name {
  font-size: 13px;
  font-weight: 500;
  flex: 1;
}
.connector-builtin-action {
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}
.connector-builtin-action:hover { text-decoration: underline; }

/* Built-in row's "Részletek" button: carries the same action styling
   but presents as an actual <button> with focus ring for keyboard
   users. The bare <span> it replaced was unreachable by tab and
   lacked a click handler despite looking like a control. */
.connector-builtin-action.btn-link {
  background: none;
  border: none;
  /* Inherit base .connector-builtin-action sizing so both visual
     heights stay identical across built-in rows regardless of
     whether a row ends with a span or a button. */
  padding: 4px 8px;
  font: inherit;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  border-radius: 4px;
}
.connector-builtin-action.btn-link:hover {
  background: var(--bg-input);
  text-decoration: underline;
}
.connector-builtin-action.btn-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Inline <code> inside the built-in detail modal: give it a
   distinct background so the command text stands out from the
   surrounding prose in both light and dark themes. Scoped to the
   new modal's body specifically; .modal-body is shared by ~13
   other modals with their own <code> styling (Agent detail
   Settings, Telegram instructions, etc.) that we must not
   override. */
#builtinDetailBody code {
  background: var(--bg-input);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.connector-grid {
  display: block;
}

.connector-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}
.connector-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.connector-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.connector-status-dot.connected { background: var(--success); box-shadow: 0 0 6px rgba(120,140,93,0.4); }
.connector-status-dot.needs_auth { background: var(--accent); }
.connector-status-dot.failed { background: var(--danger); }
.connector-status-dot.unknown { background: var(--text-muted); }

.connector-info {
  flex: 1;
  min-width: 0;
}
.connector-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.connector-endpoint {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.connector-type-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.connector-type-badge.remote { background: var(--info-soft); color: var(--info); }
.connector-type-badge.local { background: var(--success-soft); color: var(--success); }
.connector-type-badge.plugin { background: var(--accent-soft); color: var(--accent); }

.connector-source-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-muted);
  margin-left: 6px;
  vertical-align: middle;
}

.info-box {
  padding: 12px 16px;
  margin: 0 0 16px;
  border-radius: 8px;
  background: var(--info-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  border-left: 3px solid var(--info);
}
.info-box strong { color: var(--info); }

.connector-stale-banner {
  padding: 10px 14px;
  margin: 0 0 12px;
  border-radius: 6px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  border-left: 3px solid var(--danger);
}

.connector-card-readonly {
  cursor: default;
  opacity: 0.9;
}
.connector-card-readonly:hover {
  /* The base .connector-card:hover rule applies border-color +
     box-shadow to hint at a click target. Read-only cards have no
     click handler, so mute those cues explicitly. */
  border-color: var(--border);
  box-shadow: none;
}
.connector-readonly-hint {
  color: var(--text-muted);
  font-style: italic;
  font-size: 11px;
  margin-top: 2px;
}

.connector-detail-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.connector-detail-row {
  display: flex;
  gap: 12px;
}
.connector-detail-row .meta-label { min-width: 80px; }

.connector-agent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.connector-agent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}
.connector-agent-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}
.connector-agent-item label {
  font-size: 13px;
  cursor: pointer;
}

.connector-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
  color: var(--text-muted);
  font-size: 14px;
  gap: 10px;
}

/* === Connector Tabs === */
.connector-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.connector-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -1px;
}
.connector-tab:hover {
  color: var(--text);
}
.connector-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* === Catalog Filters === */
.catalog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.catalog-filter-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.catalog-filter-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}
.catalog-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* === Catalog Grid === */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.catalog-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  gap: 12px;
}
.catalog-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.catalog-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.catalog-card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  font-size: 22px;
}
.catalog-card-info {
  flex: 1;
  min-width: 0;
}
.catalog-card-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.catalog-card-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.catalog-card-link:hover { opacity: 1; }
.catalog-card-type {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}
.catalog-card-type.local {
  background: var(--success-soft);
  color: var(--success);
}
.catalog-card-type.remote {
  background: var(--info-soft);
  color: var(--info);
}
.catalog-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.catalog-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.catalog-install-btn {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.catalog-install-btn.install {
  background: var(--success);
  color: #fff;
}
.catalog-install-btn.install:hover {
  filter: brightness(1.1);
}
.catalog-install-btn.installed {
  background: var(--success-soft);
  color: var(--success);
  cursor: default;
  font-weight: 600;
}
.catalog-uninstall-link {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  margin-left: auto;
  transition: color var(--transition);
}
.catalog-uninstall-link:hover {
  color: var(--danger);
  text-decoration: underline;
}
.catalog-auth-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin-left: 4px;
}

/* Catalog install modal env fields */
.catalog-env-group {
  margin-bottom: 14px;
}
.catalog-env-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-family: monospace;
}
.catalog-env-group input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
}
.catalog-env-group input:focus {
  border-color: var(--border-focus);
  outline: none;
}

/* === Status Page === */
.status-overall {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  font-size: 18px;
  font-weight: 600;
}
.status-overall.operational {
  background: var(--success-soft);
  color: var(--success);
}
.status-overall.degraded {
  background: rgba(217, 119, 87, 0.12);
  color: var(--accent);
}
.status-overall.unknown {
  background: var(--bg-input);
  color: var(--text-muted);
}

.status-services {
  margin-bottom: 28px;
}
.status-services h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.status-service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.status-service {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.status-service-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-service-dot.operational { background: var(--success); }
.status-service-dot.degraded { background: var(--accent); }
.status-service-dot.down { background: var(--danger); }

.status-service-name {
  font-size: 13px;
  font-weight: 500;
}
.status-service-uptime {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.status-incidents h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.status-incident-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-incident {
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 3px solid var(--border);
}
.status-incident.resolved { border-left-color: var(--success); }
.status-incident.monitoring { border-left-color: var(--info); }
.status-incident.identified { border-left-color: var(--accent); }
.status-incident.investigating { border-left-color: var(--danger); }

.status-incident-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.status-incident-title {
  font-size: 14px;
  font-weight: 600;
}
.status-incident-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 8px;
  border-radius: 4px;
}
.status-incident-badge.resolved { background: var(--success-soft); color: var(--success); }
.status-incident-badge.monitoring { background: var(--info-soft); color: var(--info); }
.status-incident-badge.identified { background: rgba(217,119,87,0.12); color: var(--accent); }
.status-incident-badge.investigating { background: rgba(191,77,67,0.12); color: var(--danger); }

.status-incident-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.status-incident-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

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

/* === Migration Page === */
.migrate-steps {
  max-width: 700px;
}
.migrate-step h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}
.migrate-step[hidden] { display: none; }

.migrate-findings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.migrate-finding {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.migrate-finding-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.migrate-finding-info {
  flex: 1;
  min-width: 0;
}
.migrate-finding-name {
  font-size: 13px;
  font-weight: 500;
}
.migrate-finding-type {
  font-size: 11px;
  color: var(--text-muted);
}
.migrate-finding-size {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.migrate-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.migrate-result {
  padding: 20px;
  background: var(--success-soft);
  border-radius: var(--radius);
}
.migrate-result h4 {
  color: var(--success);
  margin-bottom: 10px;
}
.migrate-result-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}
.migrate-result-stat {
  text-align: center;
}
.migrate-result-stat-value {
  font-size: 20px;
  font-weight: 600;
}
.migrate-result-stat-label {
  font-size: 11px;
  color: var(--text-muted);
}
.migrate-result-details {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* === Skills Page === */
.skills-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.skills-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  gap: 12px;
}

.skills-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.skills-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.skills-card-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 18px;
}

.skills-card-info {
  flex: 1;
  min-width: 0;
}

.skills-card-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
  word-break: break-word;
}

.skills-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.skills-card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.skills-agent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--info-soft);
  color: var(--info);
}

.skills-agent-badge.none {
  background: var(--bg-input);
  color: var(--text-muted);
  font-style: italic;
}

.skills-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.skills-empty svg {
  color: var(--text-muted);
  opacity: 0.5;
  margin-bottom: 12px;
}

/* Skills detail modal */
.skill-detail-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

.skill-detail-meta {
  margin: 0 0 20px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.skill-detail-meta .skill-detail-source strong {
  color: var(--text);
}
.skill-detail-meta .skill-detail-note {
  margin-top: 2px;
  font-style: italic;
}

.skill-detail-agents {
  margin-bottom: 24px;
}

.skill-agent-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.skill-agent-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.skill-agent-checkbox:hover {
  border-color: var(--accent);
}

.skill-agent-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.skill-agent-checkbox label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  flex: 1;
}

.skill-agent-auto,
.connector-agent-auto {
  opacity: 0.85;
  background: var(--bg-input);
}

.tag-auto {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.skill-detail-content-wrap {
  margin-top: 20px;
}

.skill-detail-content {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 8px;
}

/* === Responsive === */
@media (max-width: 900px) {
  .kanban-board {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .kanban-col { min-height: auto; }
}

@media (max-width: 640px) {
  main { padding: 20px 16px 48px; }
  .agents-grid { grid-template-columns: 1fr; gap: 12px; }
  .agent-card { padding: 20px 14px; min-height: auto; }
  .agent-avatar { width: 44px; height: 44px; font-size: 18px; }
  .modal { width: 95%; }
  .modal-agent-detail { max-width: 100%; }
  .header-left { gap: 16px; }
  .mem-toolbar { flex-direction: column; }
  .mem-stats { gap: 8px; }
  .stat-card { min-width: 70px; padding: 12px; }
  .stat-value { font-size: 20px; }
  .mem-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .mem-tab { padding: 10px 12px; font-size: 12px; }
  .log-date-nav { gap: 8px; }
  .log-current-date { font-size: 14px; min-width: 120px; }
  .log-entry { padding: 10px 12px; gap: 8px; }
  .log-entry-time { font-size: 11px; }
  .tab-nav { padding: 0 16px; overflow-x: auto; }
  .tab-btn { padding: 10px 12px; font-size: 13px; }
  .tab-panel { padding: 0 16px 16px; }
  .agent-overview-grid { grid-template-columns: 1fr; }
  .agent-detail-bottom { margin: 0 16px; }
  .schedule-view-toggle { flex-wrap: wrap; }
  .schedule-row { padding: 12px 14px; gap: 10px; }
  .schedule-actions { opacity: 1; }
  .timeline-agent { width: 70px; }
  .timeline-hours { margin-left: 70px; }
  .timeline-marker { width: 24px; height: 24px; top: 10px; }
  .timeline-marker-tooltip { font-size: 10px; }
  .connector-scope-grid { grid-template-columns: 1fr; }
  .connector-stats { gap: 8px; }
  .catalog-grid { grid-template-columns: 1fr; }
  .catalog-filters { gap: 4px; }
  .catalog-filter-btn { padding: 5px 10px; font-size: 12px; }
  .skills-grid { grid-template-columns: 1fr; }
  .skills-stats { gap: 8px; }
  .autonomy-grid { gap: 8px; }
  .autonomy-row { flex-wrap: wrap; gap: 10px; }
  .autonomy-row-label { min-width: unset; flex: 1 1 100%; }
}

/* === Autonomy Page === */
.autonomy-legend {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.autonomy-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.autonomy-legend-item strong {
  font-weight: 600;
  font-size: 14px;
}
.autonomy-level-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.autonomy-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.autonomy-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}
.autonomy-row:hover { border-color: var(--accent); }
.autonomy-row.locked {
  opacity: 0.55;
  pointer-events: none;
}
.autonomy-row.locked:hover { border-color: var(--border); }
.autonomy-row.capped { border-left: 3px solid var(--accent); }
.autonomy-row-label {
  flex: 1;
  min-width: 260px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.autonomy-row-lock {
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.autonomy-row-lock svg { flex-shrink: 0; }
.autonomy-row-cap {
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.autonomy-row-cap svg { flex-shrink: 0; }
.autonomy-levels {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: 6px;
  padding: 3px;
}
.autonomy-level-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: all var(--transition);
  min-width: 36px;
  text-align: center;
}
.autonomy-level-btn:hover:not(.active):not(:disabled) {
  color: var(--text);
  background: var(--bg-card);
}
.autonomy-level-btn.over-cap {
  opacity: 0.3;
  cursor: not-allowed;
}
.autonomy-level-btn.active {
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.autonomy-level-btn.active[data-level="1"] {
  background: var(--text-muted);
}
.autonomy-level-btn.active[data-level="2"] {
  background: var(--accent);
}
.autonomy-level-btn.active[data-level="3"] {
  background: var(--success);
}
.autonomy-grid > :last-child { margin-bottom: 0; }
.autonomy-footer {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* === connectors.hu cross-promo banner === */
.cxhu-banner {
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(0, 151, 124, 0.25);
  background: linear-gradient(135deg, rgba(0, 151, 124, 0.06) 0%, rgba(89, 233, 206, 0.04) 100%);
}
[data-theme="dark"] .cxhu-banner {
  background: linear-gradient(135deg, rgba(0, 151, 124, 0.12) 0%, rgba(89, 233, 206, 0.06) 100%);
  border-color: rgba(0, 151, 124, 0.35);
}
.cxhu-banner-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}
.cxhu-banner-logo { flex-shrink: 0; line-height: 0; }
.cxhu-banner-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
.cxhu-banner-headline {
  font-weight: 700;
  font-size: 14px;
  color: #00977c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="dark"] .cxhu-banner-headline { color: #59e9ce; }
.cxhu-banner-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.cxhu-banner-cta {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: #00977c;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), transform var(--transition);
}
.cxhu-banner-cta:hover {
  background: #007d67;
  transform: translateY(-1px);
}
.cxhu-banner-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background var(--transition);
}
.cxhu-banner-close:hover {
  color: var(--text);
  background: var(--bg-input);
}
/* install flow states */
.cxhu-banner-action {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.cxhu-state {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cxhu-state[hidden] { display: none; }
.cxhu-banner-cta {
  border: none;
  cursor: pointer;
}
.cxhu-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 151, 124, 0.25);
  border-top-color: #00977c;
  border-radius: 50%;
  animation: cxhu-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes cxhu-spin { to { transform: rotate(360deg); } }
.cxhu-state-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.cxhu-done-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #00977c;
  background: rgba(0, 151, 124, 0.1);
  padding: 5px 10px;
  border-radius: 999px;
}
[data-theme="dark"] .cxhu-done-badge { color: #59e9ce; background: rgba(89, 233, 206, 0.1); }
.cxhu-link-sm {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.cxhu-link-sm:hover { color: #00977c; }
.cxhu-state--token {
  gap: 6px;
}
.cxhu-token-input {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  outline: none;
  width: 200px;
  transition: border-color var(--transition);
}
.cxhu-token-input:focus { border-color: #00977c; }
.cxhu-token-input::placeholder { color: var(--text-muted); font-size: 11px; }
.cxhu-error-msg {
  font-size: 12px;
  color: var(--danger);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cxhu-retry-btn { background: var(--danger); }
.cxhu-retry-btn:hover { background: var(--danger-hover); }
@media (max-width: 640px) {
  .cxhu-banner-inner { flex-wrap: wrap; }
  .cxhu-banner-logo { display: none; }
  .cxhu-banner-text { min-width: 100%; }
  .cxhu-banner-headline { white-space: normal; }
  .cxhu-banner-action { width: 100%; }
  .cxhu-state--token { flex-wrap: wrap; }
  .cxhu-token-input { width: 100%; }
  .cxhu-banner-cta { width: 100%; justify-content: center; }
  .cxhu-banner-close { position: absolute; top: 10px; right: 10px; }
  .cxhu-banner { position: relative; }
}
