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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0d1117;
  color: #c9d1d9;
  min-height: 100vh;
}

/* Board page: flex-column body with fixed header + in-flow toolbar +
   board that fills remaining viewport. No var-height sync needed — the
   browser computes everything. Scoped to index.html via :has(main.board)
   so other pages (dashboard, activity, usage, settings) keep normal flow. */
html:has(main.board),
html:has(main.board) body {
  overflow: hidden;
  height: 100vh;
}

body:has(main.board) {
  padding-top: var(--header-height);
  display: flex;
  flex-direction: column;
}

body:has(main.board) .board-toolbar { flex: 0 0 auto; }
body:has(main.board) .search-filter-banner { flex: 0 0 auto; }
body:has(main.board) main.board { flex: 1 1 auto; min-height: 0; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 8px;
  padding: 16px 24px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1001;
}

header button,
header select,
header .lets-chat-btn,
header nav a {
  white-space: nowrap;
}

header h1 {
  font-size: 20px;
  font-weight: 600;
  color: #e6edf3;
  white-space: nowrap;
}

@media (max-width: 900px) {
  header .h1-tagline { display: none; }
}

.header-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Board toolbar — board-specific controls (search, project filter, focus/
   collapse/new-task) live here, below the header but above the columns.
   Flex child of body; sits in normal flow below the fixed header's
   reserved space (body padding-top). */
.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  row-gap: 8px;
  padding: 6px 24px 8px;
  background: #0d1117;
  border-bottom: 1px solid #21262d;
  position: relative;
  z-index: 1000;
}

.board-toolbar-left,
.board-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  row-gap: 8px;
}

.board-toolbar button,
.board-toolbar select,
.board-toolbar input {
  white-space: nowrap;
}

.search-wrapper {
  position: relative;
}

.search-wrapper input {
  width: 200px;
  transition: width 0.2s;
}

.search-wrapper input:focus {
  width: 280px;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  min-width: 360px;
  max-height: 400px;
  overflow-y: auto;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  margin-top: 4px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  scrollbar-width: thin;
  scrollbar-color: #30363d transparent;
}

.search-results.hidden { display: none; }

.search-result {
  padding: 10px 14px;
  border-bottom: 1px solid #21262d;
  cursor: pointer;
  transition: background 0.1s;
}

.search-result:last-child { border-bottom: none; }
.search-result:hover { background: #1a1e24; }

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

.search-result-title {
  font-size: 13px;
  font-weight: 500;
  color: #e6edf3;
}

.search-result-meta {
  display: flex;
  gap: 6px;
  font-size: 11px;
}

.search-empty {
  padding: 16px;
  color: #484f58;
  font-size: 13px;
  text-align: center;
}

.status-pill-inline {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
}
.status-pill-inline.backlog { background: #484f58; color: #e6edf3; }
.status-pill-inline.in_progress { background: #1f6feb; color: #fff; }
.status-pill-inline.blocked { background: #da3633; color: #fff; }
.status-pill-inline.in_review { background: #9e6a03; color: #fff; }
.status-pill-inline.done { background: #238636; color: #fff; }

select, input, textarea {
  background: #0d1117;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  font-family: inherit;
}

select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: #58a6ff;
}

button {
  background: #238636;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

button:hover {
  background: #2ea043;
}

/* Board layout */
.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 20px 24px;
  align-items: stretch;
  overflow: hidden;
}

.column {
  background: #161b22;
  border-radius: 8px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid;
}

.column-header.backlog {
  color: #8b949e;
  border-color: #484f58;
}

.column-header.in_progress {
  color: #58a6ff;
  border-color: #1f6feb;
}

.column-header.blocked {
  color: #f85149;
  border-color: #da3633;
}

.column-header.in_review {
  color: #d29922;
  border-color: #9e6a03;
}

.column-header.done {
  color: #3fb950;
  border-color: #238636;
}

.count {
  background: #30363d;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  color: #8b949e;
}

.done-toggle, .column-sort-btn {
  background: #21262d;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  color: #8b949e;
  cursor: pointer;
  transition: background 0.15s;
}

.done-toggle {
  margin-left: auto;
}

.column-sort-btn {
  margin-left: auto;
}

.done-toggle + .column-sort-btn {
  margin-left: 4px;
}

.done-toggle:hover, .column-sort-btn:hover {
  background: #30363d;
  color: #e6edf3;
}

.column-sort-btn.sort-active {
  background: #1f6feb;
  color: #e6edf3;
}

.card-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: #30363d transparent;
}

/* Task cards */
.card {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.card:hover {
  border-color: #58a6ff;
}

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

.card-id {
  font-size: 11px;
  color: #484f58;
  font-weight: 500;
  font-family: monospace;
}

.badge-priority-critical {
  background: #da3633;
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-priority-high {
  background: #9e6a03;
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-priority-medium {
  background: #1f2937;
  color: #58a6ff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 500;
  text-transform: uppercase;
}

.badge-priority-low {
  background: #30363d;
  color: #8b949e;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 500;
  text-transform: uppercase;
}

.card-title {
  font-size: 13px;
  font-weight: 500;
  color: #e6edf3;
  margin-bottom: 8px;
  word-break: break-word;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card collapse/expand */
.card-chevron {
  margin-left: auto;
  font-size: 9px;
  color: #484f58;
  transition: color 0.15s;
}

.card:hover .card-chevron {
  color: #8b949e;
}

.card-details {
  transition: max-height 0.2s ease, opacity 0.15s ease;
  overflow: hidden;
}

.card.collapsed .card-details {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}

.card.collapsed .card-title {
  margin-bottom: 0;
}

/* Collapse All button */
.collapse-all-btn {
  background: #21262d;
  color: #c9d1d9;
  font-size: 13px;
  padding: 5px 12px;
  border: 1px solid #30363d;
}

.collapse-all-btn:hover {
  background: #30363d;
  border-color: #8b949e;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
}

.badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.badge-project {
  background: #1f2937;
  color: #79c0ff;
}

.badge-agent {
  background: #1a1e2e;
  color: #a5b4fc;
}

.badge-branch {
  background: #1a2e1a;
  color: #7ee787;
}

.badge-cost {
  background: #0d2818;
  color: #3fb950;
  font-family: monospace;
}

/* Hide costs mode — applies across board and dashboard views */
body.hide-costs .badge-cost,
body.hide-costs .cost,
body.hide-costs [data-cost-section] {
  display: none !important;
}

.badge-time {
  color: #484f58;
}

.blocked-reason {
  margin-top: 6px;
  font-size: 12px;
  color: #f85149;
  padding: 4px 8px;
  background: #1a0a0a;
  border-radius: 4px;
}

.mcp-failure-banner {
  background: #1a1400;
  border: 1px solid #9e6a03;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #d29922;
}
.mcp-failure-banner .mcp-failure-icon {
  flex-shrink: 0;
}
.mcp-failure-banner .retry-btn {
  margin-left: auto;
  background: #e67e22;
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  flex-shrink: 0;
}
.mcp-failure-banner .retry-btn:hover {
  background: #d35400;
}

.review-notes {
  margin-top: 6px;
  font-size: 12px;
  color: #d29922;
  padding: 4px 8px;
  background: #1a1400;
  border-radius: 4px;
  border-left: 2px solid #9e6a03;
  white-space: pre-wrap;
}
.review-cycle-header {
  font-weight: 700;
  color: #58a6ff;
  border-bottom: 1px solid #30363d;
  padding: 4px 0 2px;
  margin: 8px 0 4px;
  font-size: 11px;
  text-transform: uppercase;
}
.review-notes .review-cycle-header:first-child {
  margin-top: 0;
}

/* Description toggle */
.card-description-toggle {
  font-size: 11px;
  color: #484f58;
  cursor: pointer;
  margin-top: 8px;
  padding: 4px 0;
  min-height: 32px;
  display: flex;
  align-items: center;
  user-select: none;
}
.card-description-toggle:hover {
  color: #8b949e;
}
.toggle-chevron {
  font-size: 9px;
  display: inline-block;
  transition: transform 0.15s;
}
.card-description-toggle.open .toggle-chevron {
  transform: rotate(90deg);
}
.card-description {
  font-size: 12px;
  color: #8b949e;
  margin-top: 4px;
  margin-bottom: 4px;
  word-break: break-word;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.2s ease, opacity 0.15s ease;
}
.card-description.visible {
  max-height: 300px;
  overflow-y: auto;
  opacity: 1;
  white-space: pre-wrap;
}

/* Card actions (visible on hover) */
.card-actions {
  display: none;
  margin-top: 8px;
  gap: 6px;
}

.card:hover .card-actions {
  display: flex;
}

/* Always show review actions on in_review cards */
[data-status="in_review"] .card .card-actions {
  display: flex;
}

.card-actions button {
  font-size: 11px;
  padding: 2px 8px;
  background: #21262d;
  color: #c9d1d9;
}

.card-actions button:hover {
  background: #30363d;
}

.card-actions button.delete-btn:hover {
  background: #da3633;
}

.modal-actions .delete-btn {
  background: #da3633;
  color: #fff;
  margin-right: auto;
}
.modal-actions .delete-btn:hover {
  background: #f85149;
}

.card-actions button.approve-btn {
  background: #238636;
  color: #fff;
}

.card-actions button.approve-btn:hover {
  background: #2ea043;
}

.card-actions button.changes-btn {
  background: #9e6a03;
  color: #fff;
}

.card-actions button.changes-btn:hover {
  background: #bb8009;
}

.card-actions button.chat-btn {
  background: #1f6feb;
  color: #fff;
}

.card-actions button.chat-btn:hover {
  background: #388bfd;
}

.review-summary-link {
  margin-top: 6px;
  font-size: 11px;
  color: #58a6ff;
  cursor: pointer;
  padding: 2px 0;
}

.review-summary-link:hover {
  text-decoration: underline;
}

/* Review Summary Modal */
.summary-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.summary-overlay.hidden {
  display: none;
}

.summary-modal {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 24px;
  width: 800px;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.summary-modal h2 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #e6edf3;
}

.summary-modal pre {
  flex: 1;
  overflow: auto;
  font-size: 13px;
  color: #c9d1d9;
  white-space: pre-wrap;
  word-break: break-word;
  background: #0d1117;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid #21262d;
  max-height: 60vh;
}

.summary-modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 24px;
  width: 420px;
  max-width: 90vw;
}

.modal h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: #e6edf3;
}

.modal label {
  display: block;
  font-size: 13px;
  color: #8b949e;
  margin-bottom: 12px;
}

.modal label select,
.modal label input,
.modal label textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.modal-actions button[type="button"] {
  background: #21262d;
}

.modal-actions button[type="button"]:hover {
  background: #30363d;
}

/* Inline new project fields in task modal */
.new-project-fields {
  background: #0d1117;
  border: 1px solid #1f6feb;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
}

.new-project-fields.hidden {
  display: none;
}

.new-project-fields label {
  margin-bottom: 8px;
}

.new-project-fields label:last-child {
  margin-bottom: 0;
}

/* Project settings button */
.project-settings-btn {
  background: #21262d;
  border: 1px solid #30363d;
  color: #8b949e;
  font-size: 14px;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.project-settings-btn:hover {
  color: #58a6ff;
  background: #1a1e2e;
  border-color: #1f6feb;
}
.project-settings-btn.hidden { display: none; }

/* Deliver button */
.project-deliver-btn {
  background: #21262d;
  border: 1px solid #30363d;
  color: #8b949e;
  font-size: 14px;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.project-deliver-btn:hover:not(:disabled) {
  color: #58a6ff;
  background: #1a1e2e;
  border-color: #1f6feb;
}
.project-deliver-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.project-deliver-btn.hidden { display: none; }

/* Deliver modal */
.deliver-modal h3 {
  font-size: 16px;
  margin: 0 0 12px;
  color: #e6edf3;
}
.deliver-preview {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  color: #8b949e;
  margin-bottom: 12px;
}
.deliver-path-input {
  display: block;
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e6edf3;
  font-family: monospace;
  font-size: 13px;
  padding: 8px 10px;
  margin-top: 4px;
  box-sizing: border-box;
}
.deliver-progress {
  margin-top: 12px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.deliver-progress.hidden { display: none; }
.deliver-progress-bar {
  height: 6px;
  flex: 1;
  background: #21262d;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.deliver-progress-bar::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 30%;
  background: #58a6ff;
  border-radius: 3px;
  animation: deliver-bar-pulse 1.5s ease-in-out infinite;
}
@keyframes deliver-bar-pulse {
  0%, 100% { width: 20%; opacity: 0.7; }
  50% { width: 60%; opacity: 1; }
}
.deliver-progress-text {
  font-size: 12px;
  color: #8b949e;
  white-space: nowrap;
}
.deliver-error {
  margin-top: 8px;
  font-size: 13px;
  color: #d29922;
  background: #2d2a1e;
  border: 1px solid #d29922;
  border-radius: 6px;
  padding: 10px 12px;
}
.deliver-error.hidden { display: none; }
.deliver-error-details {
  margin-top: 8px;
  font-size: 12px;
  color: #8b949e;
}
.deliver-error-details summary {
  cursor: pointer;
  user-select: none;
}
.deliver-error-details pre {
  margin-top: 4px;
  font-family: monospace;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
  background: #161b22;
  padding: 6px 8px;
  border-radius: 4px;
  color: #8b949e;
}
.deliver-error-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}
.deliver-error-actions .btn-small {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid #444c56;
  background: #21262d;
  color: #c9d1d9;
}
.deliver-error-actions .btn-small:hover {
  background: #30363d;
}

/* Delivery overwrite confirmation */
.deliver-overwrite {
  margin-top: 10px;
  background: #3d2e00;
  border: 1px solid #6e5a1f;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  color: #e3b341;
}
.deliver-overwrite.hidden { display: none; }
.deliver-overwrite p { margin: 0 0 8px; }
.deliver-overwrite-actions {
  display: flex;
  gap: 8px;
}
.btn-danger {
  background: #da3633;
  color: #fff;
  border: 1px solid #f85149;
  border-radius: 6px;
  padding: 4px 14px;
  cursor: pointer;
  font-size: 13px;
}
.btn-danger:hover { background: #b62324; }

/* Delivery toast */
.deliver-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #238636;
  color: #fff;
  border: 1px solid #2ea043;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  max-width: 520px;
  text-align: center;
  line-height: 1.6;
}
.deliver-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  cursor: pointer;
}
.deliver-toast-btn {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 13px;
  margin-left: 4px;
}
.deliver-toast-btn:hover { background: rgba(255,255,255,0.35); }

/* Terminal path button */
.terminal-btn {
  background: #21262d;
  border: 1px solid #30363d;
  color: #8b949e;
  font-size: 12px;
  font-family: monospace;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.terminal-btn:hover {
  color: #3fb950;
  background: #1a2e1a;
  border-color: #238636;
}
.terminal-btn.copied {
  color: #3fb950;
  border-color: #238636;
}

/* Terminal panel */
.terminal-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 340px;
  background: #0d1117;
  border-top: 1px solid #30363d;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.2s ease;
}

.terminal-panel.open {
  transform: translateY(0);
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  min-height: 36px;
}

.terminal-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
}

.terminal-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: #8b949e;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.terminal-tab.active {
  background: #21262d;
  color: #e6edf3;
}

.terminal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #484f58;
  flex-shrink: 0;
}

.terminal-dot.alive {
  background: #3fb950;
  box-shadow: 0 0 6px #3fb950;
  animation: pulse-dot 2s infinite;
}

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

.terminal-tab-label {
  cursor: pointer;
}

.terminal-tab-project {
  cursor: pointer;
  opacity: 0.4;
  font-size: 11px;
  text-decoration: none;
  color: #58a6ff;
  margin-left: 2px;
}

.terminal-tab-project:hover {
  opacity: 1;
}

.terminal-tab-close {
  cursor: pointer;
  opacity: 0.5;
  font-size: 14px;
  line-height: 1;
}

.terminal-tab-close:hover {
  opacity: 1;
  color: #f85149;
}

.terminal-controls {
  display: flex;
  gap: 6px;
}

.terminal-controls button {
  background: #21262d;
  border: 1px solid #30363d;
  color: #8b949e;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.terminal-controls button:hover {
  color: #e6edf3;
  border-color: #8b949e;
}

.terminal-tab-test {
  color: #a78bfa;
  font-size: 11px;
  cursor: pointer;
  margin-left: 4px;
  font-weight: 500;
}

.terminal-tab-test:hover {
  color: #c4b5fd;
  text-decoration: underline;
}

/* Neutral passive 'Disconnected' indicator on stale bridge tabs. */
.terminal-tab-stale {
  color: #8b949e;
  font-size: 11px;
  margin-left: 6px;
  font-style: italic;
}

.terminal-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.terminal-instance {
  position: absolute;
  inset: 0;
  padding: 4px;
}

.board-with-terminal {
  height: calc(100vh - var(--header-height) - 350px);
}
/* When terminal is open, lift chat panel above the terminal */
.board-with-terminal ~ .chat-panel { bottom: 340px; }

/* Launch agent button */
.launch-agent-btn {
  background: #238636;
  color: #fff;
  border: 1px solid #2ea043;
  font-weight: 500;
}

.launch-agent-btn:hover {
  background: #2ea043;
}

/* Resume agent button */
.resume-agent-btn {
  background: #8b5cf6;
  color: #fff;
  border: 1px solid #9b6ff6;
  font-weight: 500;
}

.resume-agent-btn:hover {
  background: #a78bfa;
}

/* Agent active dot on cards */
.agent-active-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3fb950;
  margin-left: 4px;
  vertical-align: middle;
  animation: pulse-dot 2s infinite;
}

/* Agent stale dot — in_progress but no alive agent */
.agent-stale-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d29922;
  margin-left: 4px;
  vertical-align: middle;
}

/* Launch orchestrator button */
.launch-orchestrator-btn {
  background: #8b5cf6;
  color: #fff;
  border: 1px solid #9b6ff6;
  font-weight: 500;
}

.launch-orchestrator-btn:hover {
  background: #a78bfa;
}

/* Orchestration status button */
.orchestration-status-btn {
  background: #1f6feb;
  color: #fff;
  border: 1px solid #388bfd;
  font-weight: 500;
  font-size: 11px;
}

.orchestration-status-btn:hover {
  background: #388bfd;
}

/* Resume/Retry orchestration buttons */
.resume-orchestration-btn {
  background: #27ae60;
  color: #fff;
  border: 1px solid #2ecc71;
  font-weight: 500;
  font-size: 11px;
}

.resume-orchestration-btn:hover {
  background: #2ecc71;
}

.retry-orchestration-btn {
  background: #e67e22;
  color: #fff;
  border: 1px solid #f39c12;
  font-weight: 500;
  font-size: 11px;
}

.retry-orchestration-btn:hover {
  background: #f39c12;
}

/* Orchestrator child tasks display */
.orchestrator-children {
  margin-top: 8px;
  padding: 8px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 6px;
  font-size: 12px;
}

.orchestrator-label {
  font-weight: 600;
  color: #a78bfa;
  margin-bottom: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.child-task-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}

.child-task-id {
  color: #8b949e;
  font-size: 11px;
  min-width: 30px;
}

.child-task-title {
  color: #c9d1d9;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status dots for child tasks */
.child-task-status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot-backlog { background: #8b949e; }
.status-dot-in-progress { background: #1f6feb; animation: pulse-dot 2s infinite; }
.status-dot-in-progress-static { background: #1f6feb; }
.status-dot-blocked { background: #f85149; }
.status-dot-in-review { background: #d29922; }
.status-dot-done { background: #3fb950; }

/* Parent task link for child tasks */
.parent-task-link {
  margin-top: 6px;
  font-size: 11px;
  color: #8b949e;
  font-style: italic;
}

.parent-task-link .card-id {
  color: #a78bfa;
}

/* Launch toast */
.launch-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1f6feb;
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.launch-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* QA verdict badges */
.qa-verdict {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.qa-approve {
  color: #3fb950;
  background: #0d2818;
  border: 1px solid #238636;
}

.qa-changes {
  color: #f0883e;
  background: #1a1400;
  border: 1px solid #9e6a03;
}

/* Agent session stats badge */
.badge-sessions {
  background: #1a1e2e;
  color: #a5b4fc;
  font-family: monospace;
  font-size: 10px;
}

/* Output file links on cards */
.output-files {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.output-file-link {
  font-size: 10px;
  color: #58a6ff;
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 3px;
  padding: 1px 6px;
  text-decoration: none;
  font-family: monospace;
}

.output-file-link:hover {
  background: #161b22;
  border-color: #58a6ff;
}

/* File Browser Modal */
.file-browser-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.file-browser-overlay.hidden {
  display: none;
}

.file-browser-modal {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.file-browser-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #30363d;
}

.file-browser-header h2 {
  font-size: 15px;
  color: #e6edf3;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-browser-close {
  background: none;
  border: none;
  color: #8b949e;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.file-browser-close:hover {
  color: #e6edf3;
}

.file-browser-list {
  overflow-y: auto;
  flex: 1;
}

.file-browser-row {
  display: grid;
  grid-template-columns: 28px 1fr 70px 90px 60px;
  align-items: center;
  padding: 8px 18px;
  border-bottom: 1px solid #21262d;
  color: #c9d1d9;
  font-size: 13px;
  cursor: default;
  transition: background 0.15s;
}

.file-browser-row:hover {
  background: #1c2333;
}

.file-browser-row-icon {
  font-size: 16px;
  text-align: center;
}

.file-browser-row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: monospace;
  font-size: 12px;
}

.file-browser-row-size {
  color: #8b949e;
  font-size: 11px;
  text-align: right;
  font-family: monospace;
}

.file-browser-row-date {
  color: #8b949e;
  font-size: 11px;
  text-align: right;
}

.file-browser-row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.file-browser-row-actions button {
  background: none;
  border: none;
  color: #58a6ff;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 3px;
}

.file-browser-row-actions button:hover {
  background: #30363d;
}

.file-browser-empty {
  padding: 40px 18px;
  text-align: center;
  color: #8b949e;
  font-size: 14px;
}

.file-browser-empty.hidden {
  display: none;
}

.file-browser-preview {
  border-top: 1px solid #30363d;
  max-height: 45vh;
  display: flex;
  flex-direction: column;
}

.file-browser-preview.hidden {
  display: none;
}

.file-browser-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  background: #0d1117;
  font-size: 12px;
  color: #58a6ff;
  font-family: monospace;
}

.file-browser-preview-content {
  flex: 1;
  overflow: auto;
  padding: 12px 18px;
  margin: 0;
  font-size: 12px;
  font-family: monospace;
  color: #c9d1d9;
  background: #0d1117;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

/* View Output button on cards */
.view-output-btn {
  display: inline-block;
  font-size: 11px;
  color: #58a6ff;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  margin-top: 6px;
  margin-bottom: 2px;
  font-family: inherit;
}

.view-output-btn:hover {
  background: #161b22;
  border-color: #58a6ff;
}

@media (max-width: 600px) {
  .file-browser-modal {
    width: 98%;
    max-height: 90vh;
  }

  .file-browser-row {
    grid-template-columns: 28px 1fr 60px;
    padding: 8px 12px;
  }

  .file-browser-row-date,
  .file-browser-row-size {
    display: none;
  }
}

/* Agent completion toast */
.agent-toast {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  max-width: 400px;
}

.agent-toast.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.agent-toast.success {
  background: #238636;
  color: #fff;
  border: 1px solid #2ea043;
}

.agent-toast.error {
  background: #da3633;
  color: #fff;
  border: 1px solid #f85149;
}

.agent-toast.info {
  background: #1f6feb;
  color: #fff;
  border: 1px solid #388bfd;
}

/* Orchestration badges */
.badge-orchestration { font-size: 10px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; padding: 1px 5px; border-radius: 3px; }
.badge-orch-planning { background: #8b5cf6; color: #fff; animation: pulse-dot 2s infinite; }
.badge-orch-running { background: #f0883e; color: #fff; animation: pulse-dot 2s infinite; }
.badge-orch-completed { background: #238636; color: #fff; }
.badge-orch-failed { background: #da3633; color: #fff; }

/* Wall-time badges */
.badge-wall-time { font-size: 10px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; padding: 1px 5px; border-radius: 3px; }
.badge-wall-time-in-progress { background: #f0883e; color: #fff; }
.badge-wall-time-blocked { background: #da3633; color: #fff; }
.badge-wall-time-in-review { background: #8b5cf6; color: #fff; }
.badge-wall-time-done { background: #238636; color: #fff; }

/* Cancel orchestration button */
.cancel-orchestration-btn { display: block; margin-top: 16px; padding: 8px 20px; background: #da3633; color: #fff; border: 1px solid #f85149; border-radius: 6px; cursor: pointer; font-weight: 500; }
.cancel-orchestration-btn:hover { background: #f85149; }

/* Search filter banner */
.search-filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  background: #1a3a5c;
  border: 1px solid #1f6feb;
  border-left: none;
  border-right: none;
  font-size: 13px;
  color: #e6edf3;
}

.search-filter-banner.hidden {
  display: none;
}

.search-filter-banner button {
  background: transparent;
  color: #8b949e;
  border: none;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
}

.search-filter-banner button:hover {
  color: #e6edf3;
  background: rgba(255, 255, 255, 0.1);
}

/* Card highlight for search filter */
.card-highlighted {
  border-color: #58a6ff;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.3);
  animation: highlight-pulse 1.5s ease-in-out;
}

@keyframes highlight-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.5); }
}

/* Responsive */
@media (max-width: 1200px) {
  .board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 500px) {
  .board {
    grid-template-columns: 1fr;
  }
  .column {
    max-height: 60vh;
  }
}

/* Workspace picker (cloud mode) */
.workspace-prefix-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 4px;
}

.workspace-prefix {
  background: #0d1117;
  border: 1px solid #30363d;
  border-right: none;
  border-radius: 6px 0 0 6px;
  padding: 6px 8px;
  font-size: 12px;
  color: #8b949e;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  flex-shrink: 0;
}

.workspace-prefix-row input {
  flex: 1;
  border-radius: 0 6px 6px 0 !important;
  margin-top: 0 !important;
}

.workspace-browse {
  margin-top: 8px;
}

.workspace-browse select {
  display: block;
  width: 100%;
  margin-top: 4px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 6px 8px;
  color: #c9d1d9;
  font-size: 14px;
  font-family: inherit;
}

.workspace-browse select:focus {
  outline: none;
  border-color: #58a6ff;
}

.workspace-error {
  color: #f85149;
  font-size: 12px;
  margin-top: 6px;
}

.workspace-error.hidden {
  display: none;
}

.workspace-info {
  padding: 8px;
  background: #1a1a2e;
  border-radius: 4px;
}

.workspace-info .workspace-label {
  color: #888;
  margin-right: 8px;
}

.workspace-info .workspace-path {
  font-family: monospace;
  word-break: break-all;
}

.workspace-guidance {
  background: #1c2128;
  border: 1px solid #d29922;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 13px;
  color: #d29922;
}

/* Chat panel — side-docked, full height, user can pin to right or left */
:root { --header-height: 57px; --chat-panel-width: 420px; }
.chat-panel { position:fixed;top:var(--header-height);bottom:0;width:var(--chat-panel-width);background:#0d1117;z-index:1000;display:flex;flex-direction:column;transition:transform .2s ease; }
.chat-panel.no-transition { transition: none !important; }
.chat-panel.dock-right { right:0;left:auto;border-left:1px solid #30363d;transform:translateX(100%); }
.chat-panel.dock-left { left:0;right:auto;border-right:1px solid #30363d;transform:translateX(-100%); }
.chat-panel.dock-right.open { transform:translateX(0); }
.chat-panel.dock-left.open { transform:translateX(0); }
/* Tasks board (#board) + its fixed-position toolbar get padding-based shrink
   so columns reflow without reflowing the whole page layout. */
body.chat-open.chat-dock-right #board, body.chat-open.chat-dock-right .board-toolbar { padding-right:calc(var(--chat-panel-width) + 16px); }
body.chat-open.chat-dock-left #board, body.chat-open.chat-dock-left .board-toolbar { padding-left:calc(var(--chat-panel-width) + 16px); }

/* Generic <main> content on Dashboard/Activity/Usage/Settings: shrink by
   subtracting the chat column. One rule covers all four pages; page-specific
   selectors below are only needed when a page wants different margins. */
body.chat-open main:not(#board) {
  max-width: calc(100vw - var(--chat-panel-width) - 48px);
}
body.chat-open.chat-dock-right main:not(#board) {
  margin-right: var(--chat-panel-width);
  padding-right: 16px;
}
body.chat-open.chat-dock-left main:not(#board) {
  margin-left: var(--chat-panel-width);
  padding-left: 16px;
}
/* Settings uses .container instead of <main>; include it in the same shrink. */
body.chat-open .container {
  max-width: calc(100vw - var(--chat-panel-width) - 48px);
}
body.chat-open.chat-dock-right .container {
  margin-right: var(--chat-panel-width);
  margin-left: 0;
  padding-right: 16px;
}
body.chat-open.chat-dock-left .container {
  margin-left: var(--chat-panel-width);
  margin-right: 0;
  padding-left: 16px;
}

main.dashboard-main {
  margin-top: var(--header-height);
  padding-top: 34px;
}

/* Narrow viewports: when there isn't enough room to show main + chat side by
   side, chat takes the full width and main hides. Everything the user needs
   (status, approvals, commands) still flows through chat, so no information
   is lost — it's just presented in a single column. The top-right Hide/Show
   Chat button remains the escape hatch back to the board. */
@media (max-width: 720px) {
  body.chat-open main, body.chat-open .container,
  body.chat-open #board, body.chat-open .board-toolbar,
  body.chat-open .search-filter-banner {
    display: none !important;
  }
  body.chat-open .chat-panel.open {
    width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
    border-left: none;
    border-right: none;
  }
  /* Disable the side-shrink margins at this width so nothing fights the full-
     bleed chat panel. */
  body.chat-open.chat-dock-right main:not(#board),
  body.chat-open.chat-dock-left main:not(#board),
  body.chat-open .container {
    margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0;
  }
}
/* Focus mode: hide low-activity columns to give the active workflow
   (In Progress, In Review) more horizontal room. Blocked reappears
   automatically if any task lands in it. Works whether or not chat is open. */
body.focus-mode #board .column[data-status="backlog"] { display:none; }
body.focus-mode #board .column[data-status="done"] { display:none; }
body.focus-mode #board .column[data-status="blocked"]:not(.has-tasks) { display:none; }
body.focus-mode #board { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
/* Backlog View: show only the backlog column for triage */
body.backlog-view #board .column[data-status="in_progress"] { display:none; }
body.backlog-view #board .column[data-status="blocked"] { display:none; }
body.backlog-view #board .column[data-status="in_review"] { display:none; }
body.backlog-view #board .column[data-status="done"] { display:none; }
body.backlog-view #board { grid-template-columns: 1fr; }
/* Lock width so the rotating label (Focus / Backlog View / Show All) doesn't
   reshuffle the rest of the header row as it changes between states. */
#focus-mode-btn { min-width: 110px; text-align: center; }
#focus-mode-btn.active { background:#1f6feb;color:#fff;border-color:#388bfd; }
#focus-mode-btn.active:hover { background:#388bfd; }
#focus-mode-btn.backlog-active { background:#9e6a03;color:#fff;border-color:#bb8009; }
#focus-mode-btn.backlog-active:hover { background:#bb8009; }
/* Resize handle — 6px strip on the inner edge of the panel */
.chat-resize-handle { position:absolute;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:10;transition:background .15s ease; }
.chat-resize-handle:hover, .chat-resize-handle.dragging { background:#1f6feb; }
.chat-panel.dock-right .chat-resize-handle { left:-3px; }
.chat-panel.dock-left .chat-resize-handle { right:-3px; }
body.chat-resizing { cursor:col-resize !important;user-select:none; }
body.chat-resizing * { cursor:col-resize !important; }
/* Disable transitions while dragging so the panel tracks the cursor exactly */
body.chat-resizing .chat-panel { transition:none !important; }
.chat-header { display:flex;align-items:center;justify-content:space-between;gap:8px;padding:14px 12px 10px;background:#161b22;border-bottom:1px solid #30363d; }
.chat-header-title { color:#c9d1d9;font-weight:600;font-size:13px;display:flex;align-items:center;gap:6px;min-width:0;flex:1; }
.chat-controls button { background:#21262d;border:1px solid #30363d;color:#8b949e;font-size:14px;padding:2px 8px;border-radius:4px;cursor:pointer;line-height:1; }
.chat-controls button:hover { color:#e6edf3;border-color:#8b949e; }
.chat-messages { flex:1;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:8px; }
.chat-msg { max-width:80%;padding:8px 12px;border-radius:8px;font-size:13px;line-height:1.5;word-wrap:break-word;flex-shrink:0; }
.chat-msg.user { align-self:flex-end;background:#1f6feb;color:#fff; }
.chat-msg.agent { align-self:flex-start;background:#21262d;color:#c9d1d9;border:1px solid #30363d; }
.chat-msg.system { align-self:center;color:#8b949e;font-style:italic;font-size:12px; }
.chat-msg.md { max-width:92%; }
.chat-msg.md > :first-child { margin-top:0; }
.chat-msg.md > :last-child { margin-bottom:0; }
.chat-msg.md p { margin:6px 0; }
.chat-msg.md h1, .chat-msg.md h2, .chat-msg.md h3, .chat-msg.md h4 { margin:10px 0 6px;line-height:1.3; }
.chat-msg.md h1 { font-size:16px; }
.chat-msg.md h2 { font-size:15px; }
.chat-msg.md h3, .chat-msg.md h4 { font-size:14px; }
.chat-msg.md ul, .chat-msg.md ol { margin:6px 0;padding-left:20px; }
.chat-msg.md ol { list-style-type: decimal; }
.chat-msg.md li { margin:2px 0; }
.chat-msg.md code { background:#0d1117;border:1px solid #30363d;border-radius:3px;padding:1px 5px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px; }
.chat-msg.md pre { background:#0d1117;border:1px solid #30363d;border-radius:6px;padding:10px;overflow-x:auto;margin:8px 0; }
.chat-msg.md pre code { background:none;border:none;padding:0;font-size:12px; }
.chat-msg.md blockquote { margin:6px 0;padding-left:10px;border-left:3px solid #30363d;color:#8b949e; }
.chat-msg.md hr { border:none;border-top:1px solid #30363d;margin:10px 0; }
.chat-msg.md a { color:#58a6ff;text-decoration:none; }
.chat-msg.md a:hover { text-decoration:underline; }
.chat-msg.md table { border-collapse:collapse;margin:8px 0;font-size:12px;width:auto; }
.chat-msg.md th, .chat-msg.md td { border:1px solid #30363d;padding:6px 10px;text-align:left;vertical-align:top; }
.chat-msg.md th { background:#161b22;font-weight:600;color:#c9d1d9; }
.chat-msg.md tr:nth-child(even) td { background:#1a1f25; }
.chat-msg.status { align-self:flex-start;background:transparent;color:#8b949e;font-style:italic;font-size:12px;padding:4px 12px;border:none;animation:status-fade 1.5s ease-in-out infinite; }
@keyframes status-fade { 0%, 100% { opacity:1; } 50% { opacity:0.5; } }
.chat-msg.status.status-elapsed { color:#58a6ff;animation:status-pulse 2s ease-in-out infinite; }
@keyframes status-pulse { 0%, 100% { opacity:0.7; } 50% { opacity:1; } }
.chat-msg-attachment { display:flex;align-items:center;gap:6px;background:#161b22;border:1px solid #30363d;border-radius:6px;padding:6px 10px;font-size:12px;color:#8b949e; }
.chat-approval-bar { padding:8px 12px;background:#1c1e23;border-top:1px solid #30363d;display:flex;align-items:center;gap:8px; }
.chat-approval-bar.hidden { display:none; }
.chat-approval-action { flex:1;color:#d29922;font-size:13px; }
.chat-btn-allow { background:#238636;color:#fff;border:none;padding:6px 16px;border-radius:6px;cursor:pointer;font-size:13px; }
.chat-btn-allow:hover { background:#2ea043; }
.chat-btn-deny { background:#da3633;color:#fff;border:none;padding:6px 16px;border-radius:6px;cursor:pointer;font-size:13px; }
.chat-btn-deny:hover { background:#e5534b; }
.chat-focus-indicator { display:inline-flex;align-items:center;gap:4px;font-size:0.75rem;padding:2px 4px 2px 8px;border-radius:10px;background:rgba(210,153,34,0.15);color:#d29922;border:1px solid rgba(210,153,34,0.4);min-width:0;max-width:180px;white-space:nowrap;font-weight:500; }
.chat-focus-indicator.hidden { display:none; }
.chat-focus-indicator-label { overflow:hidden;text-overflow:ellipsis;min-width:0; }
.chat-memory-indicator { font-size:0.7rem;color:#888;font-weight:normal;cursor:pointer;flex-shrink:0; }
.chat-memory-indicator.hidden { display:none; }
.chat-focus-unfocus { background:none;border:none;color:#856404;width:16px;height:16px;padding:0;border-radius:50%;cursor:pointer;font-size:0.85rem;line-height:1;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0; }
.chat-focus-unfocus:hover { background:#856404;color:#fff; }
.chat-input-area { display:flex;align-items:flex-end;gap:8px;padding:8px 12px;border-top:1px solid #30363d;background:#0d1117; }
.chat-input { flex:1;background:#0d1117;border:1px solid #30363d;border-radius:6px;color:#c9d1d9;padding:8px 10px;font-family:inherit;font-size:13px;resize:none;max-height:120px;outline:none; }
.chat-input:focus { border-color:#58a6ff; }
.chat-send-btn { background:#238636;color:#fff;border:none;padding:6px 16px;border-radius:6px;cursor:pointer;font-size:13px; }
.chat-send-btn:hover { background:#2ea043; }
.chat-attach-btn { background:none;border:1px solid #30363d;border-radius:6px;padding:6px 10px;cursor:pointer;font-size:16px; }
.chat-attach-btn:hover { border-color:#8b949e; }
.chat-drop-zone { position:absolute;inset:0;background:rgba(31,111,235,0.15);border:2px dashed #1f6feb;display:flex;align-items:center;justify-content:center;color:#58a6ff;font-size:16px;z-index:10;pointer-events:none; }
.chat-drop-zone.hidden { display:none; }
.chat-file-input-hidden { display:none; }

/* Agents toggle button */
.agents-toggle-btn { position:fixed;bottom:16px;right:16px;z-index:1100;background:#161b22;border:1px solid #30363d;color:#c9d1d9;border-radius:20px;padding:6px 14px;cursor:pointer;font-size:13px;font-family:inherit;display:flex;align-items:center;gap:6px;transition:all 0.2s ease; }
.agents-toggle-btn:hover { background:#1c2128;border-color:#58a6ff; }
.agents-toggle-dot { width:8px;height:8px;border-radius:50%;background:#3fb950; }
.agents-toggle-btn.has-hidden-agents .agents-toggle-dot { animation:pulse-dot 2s infinite;box-shadow:0 0 6px #3fb950; }
.agents-toggle-btn.no-alive .agents-toggle-dot { background:#8b949e;animation:none; }

/* Generic hidden utility */
.hidden { display:none !important; }

/* Chat history panel */
.chat-history-panel { position:absolute;top:37px;left:0;right:0;max-height:60%;background:#0d1117;border-bottom:1px solid #30363d;z-index:5;display:flex;flex-direction:column;overflow:hidden; }
.chat-history-header { display:flex;align-items:center;justify-content:space-between;padding:8px 12px;border-bottom:1px solid #30363d;background:#161b22;flex-shrink:0; }
.chat-history-header span { color:#c9d1d9;font-weight:600;font-size:13px; }
.chat-history-close { background:#21262d;border:1px solid #30363d;color:#8b949e;font-size:14px;padding:2px 8px;border-radius:4px;cursor:pointer;line-height:1; }
.chat-history-close:hover { color:#e6edf3;border-color:#8b949e; }
.chat-history-list { overflow-y:auto;flex:1;min-height:0; }
.chat-history-item { padding:10px 12px;border-bottom:1px solid #21262d;cursor:pointer;transition:background .15s ease; }
.chat-history-item:hover { background:#161b22; }
.chat-history-item:last-child { border-bottom:none; }
.chat-history-item .chat-history-date { display:block;color:#58a6ff;font-weight:600;font-size:12px;margin-bottom:2px; }
.chat-history-item .chat-history-preview { display:block;color:#8b949e;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }

/* Chat history read-only banner */
.chat-history-banner { display:flex;align-items:center;justify-content:space-between;padding:6px 12px;background:#1c2333;border-bottom:1px solid #30363d;flex-shrink:0; }
.chat-history-banner span { color:#a5b4cf;font-size:12px;font-style:italic; }
.chat-history-back-btn { background:#21262d;border:1px solid #30363d;color:#8b949e;font-size:12px;padding:3px 10px;border-radius:4px;cursor:pointer;white-space:nowrap; }
.chat-history-back-btn:hover { color:#e6edf3;border-color:#8b949e; }

/* Viewing-history tint on messages area */
.chat-messages.viewing-history { background:#0f1318; }

/* Blocked-children banner on orchestration parent cards */
.blocked-children-banner {
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid #ca8a04;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 12px;
}

.blocked-children-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  color: #eab308;
  margin-bottom: 4px;
}

.blocked-children-header .resume-orchestration-btn {
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
  border: 1px solid #ca8a04;
  border-radius: 4px;
  cursor: pointer;
}

.blocked-children-header .resume-orchestration-btn:hover {
  background: rgba(234, 179, 8, 0.3);
}

.blocked-child-item {
  color: #9ca3af;
  padding: 2px 0;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Let's Chat button */
.lets-chat-btn {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #238636, #2ea043);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 16px;
  text-decoration: none;
  line-height: 1;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.lets-chat-btn::before {
  content: '\1F4AC\00a0';
  font-size: 14px;
}

.lets-chat-btn:hover {
  filter: brightness(1.15);
  transform: scale(1.05);
}

/* Memory inspector modal */
.memory-modal { max-height:70vh;display:flex;flex-direction:column; }
.memory-modal-list { overflow-y:auto;flex:1;margin-bottom:16px;max-height:50vh; }
.memory-modal-item { padding:10px 0;border-bottom:1px solid #21262d; }
.memory-modal-name { font-weight:600;color:#e6edf3;margin-bottom:2px; }
.memory-modal-desc { font-size:13px;color:#8b949e; }
.memory-modal-hint { font-size:12px;color:#8b949e;margin-top:8px;font-style:italic; }

/* Awaiting-bridge dashboard banner — rendered when parked tasks exist */
.awaiting-bridge-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1a1400;
  border: 1px solid #9e6a03;
  border-left: 3px solid #d29922;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #e3b341;
  font-size: 13px;
  line-height: 1.4;
}
.awaiting-bridge-banner.hidden { display: none; }
.awaiting-bridge-banner-msg { flex: 1; }
.awaiting-bridge-banner-btn {
  background: linear-gradient(135deg, #1f6feb, #388bfd);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  transition: filter 0.15s ease;
}
.awaiting-bridge-banner-btn:hover { filter: brightness(1.15); }
.awaiting-bridge-banner-btn:focus-visible {
  outline: 2px solid #58a6ff;
  outline-offset: 2px;
}

/* Capability hint inside the Connect My Computer modal */
.connect-capability-hint {
  background: #0d2818;
  border: 1px solid #238636;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
  color: #7ee787;
  font-size: 12px;
  line-height: 1.5;
}
.connect-capability-hint.hidden { display: none; }

/* Connect My Computer — header button (matches .lets-chat-btn sizing) */
.connect-computer-btn {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #1f6feb, #388bfd);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 12px;
  text-decoration: none;
  line-height: 1;
  font-family: inherit;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.connect-computer-btn::before {
  /* Plain unicode glyph prefix — NOT an emoji (no color variation selector) */
  content: '\21CC\00a0';
  font-size: 14px;
}
.connect-computer-btn:hover {
  filter: brightness(1.15);
  transform: scale(1.05);
}
.connect-computer-btn.connected {
  background: linear-gradient(135deg, #1f7a3a, #2ea043);
}
.connect-computer-btn.connected::before {
  content: '';
}
.connect-computer-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: #7ee787;
  box-shadow: 0 0 0 0 rgba(126, 231, 135, 0.7);
  animation: connect-dot-pulse 1.8s ease-out infinite;
}
@keyframes connect-dot-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(126, 231, 135, 0.7); }
  70%  { box-shadow: 0 0 0 8px rgba(126, 231, 135, 0); }
  100% { box-shadow: 0 0 0 0 rgba(126, 231, 135, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .connect-computer-dot { animation: none; }
}

/* Connect modal overlay + shell (matches .project-modal conventions) */
.connect-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2100;
}
.connect-modal-overlay.hidden { display: none; }
.connect-modal {
  position: relative;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 24px;
  width: 560px;
  max-width: 92vw;
  color: #e6edf3;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.connect-modal h2 {
  font-size: 16px;
  color: #e6edf3;
  margin: 0 32px 12px 0;
}
.connect-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  color: #8b949e;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: inherit;
}
.connect-modal-close:hover { color: #e6edf3; background: #21262d; }
.connect-modal-explain {
  font-size: 13px;
  color: #8b949e;
  margin: 0 0 14px 0;
  line-height: 1.5;
}
.connect-os-label {
  font-size: 12px;
  color: #58a6ff;
  margin-bottom: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* One-liner code block + copy button */
.connect-oneliner-wrap {
  position: relative;
  margin-bottom: 14px;
}
pre.connect-oneliner {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 14px 60px 14px 14px;
  margin: 0;
  color: #e6edf3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  min-height: 48px;
}
.btn-copy-oneliner {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #21262d;
  border: 1px solid #30363d;
  color: #c9d1d9;
  font-size: 12px;
  font-family: inherit;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-copy-oneliner:hover {
  background: #30363d;
  color: #e6edf3;
  border-color: #8b949e;
}
.btn-copy-oneliner.copied {
  background: #238636;
  border-color: #2ea043;
  color: #fff;
}
.btn-copy-oneliner.copied::before {
  content: '\2713\00a0';
}
.btn-download-connect {
  display: block;
  margin-top: 8px;
  margin-bottom: 4px;
  background: #238636;
  border: 1px solid #2ea043;
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-download-connect:hover {
  background: #2ea043;
  border-color: #3fb950;
}
.connect-download-hint {
  font-size: 12px;
  color: #8b949e;
  margin-bottom: 10px;
}
.connect-download-hint.hidden {
  display: none;
}

/* Status indicator line */
.connect-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #c9d1d9;
  margin-bottom: 8px;
}
.connect-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #484f58;
  flex-shrink: 0;
  display: inline-block;
}
.connect-status-dot.waiting {
  background: #d29922;
  box-shadow: 0 0 6px #d29922;
  animation: connect-pulse-amber 1.4s infinite;
}
.connect-status-dot.connected {
  background: #3fb950;
  box-shadow: 0 0 6px #3fb950;
}
.connect-status-dot.disconnected {
  background: #8b949e;
  box-shadow: none;
}
@keyframes connect-pulse-amber {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* Modal footer actions */
.connect-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.connect-btn-dismiss {
  background: #21262d;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.connect-btn-dismiss:hover {
  background: #30363d;
  color: #e6edf3;
}

/* Bridge terminal tab — visual distinction (classes applied by terminal.js in Phase 2) */
.terminal-tab.bridge {
  border-left: 2px solid #a78bfa;
  background: rgba(167, 139, 250, 0.08);
  padding-left: 8px;
  position: relative;
}
.terminal-tab.bridge.active {
  background: rgba(167, 139, 250, 0.18);
}
.terminal-tab-icon {
  display: inline-block;
  font-size: 11px;
  color: #a78bfa;
  margin-right: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  line-height: 1;
}

/* Bridge status dots — override/augment .terminal-dot.alive */
.terminal-dot.bridge-green {
  background: #3fb950;
  box-shadow: 0 0 6px #3fb950;
  animation: pulse-dot 2s infinite;
}
.terminal-dot.bridge-yellow {
  background: #d29922;
  box-shadow: 0 0 6px #d29922;
  animation: pulse-dot 1.2s infinite;
}
.terminal-dot.bridge-gray {
  background: #8b949e;
  box-shadow: none;
  animation: none;
}

/* Tooltip/subtitle under bridge tab label */
.terminal-tab.bridge .bridge-machine-banner {
  font-size: 10px;
  color: #a78bfa;
  opacity: 0.75;
  margin-left: 4px;
  font-style: italic;
}

/* Shared top-nav (populated by js/nav.js). */
nav[data-top-nav] a {
  color: #58a6ff;
  text-decoration: none;
  font-size: 14px;
  margin-left: 16px;
}
nav[data-top-nav] a:first-child { margin-left: 0; }
nav[data-top-nav] a:hover { text-decoration: underline; }
nav[data-top-nav] a.active { color: #e6edf3; font-weight: 600; }


/* Settings rows + toggle switches (used on /settings Automation card;
   previously inline on dashboard's orphaned modal). */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #21262d;
}
.settings-row:last-child { border-bottom: none; }
.settings-label { flex: 1; }
.settings-label .title {
  font-size: 14px;
  color: #e6edf3;
  font-weight: 500;
}
.settings-label .desc {
  font-size: 12px;
  color: #8b949e;
  margin-top: 2px;
}
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin-left: 16px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #21262d;
  border-radius: 12px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #c9d1d9;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: #238636; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Value Modal ── */
.value-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 2200; display: flex; align-items: center; justify-content: center; }
.value-modal-overlay.hidden { display: none; }
.value-modal { position: relative; width: 92vw; max-width: 800px; max-height: 80vh; overflow-y: auto; background: #161b22; border: 1px solid #30363d; border-radius: 12px; padding: 24px; color: #e6edf3; box-shadow: 0 12px 40px rgba(0,0,0,0.45); }
.value-modal-close { position: absolute; top: 10px; right: 12px; background: transparent; border: none; color: #8b949e; font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 6px; font-family: inherit; }
.value-modal-close:hover { color: #e6edf3; background: #21262d; }
.value-modal-title { font-size: 16px; color: #e6edf3; margin: 0 32px 8px 0; }
.value-modal-period { font-size: 13px; color: #8b949e; margin: 0 0 16px 0; }
.value-modal-section-title { font-size: 13px; color: #8b949e; text-transform: uppercase; letter-spacing: 0.5px; margin: 18px 0 6px 0; }
.value-modal-explain { font-size: 13px; color: #8b949e; line-height: 1.5; margin: 0 0 8px 0; }
.value-modal-link { color: #58a6ff; text-decoration: none; }
.value-modal-link:hover { text-decoration: underline; }

/* Table */
.value-modal-table-wrap { overflow-x: auto; margin-bottom: 8px; }
.value-modal-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.value-modal-table th { background: #21262d; text-align: left; padding: 6px 10px; color: #8b949e; font-weight: 600; border-bottom: 1px solid #30363d; white-space: nowrap; }
.value-modal-table td { padding: 6px 10px; border-bottom: 1px solid #21262d; }
.value-modal-table tr:nth-child(even) td { background: #0d1117; }
.value-modal-table tr:nth-child(odd) td { background: #161b22; }
.value-modal-empty { text-align: center; color: #8b949e; padding: 16px; }
.value-modal-tier { font-weight: 600; }
.value-modal-tier-signals { color: #8b949e; font-size: 11.5px; }

/* Savings & exclusions */
.value-modal-savings { font-size: 13px; line-height: 1.6; }
.value-modal-savings p { margin: 2px 0; }
.value-modal-tangible { color: #3fb950; font-weight: 600; }
.value-modal-exclusions { font-size: 13px; color: #8b949e; line-height: 1.6; margin: 4px 0 8px 20px; padding: 0; }
.value-modal-exclusions li { margin: 2px 0; }
.value-modal-exclusions strong { color: #e6edf3; }

/* Methodology */
.value-modal-methodology { font-size: 12.5px; color: #8b949e; line-height: 1.6; margin: 0 0 4px 0; }
.value-modal-citations { font-size: 12.5px; color: #8b949e; margin: 0 0 8px 0; }
