:root {
  --border: #ddd;
  --muted: #666;
  --bg: #fafafa;
  --panel: #fff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: #222;
}

.project-picker-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.project-picker-card {
  width: min(820px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
}

.project-picker-header h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.project-picker-header p,
.project-picker-empty,
.project-picker-link span {
  color: var(--muted);
}

.project-picker-error {
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid #e9b4b4;
  border-radius: 10px;
  background: #fff1f1;
  color: #8f1f1f;
}

.project-picker-list {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.project-picker-link {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-decoration: none;
}

.project-picker-link:hover {
  border-color: #9bb4d4;
  background: #f6faff;
}

header {
  height: 64px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.nav-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f7f7f7;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-toggle:hover {
  background: #eee;
}

header h1 {
  margin: 0;
  font-size: 20px;
}

header p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.top-menu {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 18px;
  flex: 0 0 auto;
}

/* Header-mounted search: scope select + input + floating results dropdown. */
.header-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  margin-right: 16px;
  width: 480px;
  max-width: 50vw;
}

.header-impact-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.header-impact-filter select {
  width: min(320px, 32vw);
  min-width: 180px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: #222;
  font: inherit;
}

.header-impact-filter select:focus {
  outline: 2px solid #bfd7ff;
  border-color: #7aa7e8;
}

.header-impact-only {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  cursor: pointer;
}

.header-impact-only input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.index-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 54px;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fafbfc;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  white-space: nowrap;
}

.index-status-spinner {
  display: none;
  width: 10px;
  height: 10px;
  border: 2px solid #d0d5dd;
  border-top-color: #3657d6;
  border-radius: 999px;
}

.index-status.indexing .index-status-spinner {
  display: inline-block;
  animation: index-spin 0.75s linear infinite;
}

.index-status.indexing {
  color: #3657d6;
  border-color: #c7d7fe;
  background: #f3f6ff;
}

.index-status.error {
  color: #b42318;
  border-color: #fecdca;
  background: #fff1f0;
}

@keyframes index-spin {
  to { transform: rotate(360deg); }
}

.header-search select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 13px;
  cursor: pointer;
  flex: 0 0 auto;
}

.header-search input#searchBox {
  flex: 1;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  width: auto;            /* override the global `input { width: 100% }` */
}

.header-search-results {
  position: absolute;
  top: 38px;
  right: 0;
  left: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  max-height: 60vh;
  overflow-y: auto;
  z-index: 50;
  display: none;
}

.header-search-results.open {
  display: block;
}

.header-search-results .result {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
}

.header-search-results .result:last-child {
  border-bottom: none;
}

.header-search-results .result a {
  display: block;
  text-decoration: none;
  color: inherit;
}

.header-search-results .result strong {
  display: block;
  margin-bottom: 2px;
}

.header-search-results .result small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.menu-option {
  width: auto;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: #222;
  font-size: 13px;
  text-align: center;
  cursor: pointer;
}

.menu-option:hover {
  background: #f4f7fb;
}

.menu-option.active {
  border-color: #7f9fc7;
  background: #eaf2fb;
  font-weight: 600;
}

/* Three-column layout with two drag handles. Widths are driven by CSS
   variables on <body> so the resize JS can update them at runtime; collapsed
   states zero the relevant column and hide the panel. */
:root {
  --left-w-default:  280px;
  --right-w-default: 340px;
  --handle-w:        6px;
  --left-w:          var(--left-w-default);
  --right-w:         var(--right-w-default);
}

main {
  display: grid;
  grid-template-columns:
    var(--left-w)
    var(--handle-w)
    1fr
    var(--handle-w)
    var(--right-w);
  height: calc(100vh - 64px);
  transition: grid-template-columns 0.12s ease;
}

main.resizing {
  transition: none;   /* drag must feel instant */
  user-select: none;
}

/* The two resize handles. Thin, sit between panels, cursor changes on hover. */
.col-resizer {
  background: transparent;
  cursor: col-resize;
  user-select: none;
  position: relative;
  z-index: 5;
}

.col-resizer:hover,
.col-resizer.active {
  background: #d6eaff;
}

body.nav-collapsed main {
  grid-template-columns:
    0
    0
    1fr
    var(--handle-w)
    var(--right-w);
}

body.right-collapsed main {
  grid-template-columns:
    var(--left-w)
    var(--handle-w)
    1fr
    0
    0;
}

body.nav-collapsed.right-collapsed main {
  grid-template-columns: 0 0 1fr 0 0;
}

body.nav-collapsed .left,
body.nav-collapsed .col-resizer-left,
body.right-collapsed .right,
body.right-collapsed .col-resizer-right {
  display: none;
}

aside.left        { grid-column: 1; }
.col-resizer-left  { grid-column: 2; }
.center            { grid-column: 3; }
.col-resizer-right { grid-column: 4; }
aside.right        { grid-column: 5; }

aside, .center {
  overflow: auto;
  padding: 12px;
}

.left, .right {
  background: var(--panel);
}

/* Keep the side panels above any fixed-position annotation markers (which use a
   high z-index to float over content) so panel controls like the annotation
   delete/edit buttons always receive clicks. */
.left, .right {
  position: relative;
  z-index: 9000;
}

.left  { border-right: 1px solid var(--border); }
.right { border-left:  1px solid var(--border); }

/* Right panel header: tabs on the left, collapse toggle on the right. */
.right-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.right-tabs {
  display: flex;
  gap: 4px;
}

.right-tab {
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: #f1f3f5;
  color: #444;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  padding: 5px 12px;
  cursor: pointer;
}

.right-tab.active {
  background: var(--panel, #fff);
  color: #111827;
  border-color: #93c5fd;
}

.right-pane[hidden] { display: none; }

/* Git history list (Trace tab). */
.history-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.history-row {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
}

.history-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  color: #6b7280;
  font-size: 11px;
  margin-bottom: 2px;
}

.history-hash {
  font-family: "Menlo", "Consolas", monospace;
  color: #2563eb;
}

.history-subject {
  display: block;
  color: #111827;
}

.history-empty, .history-loading, .history-author {
  color: #6b7280;
  font-size: 11px;
}

.right-toggle {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f7f7f7;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  color: #555;
}

.right-toggle:hover {
  background: #eee;
}

/* Floating "show right panel" tab that appears only when the right panel is
   collapsed. Anchored to the right edge of <main>. */
.right-expand {
  display: none;
  position: absolute;
  right: 0;
  top: 12px;
  width: 24px;
  height: 32px;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 6px 0 0 6px;
  background: #f7f7f7;
  font-size: 14px;
  cursor: pointer;
  color: #555;
  z-index: 6;
}

body.right-collapsed .right-expand {
  display: block;
}

/* main needs to be position:relative so the floating right-expand tab can
   anchor inside it. */
main { position: relative; }
.right { border-left: 1px solid var(--border); }

section {
  margin-bottom: 20px;
}

h2 {
  font-size: 14px;
  margin: 0 0 8px;
  color: #333;
}

button, .file-link, .object-link {
  cursor: pointer;
}

.file-row {
  margin: 1px 0;
}

.file-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  color: #174ea6;
  text-decoration: none;
  font-size: 13px;
}

.file-link-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-badge {
  flex: 0 0 auto;
  min-width: 32px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.artifact-badge-empty {
  background: #f3f4f6;
  color: #6b7280;
}

.artifact-badge-partial {
  background: #fff3c4;
  color: #8a5b00;
}

.artifact-badge-full,
.artifact-badge-linked {
  background: #dcfce7;
  color: #166534;
}

.file-link:hover {
  background: #eef3ff;
}

.file-link.selected {
  background: #dbeafe;
  color: #123f8f;
  font-weight: 700;
}

.file-link-impacted {
  border-left: 3px solid #cca700;
  padding-left: 5px;
}

.file-link-impacted-added {
  border-left-color: #587c0c;
}

.file-link-impacted-modified {
  border-left-color: #cca700;
}

.file-link-impacted-deleted {
  border-left-color: #f14c4c;
  opacity: 0.76;
}

.file-link-impacted-added-modified {
  border-left-color: #cca700;
}

.file-link-impacted-added-deleted,
.file-link-impacted-modified-deleted,
.file-link-impacted-added-modified-deleted {
  border-left-color: #f14c4c;
}

.plan-impact-badge {
  flex: 0 0 auto;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.plan-impact-badge-added,
.changes-impact-badge-added {
  background: #e5f3d4;
  color: #587c0c;
}

.plan-impact-badge-modified,
.changes-impact-badge-modified,
.plan-impact-badge-added-modified,
.changes-impact-badge-added-modified {
  background: #fff4ce;
  color: #8a6d00;
}

.plan-impact-badge-deleted,
.changes-impact-badge-deleted,
.plan-impact-badge-added-deleted,
.changes-impact-badge-added-deleted,
.plan-impact-badge-modified-deleted,
.changes-impact-badge-modified-deleted,
.plan-impact-badge-added-modified-deleted,
.changes-impact-badge-added-modified-deleted {
  background: #fde7e9;
  color: #c50f1f;
}

.plan-impact-change {
  flex: 0 0 auto;
  color: #6e6e6e;
  font-family: "Menlo", "Consolas", monospace;
  font-size: 11px;
}

.plan-impact-diff {
  margin: 0 0 16px;
  padding: 0;
  border: 1px solid #d0d7de;
  background: #f6f8fa;
  border-radius: 6px;
  color: #24292f;
  font-family: "Menlo", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.35;
  overflow-x: auto;
}

.plan-impact-diff-title {
  padding: 8px 10px;
  border-bottom: 1px solid #d0d7de;
  background: #ffffff;
  color: #57606a;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.plan-impact-diff-line {
  padding: 1px 10px;
  white-space: pre;
}

.plan-impact-diff-add {
  color: #116329;
  background: #dafbe1;
}

.plan-impact-diff-del {
  color: #82071e;
  background: #ffebe9;
}

.plan-impact-diff-hunk {
  color: #0550ae;
  background: #ddf4ff;
}

.tree-loading {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 0;
  display: block;
}

.changes-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.changes-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
}

.changes-item-modified .changes-path {
  font-weight: 650;
}

.changes-item-deleted .changes-path {
  color: #c50f1f;
  text-decoration: line-through;
}

.plan-impact-debug h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.plan-impact-debug dl {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 4px 8px;
  margin: 0 0 12px;
  font-size: 12px;
}

.plan-impact-debug dt {
  color: var(--muted);
  font-weight: 700;
}

.plan-impact-debug dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.plan-debug-block {
  margin-top: 10px;
}

.plan-debug-counts,
.plan-debug-commits {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  gap: 5px;
  font-size: 12px;
}

.plan-debug-counts li,
.plan-debug-commits li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.plan-debug-commits code {
  color: #57606a;
}

.plan-debug-commits span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.plan-debug-status {
  font-weight: 700;
}

.changes-path {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: "Menlo", "Consolas", monospace;
}

.changes-impact-badge {
  flex: 0 0 auto;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.folder {
  margin: 8px 0 4px;
  font-weight: 650;
  font-size: 13px;
}

.folder-toggle {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  border-radius: 4px;
}

.folder-toggle:hover {
  background: #f0f3f8;
}

.folder-toggle.selected {
  background: #e6f0fb;
  color: #123f8f;
}

.folder-toggle .chevron {
  display: inline-block;
  width: 12px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  flex-shrink: 0;
}

.folder-toggle .folder-label {
  flex: 1;
}

.plan-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9ca3af;
  flex: 0 0 auto;
}

.plan-folder-active .plan-status-dot {
  outline: 2px solid #bfdbfe;
  outline-offset: 1px;
}

.plan-active-badge {
  flex: 0 0 auto;
  padding: 1px 6px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.plan-folder-draft .plan-status-dot {
  background: #9ca3af;
}

.plan-folder-approved .plan-status-dot {
  background: #2563eb;
}

.plan-folder-executing .plan-status-dot {
  background: #f59e0b;
}

.plan-folder-executed .plan-status-dot {
  background: #16a34a;
}

.plan-folder-partially-executed .plan-status-dot {
  background: #d97706;
}

.plan-folder-released .plan-status-dot {
  background: #6d28d9;
}

.folder-children {
  margin-left: 10px;
  border-left: 1px solid #eee;
  padding-left: 8px;
}

/* ---------- Left-panel Dashboard link ------------------------------------ */

.home-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #f4f7fb;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #222;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s, border-color 0.1s;
}

.home-link[hidden] {
  display: none;
}

.home-link:hover,
.home-link:focus {
  background: #e6eef9;
  border-color: #99b3d9;
  outline: none;
}

.home-link.selected {
  background: #dbeafe;
  border-color: #93c5fd;
}

.home-icon {
  font-size: 16px;
  line-height: 1;
  color: #2563eb;
}

/* ---------- Dashboard (home view) ---------------------------------------- */

.startup-banner {
  background: #fffbe6;
  border: 1px solid #f0c040;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: #7a5a00;
}

.dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
  align-items: start;
}

.dash-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (max-width: 1100px) {
  .dashboard { grid-template-columns: 1fr; }
}

.dash-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  background: white;
}

.dash-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 14px;
  border-bottom: 1px solid var(--border);
}

.dash-tab {
  appearance: none;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #596276;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 12px 8px;
}

.dash-tab:hover,
.dash-tab:focus {
  color: #1a2233;
  outline: none;
}

.dash-tab.active {
  color: #1a2233;
  border-bottom-color: #3657d6;
}

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

.dash-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.dash-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #333;
  letter-spacing: 0.02em;
}

.dash-card-action {
  font-size: 12px;
}

.dash-card-action a {
  color: var(--link, #2563eb);
  text-decoration: none;
}

.dash-card-action a:hover { text-decoration: underline; }

.dash-subsection {
  margin: 10px 0 8px;
}

.dash-sub-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  margin-bottom: 4px;
}

.dash-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: baseline;
}

.dash-stat {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
}

.dash-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #222;
  line-height: 1;
}

.dash-stat-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.dash-line {
  font-size: 13px;
  color: #444;
  line-height: 1.5;
  margin-top: 2px;
}

.dash-line code {
  font-family: monospace;
  font-size: 12px;
  background: #f4f4f4;
  padding: 1px 4px;
  border-radius: 3px;
}

.dash-line a {
  color: var(--link, #2563eb);
  text-decoration: none;
}

.dash-line a:hover { text-decoration: underline; }

/* Plan section special-cases */
.dash-current-plan {
  cursor: pointer;
  margin-bottom: 6px;
}

.dash-plan-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dash-plan-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.dash-plan-row:hover,
.dash-plan-row:focus {
  background: #f4f7fb;
  outline: none;
}

.dash-plan-id {
  font-family: monospace;
  color: #222;
  flex-shrink: 0;
}

.dash-released-line {
  font-size: 12px;
  margin-top: 6px;
}

/* Method card per-category rule list */
.method-rule-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.method-rule-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.method-rule-row:hover,
.method-rule-row:focus {
  background: #f4f7fb;
  outline: none;
}

.method-rule-cat-name {
  color: #222;
}

.method-rule-cat-count {
  font-family: monospace;
  color: #666;
  font-size: 12px;
}

.method-cmd-groups {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.method-cmd-group {
  display: flex;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.method-cmd-group-name {
  font-weight: 600;
  min-width: 60px;
  color: #444;
}

.method-cmd-labels {
  color: #555;
}

/* Plans list card (right column, top) */
.dash-plans-list .dash-plan-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dash-plans-overview {
  margin-bottom: 18px;
}

.dash-plan-overview-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 348px;
  overflow-y: auto;
  padding-right: 4px;
}

.dash-plan-overview-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.75fr) minmax(220px, 2fr) max-content;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}

.dash-plan-overview-row:last-child {
  border-bottom: 0;
}

.dash-plan-overview-row:hover,
.dash-plan-overview-row:focus {
  background: #fafbff;
  outline: none;
}

.dash-plan-row-selected {
  background: #f3f6ff;
  box-shadow: inset 3px 0 0 #3657d6;
}

.dash-plan-summary {
  min-width: 0;
  color: #333;
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-plan-profile {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #dfe4ee;
}

.dash-plan-profile .plan-summary {
  margin-top: 0;
}

.dash-plan-profile .plan-report {
  margin-top: 14px;
}

.dash-plan-scope-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #eef0f4;
}

.dash-plan-scope-block .doc-body {
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.dash-plan-profile .commands-block {
  display: none;
}

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

.business-capability-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 13px;
}

.business-capability-table th {
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  color: #667085;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  text-align: left;
  text-transform: uppercase;
}

.business-capability-table td {
  border-bottom: 1px solid #eef0f4;
  padding: 10px;
  vertical-align: top;
}

.business-capability-table tr:last-child td {
  border-bottom: 0;
}

.business-capability-cell {
  min-width: 220px;
}

.business-capability-title {
  font-weight: 700;
  color: #1a2233;
  margin-bottom: 4px;
}

.business-capability-title a,
.business-cell-list a {
  color: var(--link, #2563eb);
  text-decoration: none;
}

.business-capability-title a:hover,
.business-cell-list a:hover {
  text-decoration: underline;
}

.business-capability-def {
  font-size: 12px;
  line-height: 1.4;
}

.business-capability-detail {
  margin-top: 8px;
}

.business-capability-detail span {
  display: block;
  color: #667085;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.business-capability-detail p {
  margin: 0;
  color: #344054;
  font-size: 12px;
  line-height: 1.45;
}

.business-cell-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
}

.business-impl-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  margin-left: 6px;
  padding: 1px 6px;
  vertical-align: middle;
}

.business-impl-status.built {
  background: #eaf7ee;
  color: #1f7a3f;
}

.business-impl-status.pending {
  background: #fff8e8;
  color: #8a5a00;
}

.business-global-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eef0f4;
}

.business-global-list h3 {
  margin: 0 0 8px;
  color: #1a2233;
  font-size: 13px;
}

.business-global-list .business-cell-list {
  padding-left: 18px;
}

.business-erd {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eef0f4;
}

.business-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.business-section-head h3 {
  margin: 0;
  color: #1a2233;
  font-size: 13px;
}

.business-section-head a {
  color: var(--link, #2563eb);
  font-size: 12px;
  text-decoration: none;
}

.business-section-head a:hover {
  text-decoration: underline;
}

.business-erd-frame {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.business-erd-frame img {
  display: block;
  max-width: 100%;
  height: auto;
}

.matrix-scroll {
  overflow-x: auto;
}

.layer-cap-matrix {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

.layer-cap-matrix th,
.layer-cap-matrix td {
  border: 1px solid #e4e7ec;
  padding: 7px 12px;
  text-align: left;
  vertical-align: middle;
}

.layer-cap-matrix thead th {
  background: #f9fafb;
  font-weight: 600;
  color: #344054;
  white-space: nowrap;
}

.layer-cap-matrix .matrix-corner {
  font-weight: 600;
  color: #667085;
  white-space: nowrap;
}

.layer-cap-matrix .matrix-layer {
  background: #f9fafb;
  font-weight: 600;
  color: #344054;
  white-space: nowrap;
}

.layer-cap-matrix .matrix-tier {
  background: #eef2f6;
  font-weight: 700;
  color: #1d2939;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.layer-cap-matrix .matrix-tier-tech {
  vertical-align: middle;
}

.layer-cap-matrix .matrix-cell {
  text-align: center;
  color: #98a2b3;
}

.layer-cap-matrix .matrix-dot {
  color: #667085;
}

.layer-cap-matrix .matrix-dot-present {
  color: #12b76a;
}

.layer-cap-matrix .matrix-dot-missing {
  color: #d0d5dd;
}

.layer-cap-matrix .matrix-dot-gap {
  color: #f79009;
}

.coverage-gap-note {
  color: #b54708;
  font-size: 13px;
  margin: 4px 0 0;
}

.matrix-row-spanning .matrix-cell-span {
  text-align: center;
  font-style: italic;
  color: #667085;
  background: #f5f8ff;
}

.matrix-footnote {
  margin: 8px 2px 0;
  font-size: 12px;
}

.coverage-report .coverage-cell {
  cursor: pointer;
}

.coverage-report .coverage-cell:hover,
.coverage-report .coverage-cell:focus {
  background: #eef4ff;
  outline: none;
}

.coverage-report .coverage-row-shared .matrix-layer {
  font-style: italic;
  color: #667085;
}

.coverage-detail {
  margin: 10px 2px 0;
  padding: 10px 12px;
  border: 1px solid #e4e7ec;
  border-radius: 6px;
  background: #f9fafb;
}

.coverage-detail-head {
  margin-bottom: 6px;
}

.coverage-file-list {
  margin: 0;
  padding-left: 18px;
}

.coverage-file-list li {
  margin: 2px 0;
}

@media (prefers-color-scheme: dark) {
  .layer-cap-matrix th,
  .layer-cap-matrix td { border-color: #333; }
  .layer-cap-matrix thead th,
  .layer-cap-matrix .matrix-layer { background: #1c1c1e; color: #e5e5e7; }
  .layer-cap-matrix .matrix-tier { background: #23262b; color: #f0f0f2; }
  .matrix-row-spanning .matrix-cell-span { background: #1a2233; color: #a9b4c7; }
  .layer-cap-matrix .matrix-dot-present { color: #32d583; }
  .layer-cap-matrix .matrix-dot-missing { color: #475467; }
  .layer-cap-matrix .matrix-dot-gap { color: #fdb022; }
  .coverage-gap-note { color: #fdb022; }
  .coverage-report .coverage-cell:hover,
  .coverage-report .coverage-cell:focus { background: #232a3a; }
  .coverage-detail { background: #1c1c1e; border-color: #333; }
  .coverage-report .coverage-row-shared .matrix-layer { color: #98a2b3; }
}

.design-artifact-list {
  margin: 0;
  padding: 0;
}

.design-artifact-section {
  border-bottom: 1px solid #eef0f4;
}

.design-artifact-section:last-child {
  border-bottom: 0;
}

.design-artifact-header {
  display: grid;
  grid-template-columns: 28px minmax(220px, 1fr) max-content;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
}

.design-artifact-content {
  padding: 0 0 14px 40px;
}

.design-artifact-content .doc-body {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}

.design-artifact-image {
  max-height: 640px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.design-artifact-image img {
  display: block;
  max-width: 100%;
  height: auto;
}

.design-artifact-text {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  color: #344054;
  font-size: 13px;
  line-height: 1.45;
}

.design-artifact-text p {
  margin: 0 0 6px;
}

.design-artifact-text p:last-child {
  margin-bottom: 0;
}

.design-artifact-code {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  padding: 12px 14px;
  white-space: pre;
}

.ui-catalog-source {
  margin-bottom: 10px;
  color: #667085;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
}

.ui-catalog-source a {
  color: var(--link, #2563eb);
  text-decoration: none;
}

.ui-catalog-source a:hover {
  text-decoration: underline;
}

.ui-catalog-report .panel-inventory {
  margin-top: 0;
}

.ui-artifact-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eef0f4;
}

.design-artifact-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.design-artifact-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.design-artifact-label {
  color: #1a2233;
  font-size: 13px;
  font-weight: 700;
}

.design-artifact-path,
.design-artifact-path a,
.design-artifact-path code {
  color: #667085;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.design-artifact-path a {
  color: var(--link, #2563eb);
  text-decoration: none;
}

.design-artifact-path a:hover {
  text-decoration: underline;
}

@media (max-width: 760px) {
  .business-global-lists {
    grid-template-columns: 1fr;
  }

  .design-artifact-header {
    grid-template-columns: 28px 1fr;
  }

  .design-artifact-section .business-impl-status {
    grid-column: 2;
    justify-self: start;
    margin-left: 0;
  }

  .design-artifact-content {
    padding-left: 0;
  }
}

.dash-plan-deferrals {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eef0f4;
}

.dash-plan-deficits {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eef0f4;
}

.dash-plan-deficits-title {
  font-size: 13px;
  font-weight: 700;
  color: #1a2233;
  margin-bottom: 4px;
}

.dash-plan-deficits-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dash-plan-deficit-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.75fr) minmax(220px, 2fr);
  gap: 12px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.dash-plan-deficit-row:last-child {
  border-bottom: 0;
}

.dash-plan-deficit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.dash-plan-deficit-chip {
  display: inline-flex;
  max-width: 100%;
  border: 1px solid #f5d08a;
  border-radius: 999px;
  background: #fff8e8;
  color: #7a4b00;
  padding: 2px 8px;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.dash-plan-deferrals-title {
  font-size: 13px;
  font-weight: 700;
  color: #1a2233;
  margin-bottom: 4px;
}

.dash-plan-deferrals-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dash-plan-defer-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 6px;
  border-bottom: 1px solid #f0f0f0;
  border-radius: 5px;
}

.dash-plan-defer-row:last-child {
  border-bottom: 0;
}

.dash-plan-defer-row[data-plan-id] {
  cursor: pointer;
}

.dash-plan-defer-row[data-plan-id]:hover,
.dash-plan-defer-row[data-plan-id]:focus-visible {
  background: #f5f8ff;
  outline: none;
}

.dash-plan-defer-reason {
  flex: 1 1 auto;
  font-size: 14px;
  color: #344054;
  line-height: 1.4;
}

.dash-plan-defer-plan {
  flex: 0 0 auto;
  font-size: 11px;
  color: #98a2b3;
  white-space: nowrap;
  font-family: var(--mono, ui-monospace, monospace);
}

.dash-plan-defer-followup {
  flex-basis: 100%;
  font-size: 12px;
  color: #2c7a3f;
  margin-top: 2px;
}

@media (max-width: 760px) {
  .dash-plan-overview-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .dash-plan-deficit-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .dash-plan-summary {
    white-space: normal;
  }

  .dash-plan-overview-row .lifecycle {
    justify-self: start;
  }
}

/* Active plan detail card */
.dash-active-plan .plan-card {
  cursor: pointer;
}

/* Category index page (when a Method-card category row is clicked) */
.category-heading {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  color: #222;
}

.category-note {
  margin: 0 0 16px;
  font-size: 13px;
}

.rule-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rule-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
}

.rule-row:last-child { border-bottom: none; }

.rule-link {
  display: flex;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  flex: 1;
  align-items: baseline;
}

.rule-link:hover .rule-title { color: var(--link, #2563eb); }

.rule-id {
  font-family: monospace;
  font-size: 11px;
  color: #888;
  flex-shrink: 0;
  width: 280px;
  word-break: break-all;
}

.rule-title {
  flex: 1;
  font-size: 13px;
  color: #222;
}

.rule-status {
  font-family: monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1e6b1e;
  padding: 1px 8px;
  border-radius: 999px;
  background: #d4f1d4;
}

.rule-status.draft     { color: #5a3a00; background: #fff3cd; }
.rule-status.deprecated{ color: #5a1a1a; background: #ffd7d4; }
.rule-status.proposed  { color: #0a4f99; background: #d6eaff; }

/* ---------- Plan detail (single-plan page) ------------------------------ */

.home-section {
  margin-bottom: 28px;
}

.home-heading {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.home-heading .muted {
  font-weight: 400;
  color: var(--muted);
  font-size: 14px;
}

.empty-state {
  padding: 12px;
  color: var(--muted);
  background: #fafafa;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.muted { color: var(--muted); }

/* Plan card (used on home + detail). The active card is bigger and bolder. */
.plan-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: white;
  cursor: pointer;
  transition: box-shadow 0.1s, border-color 0.1s;
}

.plan-card:hover,
.plan-card:focus {
  border-color: #888;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  outline: none;
}

.plan-card-active {
  border-width: 2px;
  border-color: #f39c12;
  background: #fffaf0;
}

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

.plan-id {
  font-family: monospace;
  font-size: 14px;
  font-weight: 600;
  color: #222;
}

.active-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 10px;
  background: #f39c12;
  color: white;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  font-family: sans-serif;
}

/* Lifecycle badges — colored by state. */
.lifecycle {
  display: inline-block;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.lifecycle-draft               { background: #eeeeee; color: #555; }
.lifecycle-approved            { background: #d6eaff; color: #0a4f99; }
.lifecycle-executing           { background: #fff3cd; color: #8a6100; }
.lifecycle-executed            { background: #d4f1d4; color: #1e6b1e; }
.lifecycle-partially-executed  { background: #cfe9e6; color: #0f5d5d; }
.lifecycle-released            { background: #f2eafd; color: #4b2a78; }

.plan-scope {
  font-size: 13px;
  color: #444;
  line-height: 1.4;
  margin-bottom: 8px;
}

.plan-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.tasks-bar {
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.tasks-bar-fill {
  height: 100%;
  background: #2c7;
  transition: width 0.2s;
}

.plan-last-event,
.plan-recommended {
  font-size: 12px;
  color: #555;
  margin-top: 4px;
  line-height: 1.4;
}

/* Commands block on the home + detail pages. */
.commands-block {
  margin: 16px 0 28px;
}

.commands-heading {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.command-card {
  border: 1px solid var(--border);
  border-left: 4px solid #888;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: white;
}

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

.command-name {
  font-family: monospace;
  font-size: 13px;
  font-weight: 600;
  color: #222;
}

.badge {
  display: inline-block;
  padding: 1px 8px;
  font-size: 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.badge-recommended { background: #2c7; color: white; }
.badge-destructive { background: #e9b04a; color: #5a3700; }

.command-recommended { border-left-color: #2c7; }
.command-destructive { border-left-color: #e9b04a; }

.command-description {
  font-size: 12px;
  color: #555;
  margin: 4px 0;
  line-height: 1.4;
}

.command-impact-label {
  font-size: 11px;
  font-weight: 600;
  color: #777;
  margin: 6px 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.command-impact {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: #444;
  line-height: 1.5;
}

.not-active-notice {
  padding: 10px 12px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 6px;
  font-size: 12px;
  color: #6e5300;
  margin: 12px 0;
  line-height: 1.5;
}

.plan-files-block,
.plan-log-block {
  margin-top: 18px;
}

.plan-files-list,
.plan-log-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.6;
}

.plan-file-link {
  font-family: monospace;
  font-size: 12px;
  color: var(--link, #2563eb);
  text-decoration: none;
}
.plan-file-link:hover {
  text-decoration: underline;
}

.plan-file-missing .muted {
  font-family: monospace;
  font-size: 12px;
}

/* ----- KPI strip --------------------------------------------------------- */
.kpi-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.kpi {
  flex: 1 1 0;
  min-width: 92px;
  background: var(--panel, #fff);
  border: 1px solid var(--border, #e2e6ee);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: center;
}
.kpi-wide { flex: 2 1 0; min-width: 160px; }
.kpi-val { font-size: 22px; font-weight: 700; color: #1a2233; line-height: 1.1; }
.kpi-val.kpi-meta { font-size: 14px; font-family: ui-monospace, Menlo, Consolas, monospace; color: #334; word-break: break-all; }
.kpi-val.kpi-bad { color: #c92a2a; }
.kpi-label { margin-top: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: #8a93a6; }

/* Clickable KPI (reveals a detail panel) */
.kpi-clickable {
  font: inherit;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.kpi-clickable:hover { border-color: #b9c2d6; background: #fafbff; }
.kpi-clickable.kpi-open { border-color: #3657d6; background: #f3f6ff; }
.kpi-caret { display: inline-block; transition: transform 0.12s; }
.kpi-clickable.kpi-open .kpi-caret { transform: rotate(180deg); }

/* KPI detail panel (deferrals) */
.kpi-detail {
  margin: -8px 0 18px;
  border: 1px solid var(--border, #e2e6ee);
  border-radius: 10px;
  background: var(--panel, #fff);
  padding: 12px 16px;
}
.kpi-detail-title { font-size: 13px; font-weight: 700; color: #1a2233; margin-bottom: 8px; }
.kpi-detail-list { list-style: none; margin: 0; padding: 0; }
.kpi-defer-row { padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.kpi-defer-row:last-child { border-bottom: 0; }
.kpi-defer-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kpi-defer-head code { background: #f2f4f7; border: 1px solid #eaecf0; padding: 1px 6px; border-radius: 5px; font-size: 12px; }
.kpi-defer-reason { font-size: 12px; color: #475; margin-top: 3px; line-height: 1.45; }
.kpi-defer-followup { font-size: 12px; color: #2c7a3f; margin-top: 2px; }

/* ----- Main grid (primary product col + narrower activity rail) ----------- */
.dashboard-main { grid-template-columns: 1.5fr 1fr; }
@media (max-width: 900px) { .dashboard-main { grid-template-columns: 1fr; } }

/* ----- Capabilities & Use Cases card ------------------------------------- */
.cap-list { list-style: none; margin: 0; padding: 0; }
.cap-row { padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.cap-row:last-child { border-bottom: 0; }
.cap-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.cap-name { font-weight: 600; color: #1a2233; }
.cap-open { color: var(--link, #2563eb); text-decoration: none; font-size: 13px; }
.cap-def { font-size: 12px; margin: 3px 0 0 22px; line-height: 1.4; }
.cap-group-toggle { margin: 6px 0 0 22px; font-size: 12px; color: #667; cursor: pointer; user-select: none; text-transform: none; letter-spacing: 0; font-weight: 600; }
.cap-group-list { margin: 2px 0 4px 22px; padding-left: 18px; font-size: 12px; line-height: 1.7; }
.cap-item-link { color: var(--link, #2563eb); text-decoration: none; }
.cap-item-link:hover { text-decoration: underline; }
.cap-item-link.muted { color: #98a2b3; }

/* ----- Compact Plans summary --------------------------------------------- */
.plans-summary > summary {
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  list-style: revert;
}
.plans-count { font-size: 22px; font-weight: 700; color: #1a2233; }
.plans-count-label { font-size: 12px; color: #8a93a6; text-transform: uppercase; letter-spacing: 0.04em; }
.plans-summary[open] .dash-plan-list { margin-top: 8px; }

/* ----- "Under the hood" collapsible -------------------------------------- */
.dash-underhood { margin-top: 8px; }
.dash-underhood > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #667;
  padding: 8px 0;
  list-style: revert;
}
.dash-underhood[open] > summary { margin-bottom: 12px; }
.dash-underhood-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
}

/* ----- Dashboard "View" card --------------------------------------------- */
.view-list { list-style: none; margin: 0; padding: 0; }
.view-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}
.view-row:last-child { border-bottom: 0; }
.view-label { font-weight: 600; font-size: 13px; color: #333; min-width: 96px; }
.view-links { display: inline-flex; flex-wrap: wrap; gap: 10px; }
.view-open-link {
  font-size: 13px;
  color: var(--link, #2563eb);
  text-decoration: none;
  font-weight: 500;
}
.view-open-link:hover { text-decoration: underline; }
.view-hint { flex-basis: 100%; font-size: 11px; color: #888; }

.app-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #667085;
}
.app-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #d0d5dd;
}
.app-status-loading .app-status-dot { background: #f59e0b; animation: app-status-pulse 1s ease-in-out infinite; }
.app-status-loaded  .app-status-dot { background: #12b76a; }
.app-status-failed  .app-status-dot { background: #f04438; }
.app-status-loading .app-status-label { color: #b54708; }
.app-status-failed  .app-status-label { color: #b42318; }
.app-status-url {
  font-size: 11px;
  color: #98a2b3;
  background: #f2f4f7;
  padding: 1px 5px;
  border-radius: 4px;
  max-width: 40ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-status-via { color: #cbd2dc; font-size: 10px; }
.app-status-msg { color: #667085; font-size: 12px; }
@keyframes app-status-pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.view-hint code { background: #f2f4f7; border: 1px solid #eaecf0; padding: 1px 5px; border-radius: 5px; }

/* ----- Plan report: Input / Impact / Details ----------------------------- */
.plan-report { margin-top: 18px; }
.rep-block { margin-bottom: 20px; }
.rep-subhead {
  font-size: 11px;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 12px 0 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.rep-count {
  display: inline-block;
  background: #eef2ff;
  color: #3657d6;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
}

/* Actor filter */
.rep-filter { margin-left: auto; display: inline-flex; gap: 4px; }
.rep-filter-btn {
  border: 1px solid var(--border);
  background: white;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  cursor: pointer;
  color: #555;
}
.rep-filter-btn.active { background: #3657d6; border-color: #3657d6; color: white; }

/* Log table */
.rep-log, .rep-details {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.rep-log th, .rep-details th {
  text-align: left;
  color: #777;
  font-size: 11px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding: 6px 8px;
}
.rep-log td, .rep-details td {
  border-bottom: 1px solid #f0f0f0;
  padding: 6px 8px;
  vertical-align: top;
}
.rep-ts { white-space: nowrap; color: #888; font-family: monospace; }
.rep-input { font-family: monospace; }
.rep-actor {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.rep-actor-user { background: #e7f5ff; color: #1971c2; }
.rep-actor-ai { background: #f3f0ff; color: #6741d9; }

/* User input (from debug.md) */
.rep-usermsgs { list-style: none; margin: 0; padding: 0; }
.rep-usermsgs li {
  border-left: 3px solid #1971c2;
  background: #f4f9ff;
  border-radius: 0 8px 8px 0;
  padding: 7px 12px;
  margin-bottom: 8px;
}
.rep-msg-meta { font-size: 11px; color: #888; margin-bottom: 3px; }
.rep-msg-title { color: #1971c2; font-weight: 600; }
.rep-msg { font-size: 13px; color: #222; line-height: 1.45; white-space: pre-wrap; }

/* Memory consumed */
.rep-memory {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.6;
  columns: 2;
}
.report-file { font-family: monospace; color: var(--link, #2563eb); text-decoration: none; }
.report-file:hover { text-decoration: underline; }

/* Impact */
.rep-stats { display: flex; gap: 18px; flex-wrap: wrap; margin: 6px 0 12px; }
.rep-stat { font-size: 13px; color: #555; }
.rep-stat b { font-size: 20px; color: #222; margin-right: 4px; }
.rep-stat-ok b { color: #2c7a3f; }
.rep-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.rep-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f6f7f9;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 12px;
  color: #444;
}
.rep-chip b { color: #3657d6; }
.rep-rules { font-size: 11px; color: #666; line-height: 1.8; }
.rep-rules-label { font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #777; }
.rep-rules code { background: #f2f4f7; border: 1px solid #eaecf0; padding: 1px 5px; border-radius: 5px; }

/* Details */
.rep-details-scroll { max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.rep-details thead th { position: sticky; top: 0; background: #fafbfc; }
.rep-type { font-family: monospace; font-size: 11px; color: #555; }
.rep-ok { color: #2c7a3f; font-weight: 700; }
.rep-derives { color: #888; white-space: nowrap; }
.rep-empty { color: #777; font-size: 13px; padding: 10px 0; }

.released-toggle {
  font-size: 13px;
}
.released-toggle summary {
  cursor: pointer;
  color: var(--muted);
  padding: 6px 0;
  user-select: none;
}
.released-toggle summary:hover {
  color: #333;
}

input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.result {
  padding: 8px;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}

.result strong {
  display: block;
}

.result small {
  color: var(--muted);
}

.doc-toolbar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

#docPath {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

#doc {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  line-height: 1.5;
}

.iframe-view {
  width: 100%;
  height: calc(100vh - 200px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

.iframe-view-bar {
  margin-bottom: 8px;
  font-size: 12px;
}

.iframe-view-bar a {
  color: #174ea6;
  text-decoration: none;
}

.iframe-view-bar a:hover {
  text-decoration: underline;
}

.image-view {
  margin: 0;
  text-align: center;
}

.image-view img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.image-view figcaption {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.feature-view .scenario-heading {
  margin: 24px 0 8px;
  padding: 8px 12px;
  background: #eef3ff;
  border-left: 4px solid #174ea6;
  border-radius: 4px;
  font-size: 15px;
}

.feature-view .scenario-heading.status-passed {
  background: #e6f4ea;
  border-left-color: #137333;
}

.feature-view .scenario-heading.status-failed {
  background: #fce8e6;
  border-left-color: #c5221f;
}

.feature-view .scenario-heading.status-skipped {
  background: #f1f3f4;
  border-left-color: #5f6368;
}

.feature-view .status-badge {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

.feature-view .status-badge.status-passed { background: #137333; color: #fff; }
.feature-view .status-badge.status-failed { background: #c5221f; color: #fff; }
.feature-view .status-badge.status-skipped { background: #5f6368; color: #fff; }
.feature-view .status-badge.status-unknown { background: #d4a017; color: #fff; }

.feature-view .scenario-evidence {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr);
  gap: 16px;
  align-items: start;
  margin: 4px 0 12px;
}

@media (max-width: 900px) {
  .feature-view .scenario-evidence {
    grid-template-columns: 1fr;
  }
}

.feature-view .scenario-screenshot-link {
  display: block;
}

.feature-view .scenario-screenshot {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: block;
}

.feature-view .scenario-noscreenshot {
  padding: 6px 10px;
  background: #fff7e6;
  border-left: 4px solid #d4a017;
  border-radius: 4px;
  font-size: 12px;
  color: #5a4509;
  align-self: start;
}

.feature-view .scenario-metrics {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #222;
}

.feature-view .scenario-metrics-empty {
  color: var(--muted);
  font-style: italic;
}

.feature-view .metrics-table {
  width: 100%;
  border-collapse: collapse;
}

.feature-view .metrics-table th,
.feature-view .metrics-table td {
  padding: 4px 0;
  border: none;
  text-align: left;
  vertical-align: top;
}

.feature-view .metrics-table th {
  font-weight: 600;
  color: var(--muted);
  width: 40%;
  padding-right: 10px;
}

.feature-view .metrics-pct {
  color: var(--muted);
  font-size: 12px;
}

.feature-view .metrics-failure {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f0d6d4;
  font-size: 12px;
  color: #c5221f;
}

.feature-view .feature-source {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  padding: 6px 10px;
  background: #f6f8fa;
  border-radius: 6px;
}

.feature-view .feature-source code {
  background: transparent;
  padding: 0;
}

.feature-view .feature-block {
  margin: 0 0 12px;
  background: #f5f5f5;
}

#doc h1, #doc h2, #doc h3 {
  line-height: 1.2;
}

#doc table {
  border-collapse: collapse;
  width: 100%;
}

#doc th, #doc td {
  border: 1px solid var(--border);
  padding: 6px 8px;
}

#doc pre {
  overflow: auto;
  padding: 12px;
  background: #f5f5f5;
  border-radius: 8px;
}

.known-object {
  color: #174ea6;
  font-weight: 650;
  text-decoration: none;
  border-bottom: 1px dotted #174ea6;
}

.known-object.unresolved {
  color: #875000;
}

.task {
  padding: 6px 0;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}

.task small {
  display: block;
  color: var(--muted);
}

.command-btn {
  width: 100%;
  margin: 4px 0;
  padding: 8px;
  border: 1px solid var(--border);
  background: #f7f7f7;
  border-radius: 8px;
  text-align: left;
}

.command-btn:hover {
  background: #eee;
}

/* Commands panel — select + revealed detail block. */
#commandSelect {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 13px;
  margin-bottom: 8px;
  cursor: pointer;
}

.command-detail {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  padding: 10px;
  margin-bottom: 8px;
}

.command-detail[hidden] {
  display: none;
}

.command-label {
  font-weight: 600;
  margin-bottom: 4px;
}

.command-shell {
  display: block;
  background: #111;
  color: #d6eaff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 6px;
  word-break: break-all;
}

.command-description {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 8px 0;
  line-height: 1.4;
}

.command-run-btn {
  width: 100%;
  padding: 8px;
  background: #2c7;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.command-run-btn:hover {
  background: #25a060;
}

#commandOutput {
  max-height: 260px;
  overflow: auto;
  background: #111;
  color: #eee;
  padding: 10px;
  border-radius: 8px;
  white-space: pre-wrap;
  border-left: 4px solid transparent;
}

#commandOutput.command-output-ok {
  border-left-color: #2c7;
}

#commandOutput.command-output-fail {
  border-left-color: #e74c3c;
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  background: #eee;
  border-radius: 999px;
  font-size: 11px;
  margin-right: 4px;
}

@media (max-width: 1100px) {
  main {
    grid-template-columns: 240px 1fr;
  }
  .right {
    display: none;
  }
  body.nav-collapsed main {
    grid-template-columns: 0 1fr;
  }
}

.manifest-table-view {
  overflow-x: auto;
}

.manifest-table-caption {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.manifest-filter {
  max-width: 420px;
  margin-bottom: 10px;
}

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

.manifest-table th,
.manifest-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  vertical-align: top;
}

.manifest-table th {
  background: #f6f8fb;
  cursor: pointer;
  position: sticky;
  top: 0;
}

.manifest-table td code {
  white-space: pre-wrap;
}

/* ── Project Status & Plan Status cards ─────────────────────────────────── */
.dash-project-status,
.dash-plan-status {
  border-left: 3px solid #2563eb;
}

.status-ok   { color: #16a34a; font-weight: 600; }
.status-missing { color: #9ca3af; }
.status-ok-line { color: #16a34a; font-size: 13px; }
.status-next { font-size: 13px; margin-top: 4px; }

.status-cap-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.status-cap-row {
  font-size: 12px;
  padding: 2px 0;
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}

.status-cap-def {
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}

.status-delivery-row {
  font-size: 12px;
  padding: 1px 0;
  display: flex;
  align-items: baseline;
  gap: 4px;
  word-break: break-all;
}

.status-steps-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.status-steps-list li code {
  font-size: 11px;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.status-table-list {
  list-style: none;
  margin: 2px 0 0 16px;
  padding: 0;
}

.status-table-list li {
  font-size: 11px;
  padding: 1px 0;
}

.status-table-name {
  font-family: monospace;
  font-weight: 600;
  color: #2563eb;
}

/* ---- Tree toolbar ------------------------------------------------------- */

.tree-toolbar {
  display: flex;
  gap: 4px;
  padding: 4px 8px 2px;
}

.tree-tool-btn {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #f7f7f7;
  color: var(--muted);
  cursor: pointer;
}

.tree-tool-btn:hover { background: #eee; color: #222; }

/* ---- Prototype launcher ------------------------------------------------- */

.proto-tree-btn {
  margin-left: 6px;
  font-size: 11px;
  color: #2563eb;
  cursor: pointer;
  opacity: 0.7;
  user-select: none;
}
.proto-tree-btn:hover { opacity: 1; }

.proto-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.proto-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
}

.proto-row-open { margin-left: auto; font-size: 12px; }

.proto-name-link { color: #222; text-decoration: none; }
.proto-name-link:hover { text-decoration: underline; }

.proto-open-link { color: #2563eb; text-decoration: none; font-weight: 500; }
.proto-open-link:hover { text-decoration: underline; }

.proto-detail-card { max-width: 640px; }

.proto-output {
  margin: 12px 0 0;
  padding: 10px;
  background: #f5f5f5;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
}

/* === Traceability tab === */
.trace { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.trace-header { display: flex; gap: 8px; align-items: center; padding-bottom: 8px; border-bottom: 1px solid #ddd; flex-wrap: wrap; }
.trace-header input, .trace-header select { font: inherit; padding: 4px 8px; border: 1px solid #ccc; border-radius: 4px; background: #fff; }
.trace-header input { flex: 1; min-width: 120px; max-width: 320px; }
.trace-meta { color: #777; font-size: 12px; margin-left: auto; }
.trace-body { display: grid; grid-template-columns: 340px 1fr; gap: 12px; flex: 1; min-height: 0; margin-top: 10px; }
.trace-sidebar { background: #fafafa; border: 1px solid #ddd; border-radius: 6px; overflow-y: auto; min-height: 0; }
.trace-sidebar ul { list-style: none; padding: 0; margin: 0; }
.trace-item { padding: 8px 12px; border-bottom: 1px solid #eee; cursor: pointer; }
.trace-item:hover { background: #f0f4f8; }
.trace-item.selected { background: #e6f0fb; border-left: 3px solid #2b6cb0; padding-left: 9px; }
.trace-item.orphan .trace-path { color: #888; }
.trace-path { font-family: 'Menlo','Consolas',monospace; font-size: 12px; word-break: break-all; }
.trace-row2 { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 11px; color: #777; }
.trace-count { color: #777; }
.trace-orphan { color: #b45309; font-weight: 600; }
.trace-kind { padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #fff; }
.trace-kind.business { background: #047857; }
.trace-kind.design { background: #6d28d9; }
.trace-detail { overflow-y: auto; padding-right: 4px; min-height: 0; }
.trace-detail-header h2 { font-family: 'Menlo','Consolas',monospace; font-size: 15px; margin: 0 0 6px 0; word-break: break-all; }
.trace-detail-meta { color: #777; font-size: 12px; display: flex; gap: 12px; align-items: center; }
.trace-panel { margin-top: 16px; }
.trace-panel h3 { margin: 0 0 4px 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #777; }
.trace-sub { font-size: 11px; color: #777; margin-bottom: 8px; font-style: italic; }
.trace-card { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 10px 12px; }
.trace-kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; font-size: 12px; margin: 0; }
.trace-kv dt { color: #777; }
.trace-kv dd { margin: 0; font-family: 'Menlo','Consolas',monospace; word-break: break-all; }

.right-trace-panel {
  font-size: 12px;
}

.right-trace-panel .trace-detail-header h2 {
  font-size: 12px;
}

.right-trace-panel .trace-card {
  padding: 8px;
}

.right-trace-panel .trace-kv {
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 4px 8px;
}

.right-trace-panel .trace-impls {
  padding-left: 0;
}

.annotations-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.annotations-header h2 {
  margin: 0;
}

.annotations-header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.annotation-dest-label {
  font-size: 12px;
  color: #667085;
}

.annotation-dest {
  font: inherit;
  font-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #f9fafb;
  color: #111827;
  padding: 3px 6px;
  cursor: pointer;
}

.annotations-header button,
.annotation-editor button {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #f9fafb;
  color: #111827;
  cursor: pointer;
  font: inherit;
  padding: 4px 8px;
}

.annotation-mode .annotations-header #annotationMode {
  border-color: #15803d;
  background: #15803d;
  color: #fff;
}

.annotation-count {
  margin-top: 6px;
  color: #6b7280;
  font-size: 12px;
}

.annotation-saved-to {
  margin-top: 3px;
  color: #6b7280;
  font-family: "Menlo", "Consolas", monospace;
  font-size: 10px;
  overflow-wrap: anywhere;
}

.annotation-editor {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
}

.annotation-target-meta {
  margin-bottom: 6px;
  color: #6b7280;
  font-size: 12px;
}

.annotation-editor textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 7px;
  font: inherit;
  font-size: 13px;
}

.annotation-editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.annotation-editor #annotationSave {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.annotation-marker {
  position: fixed;
  z-index: 8999;
  width: 22px;
  height: 22px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #f59e0b;
  color: #111827;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.3);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
}

.annotation-target-flash {
  outline: 3px solid #f59e0b !important;
  outline-offset: 3px;
  transition: outline-color 0.2s ease;
}

.annotation-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.annotation-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: start;
}

.annotation-list [data-annotation-focus] {
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #111827;
  text-align: left;
  overflow-wrap: anywhere;
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  width: 100%;
}

.annotation-current [data-annotation-focus] {
  border-color: #93c5fd;
  background: #eff6ff;
}

.annotation-page,
.annotation-note {
  display: block;
}

.annotation-page {
  margin-bottom: 3px;
  color: #6b7280;
  font-family: "Menlo", "Consolas", monospace;
  font-size: 10px;
}

.annotation-note {
  color: #111827;
  font-size: 12px;
}

/* Per-item operation buttons (Edit / Delete / Close) stacked in the second
   grid column. */
.annotation-ops {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
}

.annotation-op {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #f9fafb;
  color: #374151;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  padding: 3px 8px;
  white-space: nowrap;
}

.annotation-op:hover { background: #eef2f7; }

.annotation-op-delete {
  border-color: #fecaca;
  background: #fff1f2;
  color: #991b1b;
}
.annotation-op-delete:hover { background: #ffe4e6; }

.annotation-op-done.is-done {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

/* A closed/done annotation stays visible but reads as resolved. */
.annotation-list li.annotation-done .annotation-note {
  text-decoration: line-through;
  color: #9ca3af;
}
.annotation-list li.annotation-done [data-annotation-focus] {
  opacity: 0.7;
}

.annotation-move-to {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #f9fafb;
  color: #111827;
  font: inherit;
  font-size: 11px;
  padding: 3px 6px;
  cursor: pointer;
}

/* While editing a note inline, stack everything in a single full-width column
   (override the base two-column `.annotation-list li` grid — note the matching
   specificity so this actually wins). The textarea spans 100% and the
   Save/Cancel buttons sit on their own row beneath it. */
.annotation-list li.annotation-editing {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.annotation-inline-note {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 56px;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  padding: 6px;
  font: inherit;
  font-size: 12px;
}

.annotation-edit-context {
  margin: 0;
  padding: 6px 8px;
  border-left: 3px solid #60a5fa;
  background: #eff6ff;
  color: #1e3a5f;
  font-size: 12px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.annotation-inline-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.annotation-inline-actions button {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #f9fafb;
  color: #111827;
  cursor: pointer;
  font: inherit;
  padding: 4px 8px;
}

.annotation-inline-actions [data-annotation-save] {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.annotation-empty {
  color: #6b7280;
  font-size: 12px;
}

.annotation-active-note {
  margin: 0;
  padding: 0 12px 12px;
  color: #374151;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.trace-group { margin-top: 8px; }
.trace-group-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #555; padding: 4px 0; }
.trace-impls { list-style: none; padding: 0; margin: 0; }
.trace-impls li { padding: 5px 0; border-bottom: 1px solid #eee; font-size: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.trace-impls li:last-child { border-bottom: none; }
.trace-artifact { font-family: 'Menlo','Consolas',monospace; flex: 1; min-width: 200px; word-break: break-all; }
.trace-tag { padding: 1px 6px; border-radius: 3px; font-size: 10px; background: #eef2f7; color: #475569; }
.trace-arrow { color: #94a3b8; font-size: 10px; }
.trace-status { padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; }
.trace-status.created, .trace-status.updated, .trace-status.finalized, .trace-status.repaired { background: #d1fae5; color: #047857; }
.trace-status.already-exists { background: #f1f5f9; color: #777; }
.trace-status.pending, .trace-status.failed, .trace-status.missing, .trace-status.blocked { background: #fee2e2; color: #b91c1c; }
.trace-status.skipped, .trace-status.deferred { background: #fef3c7; color: #b45309; }
.trace-hist { border-collapse: collapse; width: 100%; font-size: 12px; }
.trace-hist th, .trace-hist td { padding: 5px 8px; text-align: left; border-bottom: 1px solid #eee; }
.trace-hist th { font-weight: 600; color: #777; text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px; }
.trace-hist tr:last-child td { border-bottom: none; }
.trace-hist .trace-ts { font-family: 'Menlo','Consolas',monospace; color: #777; white-space: nowrap; }
.trace-muted { color: #777; }
.trace-empty { padding: 40px; text-align: center; color: #777; }

/* === Product Dashboard (5 core memory categories) === */
.prod-dashboard { margin-bottom: 20px; }
.prod-dashboard-empty { padding: 16px; background: #fff; border: 1px solid #ddd; border-radius: 8px; color: #555; }
.prod-section { margin-bottom: 16px; background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 10px 14px; }
.prod-section h3 { margin: 0 0 8px 0; font-size: 14px; font-weight: 600; color: #222; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.prod-count { color: #777; font-weight: 500; font-size: 12px; }
.prod-summary { color: #777; font-weight: 400; font-size: 12px; margin-left: auto; }
.prod-empty { color: #777; font-style: italic; font-size: 12px; margin: 4px 0 0; }
.prod-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.prod-table th { text-align: left; padding: 4px 8px; color: #777; font-weight: 600; text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px; border-bottom: 1px solid #eee; }
.prod-table th.num { text-align: right; width: 50px; }
.prod-table td { padding: 5px 8px; border-bottom: 1px solid #f4f4f4; }
.prod-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.prod-table td.num.zero { color: #ccc; }
.prod-table td.name { font-family: 'Menlo','Consolas',monospace; font-size: 11.5px; }
.prod-table tbody tr.prod-row { cursor: pointer; }
.prod-table tbody tr.prod-row:hover { background: #f4f6f8; }
.prod-status { display: inline-block; width: 14px; text-align: center; font-weight: 700; }
.prod-status.built { color: #047857; }
.prod-status.spec { color: #b45309; }
.prod-status.orphan { color: #94a3b8; }

/* === Right-panel detail (clicked from product dashboard) === */
.prod-detail { font-size: 12px; }
.prod-detail-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.prod-detail-head strong { font-size: 13px; }
.prod-detail-path { font-family: 'Menlo','Consolas',monospace; font-size: 11px; color: #777; word-break: break-all; margin-bottom: 6px; }
.prod-detail-open { color: #2b6cb0; }
.prod-detail-status { font-size: 11px; color: #777; margin-bottom: 12px; }
.prod-status-pill { padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 600; text-transform: uppercase; }
.prod-status-pill.built { background: #d1fae5; color: #047857; }
.prod-status-pill.spec { background: #fef3c7; color: #b45309; }
.prod-status-pill.orphan { background: #f1f5f9; color: #94a3b8; }
.prod-detail h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #777; margin: 12px 0 4px 0; font-weight: 600; }
.prod-detail h4 .muted { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 10px; }
.prod-detail-empty { font-style: italic; font-size: 11px; margin: 4px 0 0; }
.prod-group { margin-bottom: 6px; }
.prod-group-title { font-size: 11px; color: #555; margin-bottom: 2px; }
.prod-impl-list { list-style: none; padding: 0; margin: 0; }
.prod-impl-list li { padding: 3px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.prod-impl-link { font-family: 'Menlo','Consolas',monospace; font-size: 11px; color: #2b6cb0; text-decoration: none; flex: 1; word-break: break-all; }
.prod-impl-link:hover { text-decoration: underline; }
.prod-created { font-size: 11px; color: #555; margin: 0; }
.muted { color: #777; }

/* Panel inventory visualizer — left page list + single page box */
.panel-inventory {
  margin: 12px 0;
  padding: 14px;
  border: 1px dashed #93b4e6;
  border-radius: 10px;
  /* subtle diagonal-stripe wash so it reads as a generated overlay, not file content */
  background:
    repeating-linear-gradient(135deg, rgba(37,99,235,.04) 0 10px, rgba(37,99,235,.07) 10px 20px);
}
.pi-screenshot {
  margin: 10px 0 0;
}

.pi-screenshot img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid #e4e7ec;
  border-radius: 6px;
}

@media (prefers-color-scheme: dark) {
  .pi-screenshot img { border-color: #333; }
}

.pi-rendered-badge {
  display: inline-block;
  font-size: 11px;
  color: #2563eb;
  background: #e8f0fe;
  border: 1px solid #c7dbfb;
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 12px;
  font-weight: 600;
}
.pi-layout { display: grid; grid-template-columns: 220px 1fr; gap: 14px; align-items: start; }
.pi-nav { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border); border-radius: 8px; padding: 6px; background: #fff; max-height: 70vh; overflow: auto; }
.pi-nav-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; width: 100%; }
.pi-nav-item:hover { background: #f1f5f9; }
.pi-nav-item.active { background: #e8f0fe; }
.pi-nav-name { font-size: 13px; font-weight: 600; color: #1f2937; }
.pi-nav-canvas { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; }
.pi-nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; font-weight: 700; padding: 4px 8px 8px; }
.pi-nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; font-weight: 600; padding: 10px 8px 3px; }
.pi-nav-route { font-size: 10px; color: #94a3b8; font-family: ui-monospace, monospace; }
.pi-nav-home .pi-nav-name { color: #2563eb; }
.pi-nav-role { padding: 2px 8px 8px; font-size: 11px; color: #64748b; }
.pi-role-filter { font-size: 12px; padding: 2px 4px; border: 1px solid var(--border); border-radius: 4px; background: #fff; max-width: 140px; }
.pi-nav-empty { padding: 10px 8px; font-size: 12px; color: #94a3b8; font-style: italic; }
.pi-canvas { margin: 0 0 12px; }
.pi-canvas-head { font-size: 12px; color: #475569; padding: 8px 0 6px; }
.pi-purpose { font-size: 13px; color: #334155; padding: 4px 0 12px; }
.pi-intent { color: #64748b; }
.pi-sec { border: 1px solid var(--border); border-radius: 6px; margin: 8px 0; overflow: hidden; }
.pi-sec-head { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #475569; font-weight: 600; background: #f8fafc; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.pi-sec-body { padding: 8px 10px; font-size: 12px; }
.pi-sec-body table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pi-sec-body th, .pi-sec-body td { text-align: left; padding: 4px 8px; border-bottom: 1px solid #f1f5f9; }
.pi-sec-body th { color: #94a3b8; font-weight: 600; }
.pi-sec-body ul, .pi-sec-body ol { margin: 0; padding-left: 18px; }
.pi-nav-flow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pi-nav-flow .pi-sec { margin: 8px 0 0; }
.pi-panel-kind { font-weight: 500; font-size: 11px; color: #64748b; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 4px; padding: 1px 6px; margin-left: 8px; vertical-align: middle; }
.pi-pageset-note { font-size: 12px; color: #64748b; padding: 14px; }
.pi-page { border: 1px solid var(--border); border-radius: 8px; background: #fff; overflow: hidden; }
.pi-page-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #1f2937; color: #fff; }
.pi-page-head { font-size: 13px; }
.pi-hd { color: #e5e7eb; }
.pi-hd-k { color: #94a3b8; font-weight: 600; }
.pi-hd code { background: rgba(255,255,255,.12); color: #dbeafe; padding: 1px 6px; border-radius: 4px; }
.pi-sep { color: #4b5563; margin: 0 4px; }
.pi-panels { display: flex; flex-direction: column; padding: 8px; gap: 6px; }
.pi-panel { display: grid; grid-template-columns: 18px 1fr; gap: 4px 10px; padding: 9px 12px; border: 1px solid var(--border); border-left: 3px solid #94a3b8; border-radius: 6px; background: #fafafa; align-items: baseline; }
.pi-panel.pi-maint { border-left-color: #2563eb; background: #f6faff; }
.pi-badge { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 4px; font-size: 11px; font-weight: 700; color: #fff; flex: none; }
.pi-badge.pi-maint { background: #2563eb; }
.pi-badge.pi-ref { background: #94a3b8; }
.pi-panel-name { font-weight: 600; font-size: 14px; }
.pi-fields { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.pi-fld { font-size: 12px; color: #475569; }
.pi-fld-k { color: #94a3b8; font-weight: 600; }
.pi-raw { margin-top: 12px; }
.pi-raw > summary { cursor: pointer; color: #64748b; font-size: 13px; padding: 4px 0; }
