:root {
  --canvas: #ffffff;
  --surface: #ffffff;
  --surface-subtle: #f6f7f8;
  --sidebar: #17181a;
  --sidebar-active: #2a2b2f;
  --ink: #161719;
  --muted: #65686e;
  --line: #dfe1e5;
  --line-strong: #c8cbd1;
  --plum: #7a2e72;
  --teal: #0c7570;
  --teal-soft: #edf8f6;
  --amber: #a35b00;
  --amber-soft: #fff6e8;
  --red: #b4232f;
  --red-soft: #fff1f2;
  --blue-soft: #edf5ff;
  --blue: #245c99;
  --radius: 6px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--canvas); }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
}

button,
input,
select { font: inherit; }

button,
input,
select { letter-spacing: 0; }

button { cursor: pointer; }

button:disabled { cursor: default; opacity: 0.52; }

button[type="submit"]:disabled {
  border-color: var(--line-strong);
  background: #e8e9ec;
  color: #777a80;
  opacity: 1;
}

.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: #f3f4f6;
  padding: 24px;
}

.login-panel {
  width: min(100%, 390px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 32px;
  box-shadow: 0 16px 48px rgba(17, 18, 20, 0.09);
}

.brand-lockup {
  display: grid;
  width: fit-content;
  color: var(--plum);
  line-height: 1;
}

.brand-lockup strong { font-size: 21px; font-weight: 800; }
.brand-lockup span { margin-top: 3px; color: inherit; font-size: 10px; font-weight: 700; letter-spacing: 0.18em; }

.login-panel h1 {
  margin: 30px 0 22px;
  font-size: 28px;
  line-height: 1.15;
}

form { display: grid; gap: 16px; }

label { display: grid; gap: 7px; color: #3f4247; font-size: 13px; font-weight: 700; }

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  padding: 8px 10px;
  color: var(--ink);
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid rgba(12, 117, 112, 0.35);
  outline-offset: 2px;
}

button {
  min-height: 38px;
  border: 1px solid var(--plum);
  border-radius: 4px;
  background: var(--plum);
  padding: 8px 13px;
  color: #fff;
  font-size: 13px;
  font-weight: 750;
}

button:hover:not(:disabled) { filter: brightness(0.94); }

button.secondary {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--ink);
}

button.danger { border-color: var(--red); background: var(--red); }

.form-status,
.global-status { min-height: 20px; margin: 14px 0 0; color: var(--red); font-weight: 700; }

.app-shell {
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  height: 100vh;
  grid-template-rows: auto 1fr auto;
  background: var(--sidebar);
  color: #fff;
}

.sidebar-brand { margin: 24px 22px 30px; color: #d16bc6; }
.sidebar-brand span { color: #fff; }

.sidebar nav { display: grid; align-content: start; gap: 4px; padding: 0 8px; }

.nav-item {
  display: flex;
  min-height: 44px;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 0 16px;
  color: #e9eaec;
  text-align: left;
}

.nav-item.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 #c55fba; }

.sidebar-status {
  display: grid;
  gap: 4px;
  margin: 0 16px 18px;
  border-top: 1px solid #33353a;
  padding: 16px 6px 0;
  color: #aeb1b7;
  font-size: 12px;
}

.sidebar-status strong { color: #76c8bd; }

.workbench { min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  padding: 10px 24px;
}

.topbar h1 { margin: 0; font-size: 20px; line-height: 1.2; }
.topbar > div:first-child span { color: var(--muted); font-size: 12px; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.operator { margin-right: 8px; color: var(--muted); font-size: 12px; }

.global-status {
  min-height: auto;
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: var(--amber-soft);
  padding: 10px 24px;
  color: var(--amber);
}

.global-status.success { background: var(--teal-soft); color: var(--teal); }
.global-status.error { background: var(--red-soft); color: var(--red); }

.view { min-width: 0; }

.service-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 360px) 180px;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 12px 18px;
}

.service-toolbar input,
.service-toolbar select { min-height: 36px; }

.service-workspace {
  display: grid;
  grid-template-columns: minmax(650px, 1fr) minmax(340px, 420px);
  min-height: 480px;
  border-bottom: 1px solid var(--line);
}

.service-list-wrap,
.audit-table-wrap { min-width: 0; overflow: auto; }

table { width: 100%; border-collapse: collapse; }

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #fbfbfc;
  color: #4d5056;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

td { font-size: 12px; }

.service-table tbody tr { cursor: pointer; }
.service-table tbody tr:hover { background: #fafbfc; }
.service-table tbody tr.selected { background: var(--blue-soft); box-shadow: inset 3px 0 0 var(--teal); }

.service-name { min-width: 170px; font-weight: 800; }
.status-text { font-weight: 800; text-transform: capitalize; }
.status-text.active,
.status-text.healthy,
.status-text.applied { color: var(--teal); }
.status-text.notice,
.status-text.limited,
.status-text.read-only,
.status-text.pending,
.status-text.retrying,
.status-text.stale { color: var(--amber); }
.status-text.suspended,
.status-text.degraded,
.status-text.drifted,
.status-text.failed { color: var(--red); }
.status-text.unknown,
.status-text.unconfigured,
.status-text.superseded { color: var(--muted); }

.service-inspector {
  min-width: 0;
  border-left: 1px solid var(--line);
  background: #fff;
  padding: 18px;
}

.inspector-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.inspector-heading h2 { margin: 0; font-size: 18px; }
.inspector-heading span { color: var(--muted); font-size: 12px; }

.service-facts,
.definition-list { display: grid; gap: 0; margin: 18px 0; }
.service-facts div,
.definition-list div { display: grid; grid-template-columns: 135px minmax(0, 1fr); gap: 12px; padding: 7px 0; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

.state-control { border-top: 1px solid var(--line); padding-top: 16px; }
.state-control h3 { margin: 0 0 10px; font-size: 13px; }

.mode-options {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.mode-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  cursor: pointer;
}

.mode-option:last-child { border-bottom: 0; }
.mode-option:has(input:checked) { background: var(--teal-soft); }
.mode-option:has(input:focus-visible) { outline: 2px solid rgba(12, 117, 112, 0.35); outline-offset: -2px; }
.mode-option input { width: 16px; min-height: auto; margin: 2px 0 0; accent-color: var(--teal); }
.mode-option strong { display: block; margin-bottom: 2px; text-transform: capitalize; }
.mode-option span { color: var(--muted); font-size: 11px; font-weight: 500; }
.mode-option.suspended strong { color: var(--red); }

.impact-notice {
  margin: 12px 0;
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  background: var(--amber-soft);
  padding: 10px 12px;
  color: #6e4309;
  font-size: 12px;
  font-weight: 700;
}

.impact-notice.danger { border-color: var(--red); background: var(--red-soft); color: var(--red); }

.inspector-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

.delivery-warning {
  margin: 12px 0 0;
  border-left: 3px solid var(--red);
  background: var(--red-soft);
  padding: 9px 10px;
  color: var(--red);
  font-size: 12px;
}

.audit-band,
.page-section { padding: 0 18px 22px; }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0 10px; }
.section-heading h2 { margin: 0; font-size: 15px; }
.section-heading span { color: var(--muted); font-size: 12px; }

.audit-table th,
.audit-table td { padding: 9px 10px; }
.audit-table td:last-child { min-width: 260px; }

.empty-state { padding: 28px 18px; color: var(--muted); text-align: center; }
.compact-page { max-width: 720px; }
.compact-page .definition-list { border-top: 1px solid var(--line); }
.compact-page .definition-list div { border-bottom: 1px solid var(--line); padding: 14px 4px; }

@media (max-width: 1120px) {
  .service-workspace { grid-template-columns: minmax(0, 1fr); }
  .service-inspector { border-top: 1px solid var(--line); border-left: 0; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; grid-template-rows: auto auto; }
  .sidebar-brand { margin-bottom: 18px; }
  .sidebar nav { grid-template-columns: repeat(4, minmax(0, 1fr)); padding-bottom: 8px; }
  .nav-item { justify-content: center; min-height: 40px; padding: 0 6px; font-size: 12px; }
  .nav-item.active { box-shadow: inset 0 -3px 0 #c55fba; }
  .sidebar-status { display: none; }
  .topbar { position: static; align-items: flex-start; padding: 12px; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .operator { width: 100%; margin: 0; text-align: right; }
  .service-toolbar { grid-template-columns: 1fr; padding: 10px 12px; }
  .service-list-wrap { max-width: 100vw; }
  .service-inspector { padding: 16px 12px; }
  .audit-band,
  .page-section { padding-right: 12px; padding-left: 12px; }
  .service-facts div,
  .definition-list div { grid-template-columns: 110px minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .login-panel { padding: 24px 20px; }
  .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { display: grid; }
  .topbar-actions { justify-content: flex-start; }
  .operator { text-align: left; }
  .inspector-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
