:root {
  color-scheme: dark;
  --ink: #f5f5f0;
  --muted: #8f938d;
  --line: rgba(255, 255, 255, 0.09);
  --panel: rgba(17, 19, 18, 0.86);
  --green: #75f2ae;
  --amber: #ffc768;
  --red: #ff6f6f;
  --black: #080a09;
}

* { box-sizing: border-box; }

html { background: var(--black); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% -10%, rgba(117, 242, 174, 0.12), transparent 31rem),
    radial-gradient(circle at 100% 80%, rgba(255, 199, 104, 0.07), transparent 34rem),
    linear-gradient(180deg, #0b0d0c 0%, #070908 100%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

.shell { width: min(1520px, calc(100% - 48px)); margin: 0 auto; padding: 34px 0 24px; }

.masthead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.masthead-actions { display: flex; align-items: center; gap: 18px; }
.identity { display: flex; align-items: center; gap: 14px; }
.mark {
  display: grid; place-items: center; width: 47px; height: 47px; border: 1px solid rgba(117, 242, 174, 0.5);
  color: var(--green); font: 700 20px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(117, 242, 174, 0.06); box-shadow: inset 0 0 24px rgba(117, 242, 174, 0.04);
}
.eyebrow { margin: 0 0 3px; color: var(--muted); font: 700 10px/1 ui-monospace, monospace; letter-spacing: 0.22em; }
h1 { margin: 0; font-size: clamp(22px, 3vw, 30px); font-weight: 540; letter-spacing: -0.035em; }
.snapshot-state { display: flex; align-items: center; gap: 9px; color: var(--muted); font: 700 10px/1 ui-monospace, monospace; letter-spacing: 0.12em; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px var(--green); }
.is-stale .pulse { background: var(--amber); box-shadow: 0 0 14px var(--amber); }
.logout-form { margin: 0; }
.logout-form button {
  min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 0;
  color: var(--ink); background: transparent; cursor: pointer;
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.08em; text-transform: uppercase;
}
.logout-form button:hover, .logout-form button:focus-visible { border-color: #2865a9; outline: 2px solid transparent; color: #fff; }

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.panel {
  position: relative; min-height: 220px; padding: 18px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(14px);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.2);
}
.panel::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: var(--muted); opacity: 0.25; }
.tone-good::after { background: var(--green); opacity: 0.8; }
.tone-caution::after { background: var(--amber); opacity: 0.72; }
.tone-danger::after { background: var(--red); opacity: 0.82; }
.panel-1, .panel-2 { grid-column: span 2; min-height: 250px; }
.panel-4 { grid-column: span 2; }
.panel-10 { grid-column: span 4; min-height: 150px; }
.panel-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.panel-number, .class, .provenance { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.panel-number { color: var(--muted); font-size: 11px; }
.class { color: var(--muted); font-size: 8px; letter-spacing: 0.08em; text-transform: uppercase; }
h2 { margin: 0 0 12px; color: #b8bcb6; font-size: 12px; font-weight: 560; }
.value { max-width: 100%; font-size: clamp(21px, 2.2vw, 34px); font-weight: 590; letter-spacing: -0.045em; line-height: 1.03; overflow-wrap: anywhere; }
.tone-good .value { color: var(--green); }
.tone-caution .value { color: var(--amber); }
.tone-danger .value { color: var(--red); }
ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 21px -18px 31px; padding: 1px 0 0; list-style: none; border-top: 1px solid var(--line); }
li { position: relative; min-width: 0; padding: 10px 18px 9px; border-bottom: 1px solid var(--line); }
li:nth-child(odd) { border-right: 1px solid var(--line); }
li span, li strong, li em { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
li span { margin-bottom: 5px; color: var(--muted); font-size: 9px; }
li strong { color: var(--ink); font: 650 11px/1.2 ui-monospace, monospace; }
li em { margin-top: 4px; color: var(--amber); font: normal 8px/1.2 ui-monospace, monospace; }
.note { color: var(--amber); font-size: 10px; line-height: 1.4; }
.provenance { position: absolute; right: 18px; bottom: 12px; left: 18px; display: flex; gap: 10px; color: #626761; font-size: 8px; }
.provenance span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
footer { display: flex; gap: 24px; margin-top: 18px; color: #5f645e; font: 9px/1 ui-monospace, monospace; }

.login-body {
  display: grid; place-items: center; padding: 24px;
  background: #080a09;
}
.login-body::before { display: none; }
.login-shell {
  width: min(100%, 440px); padding: 32px; border: 1px solid var(--line); border-top: 3px solid #2865a9;
  background: #111312; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}
.login-brand { display: flex; align-items: center; gap: 12px; color: var(--ink); font-size: 13px; font-weight: 700; letter-spacing: 0.12em; }
.login-brand .mark { width: 38px; height: 38px; border-color: #2865a9; color: #fff; background: #2865a9; }
.login-kicker { margin: 38px 0 10px; color: #6e9bd0; font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.12em; text-transform: uppercase; }
.login-shell h1 { font-size: clamp(32px, 8vw, 46px); font-weight: 600; }
.login-intro, .login-meta { color: var(--muted); font-size: 14px; line-height: 1.5; }
.login-intro { margin: 10px 0 28px; }
.login-notice { margin: 0 0 18px; padding: 12px; border-left: 3px solid var(--amber); color: var(--ink); background: rgba(255, 199, 104, 0.08); font-size: 14px; line-height: 1.45; }
.login-form { display: grid; gap: 18px; }
.login-form label { display: grid; gap: 8px; color: #b8bcb6; font-size: 14px; }
.login-form input {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #3b403c; border-radius: 0;
  color: var(--ink); background: #080a09; font: 16px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.login-form input:focus-visible { border-color: #6e9bd0; outline: 2px solid #2865a9; outline-offset: 2px; }
.login-form button {
  min-height: 48px; border: 0; border-radius: 0; color: #fff; background: #2865a9; cursor: pointer;
  font-size: 15px; font-weight: 700;
}
.login-form button:hover, .login-form button:focus-visible { background: #3475bd; outline: 2px solid #6e9bd0; outline-offset: 2px; }
.login-meta { margin: 24px 0 0; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }

@media (max-width: 1050px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-1, .panel-2, .panel-4 { grid-column: span 1; }
  .panel-10 { grid-column: span 2; }
}

@media (max-width: 650px) {
  .shell { width: min(100% - 24px, 1520px); padding-top: 20px; }
  .grid { grid-template-columns: 1fr; }
  .masthead { align-items: flex-start; gap: 16px; }
  .masthead-actions { align-items: flex-end; flex-direction: column; gap: 10px; }
  .panel { min-height: 215px; }
  .panel-10 { grid-column: span 1; min-height: 180px; }
  footer { flex-direction: column; gap: 8px; }
  .login-shell { padding: 24px 20px; }
}

@media (prefers-reduced-motion: no-preference) {
  .is-live .pulse { animation: signal 2.4s ease-in-out infinite; }
  @keyframes signal { 50% { opacity: 0.4; box-shadow: 0 0 4px var(--green); } }
}
