:root {
  --ink: #152033;
  --muted: #667085;
  --line: #d7deea;
  --panel: #ffffff;
  --page: #f6f8fb;
  --blue: #4285f4;
  --red: #db4437;
  --yellow: #f4b400;
  --green: #0f9d58;
  --purple: #8b5cf6;
  --soft-blue: #dceaff;
  --soft-green: #dff4e8;
  --soft-yellow: #fff6d8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: center;
  margin-bottom: 18px;
}

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

.brand-logo {
  width: 104px;
  height: auto;
  display: block;
  flex: 0 0 auto;
}

.brand-copy {
  min-width: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand-title {
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
}

.brand-subtitle {
  color: var(--muted);
  margin-top: 5px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.mode-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 3px;
}

.seg {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 9px 13px;
  font-weight: 700;
  cursor: pointer;
}

.seg.active {
  background: var(--blue);
  color: white;
}

.control-band,
.meta-strip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.control-band {
  display: grid;
  grid-template-columns: minmax(280px, 1.8fr) minmax(160px, 1fr) minmax(160px, 1fr) minmax(160px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
}

.field,
.check-field {
  display: grid;
  gap: 6px;
}

.field span,
.check-field span,
.eyebrow,
.panel-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
  font-size: 14px;
}

.check-field {
  grid-auto-flow: column;
  grid-auto-columns: auto;
  align-items: center;
  justify-content: start;
  min-height: 40px;
  padding-bottom: 2px;
}

.check-field input {
  width: 18px;
  height: 18px;
}

.hidden {
  display: none;
}

.meta-strip {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 1.1fr;
  gap: 0;
  margin: 12px 0;
  overflow: hidden;
}

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

.meta-strip div:last-child {
  border-right: 0;
}

.meta-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(480px, 1.55fr) minmax(320px, 0.95fr);
  gap: 12px;
  align-items: stretch;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

h2 {
  font-size: 16px;
  letter-spacing: 0;
}

svg {
  display: block;
  width: 100%;
  height: auto;
}

.network-panel svg {
  aspect-ratio: 13 / 8;
}

.stg-panel svg {
  aspect-ratio: 18 / 13;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-size: 12px;
  color: var(--muted);
  background: #fbfcfe;
}

.node {
  fill: white;
  stroke: #1f2a44;
  stroke-width: 2.4;
}

.state-node {
  fill: white;
  stroke: #202b45;
  stroke-width: 2.2;
}

.state-node.attractor {
  fill: var(--soft-green);
  stroke: var(--green);
}

.state-label,
.net-label {
  fill: var(--ink);
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
}

.edge {
  fill: none;
  stroke: #344054;
  stroke-width: 2.2;
}

.edge.sync {
  stroke: var(--blue);
}

.edge.a-edge {
  stroke: var(--red);
}

.edge.b-edge {
  stroke: var(--blue);
}

.edge.ab-edge {
  stroke: var(--purple);
}

.edge.self {
  stroke-dasharray: 6 5;
}

.reg-pos {
  stroke: var(--green);
}

.reg-neg {
  stroke: var(--red);
  stroke-dasharray: 7 5;
}

.reg-mixed {
  stroke: var(--purple);
  stroke-dasharray: 4 4;
}

.edge-label {
  fill: #101828;
  font-size: 14px;
  font-weight: 800;
  paint-order: stroke;
  stroke: white;
  stroke-width: 5px;
  stroke-linejoin: round;
}

@media (max-width: 1120px) {
  .control-band,
  .meta-strip,
  .workspace {
    grid-template-columns: 1fr;
  }

  .meta-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .meta-strip div:last-child {
    border-bottom: 0;
  }

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

  .brand {
    align-items: center;
    flex-direction: row;
  }

  .brand-logo {
    width: 82px;
  }

  .brand-title {
    font-size: 19px;
  }

  .brand-subtitle {
    font-size: 13px;
  }
}
