/* EnvLatch — black, hairline, monospace, one signal red. */
:root {
  --bg: #000;
  --raise: #0b0b0c;
  --edge: #26262a;
  --edge-hi: #3a3a40;
  --text: #ededed;
  --muted: #8a8a90;
  --red: #ff2d3d;
  --red-dim: #3a0a10;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font: 14px/1.6 var(--mono);
  color-scheme: dark;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(#0f0f11 1px, transparent 1px) 0 0 / 100% 96px,
    var(--bg);
  background-attachment: fixed;
}
body::before {
  /* hairline frame corners */
  content: "";
  position: fixed;
  inset: 14px;
  pointer-events: none;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--edge-hi), var(--edge-hi)) top left / 14px 1px,
    linear-gradient(var(--edge-hi), var(--edge-hi)) top left / 1px 14px,
    linear-gradient(var(--edge-hi), var(--edge-hi)) top right / 14px 1px,
    linear-gradient(var(--edge-hi), var(--edge-hi)) top right / 1px 14px,
    linear-gradient(var(--edge-hi), var(--edge-hi)) bottom left / 14px 1px,
    linear-gradient(var(--edge-hi), var(--edge-hi)) bottom left / 1px 14px,
    linear-gradient(var(--edge-hi), var(--edge-hi)) bottom right / 14px 1px,
    linear-gradient(var(--edge-hi), var(--edge-hi)) bottom right / 1px 14px;
  background-repeat: no-repeat;
  z-index: 0;
}
::selection {
  background: var(--red);
  color: #000;
}
[hidden] {
  display: none !important;
}

/* ---------- header ---------- */
body > header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 64px;
  padding: 12px clamp(20px, 5vw, 64px);
  border-bottom: 1px solid var(--edge);
  background: #000c;
  backdrop-filter: blur(8px);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.wordmark img {
  width: 28px;
  height: 28px;
}
.site-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
  padding: 0;
  border: 0;
}
.site-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 6px 10px;
}
.site-links a + a::before {
  content: "/" / "";
  color: var(--edge-hi);
  margin: 0 14px 0 -10px;
}
.site-links a:hover {
  color: var(--text);
}
body > header button {
  margin: 0;
}

/* ---------- type ---------- */
main {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) clamp(20px, 5vw, 48px);
}
h1,
h2,
h3 {
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.15;
}
h1 {
  font-size: clamp(2rem, 5.4vw, 4.4rem);
  letter-spacing: 0.01em;
  margin: 14px 0 22px;
}
h2 {
  font-size: 1rem;
  letter-spacing: 0.14em;
}
h3 {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin: 22px 0 8px;
}
p {
  max-width: 760px;
}
a {
  color: var(--text);
  text-decoration-color: var(--red);
  text-underline-offset: 0.25em;
}
a:hover {
  color: var(--red);
}
code,
pre {
  font-family: var(--mono);
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.eyebrow,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
  animation: pulse 2.4s steps(2, jump-none) infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}
.intro {
  color: var(--muted);
  font-size: 1rem;
  max-width: 560px;
}

/* ---------- controls ---------- */
label {
  display: block;
  margin: 14px 0;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 0;
  border: 0;
  border-bottom: 1px solid var(--edge-hi);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: 0.95rem var(--mono);
  letter-spacing: 0.04em;
  text-transform: none;
}
select,
textarea {
  padding-inline: 10px;
  border: 1px solid var(--edge-hi);
  background: var(--raise);
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--red);
}
input[type="checkbox"],
input[type="radio"] {
  display: inline-block;
  width: auto;
  margin: 0 8px 0 0;
  accent-color: var(--red);
}
input::placeholder,
textarea::placeholder {
  color: #5c5c62;
}
textarea {
  min-height: 100px;
}
button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 40px;
  margin: 6px 6px 6px 0;
  padding: 9px 16px;
  border: 1px solid var(--edge-hi);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: 500 0.75rem var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition:
    border-color 0.12s,
    color 0.12s,
    background 0.12s;
}
button::before {
  content: "[" / "";
  color: var(--muted);
}
button::after {
  content: "]" / "";
  color: var(--muted);
}
button:hover {
  border-color: var(--text);
}
button:active {
  background: #ffffff0d;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 1px solid var(--red);
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
#login button:not([value]),
.primary {
  width: 100%;
  border-color: var(--red);
  color: var(--red);
  box-shadow: inset 0 0 0 0 var(--red);
}
#login button:not([value])::before,
#login button:not([value])::after {
  color: var(--red);
}
#login button:not([value]):hover {
  background: var(--red);
  color: #000;
}
#login button:not([value]):hover::before,
#login button:not([value]):hover::after {
  color: #000;
}
.danger,
.freeze {
  border-color: var(--red);
  background: var(--red);
  color: #000;
  font-weight: 600;
}
.danger::before,
.danger::after {
  color: #000;
}
.danger:hover {
  background: #ff5260;
  border-color: #ff5260;
}

/* ---------- landing ---------- */
#welcome {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 380px);
  align-items: center;
  gap: clamp(32px, 7vw, 110px);
  min-height: calc(100vh - 220px);
}
.welcome-copy {
  min-width: 0;
}
#welcome h1 {
  max-width: 13ch;
}
#welcome h1::after {
  content: "_" / "";
  color: var(--red);
  animation: pulse 1.1s steps(2, jump-none) infinite;
}
.access-diagram {
  margin: 36px 0 22px;
  max-width: 520px;
  border-top: 1px solid var(--edge);
  counter-reset: step;
}
.access-diagram > div {
  display: grid;
  grid-template-columns: 36px 110px 1fr;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--edge);
  font-size: 0.82rem;
}
.access-diagram > div::before {
  counter-increment: step;
  content: "0" counter(step) / "";
  color: var(--red);
  font-size: 0.7rem;
}
.access-diagram span {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.access-diagram strong {
  font-weight: 400;
}
.demo-link {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#login {
  position: relative;
  margin: 0;
  padding: 28px 26px 22px;
  border: 1px solid var(--edge-hi);
  background: var(--raise);
}
#login::before {
  content: "AUTH_REQUIRED" / "";
  position: absolute;
  top: -9px;
  left: 18px;
  padding: 0 8px;
  background: var(--bg);
  color: var(--red);
  font-size: 0.66rem;
  letter-spacing: 0.2em;
}
#login h2 {
  margin: 0 0 8px;
}
#login p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.7;
}
#passkeyLogin {
  width: 100%;
}

/* ---------- workspace ---------- */
#workspace {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: clamp(24px, 5vw, 56px);
  align-items: start;
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}
#workspace > nav {
  position: sticky;
  top: 24px;
  flex-direction: column;
  border-left: 1px solid var(--edge);
}
#workspace > nav button {
  justify-content: flex-start;
  width: 100%;
  min-height: 36px;
  margin: 0;
  padding: 8px 14px;
  border: 0;
  border-left: 2px solid transparent;
  margin-left: -1px;
  color: var(--muted);
  text-align: left;
}
#workspace > nav button::before {
  content: "_" / "";
  color: transparent;
}
#workspace > nav button::after {
  content: none;
}
#workspace > nav button:hover {
  color: var(--text);
}
#workspace > nav button[aria-current="true"] {
  color: var(--text);
  border-left-color: var(--red);
  background: linear-gradient(90deg, var(--red-dim), transparent);
}
#workspace > nav button[aria-current="true"]::before {
  color: var(--red);
}
.workspace-content {
  min-width: 0;
}
.title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.title h1 {
  font-size: clamp(1.4rem, 3.4vw, 2.2rem);
  margin: 0 0 8px;
}
#health {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}
#reviewNotice:empty {
  display: none;
}
#search {
  max-width: 360px;
}
.panel {
  position: relative;
  margin: 28px 0;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--edge);
  background: #050505;
}
.panel > h2:first-child {
  margin-top: 0;
}
.panel form {
  max-width: 660px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--edge);
}
.overview-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  margin-bottom: 18px;
}
.overview-heading h2,
.overview-heading button {
  margin: 0;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--edge);
  border-left: 1px solid var(--edge);
}
.overview-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.metric {
  padding: 14px 16px;
  border-right: 1px solid var(--edge);
  border-bottom: 1px solid var(--edge);
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.metric strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 1.9rem;
  font-weight: 400;
  letter-spacing: 0;
}
.overview-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 0;
  margin: 22px 0;
  border: 1px solid var(--edge);
}
.overview-columns > section {
  min-width: 0;
  padding: 0 16px 14px;
}
.overview-columns > section + section {
  border-left: 1px solid var(--edge);
}
.overview-columns h3 {
  margin: 14px 0 6px;
}
.overview-columns .record:last-child {
  border-bottom: 0;
}
.record {
  padding: 11px 0;
  border-bottom: 1px solid var(--edge);
  overflow-wrap: anywhere;
}
.record code,
.panel pre {
  color: #c9c9ce;
  font-size: 0.78rem;
}
.access-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.access-row p {
  margin: 0.15em 0;
}
.access-kind {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.access-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.access-status::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--red);
}
.access-row button {
  min-height: 32px;
  padding: 5px 10px;
  border-color: transparent;
  color: var(--red);
}
.access-row button::before,
.access-row button::after {
  color: var(--red);
}
.access-row button:hover {
  border-color: var(--red);
}
#audit {
  max-height: 380px;
  overflow: auto;
}
.audit-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
}
.audit-row > * {
  grid-column: 2;
}
.audit-row::before {
  content: "";
  grid-row: 1 / span 3;
  width: 1px;
  margin: 6px 0 0 3px;
  background: linear-gradient(var(--red) 0 6px, var(--edge) 6px);
}
.audit-row strong {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.audit-row time {
  color: var(--muted);
  font-size: 0.7rem;
}
.audit-row code {
  font-size: 0.68rem;
}
.billing-tools {
  margin-top: 22px;
  padding-top: 12px;
  border-top: 1px solid var(--edge);
}
details > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  list-style: none;
}
details > summary::before {
  content: "+ " / "";
  color: var(--red);
}
details[open] > summary::before {
  content: "- " / "";
}

/* ---------- feedback & dialogs ---------- */
#message {
  position: sticky;
  bottom: 16px;
  z-index: 5;
  padding: 12px 16px;
  border: 1px solid var(--edge-hi);
  border-left: 2px solid var(--red);
  background: var(--raise);
  color: var(--text);
  font-size: 0.82rem;
}
#message:empty {
  display: none;
}
dialog {
  max-width: min(92vw, 780px);
  padding: 24px;
  border: 1px solid var(--edge-hi);
  border-radius: 0;
  background: var(--raise);
  color: var(--text);
}
dialog::backdrop {
  background: #000c;
}
dialog pre {
  max-height: 55vh;
  overflow: auto;
}
footer {
  position: relative;
  z-index: 1;
  padding: 22px clamp(20px, 5vw, 64px);
  border-top: 1px solid var(--edge);
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
footer a {
  color: var(--muted);
}
footer a:hover {
  color: var(--text);
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  body {
    background: var(--bg);
  }
  body::before {
    display: none;
  }
  #welcome,
  #workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    min-height: 0;
  }
  #workspace > nav {
    position: static;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    border: 0;
    border-bottom: 1px solid var(--edge);
  }
  #workspace > nav button {
    width: auto;
    white-space: nowrap;
    border-left: 0;
    border-bottom: 2px solid transparent;
    margin: 0 0 -1px;
  }
  #workspace > nav button[aria-current="true"] {
    border-bottom-color: var(--red);
    background: none;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
  }
  .overview-columns {
    grid-template-columns: 1fr;
  }
  .overview-columns > section + section {
    border-left: 0;
    border-top: 1px solid var(--edge);
  }
  .title {
    display: block;
  }
  button {
    min-height: 44px;
  }
}
@media (max-width: 480px) {
  .site-links a {
    font-size: 0.66rem;
    padding-inline: 6px;
  }
  .site-links a + a::before {
    margin: 0 8px 0 -6px;
  }
  .wordmark {
    letter-spacing: 0.14em;
  }
  .access-diagram > div {
    grid-template-columns: 30px 90px 1fr;
  }
  .access-row {
    gap: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
.site-links a {
  white-space: nowrap;
}
@media (max-width: 560px) {
  body:has(#logout:not([hidden])) .site-links {
    display: none;
  }
  body:has(#logout:not([hidden])) #logout {
    margin-left: auto;
  }
}
