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

body {
  font-family: system-ui, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  height: 100dvh;
  overflow: hidden;
}

/* ── Two-column layout ─────────────────────────────────────────────── */

#layout { display: flex; height: 100dvh; }

/* ── Sidebar ───────────────────────────────────────────────────────── */

#sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #141414;
  border-right: 1px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#sidebar-header {
  padding: 0.75rem;
  border-bottom: 1px solid #2a2a2a;
  display: flex;
  align-items: center;
}

.logo { font-weight: 600; font-size: 1.05rem; }

#conv-list-header {
  padding: 0.4rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #2a2a2a;
}

.conv-list-label { font-size: 0.72rem; color: #555; text-transform: uppercase; letter-spacing: 0.05em; }

#new-btn {
  background: none;
  border: 1px solid #2a2a2a;
  color: #aaa;
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}
#new-btn:hover { background: #1e1e1e; color: #e0e0e0; border-color: #444; }

#conv-list { flex: 1; overflow-y: auto; padding: 0.5rem 0; }

.conv-item {
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  border-radius: 6px;
  margin: 0 0.35rem 0.15rem;
  font-size: 0.85rem;
  color: #aaa;
}
.conv-item:hover { background: #1e1e1e; color: #e0e0e0; }
.conv-item.active { background: #1a3a5c; color: #e0e0e0; }
.conv-item-row { display: flex; align-items: center; gap: 0.25rem; }
.conv-item-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.conv-item-date { font-size: 0.72rem; color: #555; margin-top: 0.15rem; }
.conv-item.active .conv-item-date { color: #7aa; }
.conv-item-turns { color: #444; margin-left: 0.4rem; }
.conv-assign-btn {
  display: none;
  background: none;
  border: none;
  color: #555;
  padding: 0 0.2rem;
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}
.conv-item:hover .conv-assign-btn,
.conv-item.active .conv-assign-btn,
.conv-item:hover .conv-delete-btn,
.conv-item.active .conv-delete-btn { display: block; }
.conv-assign-btn:hover { color: #aaa; }

.conv-delete-btn {
  display: none;
  background: none;
  border: none;
  color: #555;
  padding: 0 0.2rem;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}
.conv-delete-btn:hover { color: #ff6b6b; }

.assign-menu {
  min-width: 180px;
  max-height: 200px;
  overflow-y: auto;
}

/* ── Main area ─────────────────────────────────────────────────────── */

#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

header {
  padding: 0 1rem;
  border-bottom: 1px solid #2a2a2a;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 48px;
  flex-shrink: 0;
}

/* ── Tabs ──────────────────────────────────────────────────────────── */

#tabs { display: flex; gap: 0; }

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #666;
  padding: 0 1rem;
  height: 48px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-bottom: -1px;
}
.tab:hover { color: #aaa; }
.tab.active { color: #e0e0e0; border-bottom-color: #4a8ac4; }

#conv-title {
  font-size: 0.85rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ── Project picker (sidebar) ──────────────────────────────────────── */

#project-picker {
  position: relative;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #2a2a2a;
}

#project-btn {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  color: #aaa;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#project-btn:hover { background: #222; color: #e0e0e0; border-color: #444; }
#project-label { font-family: monospace; overflow: hidden; text-overflow: ellipsis; }

.dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  min-width: 200px;
  max-height: 260px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.dropdown.hidden { display: none; }
.dropdown-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.83rem;
  color: #aaa;
  border-bottom: 1px solid #222;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: #222; color: #e0e0e0; }
.dropdown-item.active { color: #f5d060; }
.dropdown-item-name { font-weight: 500; }
.dropdown-item-path { font-size: 0.72rem; color: #555; font-family: monospace; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


#restart-btn {
  background: none;
  border: 1px solid #2a2a2a;
  color: #555;
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}
#restart-btn:hover { background: #1e1e1e; color: #e0e0e0; border-color: #444; }
#restart-btn.restarting { color: #f5a060; border-color: #5a3a1a; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status { font-size: 0.8rem; color: #666; flex-shrink: 0; transition: color 0.2s; }
.status:not(:empty) { color: #888; }

@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
.msg.thinking {
  font-style: italic;
  color: #666;
  animation: pulse-text 1.4s ease-in-out infinite;
}

/* ── Panels ────────────────────────────────────────────────────────── */

.panel { display: none; flex: 1; flex-direction: column; min-height: 0; }
.panel.active { display: flex; }

/* ── Chat panel ────────────────────────────────────────────────────── */

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Turn-pair wrapper (historical renders) */
.turn-pair { display: contents; }

.msg {
  max-width: 85%;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  line-height: 1.55;
  word-wrap: break-word;
  position: relative;
}
.msg.user      { align-self: flex-end; background: #1a3a5c; white-space: pre-wrap; padding-bottom: 1.6rem; }
.msg.assistant { align-self: flex-start; background: #1e1e1e; border: 1px solid #2a2a2a; }
.msg.error     { align-self: flex-start; background: #3a1a1a; color: #ff6b6b; }

/* Per-turn action buttons — shown on hover, bottom-right inside the bubble */
.turn-actions {
  display: none;
  position: absolute;
  bottom: 0.25rem;
  right: 0.4rem;
  gap: 0.25rem;
  align-items: center;
}
.msg.user:hover .turn-actions { display: flex; }

.turn-assign-btn,
.turn-retry-btn {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.15);
  color: #c0d8f0;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  line-height: 1;
}
.turn-assign-btn:hover,
.turn-retry-btn:hover { background: rgba(255,255,255,0.15); color: #fff; border-color: rgba(255,255,255,0.35); }

.turn-assign-menu { min-width: 160px; max-height: 220px; overflow-y: auto; }

/* Markdown inside assistant messages */
.msg.assistant h1,
.msg.assistant h2,
.msg.assistant h3 { margin: 0.6em 0 0.3em; font-weight: 600; line-height: 1.3; }
.msg.assistant h1 { font-size: 1.15em; }
.msg.assistant h2 { font-size: 1.05em; }
.msg.assistant h3 { font-size: 0.95em; color: #aaa; }
.msg.assistant p  { margin: 0.4em 0; }
.msg.assistant ul,
.msg.assistant ol { padding-left: 1.4em; margin: 0.4em 0; }
.msg.assistant li { margin: 0.2em 0; }
.msg.assistant pre {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 0.6em 0.8em;
  overflow-x: auto;
  margin: 0.5em 0;
  font-size: 0.88em;
}
.msg.assistant code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.88em;
}
.msg.assistant :not(pre) > code {
  background: #1a1a2e;
  border: 1px solid #2a2a3a;
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
.msg.assistant blockquote {
  border-left: 3px solid #2a2a2a;
  margin: 0.4em 0;
  padding-left: 0.8em;
  color: #888;
}
.msg.assistant hr { border: none; border-top: 1px solid #2a2a2a; margin: 0.6em 0; }
.msg.assistant strong { font-weight: 600; }
.msg.assistant em { font-style: italic; color: #ccc; }
.msg.assistant a { color: #4a8ac4; }

.divider {
  align-self: center;
  font-size: 0.75rem;
  color: #444;
  padding: 0.25rem 0.75rem;
  border: 1px solid #2a2a2a;
  border-radius: 999px;
  user-select: none;
}

#chat-form {
  display: flex;
  padding: 0.75rem 1rem;
  border-top: 1px solid #2a2a2a;
  gap: 0.5rem;
  flex-shrink: 0;
}

#input {
  flex: 1;
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  color: #e0e0e0;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 1rem;
  outline: none;
}
#input:focus { border-color: #444; }

button[type="submit"] {
  background: #1a3a5c;
  color: #e0e0e0;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  font-size: 1rem;
}
button[type="submit"]:hover { background: #1e4a7a; }
button[type="submit"]:disabled { opacity: 0.5; cursor: not-allowed; }

#stop-btn {
  background: #3a1a1a;
  color: #ff6b6b;
  border: 1px solid #5a2a2a;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  font-size: 1rem;
}
#stop-btn:hover { background: #5a1a1a; border-color: #ff6b6b; }
.hidden { display: none !important; }

/* ── Insights panel ────────────────────────────────────────────────── */

/* Sub-tabs within the insights panel */
#insight-tabs {
  display: flex;
  border-bottom: 1px solid #2a2a2a;
  flex-shrink: 0;
  padding: 0 1rem;
  gap: 0;
}
.itab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #555;
  padding: 0.5rem 1.1rem;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: -1px;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}
.itab:hover { color: #aaa; background: none; }
.itab.active { color: #e0e0e0; border-bottom-color: #4a8ac4; background: none; }

.ipanel { display: none; }
.ipanel.active { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow-y: auto; }

#insights-content,
#activity-content,
#tenets-content,
#learning-content {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
}

.insights-section h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #666;
  margin-bottom: 0.75rem;
}

.hint { font-size: 0.82rem; color: #555; margin-bottom: 0.75rem; }

/* Stats row */
.stats-row { display: flex; gap: 1.5rem; margin-top: 0.75rem; flex-wrap: wrap; }
.stat-box {
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  min-width: 110px;
}
.stat-box .stat-val { font-size: 1.4rem; font-weight: 600; color: #f5d060; }
.stat-box .stat-lbl { font-size: 0.72rem; color: #666; margin-top: 0.1rem; }

/* Daily bar chart */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 60px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; }
.bar {
  width: 100%;
  background: #1a3a5c;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: background 0.15s;
}
.bar:hover { background: #2a5a8c; }
.bar-label { font-size: 0.6rem; color: #444; white-space: nowrap; }

/* Backend / model bars */
.pct-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; font-size: 0.82rem; }
.pct-label { width: 140px; color: #aaa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pct-bar-wrap { flex: 1; height: 8px; background: #1e1e1e; border-radius: 4px; overflow: hidden; }
.pct-bar { height: 100%; background: #1a3a5c; border-radius: 4px; transition: width 0.4s; }
.pct-count { width: 40px; text-align: right; color: #666; font-size: 0.78rem; }

/* Tool list */
.tool-row { display: flex; justify-content: space-between; font-size: 0.83rem; padding: 0.3rem 0; border-bottom: 1px solid #1a1a1a; color: #aaa; }
.tool-row code { color: #7eb8f7; font-family: monospace; }
.tool-row .tool-count { color: #555; }

/* Agent list */
.agent-row { flex-wrap: wrap; }
.agent-badge { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; padding: 0.1rem 0.35rem; border-radius: 999px; margin-left: 0.4rem; vertical-align: middle; }
.agent-specialist { background: #0a2238; color: #7eb8f7; }
.agent-generic    { background: #252515; color: #aaa; }
.agent-split-hint { width: 100%; font-size: 0.78rem; color: #c09030; background: #1e1a08; border: 1px solid #3a3010; border-radius: 6px; padding: 0.4rem 0.6rem; margin-top: 0.3rem; }

/* Suggestions */
.suggestion {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.6rem;
}
.suggestion-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
.badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}
.badge-high   { background: #3a1a1a; color: #ff8080; }
.badge-medium { background: #2a2a10; color: #f0c040; }
.badge-low    { background: #0a2a1a; color: #60b080; }
.suggestion-domain { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #668; background: #1a1a2a; padding: 0.1rem 0.4rem; border-radius: 3px; }
.suggestion-title { font-size: 0.88rem; font-weight: 500; flex: 1; color: #ccc; }
.suggestion-action-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; color: #556; letter-spacing: 0.04em; margin-bottom: 0.2rem; }
.suggestion-desc { font-size: 0.82rem; color: #aaa; margin-bottom: 0.5rem; line-height: 1.5; white-space: pre-wrap; }
.sg-body { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.5rem 0; }
.sg-row { display: grid; grid-template-columns: 7rem 1fr; gap: 0.5rem; align-items: baseline; font-size: 0.82rem; }
.sg-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #556; padding-top: 0.1rem; }
.sg-text { color: #999; line-height: 1.45; }
.sg-evidence .sg-text { color: #666; font-size: 0.76rem; }
.sg-action { background: #0d1a0d; border-left: 2px solid #2a5a2a; border-radius: 0 4px 4px 0; padding: 0.35rem 0.6rem; }
.sg-action .sg-label { color: #4a9a4a; }
.sg-action .sg-text { color: #bdb; }
.sg-validating { font-size: 0.82rem; color: #888; font-style: italic; padding: 0.5rem 0; }
.btn-validate { background: #1a1a2a; color: #8080c0; font-size: 0.78rem; padding: 0.25rem 0.7rem; border-radius: 5px; border: none; cursor: pointer; }
.btn-validate:hover { background: #252535; }
/* Validating panel */
.vexp { background: #111118; border: 1px solid #252535; border-radius: 7px; padding: 0.85rem 1rem; margin-bottom: 0.85rem; }
.vexp-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.vexp-until { margin-left: auto; font-size: 0.75rem; color: #666; }
.vexp-progress { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.vexp-bar-track { flex: 1; height: 4px; background: #222; border-radius: 2px; overflow: hidden; }
.vexp-bar-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }
.vexp-pct { font-size: 0.72rem; color: #555; width: 2.5rem; text-align: right; }
.vexp-meta { font-size: 0.78rem; color: #668; margin: 0.35rem 0; }
.vexp-evidence { font-size: 0.75rem; color: #556; margin-top: 0.3rem; font-style: italic; }
.vexp-chart { display: flex; align-items: flex-end; gap: 3px; height: 40px; margin: 0.4rem 0; }
.vexp-bar-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 28px; height: 100%; justify-content: flex-end; }
.vexp-bar { width: 100%; background: #3a5a8a; border-radius: 2px 2px 0 0; min-height: 2px; }
.vexp-date { font-size: 0.6rem; color: #445; }
.suggestion-actions { display: flex; gap: 0.5rem; }
.btn-approve, .btn-reject {
  font-size: 0.78rem;
  padding: 0.25rem 0.7rem;
  border-radius: 5px;
  border: none;
  cursor: pointer;
}
.btn-approve { background: #1a3a2a; color: #60c080; }
.btn-approve:hover { background: #1a4a2a; }
.btn-reject  { background: #2a1a1a; color: #888; }
.btn-reject:hover  { background: #3a1a1a; }
.empty-note { font-size: 0.83rem; color: #555; }

/* ── Activity panel ─────────────────────────────────────────────────── */

#activity-content > .project-card:last-child { margin-bottom: 0; }

.project-card {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  flex-shrink: 0;
}
.project-card-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.project-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #e0e0e0;
}
.project-card-path {
  font-size: 0.72rem;
  color: #444;
  font-family: monospace;
}
.project-card-overview {
  font-size: 0.82rem;
  color: #888;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}
.project-activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.project-activity-list li {
  font-size: 0.8rem;
  color: #777;
  padding: 0.15rem 0;
  border-bottom: 1px solid #1e1e1e;
}
.project-activity-list li:last-child { border-bottom: none; }
.project-activity-list li::before { content: "·  "; color: #444; }

/* ── Learning panel ──────────────────────────────────────────────────── */

.learn-doc {
  font-size: 0.84rem;
  line-height: 1.6;
  color: #ccc;
}
.learn-doc h1, .learn-doc h2, .learn-doc h3 {
  color: #aaa;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1em 0 0.4em;
}
.learn-doc p { margin: 0.3em 0; }
.learn-doc ul, .learn-doc ol { padding-left: 1.3em; margin: 0.3em 0; }
.learn-doc li { margin: 0.2em 0; }
.learn-doc strong { color: #e0e0e0; }
.learn-doc em { color: #aaa; }
.learn-meta { font-size: 0.72rem; color: #444; margin-bottom: 0.75rem; }

/* ── Accordion (Learning tab) ───────────────────────────────────────── */

.accordion-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #666;
  padding: 1rem 0.25rem 0.35rem;
  margin-top: 0.25rem;
}
.accordion-section-intro {
  font-size: 0.82rem;
  color: #888;
  padding: 0 0.25rem 0.5rem;
  margin: 0;
}

/* Numbered draggable principles list */
.item-num {
  min-width: 1.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: #555;
  flex-shrink: 0;
}
.drag-handle {
  font-size: 0.85rem;
  color: #444;
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
  line-height: 1;
  margin-right: 0.1rem;
}
.drag-handle:active { cursor: grabbing; }
.item-category {
  margin-left: auto;
  font-size: 0.65rem;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  padding-left: 0.5rem;
}
.accordion-item.dragging {
  opacity: 0.4;
}
.accordion-item.drag-over {
  border-color: #4a9eff;
  box-shadow: 0 -2px 0 #4a9eff;
}

.accordion-item {
  border: 1px solid #2a2a2a;
  border-radius: 7px;
  margin-bottom: 0.4rem;
  overflow: hidden;
}

.accordion-item[open] {
  border-color: #3a3a3a;
}

.accordion-header {
  list-style: none;
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #bbb;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
  background: #1a1a1a;
  transition: background 0.15s, color 0.15s;
}
.accordion-header::-webkit-details-marker { display: none; }
.accordion-header::before {
  content: '▶';
  font-size: 0.6rem;
  color: #555;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.accordion-item[open] .accordion-header::before { transform: rotate(90deg); }
.accordion-header:hover { background: #222; color: #e0e0e0; }
.accordion-item[open] .accordion-header { color: #e0e0e0; background: #1e1e1e; }

.accordion-body {
  padding: 0.75rem 1rem 0.9rem;
  border-top: 1px solid #2a2a2a;
  background: #111;
  font-size: 0.83rem;
}

/* Feedback bar */
.feedback-bar { display: flex; gap: 0.3rem; margin-top: 0.5rem; opacity: 0.3; transition: opacity 0.2s; }
.feedback-bar:hover { opacity: 1; }
.fb-btn { background: none; border: 1px solid #2a2a2a; border-radius: 4px; padding: 0.1rem 0.5rem; cursor: pointer; font-size: 0.8rem; font-weight: 700; color: #555; transition: border-color 0.15s, color 0.15s; }
.fb-btn:hover { border-color: #555; color: #aaa; }
.fb-btn.fb-active { border-color: #7eb8f7; color: #7eb8f7; }

.debug-btn {
  background: transparent;
  border: none;
  color: #555;
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0 0.3rem;
  margin-left: 0.4rem;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.msg.assistant:hover .debug-btn,
.debug-btn:focus {
  opacity: 1;
}
.debug-btn:hover {
  color: #7aa2f7;
}
.debug-btn:disabled {
  cursor: default;
  color: #444;
}

/* Confirm bar */
.confirm-bar { margin-top: 0.9rem; padding: 0.7rem 0.9rem; background: #0d1f30; border: 1px solid #1a4060; border-radius: 8px; }
/* Plan approval bar — slightly different accent to distinguish from legacy confirm */
.plan-bar { background: #0a1e10; border-color: #1a5030; }
.plan-bar .confirm-yes { background: #0a3a1a; border-color: #1a6a3a; color: #7ef7a8; }
.plan-bar .confirm-yes:hover { background: #0f5028; }
/* Mid-execution step confirm bar — warning accent */
.step-bar { background: #1e1400; border-color: #5a3a00; }
.step-bar .confirm-yes { background: #3a2a00; border-color: #8a6000; color: #f7c87e; }
.step-bar .confirm-yes:hover { background: #4a3800; }
.step-bar .confirm-question { color: #f7c87e; }
.confirm-question { display: block; font-size: 0.88rem; color: #b8d8ff; margin-bottom: 0.55rem; }
.confirm-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.confirm-yes  { background: #0a3a5a; border: 1px solid #1a6a9a; border-radius: 6px; color: #7eb8f7; cursor: pointer; font-size: 0.83rem; font-weight: 600; padding: 0.3rem 1rem; transition: background 0.15s; }
.confirm-yes:hover  { background: #0f5080; }
.confirm-no   { background: none; border: 1px solid #333; border-radius: 6px; color: #666; cursor: pointer; font-size: 0.83rem; padding: 0.3rem 0.9rem; transition: border-color 0.15s, color 0.15s; }
.confirm-no:hover   { border-color: #555; color: #999; }
.confirm-other { background: none; border: 1px solid #2a2a2a; border-radius: 6px; color: #555; cursor: pointer; font-size: 0.83rem; padding: 0.3rem 0.9rem; transition: border-color 0.15s, color 0.15s; }
.confirm-other:hover { border-color: #444; color: #888; }
.confirm-other-input { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.confirm-text { flex: 1; background: #111; border: 1px solid #2a2a2a; border-radius: 4px; color: #ccc; font-size: 0.83rem; padding: 0.3rem 0.6rem; outline: none; }
.confirm-text:focus { border-color: #7eb8f7; }
.confirm-send { background: #0a3a5a; border: 1px solid #1a6a9a; border-radius: 4px; color: #7eb8f7; cursor: pointer; font-size: 0.83rem; padding: 0.3rem 0.8rem; }

/* ── Workflow confirm/deny UI ──────────────────────────────────────── */

.wf-section { margin-bottom: 1.5rem; }
.wf-group-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: #555; margin-bottom: 0.75rem; }
.workflow-item { border: 1px solid #252525; border-radius: 6px; padding: 0.75rem 1rem; margin-bottom: 0.5rem; }
.workflow-item.confirmed { border-color: #1e3a1e; background: #0d1f0d; }
.wf-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.wf-badge { color: #4caf50; font-size: 0.85rem; }
.wf-body { font-size: 0.83rem; color: #888; margin-bottom: 0.5rem; }
.wf-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.wf-confirm { background: #1a3a1a; color: #4caf50; border: 1px solid #2a5a2a; border-radius: 4px; padding: 0.25rem 0.75rem; font-size: 0.78rem; cursor: pointer; }
.wf-confirm:hover { background: #224a22; }
.wf-dismiss { background: none; color: #555; border: 1px solid #333; border-radius: 4px; padding: 0.25rem 0.75rem; font-size: 0.78rem; cursor: pointer; }
.wf-dismiss:hover { color: #888; border-color: #444; }

/* ── Responsive ────────────────────────────────────────────────────── */

@media (max-width: 540px) { #sidebar { display: none; } }

/* ── Top nav ──────────────────────────────────────────────────────── */

#top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.75rem;
  height: 44px;
  border-bottom: 1px solid #2a2a2a;
  flex-shrink: 0;
}

#top-nav nav { display: flex; gap: 0.25rem; }

.nav-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
}
.nav-btn:hover { background: #1e1e1e; color: #e0e0e0; }
.nav-btn.active { background: #1e1e1e; color: #e0e0e0; font-weight: 600; }

#nav-right { display: flex; align-items: center; gap: 0.75rem; }
#status-bar { font-size: 0.75rem; color: #555; }

/* ── Panel container ──────────────────────────────────────────────── */

#panel-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Remove old header/tabs styles that conflict */
header { /* keep for any legacy references */ }

/* ── Dashboard ────────────────────────────────────────────────────── */

#panel-dashboard {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Dashboard grid: 3 columns, briefing + activity span full width ── */
#dash-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dash-card {
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  flex-shrink: 0;        /* don't shrink in flex-column — let the grid scroll instead */
}

.card-header {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #aaa;
  border-bottom: 1px solid #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-action {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 0.8rem;
  text-decoration: none;
}
.card-action:hover { color: #aaa; }

.card-body {
  padding: 0.6rem 0.75rem;
  font-size: 0.82rem;
  overflow-y: auto;        /* each card body scrolls independently */
}
/* Tall cards get more room; short cards size to content */
.card-body-lg { max-height: 70vh; }
.card-body-sm { max-height: 320px; }
.card-empty { color: #555; font-style: italic; }
.card-error { color: #a44; }
.card-btn { background: #1e1e1e; border: 1px solid #2a2a2a; color: #aaa; border-radius: 4px; padding: 0.15rem 0.4rem; font-size: 0.75rem; cursor: pointer; }
.card-btn:hover { background: #2a2a2a; color: #e0e0e0; }

/* ── Briefing strip (slim date + alerts + active projects) ── */
.briefing-strip .card-body { padding: 0; }
.briefing-strip-inner {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.45rem 0.75rem;
}
.briefing-date  { font-size: 0.82rem; font-weight: 600; color: #ccc; flex-shrink: 0; }
.briefing-alerts { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.briefing-alert-item {
  display: flex; align-items: center; gap: 0.3rem;
  font-size: 0.78rem; color: #d8843a;
}
.brief-alert-dot{ width: 5px; height: 5px; border-radius: 50%; background: #d8843a; flex-shrink: 0; }
.briefing-active { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-left: 0.25rem; }

/* ── Attention card ── */
.attention-list  { display: flex; flex-direction: column; }
.attention-row   {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.45rem 0; border-bottom: 1px solid #1e1e1e;
}
.attention-row:last-child { border-bottom: none; }
.attention-main  { flex: 1; min-width: 0; }
.attention-title-row { display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; }
.attention-title { font-size: 0.83rem; color: #ccc; }
.attention-desc  { font-size: 0.76rem; margin-top: 0.1rem; }
.attention-when  { font-size: 0.72rem; font-weight: 600; flex-shrink: 0; padding: 0.05rem 0.35rem; border-radius: 3px; border: 1px solid; }
.attention-actions { display: flex; gap: 0.5rem; flex-shrink: 0; align-items: flex-start; padding-top: 0.15rem; }
.attention-clear { color: #4a9a6a; font-size: 0.85rem; padding: 0.5rem 0; }

/* Urgency on attention-row */
.attention-row.reminder-overdue .attention-title { color: #c05050; }
.attention-row.reminder-overdue .attention-when  { color: #c05050; border-color: #5a2020; background: #2a1010; }
.attention-row.reminder-soon    .attention-when  { color: #d8843a; border-color: #5a3a1a; background: #2a1e10; }
.attention-row.reminder-today   .attention-when  { color: #8ab; border-color: #1a3a4a; }

/* Rule that would be written on approval — shown prominently */
.attention-rule      { margin-top: 0.4rem; padding: 0.35rem 0.5rem; border-left: 2px solid #2a5a2a; background: #111a11; border-radius: 0 4px 4px 0; }
.attention-rule-text { font-size: 0.8rem; color: #8aba8a; margin-top: 0.15rem; line-height: 1.4; }

/* Structured description sections */
.attention-sections { margin-top: 0.35rem; display: flex; flex-direction: column; gap: 0.2rem; }
.attention-section  { font-size: 0.78rem; color: #aaa; line-height: 1.4; }
.attention-sec-label { color: #666; margin-right: 0.3rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.attention-sec-body { color: #bbb; }

/* Action groups with outcome labels */
.attention-action-group { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.attention-outcome { font-size: 0.65rem; text-align: center; max-width: 80px; line-height: 1.2; }

/* ── Tasks / threads ── */
.task-row       { padding: 0.3rem 0; }
.task-title     { font-size: 0.82rem; margin-bottom: 0.2rem; }
.task-project   { color: #555; font-size: 0.72rem; margin-left: 0.4rem; }
.task-bar       { height: 4px; background: #2a2a2a; border-radius: 2px; margin: 0.2rem 0; }
.task-fill      { height: 100%; background: #4a9; border-radius: 2px; }
.task-meta      { color: #555; font-size: 0.72rem; }

.thread-row     { display: flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0;
                  border-bottom: 1px solid #1e1e1e; font-size: 0.8rem; flex-wrap: wrap; }
.thread-row:last-child { border-bottom: none; }
.thread-title   { flex: 1; color: #bbb; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.thread-meta    { font-size: 0.7rem; white-space: nowrap; }

/* ── Reminders ── */
.reminder-row   { display: flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0;
                  border-bottom: 1px solid #1e1e1e; }
.reminder-row:last-child { border-bottom: none; }
.reminder-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.reminder-msg   { font-size: 0.82rem; }
.reminder-when  { font-size: 0.7rem; }
.reminder-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.reminder-overdue .reminder-msg { color: #c05050; }
.reminder-overdue .reminder-when { color: #c05050; }
.reminder-soon  .reminder-when { color: #d8843a; }
.reminder-today .reminder-when { color: #8ab; }

/* ── Suggestions (kept for Insights panel) ── */
.suggestion-row { padding: 0.3rem 0; }
.sug-title      { font-size: 0.82rem; margin-bottom: 0.25rem; }
.sug-actions    { display: flex; gap: 0.4rem; }
.sug-approve    { border-color: #2a4a2a; color: #6a9a6a; }
.sug-approve:hover { background: #1a2a1a; color: #8aba8a; }
.sug-reject     { border-color: #4a2a2a; color: #9a6a6a; }
.sug-reject:hover { background: #2a1a1a; color: #ba8a8a; }

/* ── Inbox ── */
.inbox-count    { margin-left: 0.4rem; background: #e05252; color: #fff; border-radius: 10px; padding: 0 0.4rem; font-size: 0.7rem; font-weight: 700; }
.inbox-row      { padding: 0.35rem 0; border-bottom: 1px solid #1e1e1e; }
.inbox-row:last-child { border-bottom: none; }
.inbox-header   { display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.15rem; }
.inbox-badge    { border: 1px solid; border-radius: 4px; padding: 0.05rem 0.3rem; font-size: 0.68rem; flex-shrink: 0; text-transform: uppercase; letter-spacing: 0.03em; }
.inbox-title    { font-size: 0.82rem; color: #ccc; }
.inbox-desc     { font-size: 0.76rem; margin-bottom: 0.2rem; }
.inbox-actions  { display: flex; gap: 0.4rem; }

/* ── Project Pulse ── */
.pulse-grid     { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.6rem; }
.pulse-row      { padding: 0.4rem 0.5rem; border-left: 2px solid #333; font-size: 0.82rem; }
.pulse-row:hover { border-left-color: #555; }
.pulse-header   { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.2rem; }
.pulse-age      { color: #666; font-size: 0.72rem; }
.pulse-chat-btn { margin-left: auto; font-size: 0.72rem; padding: 0.05rem 0.35rem; }
.pulse-commit   { color: #bbb; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pulse-session  { color: #888; font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 0.1rem; }
.pulse-issue    { color: #e8a04a; font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 0.1rem; }

/* ── JEPA ── */
.jepa-status-row    { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.jepa-badge-ok      { background: #1a2a1a; border: 1px solid #2a4a2a; color: #6a9a6a; border-radius: 4px; padding: 0.1rem 0.4rem; font-size: 0.72rem; }
.jepa-badge-off     { background: #1e1e1e; border: 1px solid #333; color: #666; border-radius: 4px; padding: 0.1rem 0.4rem; font-size: 0.72rem; }
.jepa-metrics-row   { display: flex; gap: 1.5rem; margin-bottom: 0.6rem; }
.jepa-metric        { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; }
.jepa-predictions   { border-top: 1px solid #222; padding-top: 0.5rem; margin-top: 0.2rem; }
.jepa-pred-row      { display: flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0; border-bottom: 1px solid #1a1a1a; font-size: 0.8rem; }
.jepa-pred-row:last-child { border-bottom: none; }
.jepa-pred-main     { flex: 1; display: flex; align-items: baseline; gap: 0.35rem; flex-wrap: wrap; overflow: hidden; }
.jepa-pred-text     { color: #ccc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.jepa-pred-feedback { display: flex; gap: 0.25rem; flex-shrink: 0; }
.jepa-feedback-done { font-size: 0.7rem; color: #555; flex-shrink: 0; }
.jepa-pred-context  { font-size: 0.73rem; color: #555; margin-top: 2px; line-height: 1.3;
                       max-width: 480px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── JEPA Insights Panel ── */
.jepa-panel        { display: flex; flex-direction: column; gap: 0; }
.jepa-nav          { display: flex; gap: 0.25rem; margin-bottom: 1rem; flex-wrap: wrap; }
.jepa-nav-btn      { background: #1e1e1e; border: 1px solid #2a2a2a; color: #666; border-radius: 4px;
                      padding: 0.25rem 0.7rem; font-size: 0.78rem; cursor: pointer; }
.jepa-nav-btn:hover { color: #aaa; border-color: #444; }
.jepa-nav-btn.active { color: #e0e0e0; border-color: #4a8ac4; background: #162a3a; }
.jepa-section      { display: flex; flex-direction: column; gap: 0.4rem; }
.jepa-stat-grid    { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.jepa-stat         { background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 6px; padding: 0.5rem 0.75rem; }
.jepa-stat-label   { font-size: 0.72rem; color: #666; margin-bottom: 0.25rem; }
.jepa-stat-val     { font-size: 1.1rem; font-weight: 600; color: #ddd; }
.jepa-loss-table   { font-size: 0.8rem; }
.jepa-loss-header  { display: grid; grid-template-columns: 60px 120px 1fr 100px; gap: 0.5rem;
                      color: #555; font-size: 0.72rem; padding: 0.2rem 0; border-bottom: 1px solid #222; }
.jepa-loss-row     { display: grid; grid-template-columns: 60px 120px 1fr 100px; gap: 0.5rem;
                      padding: 0.2rem 0; border-bottom: 1px solid #1a1a1a; }
.jepa-focus-row    { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0; border-bottom: 1px solid #1a1a1a; font-size: 0.82rem; }
.jepa-gap-row      { display: flex; align-items: baseline; gap: 0.4rem; padding: 0.3rem 0; border-bottom: 1px solid #1a1a1a; font-size: 0.82rem; flex-wrap: wrap; }
.jepa-annot-row    { display: flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0; border-bottom: 1px solid #1a1a1a; font-size: 0.82rem; }
.jepa-rank         { color: #555; font-size: 0.72rem; width: 1.2rem; flex-shrink: 0; }

/* ── Activity ── */
.activity-row   { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0; font-size: 0.82rem; }
.activity-preview { flex: 1; color: #bbb; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.domain-badge   { background: #1e1e1e; border: 1px solid #333; color: #888; border-radius: 4px; padding: 0.1rem 0.35rem; font-size: 0.68rem; flex-shrink: 0; }
.activity-resume { flex-shrink: 0; }

.dash-chat {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid #2a2a2a;
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;   /* never compress — always sits below the scrollable grid */
}
.dash-chat input { flex: 1; background: #1e1e1e; border: 1px solid #2a2a2a; color: #e0e0e0; border-radius: 6px; padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.dash-chat button { background: #2a5caa; color: #fff; border: none; border-radius: 6px; padding: 0.4rem 0.8rem; cursor: pointer; font-size: 0.85rem; }

/* ── Chat panel two-column layout ────────────────────────────────── */

#chat-panel-layout {
  display: flex;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

#chat-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #141414;
  border-right: 1px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── Agent suggestion cards ──────────────────────────────────────── */

.agent-suggestion-card {
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
  background: #181818;
}

.agent-sug-name {
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.agent-sug-desc {
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
}

.agent-sug-keywords {
  margin-bottom: 0.3rem;
}

.agent-kw-badge {
  display: inline-block;
  background: #252525;
  border: 1px solid #333;
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  margin-right: 0.25rem;
  color: #aaa;
}

.agent-sug-examples summary {
  cursor: pointer;
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

.agent-sug-examples ul {
  margin: 0.25rem 0 0 1rem;
  padding: 0;
  font-size: 0.75rem;
  color: #888;
}

.create-agent-btn.btn-success {
  background: #1a3a1a;
  border-color: #2d6a2d;
  color: #6dbf6d;
  cursor: default;
}

/* ── Projects panel scrolling ───────────────────────────────────── */
#panel-projects {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
#panel-projects .projects-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* ── Project cards ──────────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding: 1rem;
}

.project-card {
  background: #181818;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.project-meta { font-size: 0.75rem; color: #666; }

.project-card-body { display: flex; flex-direction: column; gap: 0.4rem; }

.project-excerpt { font-size: 0.8rem; color: #aaa; margin: 0; }

.project-stats { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.stat-badge {
  font-size: 0.72rem;
  background: #252525;
  border: 1px solid #333;
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  color: #999;
}
.stat-curated { border-color: #2d6a2d; color: #6dbf6d; }
.stat-review  { border-color: #7a4f00; color: #c98a00; }
.stat-git     { border-color: #1a3a5a; color: #5a9fd4; }
.stat-cc      { border-color: #2d2d6a; color: #8080d4; }
.stat-mem     { border-color: #2d4a2d; color: #80b480; }

.project-card--sparse { opacity: 0.75; }
.project-card--no-disk { border-color: #2a2a1a; }

.card-btn-active { background: #2a2a2a; color: #e0e0e0; border-color: #444; }

.project-card-actions {
  border-top: 1px solid #2a2a2a;
  padding: 0.5rem 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.project-card--ghost {
  border-color: #3a2a0a;
  background: #161210;
  opacity: 0.9;
}
.project-card--ghost .project-card-header strong { color: #a08060; }

.card-btn--danger { border-color: #5a1a1a; color: #c06060; }
.card-btn--danger:hover { background: #2a1010; color: #e08080; }

.project-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
}

.panel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #2a2a2a;
}

.project-picker-select {
  background: #1a1a1a;
  border: 1px solid #333;
  color: #e0e0e0;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.stat-row {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: #aaa;
}

/* ── Hierarchy panel ──────────────────────────────────────────────── */
.hier-summary { font-size: 0.85rem; color: #aaa; padding: 0.5rem 0; }

.hier-domain-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ccc;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.4rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #2a2a2a;
}

.hier-edge-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
  background: #111;
}
.hier-edge-row:hover { background: #1a1a1a; }

.hier-lifecycle-icon { font-size: 0.8rem; flex-shrink: 0; }
.hier-edge-label     { display: flex; align-items: center; gap: 0.2rem; flex-wrap: wrap; }
.hier-edge-type      { color: #555; font-size: 0.75rem; white-space: nowrap; }

/* Lifecycle colours */
.hier-confirmed    { border-left: 2px solid #2a6e3a; }
.hier-experimenting{ border-left: 2px solid #5a5a1a; }
.hier-provisional  { border-left: 2px solid #3a3a6e; }
.hier-hypothesized { border-left: 2px solid #444; }
.hier-rejected     { border-left: 2px solid #5a1a1a; opacity: 0.55; }

/* Inspector node chips */
.hier-node-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  border: 1px solid #333;
  background: #111;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}
.hier-node-chip:hover    { border-color: #666; background: #1a1a1a; }
.hier-node-selected      { border-color: #4a8a5a !important; background: #0e1f12 !important; }

/* ── Hierarchy forms (create node / edit / add edge / rename type) ── */
.hier-form-box   { background:#0e0e0e; border:1px solid #2a2a2a; border-radius:5px;
                   padding:0.5rem 0.6rem; margin-bottom:0.5rem; }
.hier-form-title { font-size:0.72rem; text-transform:uppercase; letter-spacing:0.05em;
                   color:#555; margin-bottom:0.35rem; }
.hier-form-row   { display:flex; align-items:center; gap:0.4rem; margin-bottom:0.3rem;
                   flex-wrap:wrap; }
.hier-form-row:last-child { margin-bottom:0; }
.hier-label      { font-size:0.72rem; color:#666; white-space:nowrap; flex-shrink:0; }
.hier-input      { background:#1a1a1a; border:1px solid #333; color:#e0e0e0;
                   border-radius:3px; padding:0.2rem 0.4rem; font-size:0.78rem;
                   flex:1; min-width:80px; }
.hier-input:focus { outline:none; border-color:#555; }
.hier-select     { background:#1a1a1a; border:1px solid #333; color:#e0e0e0;
                   border-radius:3px; padding:0.2rem 0.35rem; font-size:0.78rem; }
.hier-drilldown  { border-left:2px solid #3a5a3a; padding-left:0.75rem; }
.hier-link       { cursor:pointer; text-decoration:underline dotted; }
.hier-link:hover { color:#8ab; }

/* ── Science panel ─────────────────────────────────────────────────── */
.sci-status-icon { font-size: 0.8rem; flex-shrink: 0; }
.sci-observing   { color: #888; }
.sci-validating  { color: #8a8a2a; }
.sci-confirmed   { color: #2a8a3a; }
.sci-resolved    { color: #555; }

/* ── Principles — authority tier headers ───────────────────────────── */
.pr-tier-header {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #222;
}
.pr-tier-icon   { font-size: 0.9rem; flex-shrink: 0; }
.pr-tier-label  { font-size: 0.85rem; font-weight: 600; letter-spacing: 0.02em; }
.pr-tier-sub    { font-size: 0.72rem; color: #555; }

/* Tier accent colours */
.pr-inviolate   { color: #c0392b; }
.pr-guidance    { color: #c0860a; }
.pr-strategy    { color: #555; }

/* Left-border accents on accordion items */
.pr-inviolate-item { border-left: 2px solid #5a1a1a; }
.pr-guidance-item  { border-left: 2px solid #5a3a00; }
.pr-strategy-item  { border-left: 2px solid #2a2a2a; opacity: 0.85; }
