@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap");

:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f9fbfe;
  --line: #dce3ef;
  --line-strong: #bac6d8;
  --text: #172033;
  --muted: #627089;
  --muted-2: #8a96aa;
  --blue: #155eef;
  --blue-soft: #eef4ff;
  --green: #138a4a;
  --green-soft: #ecfdf3;
  --amber: #b86e00;
  --amber-soft: #fff7e6;
  --red: #c83232;
  --red-soft: #fff0f0;
  --navy: #102033;
  --code: #0f1b2d;
  --code-line: #233654;
  --radius: 8px;
  --shadow: 0 12px 28px rgb(16 32 51 / 8%);
  --focus: 0 0 0 3px rgb(21 94 239 / 18%);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", Inter, system-ui, sans-serif;
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  align-items: center;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 7px;
  color: white;
  cursor: pointer;
  display: inline-flex;
  font-weight: 650;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

button:hover:not(:disabled) {
  box-shadow: 0 8px 18px rgb(21 94 239 / 18%);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button.secondary {
  background: white;
  border-color: var(--line);
  color: var(--text);
}

button.danger {
  background: var(--red);
  border-color: var(--red);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  box-shadow: var(--focus);
  outline: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--navy);
  color: white;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 16px;
}

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

.brand-mark {
  background: var(--blue);
  border-radius: 8px;
  display: grid;
  font-weight: 800;
  height: 42px;
  place-items: center;
  width: 42px;
}

.brand h1,
.brand p,
.page-header h2,
.page-header p,
.section-heading h3,
.section-heading p,
.outcome-panel h3,
.outcome-panel p {
  margin: 0;
}

.brand h1 {
  font-size: 21px;
  line-height: 1;
}

.brand p {
  color: #b7c3d6;
  font-size: 13px;
  line-height: 1.35;
  margin-top: 4px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-section {
  color: #7f8da3;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 14px 8px 2px;
  text-transform: uppercase;
}

.nav-item {
  background: transparent;
  border-color: transparent;
  color: #cbd5e5;
  justify-content: flex-start;
  min-height: 38px;
}

.nav-item.compact {
  color: #aebbd0;
  font-size: 14px;
  min-height: 32px;
  padding-left: 18px;
}

.nav-item:hover:not(:disabled),
.nav-item.active {
  background: rgb(255 255 255 / 9%);
  border-color: rgb(255 255 255 / 10%);
  box-shadow: none;
  color: white;
}

.nav-advanced {
  display: grid;
  gap: 4px;
}

.nav-advanced:not([open]) .nav-item {
  display: none;
}

.nav-advanced summary {
  border: 1px solid transparent;
  border-radius: 8px;
  color: #aebbd0;
  cursor: pointer;
  font-weight: 750;
  list-style-position: inside;
  padding: 8px;
}

.nav-advanced summary:hover {
  background: rgb(255 255 255 / 7%);
  border-color: rgb(255 255 255 / 10%);
  color: white;
}

.workspace-card {
  background: rgb(255 255 255 / 7%);
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: var(--radius);
  margin-top: auto;
  padding: 14px;
}

.workspace-card span,
.workspace-card p {
  color: #b7c3d6;
  font-size: 12px;
  margin: 0;
}

.workspace-card strong {
  display: block;
  margin: 6px 0;
}

.content-shell {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 340px;
  padding: 22px;
}

.shell-product-view .content-shell {
  grid-template-columns: minmax(0, 1fr);
}

.shell-product-view .outcome-panel {
  display: none;
}

.main-stage,
.outcome-panel {
  min-width: 0;
}

.page-header,
.outcome-panel,
.view,
.setup-item,
.form-panel,
.result-panel,
.plan-summary article,
.artifact-grid article,
.apply-gates article,
.summary-strip article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.page-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 20px;
}

.eyebrow,
.section-heading p,
.result-panel span,
.setup-item span,
.plan-summary span,
.artifact-heading span,
.summary-strip span,
.outcome-head span,
.outcome-facts span,
.next-action span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.page-header h2 {
  font-size: 26px;
  line-height: 1.15;
}

.page-header p {
  color: var(--muted);
  line-height: 1.45;
  margin-top: 6px;
  max-width: 760px;
}

.run-state span,
#outcome-state {
  background: var(--blue-soft);
  border: 1px solid #c7d7fe;
  border-radius: 999px;
  color: var(--blue);
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 10px;
}

.view {
  display: none;
  padding: 20px;
}

.view.active {
  display: block;
}

.closed-loop-hero {
  background:
    radial-gradient(circle at 16% 18%, rgb(21 94 239 / 22%), transparent 32%),
    radial-gradient(circle at 88% 6%, rgb(242 138 24 / 18%), transparent 26%),
    linear-gradient(135deg, #081424 0%, #102033 58%, #07111f 100%);
  border-radius: 22px;
  color: white;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  margin-bottom: 16px;
  overflow: hidden;
  padding: 26px;
}

.closed-loop-copy {
  align-content: center;
  display: grid;
  gap: 16px;
}

.hero-kicker {
  color: #9bd7ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.closed-loop-copy h3 {
  font-size: clamp(30px, 4vw, 52px);
  letter-spacing: -0.045em;
  line-height: 0.98;
  margin: 0;
  max-width: 680px;
}

.closed-loop-copy p {
  color: #c7d5e8;
  font-size: 16px;
  line-height: 1.65;
  margin: 0;
  max-width: 660px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.hero-actions button:first-child {
  background: #f28a18;
  border-color: #f28a18;
  color: #081424;
}

.closed-loop-panel {
  background: rgb(5 11 20 / 82%);
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 20px;
  box-shadow: 0 18px 42px rgb(0 0 0 / 26%);
  padding: 18px;
}

.loop-line {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 14px;
}

.loop-line span {
  background: rgb(255 255 255 / 8%);
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 999px;
  color: #d9e8ff;
  font-size: 11px;
  font-weight: 800;
  padding: 7px 8px;
  text-align: center;
}

.loop-terminal {
  background: #050b14;
  border: 1px solid #21334d;
  border-radius: 16px;
  color: #d8e8ff;
  display: grid;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  gap: 12px;
  line-height: 1.6;
  padding: 16px;
}

.loop-terminal p,
.loop-terminal div {
  margin: 0;
}

.loop-terminal b {
  color: #8be7c5;
}

.trust-boundary-strip {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.trust-boundary-strip article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
}

.trust-boundary-strip span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trust-boundary-strip strong {
  display: block;
  font-size: 15px;
  margin-top: 7px;
}

.trust-boundary-strip p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 6px 0 0;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading h3 {
  font-size: 20px;
}

.section-heading p {
  letter-spacing: 0;
  line-height: 1.45;
  margin-top: 6px;
  max-width: 820px;
  text-transform: none;
}

.choice-grid,
.value-strip,
.story-board,
.setup-grid,
.summary-strip,
.plan-summary,
.artifact-grid,
.apply-gates {
  display: grid;
  gap: 12px;
}

.choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.value-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.value-strip article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
  padding: 14px;
}

.value-strip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.value-strip strong {
  display: block;
  font-size: 15px;
  margin-top: 6px;
}

.value-strip p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin: 5px 0 0;
}

.story-board {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 16px;
}

.story-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
}

.story-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.story-card h3 {
  font-size: 16px;
  margin: 0;
}

.story-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
}

.story-card strong {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  justify-self: start;
  padding: 5px 8px;
}

.story-card.pass strong {
  background: var(--green-soft);
  color: var(--green);
}

.story-card.warn strong {
  background: var(--amber-soft);
  color: var(--amber);
}

.story-card.fail strong {
  background: var(--red-soft);
  color: var(--red);
}

.story-card button {
  align-self: end;
  min-height: 34px;
  padding: 7px 10px;
}

.choice-card {
  align-items: flex-start;
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--text);
  display: grid;
  gap: 8px;
  justify-items: start;
  min-height: 148px;
  padding: 16px;
  text-align: left;
}

.choice-card span {
  background: var(--blue-soft);
  border-radius: 999px;
  color: var(--blue);
  display: grid;
  font-weight: 800;
  height: 30px;
  place-items: center;
  width: 30px;
}

.choice-card strong {
  font-size: 17px;
}

.choice-card p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.summary-strip,
.plan-summary,
.apply-gates {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
}

.summary-strip article,
.plan-summary article,
.apply-gates article {
  padding: 14px;
}

.summary-strip strong,
.plan-summary strong,
.apply-gates strong {
  display: block;
  font-size: 16px;
  margin-top: 7px;
}

.setup-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.setup-item {
  padding: 16px;
}

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

.branch-panel {
  border-top: 1px dashed var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

.branch-current {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 8px;
}

.branch-current strong {
  color: var(--text);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.setup-hint {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 0;
}

.stat-chips {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 6px;
  margin: 10px 0 0;
}

.chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  padding: 4px 10px;
  white-space: nowrap;
}

.chip.good {
  background: #e8f6ee;
  border-color: #b8e2c8;
  color: #14683a;
}

.chip.warn {
  background: #fdf3e2;
  border-color: #f0d8a8;
  color: #8a5b09;
}

.chip.muted {
  color: var(--muted);
}

.chip.bad {
  background: var(--red-soft);
  border-color: #f2c4c4;
  color: var(--red);
}

.gate-group-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.03em;
  margin: 14px 0 8px;
  text-transform: uppercase;
}

.gate-group-label em {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.setup-grid.two {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.gate-tag {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.02em;
  padding: 2px 9px;
  text-transform: uppercase;
}

.gate-tag.required {
  background: #eef3fd;
  color: #1d4fb8;
}

.gate-tag.info {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

.record-toolbar {
  align-items: end;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.record-toolbar label {
  flex: 1;
}

.setup-item.gate {
  border-left: 3px solid var(--line);
}

.setup-item.gate.pass {
  border-left-color: #2f9e5f;
}

.setup-item.gate.warn {
  border-left-color: #d9930d;
}

.gate-question {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  margin: 2px 0 6px;
}

.gate-status {
  font-size: 13px;
  font-weight: 650;
  margin: 0 0 8px;
}

.story-rail {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.story-step {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-family: inherit;
  font-size: 12px;
  font-weight: 650;
  gap: 6px;
  min-height: 0;
  padding: 4px 10px;
  width: auto;
}

.story-step:hover {
  border-color: #9fb6e8;
}

.story-step em {
  background: var(--line);
  border-radius: 50%;
  color: var(--text);
  font-size: 10px;
  font-style: normal;
  font-weight: 750;
  height: 16px;
  line-height: 16px;
  text-align: center;
  width: 16px;
}

.story-step.done {
  background: #e8f6ee;
  border-color: #b8e2c8;
  color: #14683a;
}

.story-step.done em {
  background: #2f9e5f;
  color: white;
}

.story-step.next {
  background: #eef3fd;
  border-color: #bcd0f5;
  color: #1d4fb8;
}

.story-step.next em {
  background: #1d4fb8;
  color: white;
}

.advanced-panel {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  margin-top: 16px;
  padding: 0;
}

.advanced-panel > summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 12px 16px;
}

.advanced-panel[open] > summary {
  border-bottom: 1px dashed var(--line);
}

.advanced-panel > *:not(summary) {
  margin: 12px;
}

.review-handoff {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 16px;
  padding: 16px;
}

.review-handoff h4 {
  margin: 0 0 4px;
}

.record-sections {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.record-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.record-block h5 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.03em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.record-block p {
  font-size: 13px;
  margin: 4px 0;
}

.record-block code {
  font-size: 11px;
}

.record-block .mini-code {
  margin-top: 8px;
}

.check-list.compact-list {
  display: grid;
  gap: 8px;
}

.runners-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 16px;
  padding: 16px;
}

.runners-panel .record-block h5 {
  align-items: center;
  display: flex;
  gap: 8px;
  text-transform: none;
  font-size: 14px;
}

#join-token-box {
  margin-top: 12px;
}

.login-overlay {
  align-items: center;
  background: rgba(16, 24, 40, 0.55);
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 100;
}

.login-overlay[hidden] {
  display: none;
}

.login-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.25);
  display: grid;
  gap: 12px;
  padding: 28px;
  width: min(380px, 92vw);
}

.login-card h2 {
  margin: 4px 0 8px;
}

.login-card label {
  color: #344054;
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

.login-error {
  background: #fdecea;
  border: 1px solid #f5b5ad;
  border-radius: 8px;
  color: #912018;
  font-size: 13px;
  margin: 0;
  padding: 8px 10px;
}

/* Viewer role: hide write actions (server enforces regardless; this is UX). */
body.role-viewer .danger,
body.role-viewer #create-plan,
body.role-viewer #run-dry-run,
body.role-viewer #apply-change,
body.role-viewer #rollback-change,
body.role-viewer #commit-artifacts,
body.role-viewer #push-branch,
body.role-viewer #connect-git,
body.role-viewer #create-branch,
body.role-viewer #discover-device,
body.role-viewer #mint-join-token,
body.role-viewer #netbox-sync,
body.role-viewer #fleet-plan,
body.role-viewer #fleet-start,
body.role-viewer #fleet-halt,
body.role-viewer #fleet-drift-refresh {
  display: none;
}

.netbox-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
  padding: 16px;
}

.netbox-panel .config-head {
  margin-bottom: 12px;
}

.config-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 16px;
  padding: 16px;
}

.config-head {
  align-items: start;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.config-head span,
.json-editor h5,
.config-form h5 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.03em;
  margin: 0;
  text-transform: uppercase;
}

.config-head h4 {
  font-size: 18px;
  margin: 5px 0;
}

.config-head p,
.json-editor p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.button-row.compact {
  margin-top: 0;
  white-space: nowrap;
}

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

.config-form section,
.json-editor {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.config-form section {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.config-form h5 {
  grid-column: 1 / -1;
}

.json-editor {
  margin-top: 12px;
}

#config-json {
  background: var(--code);
  border-color: var(--code-line);
  color: #d8e5f8;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  min-height: 360px;
}

.setup-item h4,
.result-panel h4 {
  font-size: 17px;
  margin: 7px 0;
}

.setup-item p,
.result-panel p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0 0 12px;
}

.two-column {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
}

.form-panel,
.result-panel {
  padding: 16px;
}

.form-panel {
  display: grid;
  gap: 11px;
}

label {
  color: #344054;
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

input,
select,
textarea {
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.check-row {
  align-items: center;
  display: flex;
  gap: 8px;
}

.check-row input {
  min-height: 16px;
  width: 16px;
}

.desired-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(420px, 520px) minmax(0, 1fr);
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

legend,
.form-section h4 {
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
  margin: 0 0 10px;
}

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

.change-type-card {
  align-items: start;
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--text);
  display: grid;
  gap: 6px;
  justify-items: start;
  min-height: 118px;
  padding: 12px;
  text-align: left;
}

.change-type-card.active {
  background: var(--blue-soft);
  border-color: #b8c7f4;
}

.change-type-card span,
.change-type-card em,
.capability-strip span {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.change-type-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
}

.form-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.form-section.first {
  border-top: 0;
  padding-top: 0;
}

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

.form-grid .wide,
.form-grid .check-row {
  grid-column: 1 / -1;
}

.capability-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.capability-strip span {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  padding: 5px 8px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.code-box,
.mini-code {
  background: var(--code);
  border: 1px solid var(--code-line);
  border-radius: 8px;
  color: #d8e5f8;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  margin: 0;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}

.mini-code {
  max-height: 120px;
}

.code-box {
  min-height: 180px;
}

.code-box.tall {
  min-height: 300px;
}

.evidence-output {
  min-height: 420px;
}

.device-list {
  display: grid;
  gap: 8px;
}

.device-row {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 4px;
  grid-template-columns: 1fr auto;
  padding: 10px;
}

.device-row strong {
  font-size: 14px;
}

.device-row span,
.device-row p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.artifact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.artifact-grid article {
  min-width: 0;
  padding: 14px;
}

.investigate-layout {
  align-items: stretch;
}

.investigate-layout .result-panel {
  display: grid;
  gap: 10px;
}

.investigate-layout .mini-code {
  max-height: 220px;
  min-height: 130px;
}

.artifact-heading {
  margin-bottom: 10px;
}

.check-list {
  display: grid;
  gap: 8px;
}

.check-item {
  align-items: start;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted-2);
  border-radius: 7px;
  display: grid;
  gap: 4px;
  padding: 11px 12px;
}

.check-item.pass {
  border-left-color: var(--green);
}

.check-item.fail {
  border-left-color: var(--red);
}

.check-item strong {
  font-size: 14px;
}

.check-item p {
  color: var(--muted);
  margin: 0;
}

.apply-gates article {
  border-left: 4px solid var(--muted-2);
}

.apply-gates article.pass {
  background: var(--green-soft);
  border-left-color: var(--green);
}

.apply-gates article.fail {
  background: var(--red-soft);
  border-left-color: var(--red);
}

.apply-gates article.warn {
  background: var(--amber-soft);
  border-left-color: var(--amber);
}

.evidence-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.evidence-tab {
  background: white;
  border-color: var(--line);
  color: var(--text);
  min-height: 34px;
  padding: 7px 10px;
}

.evidence-tab.active {
  background: var(--blue-soft);
  border-color: #b8c7f4;
  color: var(--blue);
}

.outcome-panel {
  align-self: start;
  box-shadow: var(--shadow);
  padding: 18px;
  position: sticky;
  top: 22px;
}

.outcome-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.outcome-panel h3 {
  font-size: 20px;
  line-height: 1.25;
}

.outcome-panel > p {
  color: var(--muted);
  line-height: 1.45;
  margin-top: 8px;
}

.outcome-facts {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.outcome-facts article,
.next-action {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
}

.outcome-facts p {
  color: var(--text);
  line-height: 1.4;
  margin-top: 6px;
}

.next-action {
  margin-top: 12px;
}

.next-action strong {
  display: block;
  margin-top: 6px;
}

.state-pass {
  background: var(--green-soft) !important;
  border-color: #bdeccf !important;
  color: var(--green) !important;
}

.state-fail {
  background: var(--red-soft) !important;
  border-color: #ffd0d0 !important;
  color: var(--red) !important;
}

.state-warn {
  background: var(--amber-soft) !important;
  border-color: #f5d391 !important;
  color: var(--amber) !important;
}

@media (max-width: 1180px) {
  .content-shell {
    grid-template-columns: 1fr;
  }

  .outcome-panel {
    position: static;
  }

  .closed-loop-hero {
    grid-template-columns: 1fr;
  }

  .trust-boundary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .choice-grid,
  .value-strip,
  .story-board,
  .trust-boundary-strip,
  .setup-grid,
  .config-form,
  .config-form section,
  .two-column,
  .desired-layout,
  .change-type-grid,
  .form-grid,
  .artifact-grid,
  .summary-strip,
  .plan-summary,
  .apply-gates {
    grid-template-columns: 1fr;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .config-head {
    align-items: stretch;
    flex-direction: column;
  }

  .content-shell {
    padding: 14px;
  }
}

/* ---- Netcode Shell (governed SSH) ---- */
.shell-workspace {
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  gap: 16px;
  align-items: stretch;
  min-height: 520px;
}
@media (max-width: 1100px) { .shell-workspace { grid-template-columns: 1fr; } }
.shell-devices, .change-guard {
  background: var(--panel, #fff);
  border: 1px solid var(--border, #e2e5ea);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.shell-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted, #5b6472); }
.shell-field select { padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border, #d8dce3); font: inherit; }
.shell-mode-block { display: flex; flex-direction: column; gap: 8px; }
.shell-mode-label { font-size: 13px; font-weight: 600; color: var(--muted, #5b6472); }
.shell-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border, #d8dce3);
  border-radius: 12px;
  background: var(--panel-2, #f7f8fa);
}
.shell-mode-toggle button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #6b7280);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 6px;
}
.shell-mode-toggle button.active {
  background: #fff;
  color: var(--ink, #1f2733);
  box-shadow: 0 1px 5px rgba(16, 32, 51, .12);
}
.shell-mode-toggle button:disabled { opacity: .5; cursor: not-allowed; }
.shell-mode-block p { margin: 0; color: var(--muted, #6b7280); font-size: 12px; line-height: 1.45; }
.shell-session-meta p { display: flex; justify-content: space-between; gap: 8px; margin: 4px 0; font-size: 12.5px; }
.shell-session-meta span { color: var(--muted, #7a828f); }
.shell-session-meta strong { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.shell-terminal-wrap { display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; border: 1px solid #0c1a2b; background: #0b1622; min-height: 520px; }
.shell-terminal {
  flex: 1;
  margin: 0;
  padding: 16px 18px;
  overflow-y: auto;
  color: #cfe3f5;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.shell-terminal .shell-cmd { color: #eaf2fb; font-weight: 600; }
.shell-terminal .shell-out { color: #9fd0a6; }
.shell-terminal .shell-sys { color: #7fa8d0; }
.shell-terminal .shell-hint { color: #6b7d92; }
.shell-terminal .shell-block { color: #ff9d8a; font-weight: 600; }
.shell-input { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #0e1c2c; border-top: 1px solid #142638; }
.shell-prompt { color: #6fd8a4; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; white-space: nowrap; }
.shell-input input {
  flex: 1; background: transparent; border: none; outline: none;
  color: #eaf2fb; font-family: ui-monospace, Menlo, monospace; font-size: 13px;
}
.shell-input input::placeholder { color: #4d647d; }
.shell-input button { padding: 7px 16px; border-radius: 9px; border: none; background: #2f6feb; color: #fff; font-weight: 600; cursor: pointer; }
.shell-input button:disabled { opacity: .5; cursor: not-allowed; }
.change-guard h4 { margin: 0 0 4px; font-size: 15px; }
.guard-mode { align-self: flex-start; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eef1f6; color: #45505f; letter-spacing: .02em; }
.guard-mode.direct { background: #eaf8ef; color: #147944; }
.guard-mode.attached { background: #e7f0ff; color: #1d4ed8; }
.guard-mode.config { background: #fdeede; color: #9a5b12; }
.guard-facts { margin: 0; display: grid; gap: 3px; }
.guard-facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted, #8b94a2); margin-top: 10px; font-family: ui-monospace, Menlo, monospace; }
.guard-facts dd { margin: 0; font-size: 13.5px; line-height: 1.4; color: var(--ink, #1f2733); }
.device-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.device-chip.not-touched { background: #e6f5ec; color: #0b7a43; }
.device-chip.direct { background: #fff4d6; color: #876000; }
.device-chip.touched { background: #fde7e3; color: #b23b1f; }

/* ---- Netcode Shell: live xterm terminal (MVP4) ---- */
.shell-xterm { flex: 1; min-height: 480px; padding: 8px 6px 4px 10px; background: #0b1622; overflow: hidden; }
.shell-xterm .xterm { height: 100%; }
.shell-hint-bar { padding: 8px 14px; background: #0e1c2c; border-top: 1px solid #142638; color: #6b7d92; font-size: 12.5px; }

/* ---- Netcode Shell v2 (premium) ---- */
#view-shell { display: flex; flex-direction: column; gap: 14px; }
.shell-trustbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 11px 16px; border-radius: 12px;
  background: linear-gradient(90deg,#0c1a2b,#0e2233);
  border: 1px solid #17324a; color: #b9cbdc; font-size: 12.5px;
}
.shell-trustbar .tb-title { font-weight: 700; color: #eaf2fb; letter-spacing: .01em; font-size: 14px; }
.shell-trustbar .tb-item { display: inline-flex; align-items: center; gap: 7px; }
.shell-trustbar b { color: #eaf2fb; }
.shell-trustbar .tb-muted { color: #6b8299; margin-left: auto; }
.tb-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tb-dot.ok { background: #37d296; box-shadow: 0 0 0 3px rgba(55,210,150,.15); }
.tb-dot.bad { background: #e0654f; box-shadow: 0 0 0 3px rgba(224,101,79,.15); }
.tb-lock::before { content: "🔒"; font-size: 11px; }
.tb-key::before { content: "🔑"; font-size: 11px; }

.shell-workspace { grid-template-columns: 232px 1fr 292px; min-height: 560px; }
.shell-devices, .change-guard { background: var(--panel,#fff); border: 1px solid var(--border,#e2e5ea); border-radius: 16px; }
.shell-devices { padding: 18px; }
.shell-devices > button#shell-open { width: 100%; padding: 10px; font-weight: 600; border-radius: 10px; }
.shell-devices > button#shell-add-device { width: 100%; padding: 9px; font-weight: 600; border-radius: 10px; }
.shell-actions-col { display: flex; flex-direction: column; gap: 8px; }
.shell-actions-col button { width: 100%; }
.shell-help { font-size: 12px; line-height: 1.5; color: var(--muted,#6b7280); margin: 4px 0 0; padding-top: 12px; border-top: 1px solid var(--line-2,#eef0f3); }
.shell-help b { color: var(--ink,#1f2733); font-weight: 600; }

.shell-terminal-wrap { border-radius: 16px; border: 1px solid #0c1a2b; box-shadow: 0 10px 30px rgba(6,16,28,.12); }
.shell-term-titlebar {
  display: flex; align-items: center; gap: 12px; padding: 9px 14px;
  background: #0e1c2c; border-bottom: 1px solid #16283a; border-radius: 16px 16px 0 0;
}
.term-dots { display: inline-flex; gap: 6px; }
.term-dots i { width: 11px; height: 11px; border-radius: 50%; background: #26384a; display: inline-block; }
.term-dots i:nth-child(1){ background:#e0654f;} .term-dots i:nth-child(2){ background:#e0b24f;} .term-dots i:nth-child(3){ background:#37d296;}
.term-target { font-family: ui-monospace,Menlo,monospace; font-size: 12.5px; color: #9fc0dd; }
.term-state { margin-left: auto; font-family: ui-monospace,Menlo,monospace; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #5c7590; padding: 3px 9px; border-radius: 999px; background: #13273a; }
.term-state.live { color: #37d296; background: rgba(55,210,150,.12); }
.term-state.config { color: #e0b24f; background: rgba(224,178,79,.12); }
.shell-xterm { min-height: 470px; border-radius: 0; }

.change-guard { padding: 18px; gap: 0; }
.guard-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.guard-head h4 { margin: 0; font-size: 15px; }
.guard-mode { padding: 5px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: #eef1f6; color: #45505f; letter-spacing: .02em; }
.guard-mode.direct { background: #eaf8ef; color: #147944; }
.guard-mode.read { background: #e6f0fb; color: #1f5fb0; }
.guard-mode.attached { background: #e7f0ff; color: #1d4ed8; }
.guard-mode.config { background: #fdeede; color: #9a5b12; }
.guard-devicebox { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 12px; background: var(--panel-2,#f7f8fa); border: 1px solid var(--line-2,#eef0f3); margin-bottom: 8px; }
.guard-devicebox-label { font-size: 12px; color: var(--muted,#6b7280); font-weight: 600; }
.guard-facts dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted,#8b94a2); margin-top: 14px; font-family: ui-monospace,Menlo,monospace; }
.guard-facts dd { margin: 3px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--ink,#1f2733); }
.shell-hint-bar b { color: #b9cbdc; }

/* Attach-change picker modal */
.nc-modal-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgb(11 22 34 / 45%); backdrop-filter: blur(3px); padding: 24px; }
.nc-modal { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 14px; box-shadow: 0 24px 60px rgb(16 32 51 / 28%); overflow: hidden; }
.nc-modal-wide { max-width: 680px; }
.nc-modal-head { padding: 20px 22px 12px; border-bottom: 1px solid var(--line); }
.nc-modal-head h3 { margin: 0 0 6px; font-size: 16px; color: var(--text); }
.nc-modal-head p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.nc-modal-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.nc-modal-body.manual-device-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 720px) { .nc-modal-body.manual-device-grid { grid-template-columns: 1fr; } }
.nc-field { display: flex; flex-direction: column; gap: 6px; }
.nc-field > span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); font-weight: 600; }
.nc-field select, .nc-field input { padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 9px;
  font-size: 13.5px; color: var(--text); background: var(--surface-soft); }
.nc-field select:focus, .nc-field input:focus { outline: none; box-shadow: var(--focus); border-color: var(--blue); }
.nc-or { text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); }
.nc-modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; }

/* Fleet rollout view */
.fleet-layout { align-items: start; }
.field-row { display: flex; gap: 12px; }
.field-row label { flex: 1; }
.fleet-halt-banner { margin: 10px 0; padding: 10px 14px; border-radius: 10px; background: var(--red-soft);
  border: 1px solid #f2c4c4; color: var(--red); font-size: 13px; font-weight: 600; }
.fleet-waves { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.fleet-wave { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-soft); }
.fleet-wave.current { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(21 94 239 / 10%); }
.fleet-wave-label { min-width: 72px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); padding-top: 5px; }
.fleet-wave-devices { display: flex; flex-wrap: wrap; gap: 6px; }
.fleet-device { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 12px; font-weight: 600; color: var(--text); cursor: pointer; }
.fleet-device.passed { background: var(--green-soft); border-color: #b7e4c7; color: var(--green); }
.fleet-device.running { background: var(--blue-soft); border-color: #c2d6ff; color: var(--blue); }
.fleet-device.failed { background: var(--red-soft); border-color: #f2c4c4; color: var(--red); }
.fleet-device.skipped, .fleet-device.pending { color: var(--muted-2); }
.fleet-device.blocked { background: var(--amber-soft); border-color: #ecd3a8; color: var(--amber); }
.fleet-drift-bar { display: flex; align-items: center; gap: 14px; margin: 6px 0 12px; }
.fleet-drift-table { display: flex; flex-direction: column; gap: 6px; }
.fleet-drift-row { display: grid; grid-template-columns: 130px 130px 1fr; align-items: center; gap: 12px;
  padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.fleet-drift-row strong { font-size: 13px; }
.fleet-drift-msg { font-size: 12.5px; color: var(--muted); }

/* Fleet approval + drift watch controls */
.fleet-watch-label { align-items: center; color: var(--muted); display: inline-flex; font-size: 12.5px; font-weight: 600; gap: 6px; }
.fleet-watch-label select { border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 8px; }
#fleet-approver-row input { width: 100%; }
