:root {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: #172033;
  --surface-raised: #1f2a44;
  --border: #70809a;
  --text: #f8fafc;
  --muted: #d8e0ef;
  --subtle: #bec9d9;
  --primary: #8ecbff;
  --primary-strong: #2563eb;
  --success: #8df7b3;
  --warning: #ffd166;
  --danger: #ffb4b4;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 24px;
  align-items: end;
  padding: 40px clamp(20px, 4vw, 64px) 28px;
  background: #11182b;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.05;
}

.summary {
  max-width: 980px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.detail-actions {
  display: flex;
  gap: 12px;
  margin: 18px 0 0;
}

.diagram-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  color: #ffffff;
  background: var(--primary-strong);
  font-weight: 800;
  padding: 0 14px;
  text-decoration: none;
}

.diagram-link:hover {
  border-color: #ffffff;
}

.header-card,
.metrics article,
.report-card,
.toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.header-card {
  padding: 24px;
  text-align: center;
}

.metric-value {
  display: block;
  color: var(--success);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
}

.metric-label {
  color: var(--muted);
  font-weight: 700;
}

main {
  padding: 28px clamp(20px, 4vw, 64px) 48px;
}

.category-tabs {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.category-tab {
  flex: 0 0 auto;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 0 14px;
  white-space: nowrap;
}

.category-tab:hover {
  border-color: var(--primary);
  color: var(--text);
}

.category-tab:focus {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.category-tab[aria-pressed="true"] {
  background: var(--primary-strong);
  border-color: var(--primary);
  color: #ffffff;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) repeat(3, minmax(180px, 220px));
  gap: 16px;
  padding: 18px;
  margin-bottom: 20px;
}

.category-detail {
  margin-bottom: 20px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.category-detail-heading {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}

.category-detail-heading h2 {
  margin-bottom: 8px;
}

.category-detail-heading p {
  max-width: 960px;
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.architecture-diagrams {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(220px, 1fr));
  gap: 16px;
  padding: 20px 22px;
}

.architecture-diagram {
  min-height: 240px;
  padding: 18px;
  border: 1px solid rgba(112, 128, 154, 0.7);
  border-radius: 8px;
  background: var(--surface-raised);
}

.architecture-diagram-wide {
  grid-column: span 2;
}

.architecture-diagram h3 {
  margin-top: 0;
  margin-bottom: 14px;
  color: var(--text);
  font-size: 1rem;
}

.architecture-topology {
  min-height: 178px;
}

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

.topology-node {
  min-height: 68px;
  padding: 10px;
  border: 1px solid currentColor;
  border-radius: 8px;
  background: rgba(11, 16, 32, 0.45);
}

.topology-label,
.topology-links {
  display: block;
}

.topology-label {
  color: var(--text);
  font-weight: 800;
}

.topology-links {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.topology-edge {
  color: var(--primary);
}

.topology-app {
  color: var(--success);
}

.topology-frontend {
  color: var(--primary);
}

.topology-backend {
  color: var(--success);
}

.topology-bus {
  color: #fb923c;
}

.topology-data {
  color: var(--warning);
}

.topology-security {
  color: var(--danger);
}

.topology-external {
  color: #c4b5fd;
}

.topology-ops {
  color: #f9a8d4;
}

.architecture-flow {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.architecture-flow li {
  position: relative;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(142, 203, 255, 0.62);
  border-radius: 8px;
  background: rgba(11, 16, 32, 0.45);
  color: var(--text);
  font-weight: 800;
}

.architecture-flow li:not(:last-child)::after {
  content: "->";
  position: absolute;
  right: 14px;
  bottom: -17px;
  color: var(--primary);
  font-weight: 900;
}

.architecture-notes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0 22px 22px;
  list-style: none;
}

.architecture-notes li {
  min-height: 88px;
  padding: 14px;
  border: 1px solid rgba(112, 128, 154, 0.7);
  border-radius: 8px;
  background: rgba(11, 16, 32, 0.35);
  color: var(--muted);
  font-weight: 700;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #8290a8;
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
  padding: 0 12px;
}

input:focus,
select:focus {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metrics article {
  padding: 18px;
}

.metrics span {
  display: block;
  color: var(--primary);
  font-size: 2rem;
  font-weight: 800;
}

.metrics p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.status-report,
.category-report {
  margin-bottom: 20px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 20px 22px 22px;
}

.status-summary {
  display: grid;
  gap: 10px;
  min-height: 132px;
  padding: 18px;
  border: 1px solid rgba(112, 128, 154, 0.7);
  border-radius: 8px;
  background: var(--surface-raised);
}

.status-summary-count {
  color: var(--text);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
}

.status-summary p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.report-card {
  overflow: hidden;
}

.table-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}

.table-heading h2 {
  margin-bottom: 0;
}

.table-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

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

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.category-table {
  min-width: 760px;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(112, 128, 154, 0.55);
  text-align: left;
  vertical-align: top;
}

th {
  background: #11182b;
  color: var(--text);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

td:first-child,
.need-title {
  color: var(--text);
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-done {
  color: var(--success);
}

.status-progress {
  color: var(--warning);
}

.status-open {
  color: var(--danger);
}

.priority-p0 {
  color: var(--danger);
}

.priority-p1 {
  color: var(--warning);
}

.priority-p2 {
  color: var(--primary);
}

@media (max-width: 960px) {
  .page-header,
  .toolbar,
  .metrics,
  .status-grid,
  .architecture-diagrams,
  .architecture-notes {
    grid-template-columns: 1fr;
  }

  .header-card {
    text-align: left;
  }

  .topology-nodes {
    grid-template-columns: 1fr;
  }

  .architecture-diagram-wide {
    grid-column: auto;
  }
}
