:root {
  color-scheme: dark;
  --bg: #0a1428;
  --surface: #111d31;
  --surface-2: #172640;
  --line: rgba(79, 209, 255, 0.2);
  --text: #f4f7fb;
  --muted: #9fb0c2;
  --accent: #00cfff;
  --accent-strong: #4fd1ff;
  --bronze: #c7a15a;
  --bronze-soft: #efd08a;
  --green: #3ecf8e;
  --red: #ef6461;
  --yellow: #f2c94c;
  --gray: #8b98a8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 14% 8%, rgba(0, 207, 255, 0.11), transparent 28rem),
    linear-gradient(145deg, #050b16, var(--bg) 54%, #071225);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code,
pre,
input,
select {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(5, 11, 22, 0.92);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 800;
  border-radius: 8px;
  box-shadow: 0 0 24px rgba(0, 207, 255, 0.16);
}

.brand strong,
.brand span,
.operator strong,
.operator span,
.operator em {
  display: block;
}

.brand span,
.operator span,
.operator em {
  color: var(--muted);
  font-size: 12px;
}

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

.nav a {
  color: var(--muted);
  padding: 10px 12px;
  border: 1px solid transparent;
}

.nav a.active,
.nav a:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface);
  text-decoration: none;
}

.operator {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.primary-team-pill {
  padding: 12px;
  border: 1px solid rgba(199, 161, 90, 0.42);
  border-radius: 8px;
  background: rgba(199, 161, 90, 0.08);
}

.primary-team-pill span,
.primary-team-pill strong {
  display: block;
}

.primary-team-pill span {
  color: var(--bronze-soft);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.primary-team-pill strong {
  margin-top: 4px;
}

.logout-form {
  margin-top: 12px;
}

.logout-form button {
  width: 100%;
}

.content {
  padding: 28px;
  min-width: 0;
}

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

.page-subtitle {
  max-width: 780px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

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

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: clamp(28px, 3vw, 46px);
  text-transform: uppercase;
}

h2 {
  font-size: 16px;
  margin-bottom: 14px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.cards.compact {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 0;
}

.metric,
.panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
    var(--surface);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

.metric {
  padding: 18px;
}

.metric span,
.metric small {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.console-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 16px;
  align-items: stretch;
  border-color: rgba(0, 207, 255, 0.34);
}

.console-hero > div {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(5, 11, 22, 0.34);
}

.console-hero span {
  color: var(--muted);
}

.console-hero strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(20px, 2.2vw, 32px);
}

.system-status {
  border-color: rgba(0, 207, 255, 0.36);
}

.status-cards {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  margin-bottom: 0;
}

.status-card {
  min-height: 138px;
}

.status-card strong {
  overflow-wrap: anywhere;
}

.legacy-summary {
  display: none;
}

.metric strong.small {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.metric small {
  display: block;
  margin-top: 6px;
}

.freshness {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.freshness::before {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  content: "";
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}

.freshness-green {
  color: var(--green);
}

.freshness-yellow {
  color: var(--yellow);
}

.freshness-red {
  color: var(--red);
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

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

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

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.copy-command {
  display: block;
  margin-top: 10px;
  padding: 10px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  background: rgba(8, 14, 26, 0.82);
}

.dependency-list,
.readiness-list {
  display: grid;
  gap: 12px;
}

.dependency-card,
.readiness-row {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 26, 0.72);
}

.dependency-card p,
.readiness-row p {
  margin: 6px 0 0;
  color: var(--muted);
}

.readiness-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.runbook-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td code {
  color: #d7e9fa;
}

.actions {
  min-width: 360px;
}

.actions form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 4px 6px 0;
}

.filters form,
.form-panel form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.form-panel .field {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.form-panel .span-two {
  grid-column: span 2;
}

.form-panel [hidden] {
  display: none !important;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.role-checks {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
}

.role-checks legend {
  color: var(--muted);
}

.role-checks label,
.check-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.toggle-field {
  display: flex;
  align-items: end;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.toggle-field legend {
  width: 100%;
  margin-bottom: 6px;
  color: var(--muted);
}

.toggle-field label {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}

.toggle-field input {
  width: auto;
  min-height: auto;
  accent-color: var(--accent);
}

.toggle-field label:has(input:checked) {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 18px rgba(0, 207, 255, 0.16);
}

.role-checks.compact {
  flex-wrap: wrap;
  padding: 0;
  border: 0;
}

.check-field.compact {
  margin: 4px 0;
}

.stacked-form {
  display: grid;
  gap: 8px;
  min-width: 260px;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.inline-form input {
  min-width: 180px;
}

input,
select,
button,
.button {
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 10px;
  min-height: 38px;
}

input,
select {
  width: 100%;
}

input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

button,
.button {
  cursor: pointer;
  font-weight: 700;
}

button:hover,
.button:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.button.primary,
button.primary {
  background: linear-gradient(180deg, var(--accent-strong), #00a4dc);
  border-color: var(--accent);
  color: #07111c;
}

.run-button {
  min-width: min(100%, 240px);
  min-height: 46px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  box-shadow: 0 0 28px rgba(0, 207, 255, 0.2);
}

button.danger {
  border-color: rgba(239, 100, 97, 0.7);
  color: var(--red);
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background:
    radial-gradient(circle at 18% 12%, rgba(113, 175, 229, 0.14), transparent 32rem),
    linear-gradient(150deg, #06101f, var(--bg));
}

.auth-card {
  width: min(440px, calc(100% - 32px));
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(22, 33, 49, 0.92);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

.auth-card h1 {
  margin-bottom: 8px;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

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

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.success,
.healthy,
.health-healthy {
  color: var(--green);
}

.failed,
.critical,
.health-critical {
  color: var(--red);
}

.running,
.health-unknown {
  color: var(--accent);
}

.partial,
.warning,
.health-warning {
  color: var(--yellow);
}

.queued,
.cancelled,
.unknown {
  color: var(--gray);
}

.flash {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.04);
}

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

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.json-preview,
.json-view {
  overflow: auto;
  max-height: 70vh;
  padding: 14px;
  border: 1px solid var(--line);
  background: #09101a;
  color: #d7e9fa;
}

.truncate {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.result.ok {
  border-color: rgba(62, 207, 142, 0.7);
}

.result.bad {
  border-color: rgba(239, 100, 97, 0.7);
}

.job-progress {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 20, 30, 0.78);
}

.job-progress-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.job-id {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.job-status {
  text-transform: uppercase;
}

.job-percent,
.job-message {
  color: var(--muted);
}

.job-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.progress {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #1c2a44;
  border: 1px solid rgba(113, 175, 229, 0.22);
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b8fc6, #71afe5, #9bd5ff);
  transition: width 300ms ease;
}

.job-message {
  margin-top: 10px;
}

.job-result {
  min-height: 0;
  max-height: 220px;
  margin: 10px 0 0;
  padding: 0;
  overflow: auto;
  border: 0;
  background: transparent;
  color: #d7e9fa;
  white-space: pre-wrap;
}

.job-result:empty {
  display: none;
}

.inline-note {
  margin: 14px 0 0;
  color: var(--muted);
}

.control-plane {
  border-color: rgba(199, 161, 90, 0.38);
}

.runtime-control {
  border-color: rgba(62, 207, 142, 0.34);
}

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

.runtime-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 800;
}

.runtime-toggle input {
  width: auto;
  min-height: auto;
  accent-color: var(--green);
}

.runtime-action-row {
  align-items: center;
}

.compact-detail-list {
  margin-top: 12px;
  grid-template-columns: 90px minmax(0, 1fr);
}

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

.control-module {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 26, 0.56);
}

.control-module.wide {
  grid-column: 1 / -1;
}

.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.module-header h3,
.control-module h4 {
  margin: 0;
  line-height: 1.25;
}

.module-header h3 {
  font-size: 15px;
}

.control-module h4 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.control-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 200px));
  gap: 12px;
  align-items: end;
}

.compact-field,
.compact-select,
.compact-input {
  max-width: 200px;
}

.compact-run-button {
  width: min(200px, 100%);
  min-width: 0;
}

.control-inline {
  flex-wrap: wrap;
}

.control-inline input {
  max-width: 180px;
}

.compact-table-wrap {
  max-height: 320px;
  overflow: auto;
}

.health-control-cards {
  margin-bottom: 14px;
}

.control-health-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
  gap: 14px;
}

.warning-list {
  display: grid;
  gap: 10px;
}

.warning-card {
  padding: 10px;
  border: 1px solid rgba(242, 201, 76, 0.38);
  border-radius: 8px;
  background: rgba(242, 201, 76, 0.07);
}

.warning-card strong {
  color: var(--yellow);
  text-transform: uppercase;
  font-size: 12px;
}

.warning-card p {
  margin: 6px 0 0;
}

.warning-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.log-viewer {
  min-height: 220px;
  max-height: 360px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #08101d;
  color: #d7e9fa;
  white-space: pre-wrap;
}

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

  .sidebar {
    position: static;
  }

  .page-header,
  .grid.two,
  .console-hero {
    display: block;
  }

  .page-header > * + * {
    margin-top: 14px;
  }

  .readiness-row {
    display: grid;
  }

  .runtime-control-grid,
  .control-plane-grid,
  .control-health-grid {
    grid-template-columns: 1fr;
  }

  .control-module.wide {
    grid-column: auto;
  }

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

@media (max-width: 1180px) {
  .status-cards {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}
