@font-face {
  font-family: Manrope;
  src: url("fonts/Manrope.ttf") format("truetype");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Spectral;
  src: url("fonts/Spectral-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #1c1915;
  --muted: #5e584f;
  --paper: #f3efe6;
  --paper-2: #fffdf8;
  --line: #d5cfc3;
  --rust: #9a3412;
  --rust-deep: #7d2b10;
  --danger: #6e261c;
  --danger-bg: #f7e6df;
  --night: #12140f;
  --cream: #f6f1e7;
  --sans: Manrope, "Noto Sans", "Liberation Sans", sans-serif;
  --serif: Spectral, "Liberation Serif", Georgia, serif;
  --mono: "IBM Plex Mono", "Liberation Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--night);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }

button { cursor: pointer; }

::selection { background: #efd0c2; color: var(--ink); }

.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(22rem, 30rem);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "top gate"
    "stage gate";
  background:
    radial-gradient(820px 420px at 0% 0%, rgba(166, 68, 36, 0.28), transparent 58%),
    var(--night);
}

.top { grid-area: top; }
.stage { grid-area: stage; }
.gate { grid-area: gate; }

.stage {
  display: flex;
  flex-direction: column;
  padding: 8px 48px 32px;
}

.stack {
  width: min(100%, 42rem);
  margin-block: auto;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 28px 48px 0;
}

.top-start {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.top-nav a {
  color: inherit;
  font-size: 0.92rem;
  text-decoration: none;
}

.top-nav a:hover { text-decoration: underline; text-underline-offset: 3px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.mark {
  width: 36px;
  height: 36px;
  color: var(--cream);
  flex: none;
}

.brand strong {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.pill {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 4px 10px 4px 8px;
  border: 1px solid rgba(239, 232, 218, 0.18);
  border-radius: 999px;
  color: #e7e0d4;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.01em;
}

#pill-text {
  overflow-wrap: anywhere;
}

.lamp {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8d907f;
  flex: none;
}

.pill.is-ok .lamp {
  background: #c6de9a;
  animation: pulse 2.4s ease-out infinite;
}

.pill.is-down {
  color: #f0c7b8;
  border-color: rgba(212, 120, 90, 0.45);
}

.pill.is-down .lamp {
  background: #d4785a;
  animation: none;
}

.copy { max-width: 38rem; }

.kicker {
  margin: 0 0 14px;
  color: #e2b39a;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.display {
  margin: 0;
  max-width: 12em;
  color: var(--cream);
  font-family: var(--serif);
  font-size: clamp(2.5rem, 3.2vw, 3rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.lede {
  margin: 18px 0 0;
  max-width: 36rem;
  color: #d4cbbd;
  font-size: 1.02rem;
  line-height: 1.55;
}

.lede a { color: #f0c2ae; }

.board {
  padding: 16px 18px 14px;
  border: 1px solid rgba(243, 236, 220, 0.14);
  border-radius: 8px;
  background: rgba(8, 9, 7, 0.38);
}

.board-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}

.board-head h2 {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.board-head span,
.board-head a {
  color: #e2b39a;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.board ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.board li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 18px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid rgba(239, 232, 218, 0.1);
  font-family: var(--mono);
  font-size: 12.5px;
}

.svc {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  color: #e7e0d4;
}

.svc-name,
.svc-host {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.svc-host {
  color: #b7ad9e;
  font-size: 11px;
}

.state { color: #c8c2b6; }

.state::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: #8d907f;
  transform: translateY(-1px);
}

.state.is-operational { color: #d7e4bc; }
.state.is-operational::before { background: #c6de9a; }

.state.is-degraded { color: #f0d7a8; }
.state.is-degraded::before { background: #e0b15a; }

.state.is-down { color: #f0c7b8; }
.state.is-down::before { background: #d4785a; }

.ms {
  color: #f4eee4;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.board-foot,
.board-note {
  margin: 8px 0 0;
  color: #b7ad9e;
  font-family: var(--mono);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

.board-note { color: #f0c7b8; }

.gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 40px 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 140px),
    var(--paper);
  color: var(--ink);
  color-scheme: light;
  box-shadow: inset 3px 0 0 var(--rust);
}

.gate-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(100%, 23.5rem);
}

.eyebrow {
  margin: 0 0 14px;
  color: #7a6558;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.01em;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 3rem;
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.form-lead {
  margin: 12px 0 22px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.alert {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-left: 3px solid var(--rust);
  border-radius: 4px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.92rem;
  line-height: 1.4;
}

.alert p { margin: 0; }

.alert.is-warn {
  background: #f3eee4;
  color: #3a342c;
  border-left-color: #8a6a32;
}

.alert.is-note {
  background: #e7f0dc;
  color: #243018;
  border-left-color: #5d7340;
}

.alert-meta {
  margin-top: 4px;
  color: #8d5348;
  font-family: var(--mono);
  font-size: 12px;
}

.alert.is-warn .alert-meta,
.alert.is-note .alert-meta { color: inherit; }

.field { margin: 0 0 14px; }

label {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 0.86rem;
  font-weight: 650;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.label-row label { margin-bottom: 6px; }

.text-btn {
  margin-bottom: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: #7a3418;
  font-size: 0.82rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-btn:hover { color: var(--rust-deep); }

.control { position: relative; }

input[type="text"],
input[type="password"] {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 16px;
}

.control input { padding-right: 46px; }

input::placeholder { color: #9a9388; }

input:hover { border-color: #b7b0a4; }

input:focus {
  outline: 2px solid var(--rust);
  outline-offset: 1px;
  border-color: var(--rust);
}

input[aria-invalid="true"] { border-color: var(--rust); }

.ghost {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #6f685e;
  transform: translateY(-50%);
}

.ghost:hover { background: rgba(28, 25, 21, 0.05); color: var(--ink); }

.help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 16px;
  font-size: 0.92rem;
  font-weight: 450;
  color: #3a342c;
}

.remember input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--rust);
}

.submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 4px;
  background: var(--rust);
  color: #fffaf6;
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.alt-sign {
  margin: 14px 0 0;
  text-align: center;
}

.alt-sign a,
.alt-sign .text-btn {
  color: #7a3418;
  font-size: 0.92rem;
}

.submit:hover { background: var(--rust-deep); }

.submit:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.submit:disabled {
  cursor: progress;
  opacity: 0.86;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 1.6px solid rgba(255, 250, 246, 0.35);
  border-top-color: #fffaf6;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.noscript {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.fine {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  width: 100%;
  margin: 18px 0 0;
  color: #6f685e;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  text-align: center;
}

.fine a { color: inherit; }

[hidden] { display: none !important; }

a:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
}

button:focus-visible,
.text-btn:focus-visible,
.ghost:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(198, 222, 154, 0.55); }
  100% { box-shadow: 0 0 0 8px rgba(198, 222, 154, 0); }
}

@media (max-height: 760px) and (min-width: 1081px) {
  .top { padding-top: 18px; }
  h1 { font-size: 2.4rem; }
  .form-lead { margin-bottom: 14px; }
  .stack { gap: 20px; }
}

@media (max-width: 1080px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "top"
      "stage"
      "gate";
  }

  .top {
    padding:
      max(14px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      0
      max(16px, env(safe-area-inset-left));
  }

  .stage {
    padding:
      8px
      max(16px, env(safe-area-inset-right))
      0
      max(16px, env(safe-area-inset-left));
  }

  .stack {
    width: min(100%, 32rem);
    margin-inline: auto;
    margin-block: 0;
    gap: 0;
  }

  .copy .display { font-size: 1.85rem; max-width: 12em; }
  .lede { display: none; }

  .gate {
    margin-top: 14px;
    padding: 22px 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    box-shadow: none;
  }

  .gate-body {
    justify-content: flex-start;
    width: min(100%, 32rem);
  }

  h1 { font-size: 2.35rem; }
  .form-lead { margin-bottom: 16px; }

  .board li {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name latency"
      "state latency";
    gap: 2px 12px;
    align-items: center;
  }

  .svc { grid-area: name; }
  .state { grid-area: state; }
  .ms { grid-area: latency; }
}

.sheet-body {
  background: var(--paper);
  color: var(--ink);
  color-scheme: light;
}

.sheet-body.is-dark {
  background:
    radial-gradient(820px 420px at 0% 0%, rgba(166, 68, 36, 0.28), transparent 58%),
    var(--night);
  color: var(--cream);
  color-scheme: dark;
}

.sheet-top,
.sheet-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
  width: min(calc(100% - 32px), 46rem);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 0 8px;
}

.sheet-foot {
  justify-content: flex-start;
  padding: 8px 0 calc(22px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.82rem;
}

.sheet-foot a { color: inherit; }

.sheet {
  width: min(calc(100% - 32px), 40rem);
  margin: 12px auto 28px;
}

.sheet-body.is-dark .sheet { width: min(calc(100% - 32px), 46rem); }

.sheet-body.is-dark h1,
.sheet-body.is-dark .sheet-lead { color: var(--cream); }

.sheet-lead,
.sheet p {
  margin: 0 0 14px;
  line-height: 1.55;
}

.sheet-lead { margin-top: 12px; color: var(--muted); }

.sheet a { color: var(--rust-deep); }

.sheet-body.is-dark .top-nav a,
.sheet-body.is-dark .sheet a,
.sheet-body.is-dark .sheet-foot,
.sheet-body.is-dark .sheet-foot a { color: #e2b39a; }

.sheet form { margin: 8px 0 18px; }

@media (prefers-reduced-motion: reduce) {
  .pill.is-ok .lamp,
  .spinner { animation: none; }
}
