:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
  color: #17201d;
  background: #f3f6f5;
  --ink: #17201d;
  --muted: #68736f;
  --line: #dbe2df;
  --line-strong: #b9c5c0;
  --surface: #ffffff;
  --canvas: #f3f6f5;
  --sidebar: #18211e;
  --sidebar-line: #33403b;
  --accent: #147d68;
  --accent-dark: #106553;
  --accent-soft: #e1f2ed;
  --blue: #2e67c7;
  --blue-soft: #e8effb;
  --amber: #a96508;
  --amber-soft: #fbefd9;
  --red: #b43a3a;
  --red-soft: #fae7e5;
  --violet: #7450a8;
  --violet-soft: #f0eafb;
}

.live-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.live-status.connected {
  border-color: #8fc9b9;
  color: #146b58;
  background: #edf8f4;
}

.live-status.reconnecting,
.live-status.disconnected {
  border-color: #d9b86c;
  color: #865c08;
  background: #fff8e8;
}

.load-more-button {
  min-height: 34px;
  border: 1px solid #7db7a7;
  border-radius: 4px;
  background: #edf8f4;
  color: #125f50;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.workflow-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.workflow-action {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #b9c5c0;
  border-radius: 4px;
  padding: 0 10px;
  color: #35534a;
  background: #fff;
  font: inherit;
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
}

.workflow-action:hover {
  border-color: var(--accent);
  color: #116450;
  background: var(--accent-soft);
}

.workflow-action.external {
  border-color: #96aed6;
  color: #265ba8;
}

.workflow-action.danger {
  border-color: #d7a05a;
  color: #7c490d;
  background: #fff5e7;
}

.workflow-action:disabled {
  border-color: var(--line);
  color: #8c9692;
  background: #f3f5f4;
  cursor: not-allowed;
}

.workflow-actions.compact .workflow-action {
  width: 32px;
  flex: 0 0 32px;
  justify-content: center;
  padding: 0;
}

.workflow-actions.compact .workflow-action b {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.load-more-button {
  display: block;
  width: calc(100% - 32px);
  margin: 14px 16px 16px;
}

.load-more-button[hidden] {
  display: none;
}

.pagination {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.pagination[hidden] {
  display: none;
}

.pagination-button {
  min-width: 76px;
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0 11px;
  color: #35534a;
  background: #fff;
  cursor: pointer;
}

.pagination-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.pagination-button:disabled {
  color: #9aa39f;
  background: #f3f5f4;
  cursor: not-allowed;
}

.pagination-error {
  color: var(--red);
}

.skeleton-row td {
  pointer-events: none;
}

.skeleton-block {
  width: 72%;
  height: 10px;
  display: block;
  border-radius: 3px;
  background: #dfe5e2;
  animation: skeleton-pulse 900ms ease-in-out infinite alternate;
}

.skeleton-block.skeleton-0 { width: 84%; }
.skeleton-block.skeleton-1 { width: 58%; }
.skeleton-block.skeleton-2 { width: 36%; }

.skeleton-card {
  min-height: 72px;
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.inline-load-error {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  color: var(--red);
  font-size: 12px;
}

@keyframes skeleton-pulse {
  from { opacity: .42; }
  to { opacity: 1; }
}

.text-button.danger {
  margin-top: 8px;
  color: #9a352f;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--canvas);
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #18211e;
}

.auth-panel {
  width: min(400px, 100%);
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 18px;
  padding: 30px;
  border: 1px solid #3c4944;
  border-radius: 8px;
  color: #f7faf9;
  background: #202a27;
  box-shadow: 0 24px 70px rgb(0 0 0 / 24%);
}

.auth-panel h1 {
  margin: 1px 0 0;
  font-size: 27px;
  line-height: 1.1;
}

.auth-panel h1 span,
.brand strong span {
  color: #53c4a8;
}

.auth-panel label,
.auth-panel input,
.auth-panel button,
.auth-panel .form-error {
  grid-column: 1 / -1;
}

.auth-panel label {
  margin-top: 8px;
  color: #c0cbc7;
  font-size: 13px;
}

.auth-panel input {
  width: 100%;
  height: 42px;
  border: 1px solid #51605a;
  border-radius: 5px;
  padding: 0 12px;
  color: #fff;
  background: #17201d;
  outline: none;
}

.auth-panel input:focus {
  border-color: #53c4a8;
  box-shadow: 0 0 0 3px rgb(83 196 168 / 14%);
}

.form-error {
  min-height: 18px;
  margin: -6px 0 0;
  color: #ffaaa2;
  font-size: 13px;
}

.primary-button {
  height: 42px;
  border: 0;
  border-radius: 5px;
  color: #fff;
  font-weight: 700;
  background: var(--accent);
}

.primary-button:hover {
  background: #0e6d5b;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 18px;
  color: #eff5f2;
  background: var(--sidebar);
  border-right: 1px solid #2e3935;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 0 8px 20px;
  border-bottom: 1px solid var(--sidebar-line);
}

.brand img {
  flex: 0 0 38px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand small {
  margin-top: 2px;
  color: #9eaca6;
  font-size: 11px;
}

.navigation {
  display: grid;
  gap: 3px;
  margin-top: 20px;
}

.nav-item {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 5px;
  padding: 0 12px;
  color: #b9c5c0;
  text-align: left;
  background: transparent;
}

.nav-item:hover {
  color: #fff;
  background: #25312d;
}

.nav-item.active {
  color: #fff;
  background: #2b3934;
  box-shadow: inset 3px 0 0 #53c4a8;
}

.nav-count {
  min-width: 22px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  padding: 0 6px;
  color: #d8e3df;
  font-size: 11px;
  background: #3d4a45;
}

.sidebar-meta {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 16px 9px 0;
  border-top: 1px solid var(--sidebar-line);
  color: #94a29c;
}

.sidebar-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d3ddd9;
  font-size: 12px;
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #77847f;
}

.indicator-dot.online {
  background: #48b693;
  box-shadow: 0 0 0 3px rgb(72 182 147 / 15%);
}

.indicator-dot.warning {
  background: #e0a53d;
}

.workspace {
  min-width: 0;
  padding: 0 30px 48px;
}

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.topbar h2 {
  margin: 2px 0 0;
  font-size: 24px;
  line-height: 1.2;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-time {
  margin-right: 7px;
  color: var(--muted);
  font-size: 12px;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  background: var(--surface);
}

.icon-button:hover {
  border-color: #b8c5c0;
  background: #eef2f0;
}

.loading-line {
  height: 2px;
  margin: 0 -30px;
  background: transparent;
}

.loading-line.active {
  background: var(--accent);
  animation: loading-pulse 1s ease-in-out infinite alternate;
}

@keyframes loading-pulse {
  from { opacity: .25; }
  to { opacity: 1; }
}

.view {
  display: none;
  padding-top: 26px;
}

.view.active {
  display: block;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: var(--surface);
}

.metric {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  padding: 18px 22px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  font-size: 28px;
  line-height: 1;
}

.metric strong.metric-skeleton {
  width: 42px;
  height: 24px;
  border-radius: 3px;
  background: #dfe5e2;
  animation: skeleton-pulse 900ms ease-in-out infinite alternate;
}

.metric.warning strong {
  color: var(--amber);
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 18px;
  margin-top: 18px;
}

.panel,
.data-section {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.panel {
  min-height: 280px;
  padding: 20px;
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.panel-heading h3,
.section-heading h3,
.drawer h3 {
  margin: 4px 0 0;
  font-size: 17px;
}

.subtle {
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  min-height: 190px;
  display: grid;
  place-items: center;
  color: #8b9691;
  font-size: 13px;
}

.run-focus {
  margin-top: 24px;
}

.overview-skeleton {
  display: grid;
  gap: 16px;
}

.run-focus-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 16px;
}

.run-focus-title a,
.run-focus-title .entity-link {
  min-width: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.run-focus-title a:hover,
.run-focus-title .entity-link:hover {
  color: var(--blue);
}

.entity-link {
  max-width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.entity-link:hover {
  color: var(--blue);
  text-decoration: underline;
}

.external-entity-link span {
  margin-left: 3px;
  color: var(--muted);
  font-size: 10px;
}

.run-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.run-phase-copy {
  margin: 12px 0 0;
  color: #56625e;
  font-size: 12px;
  line-height: 1.5;
}

.run-meta div {
  min-width: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.run-meta span,
.detail-pair span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.run-meta strong {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-progress {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  margin-top: 24px;
}

.run-progress span {
  height: 5px;
  border-radius: 3px;
  background: #dfe5e2;
}

.run-progress span.complete {
  background: var(--accent);
}

.run-progress span.failed {
  background: var(--red);
}

.run-focus-actions {
  min-height: 34px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}

.run-focus-actions > span {
  order: 0;
  margin-right: auto;
}

.run-focus-actions > .workflow-actions {
  order: 1;
}

.run-focus-actions > .text-button {
  order: 2;
}

.status-bars {
  display: grid;
  gap: 13px;
  margin-top: 24px;
}

.status-bar-row {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) 2fr 28px;
  align-items: center;
  gap: 10px;
}

.status-bar-row label {
  overflow: hidden;
  color: #4d5a55;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-track {
  height: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: #edf1ef;
}

.status-track i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.status-track .bar-0 { width: 3%; }
.status-track .bar-10 { width: 10%; }
.status-track .bar-20 { width: 20%; }
.status-track .bar-30 { width: 30%; }
.status-track .bar-40 { width: 40%; }
.status-track .bar-50 { width: 50%; }
.status-track .bar-60 { width: 60%; }
.status-track .bar-70 { width: 70%; }
.status-track .bar-80 { width: 80%; }
.status-track .bar-90 { width: 90%; }
.status-track .bar-100 { width: 100%; }

.status-bar-row b {
  font-size: 12px;
  text-align: right;
}

.data-section {
  margin-top: 18px;
  overflow: hidden;
}

.data-section.flush {
  margin-top: 0;
}

.section-heading {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.section-heading.padded {
  padding: 18px 20px;
}

.text-button {
  border: 0;
  padding: 5px 0;
  color: var(--blue);
  font-size: 12px;
  background: transparent;
}

.text-button:hover {
  text-decoration: underline;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid #e8ecea;
  text-align: left;
  vertical-align: middle;
}

th {
  height: 38px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: #f8faf9;
}

td {
  overflow: hidden;
  color: #3e4a46;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr.clickable:hover {
  background: #f5f8f7;
  cursor: pointer;
}

td.task-cell {
  color: var(--ink);
  font-weight: 650;
}

td.task-cell a {
  color: inherit;
  text-decoration: none;
}

td.task-cell a:hover {
  color: var(--blue);
}

td.task-cell strong,
td.task-cell small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td.task-cell small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.session-count {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #3f4b47;
  font-weight: 700;
  background: #fff;
}

.status-pill,
.priority-pill,
.role-pill {
  max-width: 100%;
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 3px 7px;
  overflow: hidden;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill.neutral,
.status-pill.backlog,
.status-pill.local,
.status-pill.cancelled,
.status-pill.superseded {
  color: #59645f;
  background: #e9edeb;
}

.status-pill.ready,
.status-pill.completed,
.status-pill.ready-for-human {
  color: #116450;
  background: var(--accent-soft);
}

.status-pill.in-progress,
.status-pill.running,
.status-pill.preparing,
.status-pill.verifying,
.status-pill.publishing,
.status-pill.in-review,
.status-pill.implementing,
.status-pill.reviewing,
.status-pill.syncing-base,
.status-pill.resolving-conflict {
  color: #265ba8;
  background: var(--blue-soft);
}

.status-pill.paused {
  color: #704c08;
  background: #f6e8bd;
}

.status-pill.waiting-for-input,
.status-pill.needs-architecture-review,
.status-pill.changes-requested,
.status-pill.refreshing-dependencies,
.status-pill.awaiting-human-input,
.status-pill.awaiting-arch-decision,
.status-pill.awaiting-human-review,
.status-pill.awaiting-merge,
.status-pill.retry-scheduled,
.status-pill.base-update-pending,
.status-pill.advanced,
.status-pill.stale,
.status-pill.pending,
.status-pill.unknown,
.status-pill.draft {
  color: #915a0a;
  background: var(--amber-soft);
}

.status-pill.blocked,
.status-pill.failed,
.status-pill.conflict-detected,
.status-pill.conflicting,
.status-pill.changes-requested,
.status-pill.closed {
  color: #9f3030;
  background: var(--red-soft);
}

.status-pill.passed,
.status-pill.approved,
.status-pill.current,
.status-pill.mergeable,
.status-pill.open,
.status-pill.merged,
.status-pill.not-required,
.status-pill.bypassed,
.status-pill.overridden {
  color: #116450;
  background: var(--accent-soft);
}

.priority-pill.p0 {
  color: #9f3030;
  background: var(--red-soft);
}

.priority-pill.p1 {
  color: #915a0a;
  background: var(--amber-soft);
}

.priority-pill.p2 {
  color: #265ba8;
  background: var(--blue-soft);
}

.priority-pill.p3 {
  color: #59645f;
  background: #e9edeb;
}

.role-pill.worker {
  color: #116450;
  background: var(--accent-soft);
}

.role-pill.reviewer {
  color: #684494;
  background: var(--violet-soft);
}

.role-pill.human {
  color: #265ba8;
  background: var(--blue-soft);
}

.source-pill.orchestrator {
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 3px 7px;
  color: #8a5311;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  background: #f9ead2;
}

.toolbar {
  min-height: 68px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: var(--surface);
}

.search-field,
.filter-field {
  display: grid;
  gap: 5px;
}

.search-field {
  width: min(360px, 40vw);
}

.filter-field {
  width: 180px;
}

.search-field span,
.filter-field span,
.usage-note span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.search-field input,
.filter-field select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.search-field input:focus,
.filter-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgb(20 125 104 / 10%);
}

.usage-note {
  min-width: 150px;
  display: grid;
  gap: 5px;
  margin-left: auto;
  text-align: right;
}

.usage-note strong {
  font-size: 12px;
}

.secondary-button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  background: #fff;
  cursor: pointer;
}

.secondary-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.toggle-field {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.toggle-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.architecture-toolbar {
  align-items: flex-end;
}

.architecture-toolbar .secondary-button {
  margin-left: auto;
}

.architecture-metrics {
  border-radius: 0 0 6px 6px;
}

.architecture-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 18px;
  margin-top: 18px;
}

.architecture-map-section,
.architecture-inspector {
  min-width: 0;
  padding: 18px;
}

.architecture-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 11px;
}

.architecture-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-line {
  width: 22px;
  height: 0;
  border-top: 2px solid #6389af;
}

.legend-line.internal {
  border-color: #7a8a83;
}

.legend-line.violation {
  border-color: #c64d43;
  border-top-style: dashed;
}

.architecture-canvas {
  position: relative;
  min-height: 580px;
  margin-top: 12px;
  overflow: auto;
  border-top: 1px solid var(--line);
  background: #f8faf9;
}

.architecture-canvas svg {
  display: block;
  min-width: 920px;
  width: 100%;
  min-height: 580px;
}

.architecture-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.architecture-empty[hidden] {
  display: none;
}

.graph-edge {
  fill: none;
  stroke: #6f8fae;
  stroke-width: 1.7;
  opacity: .62;
}

.graph-edge.internal {
  stroke: #7a8a83;
}

.graph-edge.violation {
  stroke: #c64d43;
  stroke-width: 2.4;
  stroke-dasharray: 6 4;
  opacity: .95;
}

.graph-edge-count {
  fill: #59645f;
  font-size: 10px;
  font-weight: 700;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
}

.graph-node {
  cursor: pointer;
}

.graph-node rect {
  fill: #fff;
  stroke: #9daaa4;
  stroke-width: 1.3;
}

.graph-node.runtime rect {
  fill: #edf8f4;
  stroke: #3b9a82;
}

.graph-node.presentation rect {
  fill: #f2eef9;
  stroke: #8062a5;
}

.graph-node.adapter rect {
  fill: #eef4fb;
  stroke: #537eaa;
}

.graph-node.example rect {
  fill: #fff7e8;
  stroke: #bb8733;
}

.graph-node.application rect {
  fill: #f7f2e9;
  stroke: #8d7350;
}

.graph-node.external rect {
  fill: #f2f4f3;
  stroke: #a7afab;
  stroke-dasharray: 4 3;
}

.graph-node.selected rect {
  stroke: #111a16;
  stroke-width: 2.4;
}

.graph-node-title {
  fill: #17211d;
  font-size: 11px;
  font-weight: 700;
}

.graph-node-meta {
  fill: #68736e;
  font-size: 9px;
}

.architecture-inspector .empty-state {
  min-height: 500px;
  text-align: center;
}

.architecture-selection {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.architecture-selection dl {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 8px 10px;
  margin: 0;
  font-size: 11px;
}

.architecture-selection dt {
  color: var(--muted);
}

.architecture-selection dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.architecture-edge-list {
  display: grid;
  gap: 8px;
}

.architecture-edge-item {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.architecture-edge-item strong,
.architecture-edge-item code {
  display: block;
  overflow-wrap: anywhere;
}

.architecture-edge-item code {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.architecture-edge-item.violation strong {
  color: #a83831;
}

.architecture-finding code {
  color: #36433d;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.activity-list {
  display: grid;
}

.activity-item {
  min-height: 52px;
  display: grid;
  grid-template-columns: 130px 1fr auto;
  align-items: center;
  gap: 15px;
  padding: 8px 20px;
  border-bottom: 1px solid #e8ecea;
  font-size: 12px;
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-item code {
  overflow: hidden;
  color: #40504a;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  text-overflow: ellipsis;
}

.activity-item time {
  color: var(--muted);
  font-size: 11px;
}

.inbox-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 18px;
}

.conversation-list,
.notification-list {
  display: grid;
}

.conversation,
.notification {
  padding: 17px 20px;
  border-bottom: 1px solid #e8ecea;
}

.conversation:last-child,
.notification:last-child {
  border-bottom: 0;
}

.conversation-header,
.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.conversation-header strong,
.notification-header strong {
  font-size: 12px;
}

.conversation time,
.notification time {
  color: var(--muted);
  font-size: 10px;
}

.message-block {
  margin: 12px 0 0;
  color: #3d4945;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.answer-block {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  color: #2f4540;
  font-size: 12px;
  line-height: 1.5;
  background: #f1f8f5;
  white-space: pre-wrap;
}

.drawer {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  width: min(760px, 96vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -18px 0 50px rgb(24 33 30 / 14%);
  transform: translateX(104%);
  transition: transform 180ms ease;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}

.drawer-header > div {
  min-width: 0;
}

.drawer-load-state {
  min-height: 16px;
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.drawer-load-state.loading {
  color: var(--blue);
}

.drawer-load-state.error {
  color: var(--red);
}

.drawer-load-state.success {
  color: var(--accent-dark);
}

.drawer-content {
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
}

.drawer-skeleton {
  display: grid;
  gap: 20px;
}

.skeleton-detail-grid .detail-pair {
  min-height: 66px;
}

.skeleton-detail-grid strong.skeleton-block {
  height: 11px;
  margin-top: 11px;
}

.drawer-load-error {
  min-height: 320px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}

.drawer-load-error strong {
  color: var(--ink);
}

.drawer-load-error p {
  max-width: 420px;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.drawer-entity-links {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 10px;
}

.drawer-entity-links a {
  color: var(--blue);
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
}

.drawer-entity-links a:hover {
  text-decoration: underline;
}

.drawer-backdrop {
  position: fixed;
  z-index: 19;
  inset: 0;
  display: none;
  background: rgb(13 19 17 / 34%);
}

.drawer-backdrop.open {
  display: block;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.detail-pair {
  min-width: 0;
  padding: 12px;
  background: #fff;
}

.detail-pair strong {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  font-size: 12px;
  text-overflow: ellipsis;
}

.drawer-section {
  margin-top: 22px;
}

.drawer-section h4 {
  margin: 0 0 9px;
  font-size: 13px;
}

.drawer-section-heading {
  min-height: 26px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.drawer-section-heading span {
  color: var(--muted);
  font-size: 11px;
}

.session-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.session-card {
  min-width: 0;
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 12px;
  background: #fafcfb;
}

.session-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.session-card > strong {
  font-size: 12px;
}

.session-card > span,
.session-card > small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.session-card > code {
  display: block;
  overflow: hidden;
  color: #38534b;
  font: 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.execution-timeline {
  position: relative;
  display: grid;
}

.drawer-execution-control {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.drawer-execution-control > div:first-child {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-execution-control > div:first-child > span:last-child {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.workflow-gates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.workflow-gate {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 11px 12px;
  background: #fafcfb;
}

.workflow-gate > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.workflow-gate > div > strong {
  font-size: 11px;
}

.workflow-gate p,
.expected-transition p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.expected-transitions {
  border-top: 1px solid var(--line);
}

.expected-transition {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.expected-transition strong {
  font-size: 11px;
}

.trace-event {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 12px;
}

.trace-event::before {
  content: "";
  position: absolute;
  top: 13px;
  bottom: -3px;
  left: 5px;
  width: 1px;
  background: #dce3df;
}

.trace-event:last-child::before {
  display: none;
}

.trace-marker {
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
  margin-top: 13px;
  border: 3px solid #d7e3df;
  border-radius: 50%;
  background: #fff;
}

.source-worker .trace-marker {
  border-color: #7fc9b8;
}

.source-reviewer .trace-marker {
  border-color: #bea3dc;
}

.source-orchestrator .trace-marker {
  border-color: #e4bc7f;
}

.source-human .trace-marker {
  border-color: #7ba7e5;
}

.trace-body {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 10px 12px;
  background: #fff;
}

.trace-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.trace-heading > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.trace-heading strong {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.trace-heading time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
}

.trace-body > p,
.question-card p,
.recorded-result p {
  margin: 9px 0 0;
  color: #43504c;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.trace-usage {
  margin-top: 8px;
  color: #3f695d;
  font-size: 10px;
  font-weight: 700;
}

.trace-details,
.recorded-result,
.technical-identifiers {
  margin-top: 9px;
  border-top: 1px solid #edf0ef;
  padding-top: 8px;
}

.trace-details summary,
.recorded-result summary,
.technical-identifiers summary {
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.trace-bundle > .bundle-summary {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.trace-bundle > details {
  margin-top: 9px;
  border-top: 1px solid #edf0ef;
  padding-top: 8px;
}

.trace-bundle > details > summary,
.bundle-output > summary {
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.bundle-content {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.command-entry {
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 3px solid #8dbbac;
  border-radius: 4px;
  padding: 8px 9px;
  background: #f8faf9;
}

.command-entry.failed {
  border-left-color: #d47772;
  background: #fff8f7;
}

.bundle-entry-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.bundle-entry-heading span,
.change-kind {
  color: #357464;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.command-entry.failed .bundle-entry-heading span,
.change-kind.deleted {
  color: #a94943;
}

.bundle-entry-heading small {
  color: var(--muted);
  font-size: 9px;
}

.command-entry > code,
.file-change-entry > code {
  overflow-wrap: anywhere;
  color: #31413b;
  font: 10px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.bundle-output {
  margin-top: 7px;
}

.bundle-output pre {
  max-height: 240px;
  overflow: auto;
  margin: 7px 0 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px;
  color: #31413b;
  font: 10px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff;
}

.file-change-entry {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  border-bottom: 1px solid #edf0ef;
  padding: 6px 0;
}

.file-change-entry:last-child {
  border-bottom: 0;
}

.change-kind.added {
  color: #27755e;
}

.change-kind.modified {
  color: #916219;
}

.bundle-empty {
  color: var(--muted);
  font-size: 10px;
}

.trace-details pre,
.recorded-result pre,
.technical-identifiers pre {
  max-height: 360px;
  overflow: auto;
  margin: 9px 0 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 11px;
  color: #31413b;
  font: 10px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f7f9f8;
}

.reasoning-copy {
  margin-top: 9px;
  border-left: 3px solid #bea3dc;
  padding: 8px 10px;
  color: #443b4e;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  background: #faf8fc;
}

.question-card {
  margin-top: 8px;
  border-left: 3px solid #d9a95d;
  padding: 10px 12px;
  background: #fff9ee;
}

.manual-verification-card {
  border-left-color: #4f8a78;
  background: #f3faf7;
}

.recorded-result {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 10px 12px;
}

.recorded-result summary {
  display: flex;
  align-items: center;
  gap: 9px;
}

.recorded-result summary span:last-child {
  margin-left: auto;
  color: var(--muted);
}

.technical-identifiers {
  margin-top: 24px;
  padding-bottom: 20px;
}

.drawer-section pre {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 13px;
  color: #31413b;
  font: 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f7f9f8;
}

.toast {
  position: fixed;
  z-index: 30;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  display: none;
  border-radius: 5px;
  padding: 11px 14px;
  color: #fff;
  font-size: 12px;
  background: #29342f;
  box-shadow: 0 12px 30px rgb(0 0 0 / 18%);
}

.toast.visible {
  display: block;
}

.empty-row td,
.list-empty {
  height: 86px;
  color: #87928d;
  text-align: center;
}

.list-empty {
  display: grid;
  place-items: center;
  padding: 24px;
  font-size: 12px;
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .overview-grid,
  .inbox-grid,
  .architecture-layout {
    grid-template-columns: 1fr;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric:nth-child(2) {
    border-right: 0;
  }

  .metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    z-index: 10;
    width: 100%;
    height: auto;
    display: block;
    padding: 10px 12px 0;
  }

  .brand {
    padding: 0 2px 10px;
    border-bottom: 0;
  }

  .brand img {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .navigation {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    margin: 0 -2px;
    padding-bottom: 8px;
    scrollbar-width: none;
  }

  .navigation::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    width: auto;
    min-width: max-content;
    min-height: 36px;
    padding: 0 10px;
  }

  .nav-item.active {
    box-shadow: inset 0 -3px 0 #53c4a8;
  }

  .sidebar-meta {
    display: none;
  }

  .workspace {
    padding: 0 14px 32px;
  }

  .topbar {
    min-height: 72px;
  }

  .topbar h2 {
    font-size: 20px;
  }

  .sync-time {
    display: none;
  }

  .loading-line {
    margin: 0 -14px;
  }

  .view {
    padding-top: 16px;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    min-height: 78px;
    padding: 14px;
  }

  .metric strong {
    font-size: 23px;
  }

  .panel {
    min-height: 240px;
    padding: 16px;
  }

  .run-meta {
    grid-template-columns: 1fr 1fr;
  }

  .run-focus-title {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .run-focus-title .role-pill {
    justify-self: start;
  }

  .run-focus-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .architecture-toolbar .secondary-button {
    width: 100%;
    margin-left: 0;
  }

  .architecture-canvas {
    min-height: 520px;
  }

  .search-field {
    width: 100%;
  }

  .filter-field {
    flex: 1 1 130px;
    width: auto;
  }

  .usage-note {
    width: 100%;
    margin-left: 0;
    text-align: left;
  }

  table {
    min-width: 760px;
  }

  .activity-item {
    grid-template-columns: 100px 1fr;
  }

  .activity-item time {
    grid-column: 2;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .session-list {
    grid-template-columns: 1fr;
  }

  .workflow-gates {
    grid-template-columns: 1fr;
  }

  .drawer-execution-control {
    align-items: flex-start;
    flex-direction: column;
  }

  .drawer-execution-control .workflow-actions {
    justify-content: flex-start;
  }

  .drawer {
    width: 100vw;
  }

  .drawer-content {
    padding: 14px;
  }

  .drawer-entity-links {
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .pagination {
    justify-content: center;
  }

  .trace-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-line.active,
  .skeleton-block,
  .metric strong.metric-skeleton {
    animation: none;
  }
}
