/* ── Reset & base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface2:    #1c2128;
  --border:      #30363d;
  --border2:     #21262d;
  --text:        #c9d1d9;
  --text-dim:    #8b949e;
  --text-dimmer: #484f58;
  --green:       #3fb950;
  --red:         #f85149;
  --blue:        #58a6ff;
  --orange:      #e3b341;
  --purple:      #bc8cff;
  --teal:        #39d353;
  --accent:      #388bfd;
  --radius:      6px;
  --radius-sm:   4px;
  --font:        'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
}

/* ── Dashboard layout ────────────────────────────────────────────────────── */
.dashboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.dash-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.logo-icon { font-size: 18px; }

.dash-subtitle {
  font-size: 11px;
  color: var(--text-dim);
}

.dash-main {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dash-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.dash-row-top > .section-agents { flex: 1; }
.dash-row-top > .section-metrics { flex: 0 0 auto; }

/* ── Section base ────────────────────────────────────────────────────────── */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  width: 100%;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.section-header .section-title { margin-bottom: 0; }

.section-icon {
  color: var(--text-dim);
  font-size: 12px;
}

.badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

/* ── Agent Cards ─────────────────────────────────────────────────────────── */
.agent-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.agent-card {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 10px 14px;
  min-width: 160px;
  max-width: 220px;
}

.agent-card.online  { border-left: 3px solid var(--green); }
.agent-card.offline { border-left: 3px solid var(--red); opacity: 0.7; }
.agent-card.stale   { border-left: 3px solid var(--orange); }
.agent-card.decommissioned { border-left: 3px solid var(--text-dimmer); opacity: 0.5; }

.agent-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.agent-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-online        { background: var(--green); box-shadow: 0 0 4px var(--green); }
.dot-offline       { background: var(--red); }
.dot-stale         { background: var(--orange); box-shadow: 0 0 4px var(--orange); }
.dot-decommissioned { background: var(--text-dimmer); }

.agent-name {
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
}

.agent-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px;
}

.meta-item {
  font-size: 11px;
  color: var(--text-dim);
}

.meta-label {
  color: var(--text-dimmer);
  margin-right: 2px;
}

.agent-ts {
  font-size: 10px;
  color: var(--text-dimmer);
}

/* ── Work Queue ──────────────────────────────────────────────────────────── */
.queue-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  padding: 4px 10px;
  width: 280px;
  outline: none;
}

.filter-input:focus { border-color: var(--accent); }

.toggle-label {
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.queue-table-wrap {
  overflow-x: auto;
}

.queue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.queue-table th {
  text-align: left;
  padding: 6px 10px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  white-space: nowrap;
}

.queue-row td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border2);
  vertical-align: middle;
  cursor: pointer;
}

.queue-row:hover td { background: var(--surface2); }
.queue-row.expanded td { background: var(--surface2); }
.queue-row.done td { opacity: 0.6; }
.queue-row.row-decision td { background: rgba(88,166,255,0.05); }
.queue-row.row-decision td:first-child { border-left: 3px solid var(--blue); }

.col-id { width: 130px; }
.item-id {
  font-size: 10px;
  color: var(--text-dimmer);
  font-family: var(--font);
}

.empty-row {
  text-align: center;
  color: var(--text-dim);
  padding: 20px !important;
}

/* Priority badges */
.prio-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.prio-critical { background: rgba(248,81,73,0.2); color: #f85149; }
.prio-high     { background: rgba(255,166,77,0.2); color: #ff9944; }
.prio-medium   { background: rgba(88,166,255,0.15); color: var(--blue); }
.prio-low      { background: rgba(139,148,158,0.15); color: var(--text-dim); }
.prio-idea     { background: rgba(188,140,255,0.2); color: var(--purple); }
.prio-default  { background: var(--surface2); color: var(--text-dim); }

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
}
.status-pending     { background: rgba(88,166,255,0.1); color: var(--blue); }
.status-in-progress { background: rgba(63,185,80,0.1); color: var(--green); }
.status-done        { background: rgba(139,148,158,0.1); color: var(--text-dim); }
.status-failed      { background: rgba(248,81,73,0.1); color: var(--red); }
.status-blocked     { background: rgba(227,179,65,0.1); color: var(--orange); }

/* Expanded row */
.detail-row td { padding: 0 !important; cursor: default; }
.item-detail {
  padding: 10px 20px;
  border-top: 1px solid var(--border2);
  background: var(--bg);
}
.item-body {
  font-family: var(--font);
  font-size: 11px;
  color: var(--text-dim);
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

/* Completed section */
.completed-section { margin-top: 16px; }
.subsection-title {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-weight: 500;
}
.resolution { color: var(--text-dim); font-size: 11px; }

/* ── SquirrelBus ─────────────────────────────────────────────────────────── */
.section-bus { flex: 1; }

.bus-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.conn-badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 20px;
  font-weight: 500;
}
.conn-live    { color: var(--green); background: rgba(63,185,80,0.1); }
.conn-waiting { color: var(--text-dim); background: var(--surface2); }

.bus-stream {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 340px;
  overflow-y: auto;
  font-size: 11px;
}

.bus-empty {
  color: var(--text-dim);
  font-size: 11px;
  padding: 8px 0;
  font-style: italic;
}

.bus-msg {
  display: flex;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--border);
  background: var(--surface2);
  align-items: baseline;
}

.bus-msg:hover { border-left-color: var(--accent); }

.msg-ts   { color: var(--text-dimmer); min-width: 60px; flex-shrink: 0; }
.msg-from { color: var(--blue); min-width: 100px; flex-shrink: 0; font-weight: 500; }
.msg-text { color: var(--text); flex: 1; word-break: break-word; }

/* ── Metrics ─────────────────────────────────────────────────────────────── */
.section-metrics { flex: 0 0 auto; }

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

.metric-card {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: center;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.metric-value.metric-pending { color: var(--blue); }
.metric-value.metric-active  { color: var(--green); }
.metric-value.metric-done    { color: var(--text-dim); }
.metric-value.metric-rate    { color: var(--orange); }

.metric-label {
  font-size: 10px;
  color: var(--text-dimmer);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

/* ── Idea Incubator ──────────────────────────────────────────────────────── */
.section-ideas { flex: 0 0 380px; }

.ideas-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
}

.idea-card {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-left: 3px solid var(--purple);
  border-radius: var(--radius);
  padding: 10px 14px;
}

.idea-card.upvoted { border-left-color: var(--orange); }

.idea-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.idea-id {
  font-size: 10px;
  color: var(--text-dimmer);
  flex-shrink: 0;
}

.idea-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.idea-body {
  font-size: 11px;
  color: var(--text-dim);
  margin: 4px 0;
  line-height: 1.4;
}

.idea-tags {
  font-size: 10px;
  color: var(--purple);
  margin: 4px 0;
}

.idea-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  font-size: 11px;
  padding: 3px 10px;
  transition: background 0.1s, border-color 0.1s;
}

.btn:hover:not(:disabled) {
  background: var(--surface2);
  border-color: var(--accent);
}

.btn:disabled { opacity: 0.5; cursor: default; }

.btn-upvote {
  color: var(--orange);
  border-color: rgba(227,179,65,0.3);
}

.btn-upvote:hover:not(:disabled) {
  background: rgba(227,179,65,0.1);
}

.btn-upvoted {
  color: var(--text-dim);
  border-color: var(--border);
}

/* ── Misc ────────────────────────────────────────────────────────────────── */
.loading { color: var(--text-dim); font-size: 11px; font-style: italic; }
.empty   { color: var(--text-dimmer); font-size: 11px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dimmer); }

/* ── Tab buttons ─────────────────────────────────────────────────────────── */
.dash-tabs {
  display: flex;
  gap: 4px;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  padding: 4px 14px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}

.tab-btn.tab-active {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
  border-bottom-color: var(--accent);
}

/* ── Kanban Board ────────────────────────────────────────────────────────── */
.section-kanban {
  width: 100%;
  overflow-x: auto;
}

.kanban-board {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
  padding-bottom: 4px;
}

/* ── Column ──────────────────────────────────────────────────────────────── */
.kanban-col {
  flex: 1 1 0;
  min-width: 200px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  transition: border-color 0.15s, background 0.15s;
}

.kanban-col--over {
  border-color: var(--accent);
  background: rgba(56, 139, 253, 0.06);
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border2);
}

.kanban-col-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 40px;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: grab;
  transition: opacity 0.15s, box-shadow 0.15s, border-color 0.15s;
  user-select: none;
}

.kanban-card:hover {
  border-color: var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.kanban-card:active {
  cursor: grabbing;
  opacity: 0.75;
}

.kanban-card--high   { border-left-color: var(--red); }
.kanban-card--medium { border-left-color: var(--orange); }

.kanban-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.kanban-card-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.kanban-card-foot {
  display: flex;
  align-items: center;
  gap: 5px;
}

.kanban-avatar {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.kanban-assignee {
  font-size: 10px;
  color: var(--text-dimmer);
}

/* ── Expanded detail ─────────────────────────────────────────────────────── */
.kanban-detail {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border2);
  cursor: default;
}

.kanban-body {
  font-family: var(--font);
  font-size: 11px;
  color: var(--text-dim);
  white-space: pre-wrap;
  max-height: 120px;
  overflow-y: auto;
  margin-bottom: 8px;
  line-height: 1.4;
}

.kanban-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kanban-field-label {
  font-size: 10px;
  color: var(--text-dimmer);
  white-space: nowrap;
}

.kanban-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 11px;
  padding: 2px 6px;
  cursor: pointer;
  outline: none;
  flex: 1;
}

.kanban-select:focus { border-color: var(--accent); }

/* ── Agent Detail ────────────────────────────────────────────────────────── */
.section-agent-detail { grid-column: 1 / -1; }

.agent-detail-layout {
  display: flex;
  gap: 16px;
  min-height: 500px;
}

.agent-detail-sidebar {
  width: 160px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 12px 8px;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dimmer);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 8px;
}

.agent-list-btn {
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 12px;
  padding: 6px 8px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.agent-list-btn:hover { background: var(--surface3); color: var(--text); }
.agent-list-btn-active { background: var(--accent-dim) !important; color: var(--accent) !important; font-weight: 600; }

.agent-detail-panel { flex: 1; overflow: hidden; }

.agent-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-dimmer);
  font-size: 13px;
}

.agent-detail-content { display: flex; flex-direction: column; gap: 20px; }

.agent-profile-card {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 16px;
  border-left: 4px solid var(--border2);
}

.agent-profile-card.online { border-left-color: var(--green); }
.agent-profile-card.offline { border-left-color: var(--text-dimmer); }
.agent-profile-card.stale { border-left-color: var(--orange); }
.agent-profile-card.decommissioned { border-left-color: var(--red); opacity: 0.7; }

.profile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.profile-name { font-size: 18px; font-weight: 700; color: var(--text); margin: 0; }

.profile-status-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-online { background: var(--green-dim); color: var(--green); }
.badge-offline { background: var(--surface3); color: var(--text-dimmer); }
.badge-stale { background: rgba(227,179,65,0.15); color: var(--orange); }
.badge-decommissioned { background: var(--red-dim); color: var(--red); }

.profile-meta-grid { display: flex; flex-direction: column; gap: 6px; }

.meta-row { display: flex; gap: 10px; align-items: baseline; }
.meta-key { font-size: 11px; color: var(--text-dimmer); min-width: 100px; }
.meta-val { font-size: 12px; color: var(--text); }
.meta-val.code { font-family: monospace; font-size: 11px; color: var(--accent); }
.age-ok   { font-size: 11px; color: var(--text-dimmer); }
.age-stale { font-size: 11px; color: var(--orange); font-weight: 600; }

.section-sub { padding: 0; }
.sub-title { font-size: 12px; font-weight: 600; color: var(--text-dim); margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.05em; }

.caps-grid { display: flex; flex-wrap: wrap; gap: 6px; }

.cap-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11px;
}

.cap-key { color: var(--text-dimmer); }
.cap-val { color: var(--text); }

.history-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; }

.history-entry {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
}

.history-icon { font-size: 12px; flex-shrink: 0; }
.history-ts { color: var(--text-dimmer); min-width: 60px; flex-shrink: 0; }
.history-event { color: var(--accent); font-weight: 600; flex-shrink: 0; }
.history-detail { color: var(--text-dim); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-rev { font-family: monospace; font-size: 10px; color: var(--text-dimmer); flex-shrink: 0; }

.section-danger { padding-top: 16px; border-top: 1px solid var(--border2); }

.btn-danger {
  background: var(--red-dim, rgba(220,50,50,0.15));
  border: 1px solid var(--red, #dc3232);
  border-radius: var(--radius-sm);
  color: var(--red, #dc3232);
  font-family: var(--font);
  font-size: 12px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.1s;
}

.btn-danger:hover { background: var(--red, #dc3232); color: #fff; }

.decom-msg { font-size: 12px; color: var(--text-dim); margin: 8px 0 0; }

/* ── Issues Panel ─────────────────────────────────────────────────────── */
.issues-panel { padding: 16px; display: flex; flex-direction: column; gap: 12px; max-width: 1100px; }
.issues-header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.issues-header h2 { margin: 0; font-size: 18px; color: var(--text); }
.issues-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.issues-controls select {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); padding: 4px 8px; font-size: 12px; cursor: pointer;
}
.state-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.toggle-btn {
  background: var(--bg2); border: none; color: var(--text-dim); padding: 4px 10px;
  font-size: 12px; cursor: pointer; transition: background 0.1s, color 0.1s;
}
.toggle-btn.toggle-active { background: var(--accent); color: #fff; }
.toggle-btn:hover:not(.toggle-active) { background: var(--bg3); }
.sync-btn {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); padding: 4px 12px; font-size: 12px; cursor: pointer;
  transition: background 0.1s;
}
.sync-btn:hover:not(:disabled) { background: var(--accent); color: #fff; }
.sync-btn:disabled { opacity: 0.5; cursor: default; }
.sync-msg { font-size: 12px; color: var(--text-dim); }
.sync-info { font-size: 11px; color: var(--text-dimmer); }
.issue-count { font-size: 12px; color: var(--text-dim); }
.issues-list { display: flex; flex-direction: column; gap: 4px; }
.issues-empty { color: var(--text-dim); font-size: 13px; padding: 24px 0; text-align: center; }
.issue-row {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px; display: flex; flex-direction: column; gap: 4px;
  transition: border-color 0.1s;
}
.issue-row:hover { border-color: var(--accent); }
.issue-main { display: flex; align-items: center; gap: 8px; }
.issue-icon { font-size: 14px; flex-shrink: 0; }
.issue-title {
  color: var(--text); text-decoration: none; font-size: 13px; font-weight: 500;
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.issue-title:hover { color: var(--accent); text-decoration: underline; }
.wq-badge {
  font-size: 10px; background: rgba(139,148,158,0.15); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; color: var(--text-dim); flex-shrink: 0;
}
.issue-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.issue-repo { font-size: 11px; color: var(--text-dimmer); font-family: monospace; }
.issue-label {
  font-size: 10px; background: rgba(56,139,253,0.15); border: 1px solid rgba(56,139,253,0.3);
  border-radius: 10px; padding: 1px 6px; color: #388bfd;
}
.issue-date { font-size: 11px; color: var(--text-dimmer); margin-left: auto; }
.issue-author { font-size: 11px; color: var(--text-dimmer); }

/* ── CodingAgent (crush web UI) ─────────────────────────────────────────── */
.coding-agent {
  display: flex; flex-direction: column; height: calc(100vh - 140px);
  padding: 16px; gap: 12px; box-sizing: border-box;
}
.ca-header {
  display: flex; align-items: center; gap: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.ca-header h2 { margin: 0; font-size: 18px; color: var(--text); }
.ca-subtitle { color: var(--text-dim); font-size: 12px; flex: 1; }
.ca-refresh-btn {
  background: var(--bg2); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: var(--radius-sm); padding: 4px 10px; cursor: pointer; font-size: 12px;
}
.ca-refresh-btn:hover { border-color: var(--accent); color: var(--accent); }
.ca-error {
  background: rgba(248,81,73,0.1); border: 1px solid rgba(248,81,73,0.3);
  border-radius: var(--radius-sm); padding: 8px 12px; color: #f85149; font-size: 13px;
}
.ca-layout {
  display: flex; flex: 1; gap: 12px; overflow: hidden;
}
.ca-sidebar {
  width: 220px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.ca-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--text-dim);
}
.ca-new-btn {
  background: var(--accent); border: none; color: #fff;
  border-radius: var(--radius-sm); padding: 2px 8px; cursor: pointer; font-size: 11px;
}
.ca-new-btn:hover { opacity: 0.85; }
.ca-session-list { flex: 1; overflow-y: auto; }
.ca-session-item {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 12px;
  border-bottom: 1px solid var(--border); cursor: pointer; position: relative;
  transition: background 0.1s;
}
.ca-session-item:hover { background: var(--bg3, rgba(255,255,255,0.04)); }
.ca-session-active { background: rgba(56,139,253,0.12); border-left: 2px solid var(--accent); }
.ca-session-title { font-size: 12px; color: var(--text); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ca-session-meta { display: flex; gap: 6px; align-items: center; }
.ca-badge {
  font-size: 10px; background: rgba(139,148,158,0.15); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 4px; color: var(--text-dimmer);
}
.ca-msg-count { font-size: 10px; color: var(--text-dimmer); }
.ca-del-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 12px; opacity: 0;
  transition: opacity 0.1s;
}
.ca-session-item:hover .ca-del-btn { opacity: 0.6; }
.ca-del-btn:hover { opacity: 1 !important; }
.ca-empty { color: var(--text-dimmer); font-size: 12px; padding: 24px 12px; text-align: center; }
.ca-main {
  flex: 1; display: flex; flex-direction: column; gap: 8px; overflow: hidden;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
}
.ca-history {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0;
}
.ca-history-header {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.ca-session-name { font-size: 13px; font-weight: 600; color: var(--text); }
.ca-cwd { font-size: 11px; color: var(--text-dimmer); font-family: monospace; }
.ca-messages { padding: 8px 0; display: flex; flex-direction: column; }
.ca-msg {
  display: flex; gap: 10px; padding: 8px 14px; border-bottom: 1px solid rgba(255,255,255,0.03);
}
.ca-msg:hover { background: rgba(255,255,255,0.02); }
.ca-msg-user { background: rgba(56,139,253,0.04); }
.ca-msg-assistant { }
.ca-msg-role { font-size: 16px; flex-shrink: 0; padding-top: 2px; }
.ca-msg-content {
  margin: 0; font-size: 12px; color: var(--text); white-space: pre-wrap;
  font-family: 'JetBrains Mono', 'Fira Code', monospace; line-height: 1.5;
  overflow-x: auto; flex: 1;
}
.ca-output-panel {
  border-top: 1px solid var(--border); padding: 10px 14px;
  display: flex; flex-direction: column; gap: 6px; max-height: 40%; overflow: hidden;
}
.ca-output-label { font-size: 11px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.ca-running { color: #e3b341; animation: pulse 1.5s ease-in-out infinite; }
.ca-done { color: #3fb950; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.ca-output {
  margin: 0; font-size: 12px; font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--text); overflow-y: auto; flex: 1; white-space: pre-wrap; line-height: 1.5;
}
.ca-prompt-area {
  border-top: 1px solid var(--border); padding: 10px 14px;
  display: flex; flex-direction: column; gap: 6px; flex-shrink: 0;
}
.ca-prompt-options { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ca-input-small {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 4px 8px; font-size: 11px;
  width: 180px; outline: none;
}
.ca-input-small:focus { border-color: var(--accent); }
.ca-continuing { font-size: 11px; color: var(--accent); font-family: monospace; }
.ca-prompt-row { display: flex; gap: 8px; align-items: flex-end; }
.ca-prompt-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px; font-size: 13px; resize: vertical;
  font-family: inherit; outline: none; min-height: 60px;
}
.ca-prompt-input:focus { border-color: var(--accent); }
.ca-run-btn {
  background: var(--accent); border: none; color: #fff; border-radius: var(--radius-sm);
  padding: 8px 18px; font-size: 13px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: opacity 0.15s;
}
.ca-run-btn:hover:not(:disabled) { opacity: 0.85; }
.ca-run-btn:disabled, .ca-run-busy { opacity: 0.5; cursor: not-allowed; }
.ca-prompt-hint { font-size: 10px; color: var(--text-dimmer); }

/* ── Diff toggle button ──────────────────────────────────────────────────── */
.ca-diff-toggle {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: var(--radius-sm); padding: 2px 8px; cursor: pointer; font-size: 11px;
  font-family: var(--font); margin-left: 8px; transition: border-color 0.15s, color 0.15s;
}
.ca-diff-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* Provider badge — shows which backend handled the run (claude-code vs crush failover) */
.ca-provider-badge {
  font-size: 10px; padding: 1px 6px; border-radius: 9px; font-weight: 600;
  letter-spacing: 0.02em; margin-left: 4px;
}
.ca-provider-claude {
  background: rgba(115, 72, 234, 0.18); color: #a78bfa; border: 1px solid rgba(115,72,234,0.35);
}
.ca-provider-crush {
  background: rgba(63, 185, 80, 0.15); color: #3fb950; border: 1px solid rgba(63,185,80,0.3);
}

.ca-diff-container { flex: 1; overflow: auto; }

/* ── DiffView component ─────────────────────────────────────────────────── */
.diff-view {
  display: flex; flex-direction: column; gap: 0;
  font-family: var(--font); font-size: 12px;
}

.diff-empty {
  color: var(--text-dimmer); font-size: 13px;
  padding: 24px; text-align: center;
}

/* Toolbar */
.diff-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}

.diff-stats {
  display: flex; gap: 10px; align-items: center;
  font-size: 12px; color: var(--text-dim);
}
.diff-stat-files { color: var(--text); font-weight: 600; }
.diff-stat-add { color: var(--green); font-weight: 600; }
.diff-stat-del { color: var(--red); font-weight: 600; }

.diff-mode-toggle {
  display: flex; border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.diff-mode-btn {
  background: transparent; border: none; color: var(--text-dim);
  padding: 3px 10px; cursor: pointer; font-size: 11px;
  font-family: var(--font); transition: background 0.1s, color 0.1s;
}
.diff-mode-btn:hover { background: var(--surface2); color: var(--text); }
.diff-mode-active { background: var(--accent) !important; color: #fff !important; }

/* File navigation */
.diff-file-nav {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 6px 12px; background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.diff-nav-item {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-size: 11px;
  transition: border-color 0.15s;
}
.diff-nav-item:hover { border-color: var(--accent); }
.diff-nav-name { color: var(--text); }
.diff-nav-add { color: var(--green); font-size: 10px; }
.diff-nav-del { color: var(--red); font-size: 10px; }

/* File section */
.diff-file {
  border-bottom: 1px solid var(--border);
}
.diff-file:last-child { border-bottom: none; }

.diff-file-header {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; background: var(--surface2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 38px; z-index: 5;
}
.diff-file-icon { font-size: 13px; }
.diff-file-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  font-family: var(--font);
}

.diff-file-body { background: var(--bg); }

/* Hunk */
.diff-hunk { border-bottom: 1px solid var(--border2); }
.diff-hunk:last-child { border-bottom: none; }

.diff-hunk-header {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 12px; background: rgba(56, 139, 253, 0.08);
  border-bottom: 1px solid var(--border2);
  cursor: pointer; user-select: none;
  transition: background 0.1s;
}
.diff-hunk-header:hover { background: rgba(56, 139, 253, 0.14); }
.diff-hunk-toggle { font-size: 10px; color: var(--text-dimmer); width: 12px; }
.diff-hunk-range {
  font-size: 11px; color: var(--blue); font-family: var(--font);
}
.diff-hunk-collapsed {
  padding: 4px 12px; font-size: 11px; color: var(--text-dimmer);
  font-style: italic; background: var(--surface2);
}

/* ── Unified view ────────────────────────────────────────────────────────── */
.diff-unified-table { display: flex; flex-direction: column; }

.diff-uni-row {
  display: flex; align-items: stretch;
  min-height: 20px; line-height: 20px;
}
.diff-uni-row.diff-line-add { background: rgba(63, 185, 80, 0.1); }
.diff-uni-row.diff-line-del { background: rgba(248, 81, 73, 0.1); }
.diff-uni-row.diff-line-ctx { background: transparent; }
.diff-uni-row:hover { filter: brightness(1.15); }

.diff-uni-num {
  display: inline-block; width: 44px; flex-shrink: 0;
  text-align: right; padding: 0 6px;
  color: var(--text-dimmer); font-size: 11px;
  border-right: 1px solid var(--border2);
  user-select: none;
}
.diff-uni-num-old { }
.diff-uni-num-new { }

.diff-uni-prefix {
  display: inline-block; width: 16px; flex-shrink: 0;
  text-align: center; color: var(--text-dim);
  font-weight: 600; user-select: none;
}
.diff-line-add .diff-uni-prefix { color: var(--green); }
.diff-line-del .diff-uni-prefix { color: var(--red); }

.diff-uni-code {
  margin: 0; flex: 1; padding: 0 8px;
  white-space: pre; overflow-x: auto;
  font-family: var(--font); font-size: 12px;
  color: var(--text); line-height: 20px;
}
.diff-line-add .diff-uni-code { color: var(--green); }
.diff-line-del .diff-uni-code { color: var(--red); }

/* ── Side-by-side view ───────────────────────────────────────────────────── */
.diff-sbs-table { display: flex; flex-direction: column; }

.diff-sbs-row {
  display: grid;
  grid-template-columns: 44px 1fr 1px 44px 1fr;
  min-height: 20px; line-height: 20px;
}
.diff-sbs-row:hover { filter: brightness(1.12); }

.diff-sbs-num {
  text-align: right; padding: 0 6px;
  color: var(--text-dimmer); font-size: 11px;
  border-right: 1px solid var(--border2);
  user-select: none; line-height: 20px;
}

.diff-sbs-gutter {
  background: var(--border); width: 1px;
}

.diff-sbs-code {
  margin: 0; padding: 0 8px;
  white-space: pre; overflow-x: auto;
  font-family: var(--font); font-size: 12px;
  color: var(--text); line-height: 20px;
}

.diff-sbs-code.diff-line-add {
  background: rgba(63, 185, 80, 0.1); color: var(--green);
}
.diff-sbs-code.diff-line-del {
  background: rgba(248, 81, 73, 0.1); color: var(--red);
}
.diff-sbs-code.diff-line-ctx { background: transparent; }
.diff-sbs-code.diff-line-empty {
  background: rgba(139, 148, 158, 0.04);
}

/* ── Services Directory ──────────────────────────────────────────────────── */
.services-container {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.services-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.services-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.services-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.svc-cat-filters {
  display: flex;
  gap: 6px;
}

.svc-cat-btn {
  padding: 4px 12px;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.svc-cat-btn:hover { border-color: var(--accent); color: var(--accent); }
.svc-cat-active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

.svc-recheck-btn {
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.svc-recheck-btn:hover { border-color: var(--accent); color: var(--accent); }

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.svc-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.svc-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.svc-card-hidden { display: none; }

.svc-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.svc-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 2px;
}

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

.svc-name {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.svc-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.4;
}

.svc-status {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.svc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.svc-dot-unknown  { background: var(--text-dimmer); }
.svc-dot-checking { background: #f0c040; animation: svc-pulse 1s infinite; }
.svc-dot-up       { background: var(--green); }
.svc-dot-down     { background: var(--red); }

@keyframes svc-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.svc-status-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  min-width: 28px;
}

.svc-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.svc-cat-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-dim);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.svc-open-btn {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 5px;
  border: 1px solid var(--accent);
  transition: all 0.15s;
}
.svc-open-btn:hover {
  background: var(--accent);
  color: #fff;
}


/* ── Timeline ──────────────────────────────────────────────────────────────── */
.tl-container {
  padding: 1rem 1.5rem;
  position: relative;
}

.tl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.tl-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.tl-header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.tl-updated {
  font-size: 11px;
  color: var(--text-dimmer);
}

.tl-refresh-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.tl-refresh-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tl-subtitle {
  font-size: 12px;
  color: var(--text-dimmer);
  margin-bottom: 0.85rem;
}

.tl-spinner {
  color: var(--text-dim);
  font-size: 13px;
  padding: 1rem 0;
}

/* Legend */
.tl-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  margin-bottom: 1rem;
  font-size: 11px;
  color: var(--text-dim);
}

.tl-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

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

/* Panel */
.tl-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
}

/* Row */
.tl-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.tl-slot-label {
  min-width: 3.8rem;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dimmer);
  flex-shrink: 0;
}

/* Axis */
.tl-axis {
  position: relative;
  height: 24px;
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border-subtle, #21262d);
  border-radius: 4px;
  min-width: 280px;
}

/* Markers */
.tl-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s;
}
.tl-marker:hover {
  transform: translate(-50%, -50%) scale(1.8) !important;
}

.tl-marker-fault {
  border-radius: 2px;
  transform: translate(-50%, -50%) rotate(45deg);
}
.tl-marker-fault:hover {
  transform: translate(-50%, -50%) rotate(45deg) scale(1.8) !important;
}

/* Time axis labels */
.tl-time-axis {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-dimmer);
  margin-top: 0.3rem;
  padding: 0 0 0.1rem;
}

/* Tooltip */
.tl-tooltip {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  font-size: 12px;
  color: var(--text);
  pointer-events: none;
  z-index: 300;
  max-width: 240px;
  line-height: 1.5;
  top: 50%;
  left: 50%;
}

.tl-tooltip-hidden {
  display: none;
}

.tl-tooltip-visible {
  display: block;
}

.tl-tt-type {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}

.tl-tt-meta {
  color: var(--text-dim);
  font-size: 11px;
}

.tl-tt-detail {
  color: var(--text);
  font-size: 11px;
  margin-top: 3px;
  word-break: break-word;
}

/* Vertical event list */
.tl-event-list {
  margin-top: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.tl-event-list-header {
  padding: 0.5rem 1rem;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.tl-ev-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 1rem;
  border-bottom: 1px solid var(--border-subtle, #21262d);
  font-size: 12px;
  line-height: 1.4;
}
.tl-ev-row:last-child { border-bottom: none; }
.tl-ev-row:hover { background: var(--bg-hover, rgba(255,255,255,0.03)); }

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

.tl-ev-time {
  color: var(--text-dimmer);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 5.5rem;
}

.tl-ev-slot {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 5px;
  font-size: 10px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.tl-ev-type {
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
  min-width: 7rem;
}

.tl-ev-detail {
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
