:root {
  --bg: #030b14;
  --panel: rgba(9, 27, 47, 0.95);
  --panel-soft: rgba(14, 37, 62, 0.78);
  --border: rgba(100, 178, 255, 0.18);
  --border-bright: rgba(77, 176, 255, 0.42);
  --text: #f4f8fc;
  --muted: #90a7bb;
  --cyan: #4ddcff;
  --blue: #4098ff;
  --green: #38e5aa;
  --yellow: #ffc857;
  --red: #ff657a;
  --purple: #9d78ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 5%, rgba(22, 103, 180, 0.25), transparent 28%),
    radial-gradient(circle at 90% 9%, rgba(104, 67, 210, 0.17), transparent 26%),
    linear-gradient(180deg, #071425 0%, #04101d 55%, #020912 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

button,
input,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.architecture-shell {
  width: min(1800px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.architecture-header,
.flow-panel,
.tree-panel,
.detail-panel,
.operations-panel,
.summary-grid article {
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.architecture-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 24px;
  border-radius: 20px;
}

.architecture-header h1,
.section-heading h2,
.panel-toolbar h2 {
  margin: 4px 0 0;
}

.architecture-header p {
  max-width: 820px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.header-actions button,
.header-actions a {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--border-bright);
  border-radius: 10px;
  color: var(--text);
  background: rgba(30, 79, 124, 0.42);
  cursor: pointer;
}

.header-actions button:hover,
.header-actions a:hover {
  border-color: var(--cyan);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.status-pill.active,
.status-pill.ready {
  color: var(--green);
  border-color: rgba(56, 229, 170, 0.4);
}

.status-pill.blocked,
.status-pill.error {
  color: var(--red);
  border-color: rgba(255, 101, 122, 0.4);
}

.status-pill.test,
.status-pill.waiting {
  color: var(--yellow);
  border-color: rgba(255, 200, 87, 0.4);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.summary-grid article {
  min-height: 92px;
  padding: 16px;
  border-radius: 14px;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 1.15rem;
}

.flow-panel,
.operations-panel {
  padding: 20px;
  border-radius: 18px;
}

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

.capability-flow {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  padding: 18px 2px 4px;
}

.capability-card {
  position: relative;
  flex: 0 0 230px;
  min-height: 150px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-soft);
  cursor: pointer;
}

.capability-card:hover,
.capability-card.selected {
  border-color: var(--cyan);
  transform: translateY(-1px);
}

.capability-card:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -19px;
  top: 50%;
  z-index: 2;
  color: var(--cyan);
  font-weight: 900;
}

.capability-stage {
  color: var(--purple);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.capability-card h3 {
  margin: 8px 0;
  font-size: 1rem;
}

.capability-card p,
.capability-card small {
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(500px, 1.1fr);
  gap: 18px;
  margin: 18px 0;
}

.tree-panel,
.detail-panel {
  min-height: 720px;
  max-height: 82vh;
  overflow: hidden;
  border-radius: 18px;
}

.panel-toolbar {
  padding: 18px;
  border-bottom: 1px solid var(--border);
}

.panel-toolbar input {
  width: min(260px, 48%);
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: rgba(2, 10, 20, 0.7);
}

.repository-tree,
.detail-content {
  height: calc(82vh - 85px);
  overflow: auto;
  padding: 14px;
}

.tree-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 7px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 4px 8px;
  border: 0;
  border-radius: 7px;
  color: var(--text);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.tree-row:hover,
.tree-row.selected {
  background: rgba(64, 152, 255, 0.15);
}

.tree-toggle {
  color: var(--cyan);
  text-align: center;
}

.tree-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-kind {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.tree-children[hidden] {
  display: none;
}

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

.detail-stat,
.detail-section {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-soft);
}

.detail-stat span,
.detail-section h3 {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-stat strong {
  display: block;
  margin-top: 7px;
  overflow-wrap: anywhere;
}

.detail-section {
  grid-column: 1 / -1;
}

.detail-section h3 {
  margin: 0 0 10px;
}

.path-list {
  display: grid;
  gap: 7px;
}

.path-item {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(1, 9, 17, 0.58);
  color: #c8dded;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.approved-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.action-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-soft);
}

.action-card h3 {
  margin: 0 0 8px;
}

.action-card p {
  min-height: 42px;
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.45;
}

.action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.action-meta span {
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(2, 10, 20, 0.64);
  font-size: 0.68rem;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

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

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

  .tree-panel,
  .detail-panel {
    max-height: none;
  }

  .repository-tree,
  .detail-content {
    height: 600px;
  }
}

@media (max-width: 700px) {
  .architecture-shell {
    width: min(100% - 18px, 1800px);
  }

  .architecture-header {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

  .detail-section {
    grid-column: 1;
  }
}
