:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --ink: #172033;
  --muted: #667386;
  --line: #d8dee8;
  --panel: #ffffff;
  --panel-soft: #f9fbfd;
  --nav: #101828;
  --nav-muted: #a8b2c1;
  --blue: #1f5f99;
  --blue-soft: #e8f2fb;
  --green: #0f766e;
  --green-soft: #e5f5f1;
  --amber: #946200;
  --amber-soft: #fff4d7;
  --red: #a12c2c;
  --red-soft: #fdecec;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 21px;
  font-weight: 760;
}

h2 {
  font-size: 16px;
  font-weight: 760;
}

h3 {
  font-size: 14px;
  font-weight: 720;
}

p,
.muted,
a {
  color: var(--muted);
}

a {
  text-decoration: none;
}

a:hover {
  color: var(--blue);
}

button {
  min-height: 36px;
  border: 1px solid #1d578c;
  border-radius: 6px;
  background: var(--blue);
  color: #ffffff;
  padding: 0 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button.secondary,
.icon-button {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.icon-button {
  min-width: 66px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}

input {
  min-height: 38px;
  padding: 0 12px;
}

textarea {
  min-height: 360px;
  resize: vertical;
  padding: 14px;
  font:
    13px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  line-height: 1.45;
}

input:focus,
textarea:focus,
button:focus {
  outline: 2px solid #9cc5ef;
  outline-offset: 2px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  background: var(--nav);
  color: #ffffff;
  padding: 20px 16px;
}

.brand {
  display: grid;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.nav {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 18px 0;
}

.nav a {
  min-height: 36px;
  border-radius: 6px;
  color: var(--nav-muted);
  padding: 9px 10px;
  font-size: 14px;
  font-weight: 650;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sidebar-meta {
  color: var(--nav-muted);
  font-size: 12px;
  line-height: 1.4;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  padding: 16px 28px;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

main {
  width: min(1240px, calc(100vw - 284px));
  margin: 0 auto;
  padding: 20px 24px 48px;
}

.band,
.auth-panel {
  padding: 18px 0;
}

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

.compact-title {
  margin-bottom: 10px;
}

.auth-panel {
  border-bottom: 1px solid var(--line);
}

.next-hub-auth {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  max-width: 680px;
}

.auth-grid label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.hidden {
  display: none;
}

.dimmed {
  opacity: 0.42;
  pointer-events: none;
}

.callback-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: var(--bg);
}

.callback-state {
  width: min(320px, calc(100vw - 40px));
  text-align: center;
}

.callback-state h1 {
  margin: 0 0 10px;
  font-size: 24px;
}

.callback-state p {
  margin: 0 0 16px;
  color: var(--muted);
}

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

.metric,
.item,
.connection-item,
.flow-step,
.setup-panel,
.empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.metric {
  min-height: 86px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.metric.blue {
  border-color: #bfd6ee;
  background: var(--blue-soft);
}

.metric.amber {
  border-color: #ead18f;
  background: var(--amber-soft);
}

.metric.red {
  border-color: #e8b8b8;
  background: var(--red-soft);
}

.ops-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 12px;
  align-items: start;
  margin-top: 12px;
}

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

.flow-step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 96px;
}

.flow-step > span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #223041;
  color: #ffffff;
  font-size: 13px;
  font-weight: 760;
}

.flow-step p,
.setup-row p,
.item p {
  margin-top: 5px;
  overflow-wrap: anywhere;
}

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

.setup-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--muted);
}

.dot.pass {
  background: var(--green);
}

.dot.warn {
  background: var(--amber);
}

.dot.fail {
  background: var(--red);
}

.connection,
.readiness {
  display: grid;
  gap: 12px;
}

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

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

.connection-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.connection-item code,
.readiness code {
  display: block;
  margin-top: 8px;
  min-height: 40px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  padding: 9px;
  color: #223041;
  font-size: 12px;
}

.grid,
.split-grid {
  display: grid;
  gap: 20px;
  padding: 18px 0;
}

.grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.split-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
}

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

.item.compact {
  padding: 12px;
}

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

.tag,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

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

.tag.warn,
.status.warn {
  color: var(--amber);
  border-color: #e1c574;
  background: var(--amber-soft);
}

.tag.fail,
.status.fail {
  color: var(--red);
  border-color: #e7b5b5;
  background: var(--red-soft);
}

.tag.pass,
.status.pass {
  color: var(--green);
  border-color: #b6ded6;
  background: var(--green-soft);
}

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

.empty.flat {
  border: 0;
  background: transparent;
  padding: 0;
}

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

.audit div {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.audit div:first-child {
  border-top: 0;
}

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

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

  .sidebar {
    position: static;
    height: auto;
    grid-template-rows: auto auto;
  }

  .brand {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .nav {
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
  }

  .nav a {
    flex: 0 0 auto;
  }

  .sidebar-meta {
    display: none;
  }

  main {
    width: min(1240px, calc(100vw - 32px));
  }
}

@media (max-width: 980px) {
  .metrics,
  .ops-layout,
  .flow,
  .connection,
  .readiness,
  .grid,
  .split-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .topbar {
    display: grid;
    padding: 16px;
  }

  main {
    padding: 16px 16px 36px;
  }

  .topbar-actions,
  .auth-grid,
  .connection-item,
  .audit div {
    grid-template-columns: 1fr;
  }

  .metrics {
    gap: 10px;
  }
}
