:root {
  color-scheme: dark;
  --bg: #0e0f12;
  --surface: #17191e;
  --surface-strong: #20232a;
  --line: #30343d;
  --line-soft: #252932;
  --text: #f5f3ed;
  --muted: #a7abb4;
  --subtle: #737987;
  --accent: #ff6b4a;
  --secondary: #ffd166;
  --critical: #ff5c77;
  --high: #ff9f43;
  --medium: #ffd166;
  --boundary: #64d8cb;
  --max-width: 1440px;
  font-family:
    "Segoe UI",
    "Helvetica Neue",
    Arial,
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  max-width: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

button,
canvas {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.app-shell {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  border-right: 1px solid var(--line-soft);
  border-left: 1px solid var(--line-soft);
  background: var(--bg);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  flex: 0 0 42px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #090a0c;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 20px;
  font-weight: 800;
}

.brand div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

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

.brand span:last-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  min-width: 0;
}

.os-quicklinks {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.os-quicklinks a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  padding: 0 11px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.os-quicklinks a:hover,
.os-quicklinks a:focus-visible {
  border-color: var(--accent);
  color: var(--text);
  outline: none;
}

.connection {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border: 1px solid var(--subtle);
  background: var(--subtle);
}

.connection.is-ready .connection-dot {
  border-color: #66d17a;
  background: #66d17a;
}

.connection.is-error .connection-dot {
  border-color: var(--critical);
  background: var(--critical);
}

.project-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 64px;
  border-bottom: 1px solid var(--line);
}

.project-tab {
  position: relative;
  display: grid;
  min-width: 0;
  padding: 12px 22px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #121418;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.project-tab:last-child {
  border-right: 0;
}

.project-tab::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: transparent;
  content: "";
}

.project-tab:hover,
.project-tab:focus-visible {
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.project-tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
}

.project-tab[aria-selected="true"]::after {
  background: var(--accent);
}

.project-tab strong,
.project-tab span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-tab strong {
  font-size: 14px;
}

.project-tab span {
  margin-top: 3px;
  font-size: 11px;
}

main {
  min-width: 0;
  max-width: 100%;
}

section,
aside,
article,
div {
  min-width: 0;
}

.identity-band {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.6fr);
  gap: 42px;
  min-height: 310px;
  padding: 48px 40px 36px;
  border-bottom: 1px solid var(--line);
}

.identity-copy {
  align-self: end;
  min-width: 0;
}

.eyebrow,
.section-index,
.state-label,
.visual-label,
.section-note,
.mode-badge {
  font-family: Consolas, "SFMono-Regular", monospace;
}

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

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

h1 {
  max-width: 900px;
  margin-bottom: 10px;
  font-size: 46px;
  line-height: 1.04;
}

.kicker {
  margin-bottom: 22px;
  color: var(--secondary);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 15px;
}

.summary {
  max-width: 880px;
  margin-bottom: 0;
  color: #d3d5da;
  font-size: 17px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.project-state {
  display: grid;
  align-content: end;
  gap: 12px;
  min-width: 0;
  padding: 20px 0 4px 22px;
  border-left: 4px solid var(--accent);
}

.state-label {
  color: var(--subtle);
  font-size: 11px;
}

.project-state strong {
  font-size: 17px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.project-state span:last-child {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.visual-band,
.pipeline-band,
.evidence-band,
.analysis-section {
  padding: 30px 40px 38px;
  border-bottom: 1px solid var(--line);
}

.os-switchboard {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(420px, 1.22fr);
  gap: 28px;
  padding: 30px 40px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255, 107, 74, 0.07), transparent 44%),
    var(--surface);
}

.os-switchboard h2 {
  margin: 6px 0 10px;
}

.os-switchboard p {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.switchboard-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.switchboard-links a {
  display: grid;
  min-height: 126px;
  align-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  background: rgba(14, 15, 18, 0.82);
  color: var(--text);
  padding: 16px;
  text-decoration: none;
}

.switchboard-links a:hover,
.switchboard-links a:focus-visible {
  border-color: var(--accent);
  background: var(--surface-strong);
  outline: none;
}

.switchboard-links strong {
  font-size: 15px;
  line-height: 1.25;
}

.switchboard-links span {
  color: var(--muted);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

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

.section-index {
  color: var(--accent);
  font-size: 11px;
}

h2 {
  margin-bottom: 0;
  font-size: 19px;
  line-height: 1.2;
}

.visual-label,
.section-note {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.canvas-frame {
  position: relative;
  width: 100%;
  min-height: 400px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #101217;
}

#project-visual {
  display: block;
  width: 100%;
  height: 400px;
}

.canvas-caption {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding: 5px 7px;
  background: #101217;
  color: #ced1d8;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 10px;
  pointer-events: none;
}

.canvas-caption span {
  color: var(--accent);
}

.metrics-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.metric {
  display: grid;
  min-height: 132px;
  align-content: center;
  gap: 8px;
  padding: 24px 40px;
  border-right: 1px solid var(--line);
}

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

.metric strong {
  color: var(--accent);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 32px;
}

.metric span {
  font-size: 14px;
}

.metric small {
  color: var(--subtle);
  font-size: 11px;
  line-height: 1.4;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(var(--pipeline-count, 6), minmax(148px, 1fr));
  margin: 0;
  padding: 0 0 12px;
  overflow-x: auto;
  list-style: none;
}

.pipeline-step {
  position: relative;
  min-height: 150px;
  padding: 18px 24px 16px 0;
}

.pipeline-step::before {
  position: absolute;
  top: 25px;
  right: 0;
  left: 0;
  height: 1px;
  background: var(--line);
  content: "";
}

.pipeline-step::after {
  position: absolute;
  top: 21px;
  left: 0;
  width: 9px;
  height: 9px;
  border: 2px solid var(--accent);
  background: var(--bg);
  content: "";
}

.pipeline-step strong,
.pipeline-step span {
  display: block;
}

.pipeline-step strong {
  position: relative;
  margin-top: 30px;
  font-size: 13px;
}

.pipeline-step span {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.boundary-band {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding: 28px 40px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.boundary-band h2 {
  margin-bottom: 10px;
}

.boundary-band p {
  margin: 0;
  color: #d3d5da;
  line-height: 1.6;
}

.mode-badge {
  padding: 6px 8px;
  border: 1px solid var(--secondary);
  color: var(--secondary);
  font-size: 10px;
  white-space: nowrap;
}

.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.analysis-grid .analysis-section {
  border-bottom: 0;
}

.analysis-grid .analysis-section:first-child {
  border-right: 1px solid var(--line);
}

.findings {
  display: grid;
}

.finding {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--line-soft);
}

.severity {
  align-self: start;
  padding: 4px 6px;
  border: 1px solid currentColor;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 10px;
  text-align: center;
  text-transform: uppercase;
}

.severity-critical {
  color: var(--critical);
}

.severity-high {
  color: var(--high);
}

.severity-medium {
  color: var(--medium);
}

.severity-boundary {
  color: var(--boundary);
}

.finding-copy strong {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
}

.finding-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.roadmap {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: roadmap;
}

.roadmap li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  padding: 17px 0;
  border-top: 1px solid var(--line-soft);
  color: #d3d5da;
  font-size: 13px;
  line-height: 1.5;
  counter-increment: roadmap;
}

.roadmap li::before {
  color: var(--secondary);
  font-family: Consolas, "SFMono-Regular", monospace;
  content: "0" counter(roadmap);
}

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

.evidence-item {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 18px;
  background: var(--surface);
}

.evidence-item strong {
  font-size: 13px;
}

.evidence-item code {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 11px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 40px;
  color: var(--subtle);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 11px;
}

footer strong {
  color: var(--text);
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .identity-band {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    min-height: 0;
    padding-top: 38px;
  }

  .project-state {
    padding-top: 10px;
  }

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

  .os-switchboard {
    grid-template-columns: 1fr;
  }

  .switchboard-links {
    grid-template-columns: 1fr;
  }

  .analysis-grid .analysis-section:first-child {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 680px) {
  .app-shell {
    border: 0;
  }

  .topbar {
    min-height: 64px;
    padding: 10px 16px;
  }

  .topbar-actions {
    display: grid;
    gap: 10px;
  }

  .os-quicklinks {
    justify-content: flex-start;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    font-size: 17px;
  }

  .brand span:last-child,
  .connection span:last-child {
    display: none;
  }

  .project-tabs {
    grid-template-columns: 1fr;
  }

  .project-tab {
    min-height: 54px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .project-tab:last-child {
    border-bottom: 0;
  }

  .identity-band,
  .os-switchboard,
  .visual-band,
  .pipeline-band,
  .evidence-band,
  .analysis-section {
    padding-right: 18px;
    padding-left: 18px;
  }

  .identity-band {
    padding-top: 30px;
  }

  h1 {
    font-size: 34px;
  }

  .summary {
    font-size: 15px;
  }

  .section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: flex-start;
    gap: 8px;
  }

  .visual-label,
  .section-note {
    max-width: none;
    text-align: left;
  }

  .canvas-frame,
  #project-visual {
    min-height: 330px;
    height: 330px;
  }

  .canvas-caption {
    display: grid;
    justify-items: end;
  }

  .metrics-band {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 104px;
    padding: 20px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .boundary-band {
    grid-template-columns: 24px minmax(0, 1fr);
    padding-right: 18px;
    padding-left: 18px;
  }

  .mode-badge {
    grid-column: 2;
    justify-self: start;
  }

  .finding {
    grid-template-columns: 70px minmax(0, 1fr);
  }

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

  footer {
    display: grid;
    padding: 20px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
