:root {
  --header-h: 58px;
  --green-950: #062f29;
  --green-900: #073f36;
  --green-800: #0c594c;
  --green-100: #dcebe5;
  --paper: #f4f7f5;
  --white: #fff;
  --ink: #17312c;
  --muted: #63736f;
  --line: #d8e2de;
  --accent: #8cc7ae;
  --shadow: 0 16px 45px rgba(4, 40, 34, .18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body { background: var(--paper); }

a { color: inherit; }

button, input { font: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: -60px;
  left: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--white);
  background: var(--green-950);
}

.skip-link:focus { top: 10px; }

.app-page { overflow: hidden; }

.app-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 22px;
  height: var(--header-h);
  padding: 0 18px;
  color: var(--white);
  background: var(--green-950);
  box-shadow: 0 3px 14px rgba(0, 0, 0, .18);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  text-decoration: none;
  letter-spacing: -.02em;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border: 6px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50% 50% 46% 54%;
  transform: rotate(28deg);
}

.context-bar {
  display: flex;
  align-self: stretch;
  gap: 0;
  border-left: 1px solid rgba(255,255,255,.14);
}

.context-item {
  display: grid;
  align-content: center;
  min-width: 142px;
  padding: 0 18px;
  border-right: 1px solid rgba(255,255,255,.14);
}

.context-item small {
  color: rgba(255,255,255,.62);
  font-size: .67rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.context-item strong { margin-top: 2px; font-size: .82rem; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.header-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: rgba(255,255,255,.9);
  background: transparent;
  text-decoration: none;
  cursor: pointer;
}

.header-link:hover,
.header-link:focus-visible {
  border-color: rgba(255,255,255,.24);
  background: rgba(255,255,255,.09);
  outline: none;
}

.header-link[aria-disabled="true"] { color: rgba(255,255,255,.52); }

.button-link { appearance: none; }

.primary-link { background: var(--green-800); }

.app-main,
.app-stage,
.urbangis-app-frame { width: 100%; }

.app-main { height: calc(100dvh - var(--header-h)); }

.app-stage { height: 100%; background: #e7eeeb; }

.urbangis-app-frame { display: block; height: 100%; border: 0; }

.endpoint-state {
  display: grid;
  grid-template-columns: 14px minmax(0, 640px);
  justify-content: center;
  align-content: center;
  gap: 18px;
  width: 100%;
  height: 100%;
  padding: 36px;
  background:
    linear-gradient(rgba(7,63,54,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7,63,54,.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
}

.state-dot {
  width: 11px;
  height: 11px;
  margin-top: 9px;
  border-radius: 50%;
  background: #d7a241;
  box-shadow: 0 0 0 5px rgba(215,162,65,.15);
}

.state-label,
.eyebrow,
.step-kicker {
  margin: 0 0 10px;
  color: var(--green-800);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.endpoint-state h1 {
  max-width: 630px;
  margin: 0;
  color: var(--green-950);
  font-size: clamp(1.75rem, 3vw, 3.2rem);
  line-height: 1.06;
  letter-spacing: -.045em;
}

.endpoint-state p:not(.state-label):not(.state-code) {
  max-width: 610px;
  margin: 18px 0;
  color: var(--muted);
  line-height: 1.7;
}

.state-code {
  display: inline-block;
  margin: 0 0 24px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--green-800);
  background: rgba(255,255,255,.76);
  font: 700 .72rem ui-monospace, SFMono-Regular, Consolas, monospace;
}

.help-link {
  color: var(--green-800);
  font-weight: 750;
  text-underline-offset: 4px;
}

.about-dialog {
  width: min(520px, calc(100% - 32px));
  padding: 30px;
  border: 0;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.about-dialog::backdrop { background: rgba(3, 27, 23, .68); }

.about-dialog h2 { margin: 0 0 14px; color: var(--green-950); font-size: 2rem; }

.about-dialog p:not(.state-label) { color: var(--muted); line-height: 1.65; }

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: var(--green-900);
  background: var(--green-100);
  font-size: 1.25rem;
  cursor: pointer;
}

.live-message {
  position: fixed;
  z-index: 50;
  right: 18px;
  bottom: 18px;
  max-width: calc(100% - 36px);
  padding: 0;
  border-radius: 10px;
  color: var(--white);
  background: var(--green-950);
  box-shadow: var(--shadow);
}

.live-message:not(:empty) { padding: 12px 16px; }

.help-title { font-size: .9rem; font-weight: 700; color: rgba(255,255,255,.72); }

@media (max-width: 760px) {
  :root { --header-h: 54px; }
  .app-header { gap: 10px; padding: 0 10px; }
  .context-bar { display: none; }
  .brand strong { font-size: .94rem; }
  .brand-mark { width: 21px; height: 21px; border-width: 5px; }
  .header-link { min-height: 34px; padding: 0 9px; font-size: .82rem; }
  .button-link { display: none; }
  .help-title { display: none; }
  .endpoint-state { grid-template-columns: 1fr; padding: 24px; }
  .state-dot { margin: 0 0 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
