:root {
  color-scheme: light;
  --canvas: #eef2ec;
  --paper: #fbfcf8;
  --ink: #202a24;
  --muted: #718077;
  --line: #d2dbd1;
  --line-strong: #b8c5b9;
  --forest: #253a2e;
  --leaf: #b7e66b;
  --leaf-deep: #5b842c;
  --coral: #c75d46;
  --blue: #486d89;
  --mono: "IBM Plex Mono", Consolas, monospace;
  --sans: "DM Sans", "Aptos", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: var(--canvas);
  background-image: linear-gradient(rgba(53, 83, 62, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53, 83, 62, 0.035) 1px, transparent 1px);
  background-size: 30px 30px;
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(91, 132, 44, 0.4);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: min(1220px, calc(100% - 80px));
  min-height: 100vh;
  margin: 0 auto;
}

.topbar {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 9px 8px;
  background: var(--leaf);
  border: 1px solid rgba(32, 42, 36, 0.12);
  border-radius: 4px;
}

.brand-mark i {
  width: 4px;
  background: var(--forest);
  border-radius: 1px 1px 0 0;
}

.brand-mark i:nth-child(1) {
  height: 8px;
}

.brand-mark i:nth-child(2) {
  height: 14px;
}

.brand-mark i:nth-child(3) {
  height: 10px;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 12px;
  font-weight: 700;
}

.brand-copy small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.local-badge,
.connection-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

.status-dot,
.footer-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  background: var(--coral);
  border-radius: 50%;
}

.local-badge .status-dot {
  background: var(--leaf-deep);
  box-shadow: 0 0 0 3px rgba(91, 132, 44, 0.12);
}

.page-intro {
  min-height: 164px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 0 26px;
}

.eyebrow,
.panel-kicker,
.output-heading,
.route-summary span,
.sample-language,
.sample-title,
.page-footer,
.empty-label,
.empty-coordinates {
  font-family: var(--mono);
  font-size: 10px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 10px;
  color: var(--muted);
}

.eyebrow span {
  width: 18px;
  height: 2px;
  display: inline-block;
  background: var(--coral);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.16;
}

.connection-pill[data-state="ready"] {
  color: var(--forest);
  border-color: #a8bf93;
  background: rgba(183, 230, 107, 0.2);
}

.connection-pill[data-state="ready"] .status-dot {
  background: var(--leaf-deep);
}

.connection-pill[data-state="error"] {
  color: #8f3d2f;
  border-color: #dda99e;
  background: #fff5f1;
}

.alert {
  margin: 0 0 16px;
  padding: 12px 14px;
  color: #8f3d2f;
  border: 1px solid #dda99e;
  background: #fff5f1;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  border: 1px solid var(--line-strong);
  background: rgba(251, 252, 248, 0.92);
  box-shadow: 0 22px 56px rgba(39, 59, 43, 0.07);
}

.setup-panel,
.client-panel {
  min-width: 0;
  padding: 34px 38px 38px;
}

.client-panel {
  border-left: 1px solid var(--line);
  background: rgba(245, 248, 242, 0.72);
}

.panel-heading {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 30px;
}

.section-number {
  color: var(--leaf-deep);
  font-family: var(--mono);
  font-size: 28px;
  line-height: 1;
}

.section-number-client {
  color: var(--blue);
}

.panel-kicker {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 9px;
}

h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.2;
}

.field {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.field > label,
.effort-fieldset legend {
  color: #34443a;
  font-size: 12px;
  font-weight: 600;
}

.field input {
  width: 100%;
  height: 44px;
  min-width: 0;
  padding: 0 12px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #fff;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field input::placeholder {
  color: #9aa79d;
}

.field input:focus {
  border-color: var(--leaf-deep);
  box-shadow: 0 0 0 3px rgba(91, 132, 44, 0.1);
  outline: 0;
}

.field-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.format-fieldset {
  min-width: 0;
  margin: 0 0 21px;
  padding: 0;
  border: 0;
}

.format-fieldset legend {
  margin-bottom: 9px;
  color: #34443a;
  font-size: 12px;
  font-weight: 600;
}

.format-control {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.format-control .effort-option span {
  padding: 0 8px;
  text-align: center;
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
  margin-top: 21px;
}

.key-note {
  margin: 8px 0 22px;
}

.effort-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.effort-fieldset legend {
  margin-bottom: 9px;
}

.segmented-control {
  min-height: 43px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #fff;
}

.effort-control {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 560px) {
  .effort-control {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .effort-control .effort-option:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
  .effort-control .effort-option:nth-child(odd) {
    border-left: 0;
  }
}

.effort-option {
  position: relative;
  min-width: 0;
  display: flex;
  cursor: pointer;
}

.effort-option + .effort-option {
  border-left: 1px solid var(--line);
}

.effort-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.effort-option span {
  width: 100%;
  min-height: 41px;
  display: grid;
  place-items: center;
  color: #617067;
  font-size: 12px;
  transition: color 120ms ease, background-color 120ms ease;
}

.effort-option input:checked + span {
  color: var(--forest);
  background: var(--leaf);
  font-weight: 700;
}

.effort-option input:focus-visible + span {
  outline: 3px solid rgba(91, 132, 44, 0.4);
  outline-offset: -3px;
}

.advanced-settings {
  margin-top: 18px;
  border-top: 1px solid #e0e6de;
}

.advanced-settings summary {
  width: fit-content;
  padding: 13px 0 10px;
  color: var(--blue);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  list-style-position: inside;
}

.advanced-field {
  padding: 4px 0 2px 17px;
}

.save-row {
  margin-top: 22px;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 15px;
  color: #f7faf4;
  border: 1px solid var(--forest);
  border-radius: 3px;
  background: var(--forest);
  font-size: 13px;
  font-weight: 600;
  transition: background-color 140ms ease, transform 140ms ease;
}

.primary-button:hover {
  background: #314b3a;
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.button-hint {
  color: var(--leaf);
  font-family: var(--mono);
  font-size: 9px;
}

.save-status {
  min-height: 16px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.save-status[data-state="success"] {
  color: var(--leaf-deep);
}

.save-status[data-state="error"] {
  color: var(--coral);
}

.endpoint-empty {
  min-height: 357px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.52);
}

.empty-label {
  padding: 6px 8px;
  color: var(--coral);
  border: 1px solid #e7b6aa;
  background: #fff8f5;
}

.empty-line {
  width: 100%;
  height: 1px;
  position: relative;
  margin: 26px 0 12px;
  background: var(--line);
}

.empty-line i {
  position: absolute;
  top: -3px;
  left: 0;
  width: 7px;
  height: 7px;
  background: var(--blue);
  border: 1px solid var(--paper);
  border-radius: 50%;
}

.empty-coordinates {
  color: #9aa79d;
}

.output-block {
  min-width: 0;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.key-block {
  padding-top: 16px;
}

.output-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9px;
}

.method-tag,
.key-tag {
  padding: 3px 5px;
  color: var(--blue);
  border: 1px solid #c5d5de;
  background: #f0f6f8;
  font-size: 9px;
}

.key-tag {
  color: var(--leaf-deep);
  border-color: #c8d8b6;
  background: #f4f8ed;
}

.output-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.endpoint-row {
  align-items: flex-start;
}

.endpoint-row code {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 10px 11px;
  color: var(--forest);
  border: 1px solid #d9e2d8;
  background: #fff;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
}

.quiet-button,
.sample-copy {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 9px;
  color: var(--forest);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--paper);
  font-size: 10px;
  font-weight: 600;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.quiet-button:hover,
.sample-copy:hover {
  border-color: var(--leaf-deep);
  background: #f1f8e8;
}

.key-row input {
  width: 0;
  min-width: 0;
  height: 36px;
  flex: 1;
  padding: 0 10px;
  color: var(--forest);
  border: 1px solid #d9e2d8;
  border-radius: 3px;
  background: #fff;
  font-family: var(--mono);
  font-size: 11px;
}

.route-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr) minmax(0, 1fr);
  margin: 17px 0 20px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.route-summary > div {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 0 10px;
}

.route-summary > div:first-child {
  padding-left: 0;
}

.route-summary > div + div {
  border-left: 1px solid var(--line);
}

.route-summary span {
  color: var(--muted);
  font-size: 9px;
}

.route-summary code {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
}

.request-sample {
  overflow: hidden;
  border: 1px solid #33483b;
  border-radius: 3px;
  background: #1e2d24;
}

.sample-heading {
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px 0 13px;
  border-bottom: 1px solid rgba(226, 238, 221, 0.14);
}

.sample-heading > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sample-title {
  color: #e2eade;
  font-size: 9px;
}

.sample-language {
  color: #a9c58b;
  font-size: 9px;
}

.sample-copy {
  min-height: 27px;
  color: #e2eade;
  border-color: #526457;
  background: #2a3d31;
}

.sample-copy:hover {
  color: var(--leaf);
  border-color: #8ba873;
  background: #334a39;
}

.request-sample pre {
  max-height: 126px;
  overflow: auto;
  margin: 0;
  padding: 13px;
  color: #d4e2cd;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sample-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.sample-note code {
  color: var(--forest);
  font-family: var(--mono);
}

.page-footer {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 9px;
}

.page-footer > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-dot {
  width: 6px;
  height: 6px;
  background: var(--leaf-deep);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 5;
  max-width: min(400px, calc(100% - 32px));
  padding: 11px 14px;
  color: #f5f8f1;
  border: 1px solid #526457;
  border-radius: 3px;
  background: var(--forest);
  box-shadow: 0 8px 28px rgba(32, 42, 36, 0.2);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast[data-visible="true"] {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .page-shell {
    width: min(100% - 40px, 740px);
  }

  .workbench {
    grid-template-columns: minmax(0, 1fr);
  }

  .client-panel {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .endpoint-empty {
    min-height: 220px;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: calc(100% - 28px);
  }

  .topbar {
    height: 70px;
  }

  .page-intro {
    min-height: 142px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 13px;
  }

  h1 {
    font-size: 27px;
  }

  .setup-panel,
  .client-panel {
    padding: 25px 18px 28px;
  }

  .panel-heading {
    margin-bottom: 23px;
  }

  .field-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 17px;
  }

  .key-note {
    margin-top: 8px;
  }

  .endpoint-row {
    flex-direction: column;
    align-items: stretch;
  }

  .endpoint-row .quiet-button {
    align-self: flex-start;
  }

  .route-summary {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr);
    row-gap: 13px;
  }

  .route-summary > div:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .key-row {
    flex-wrap: wrap;
  }

  .key-row input {
    flex-basis: 100%;
  }

  .page-footer {
    min-height: 64px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
  }
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.login-card {
  width: min(440px, 100%);
  padding: 38px 38px 34px;
  border: 1px solid var(--line-strong);
  background: rgba(251, 252, 248, 0.95);
  box-shadow: 0 22px 56px rgba(39, 59, 43, 0.09);
}

.login-card h1 {
  font-size: 24px;
}

.login-heading {
  margin-bottom: 12px;
}

.login-sub {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.setup-confirm-field {
  margin-top: 17px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 560px) {
  .login-card {
    padding: 28px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}