:root {
  --bg: #0d0f12;
  --surface: #14181f;
  --surface-2: #1a1f28;
  --border: #2a3140;
  --text: #d8dde6;
  --muted: #6b7280;
  --accent: #818cf8;
  --green: #4ade80;
  --green-bg: #14532d;
  --amber: #fbbf24;
  --red: #f87171;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: Manrope, system-ui, sans-serif;
  --nav-w: 200px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 10px 16px;
  background: #fff;
  color: #000;
  font-weight: 600;
}

.skip:focus {
  left: 12px;
  top: 12px;
}

.frame {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  min-height: 100vh;
}

.side {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem 0.65rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand {
  padding: 0.25rem 0.5rem 1rem;
}

.side-brand strong {
  display: block;
  color: #f3f4f6;
  font-size: 0.95rem;
}

.side-brand span {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
}

.side nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.side nav a {
  font-size: 0.84rem;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  color: var(--muted);
}

.side nav a:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.side nav a[aria-current="page"] {
  background: rgba(129, 140, 248, 0.12);
  color: var(--accent);
  font-weight: 600;
}

.side-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 1.6;
}

.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.bar h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #f3f4f6;
}

.bar input[type="search"] {
  margin-left: auto;
  width: min(260px, 45vw);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.82rem;
}

.menu-toggle {
  display: none;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
}

main {
  flex: 1;
  padding: 1.15rem 1.25rem 2rem;
}

.demo-footer {
  padding: 0.65rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.68rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.demo-footer a {
  color: var(--accent);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: #f3f4f6;
}

.panel-head a {
  font-size: 0.75rem;
  color: var(--accent);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 500;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.data-table code {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
}

.data-table a {
  color: var(--accent);
}

.tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
}

.tag-live {
  color: var(--green);
  background: var(--green-bg);
}

.tag-roll {
  color: var(--amber);
  background: #422006;
}

.tag-fail {
  color: var(--red);
  background: #450a0a;
}

.tag-build {
  color: var(--muted);
  background: var(--surface-2);
}

.metrics-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.metrics-inline strong {
  color: var(--text);
  font-size: 1.1rem;
  display: block;
}

.flag-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.flag-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.flag-list li:last-child {
  border-bottom: 0;
}

.toggle {
  flex-shrink: 0;
  width: 52px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  position: relative;
  cursor: default;
  padding: 0;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6b7280;
  transition: left 0.15s;
}

.toggle.on {
  background: var(--green-bg);
  border-color: #22c55e;
}

.toggle.on::after {
  left: 29px;
  background: var(--green);
}

.toggle-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.detail-block {
  padding: 1rem;
}

.detail-block dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
  font-size: 0.84rem;
}

.detail-block dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.detail-block dd {
  margin: 0;
}

.breadcrumb {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.breadcrumb a {
  color: var(--accent);
}

.breakage-card {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.breakage-card:last-child {
  border-bottom: 0;
}

.breakage-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  color: #f3f4f6;
}

.breakage-card p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.breakage-meta {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.project-tile {
  padding: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.project-tile h3 {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
}

.project-tile p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.settings-section {
  padding: 1rem;
  max-width: 420px;
}

.settings-section label {
  display: block;
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.settings-section input,
.settings-section select {
  width: 100%;
  margin-bottom: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}

.oncall {
  padding: 1rem;
  font-size: 0.82rem;
  line-height: 1.6;
}

.oncall code {
  font-family: var(--mono);
  color: var(--accent);
}

@media (max-width: 960px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .project-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .frame {
    grid-template-columns: 1fr;
  }
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    width: min(var(--nav-w), 85vw);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.45);
  }
  .frame.nav-open .side {
    transform: translateX(0);
  }
  .menu-toggle {
    display: inline-block;
  }
  .project-grid {
    grid-template-columns: 1fr;
  }
}
