:root {
  color-scheme: light;
  --bg: #f7f7f2;
  --surface: #fffffb;
  --surface-muted: #f0f0ea;
  --surface-strong: #e7e7df;
  --ink: #10110f;
  --ink-soft: #282b27;
  --muted: #686c63;
  --line: #d7d7ce;
  --line-strong: #a9aaa0;
  --accent: #3157ff;
  --accent-soft: #ecefff;
  --green: #3157ff;
  --amber: #8a5a00;
  --red: #a92e42;
  --violet: #5b50b8;
  --font-mono:
    ui-monospace, "SFMono-Regular", "Cascadia Code", "Roboto Mono", "IBM Plex Mono", Menlo,
    Consolas, "Liberation Mono", monospace;
  --focus: 0 0 0 3px rgba(49, 87, 255, 0.18);
  --radius: 6px;
  font-family: var(--font-mono);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 0 28px;
  background: rgba(247, 247, 242, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.brand.button {
  min-height: 44px;
  padding: 4px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.brand.button:hover {
  background: var(--surface);
  border-color: var(--line);
}

.logo-mark {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
}

.logo-mark::before {
  position: absolute;
  inset: 8px 10px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  content: "";
}

.logo-mark::after {
  position: absolute;
  width: 2px;
  height: 30px;
  background: var(--accent);
  content: "";
  transform: rotate(39deg);
}

.account {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.account-email {
  overflow: hidden;
  max-width: 260px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-role {
  min-height: 26px;
  padding: 5px 8px;
  color: var(--violet);
  background: var(--surface);
  border: 1px solid rgba(91, 80, 184, 0.35);
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.page {
  width: min(1160px, calc(100vw - 48px));
  margin: 28px auto 52px;
}

.page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 34ch;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 34px;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.25;
  letter-spacing: 0;
}

.lede {
  max-width: 78ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid > * {
  min-width: 0;
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr);
  align-items: start;
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.endpoint-card,
.empty-state,
.signin-panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}

.panel {
  padding: 18px;
}

.panel.compact {
  padding: 14px;
}

.endpoint-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.endpoint-card:hover {
  border-color: var(--ink);
}

.empty-state,
.signin-panel {
  padding: 28px;
}

.empty-state {
  display: grid;
  gap: 16px;
  min-height: 260px;
  align-content: center;
}

.signin-wrap {
  display: grid;
  width: min(900px, calc(100vw - 40px));
  min-height: calc(100vh - 64px);
  margin: 0 auto;
  place-items: center;
}

.signin-panel {
  position: relative;
  width: 100%;
}

.signin-panel::before {
  position: absolute;
  inset: -1px auto -1px -1px;
  width: 5px;
  background: var(--ink);
  content: "";
}

.form {
  display: grid;
  gap: 14px;
}

.oauth-stack {
  display: grid;
  gap: 8px;
  margin: 22px 0 16px;
}

.oauth-button {
  width: 100%;
  min-height: 44px;
  justify-content: flex-start;
  gap: 10px;
}

.button.oauth-button {
  justify-content: flex-start;
}

.oauth-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--ink);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 800;
}

.signin-divider {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 16px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.signin-divider::before,
.signin-divider::after {
  height: 1px;
  background: var(--line);
  content: "";
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.field input:hover {
  border-color: var(--ink);
}

.field-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: none;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

.button:hover {
  background: var(--surface-muted);
  border-color: var(--ink);
}

.button.primary {
  color: var(--surface);
  background: var(--ink);
  border-color: var(--ink);
}

.button.primary:hover {
  color: var(--surface);
  background: var(--accent);
  border-color: var(--accent);
}

.button.subtle {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(49, 87, 255, 0.35);
}

.button.danger {
  color: var(--red);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 7px;
  min-height: 26px;
  padding: 4px 8px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.status::before {
  width: 7px;
  height: 7px;
  background: var(--muted);
  border-radius: 50%;
  content: "";
}

.status.connected {
  color: var(--green);
  background: #eef1ff;
  border-color: rgba(49, 87, 255, 0.28);
}

.status.connected::before {
  background: var(--green);
}

.status.waiting {
  color: var(--amber);
  background: #fbf5e6;
  border-color: rgba(138, 90, 0, 0.28);
}

.status.waiting::before {
  background: var(--amber);
}

.status.error,
.status.disconnected {
  color: var(--red);
  background: #fbebee;
  border-color: rgba(169, 46, 66, 0.26);
}

.status.error::before,
.status.disconnected::before {
  background: var(--red);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  min-height: 82px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric-value {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}

.metric-label {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.codebox {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 14px;
  overflow: auto;
  color: #f5fbf8;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
}

.codebox code,
.codebox pre {
  margin: 0;
  color: inherit;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.codebox .button {
  justify-self: start;
  color: var(--surface);
  background: transparent;
  border-color: rgba(255, 255, 251, 0.34);
}

.codebox .button:hover {
  color: var(--ink);
  background: var(--surface);
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.copy-value {
  min-width: 0;
  min-height: 36px;
  padding: 9px 10px;
  overflow: hidden;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-steps {
  display: grid;
  gap: 12px;
  counter-reset: steps;
}

.wizard-step {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 16px 16px 16px 50px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.wizard-step::before {
  position: absolute;
  top: 16px;
  left: 16px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--surface);
  background: var(--ink);
  border-radius: var(--radius);
  content: counter(steps);
  counter-increment: steps;
  font-size: 11px;
  font-weight: 800;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tab {
  min-height: 32px;
  padding: 7px 9px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.tab:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.tab.active {
  color: var(--surface);
  background: var(--ink);
  border-color: var(--ink);
}

.preset-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.preset-button {
  display: grid;
  min-height: 70px;
  align-content: center;
  justify-items: start;
  text-align: left;
  text-transform: none;
}

.preset-button small {
  margin-top: 4px;
  color: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0.72;
}

.preset-button:disabled {
  opacity: 1;
}

.table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  padding: 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: var(--surface-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--surface-muted);
}

.tool-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.notice {
  padding: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  line-height: 1.5;
}

.notice.warn {
  color: var(--amber);
  background: #fbf5e6;
  border-color: rgba(138, 90, 0, 0.28);
}

.notice.error {
  color: var(--red);
  background: #fbebee;
  border-color: rgba(169, 46, 66, 0.26);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
    padding: 12px 16px;
  }

  .brand {
    align-items: center;
  }

  .account {
    width: 100%;
    justify-content: space-between;
  }

  .account-email {
    max-width: min(56vw, 280px);
  }

  .page {
    width: min(100vw - 28px, 1160px);
    margin-top: 20px;
  }

  .page-header {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .grid.two,
  .grid.three,
  .preset-bar,
  .metric-strip {
    grid-template-columns: 1fr;
  }

  .signin-wrap {
    width: min(100vw - 28px, 900px);
  }

  .copy-row {
    grid-template-columns: 1fr;
  }

  .copy-row .button {
    width: 100%;
  }

  .codebox .button {
    justify-self: stretch;
  }

  h1 {
    font-size: 28px;
  }
}

@media (max-width: 560px) {
  .panel,
  .endpoint-card,
  .empty-state,
  .signin-panel {
    padding: 16px;
  }

  .wizard-step {
    padding: 48px 14px 14px;
  }

  .wizard-step::before {
    top: 14px;
    left: 14px;
  }

  .actions .button,
  .page-header > .button {
    width: 100%;
  }
}
