:root {
  --bg: #07110f;
  --panel: rgba(14, 29, 25, 0.88);
  --panel-strong: #10251f;
  --line: rgba(176, 211, 196, 0.14);
  --text: #edf7f1;
  --muted: #91a99e;
  --mint: #82e0b0;
  --healthy: #62d99a;
  --busy: #65b9e8;
  --degraded: #f1bd64;
  --down: #f27070;
  --unknown: #83968e;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(47, 123, 93, 0.28), transparent 35%),
    linear-gradient(145deg, #07110f 0%, #081511 52%, #09120f 100%);
}

button, input { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.11;
  pointer-events: none;
}
.ambient-one { top: 12%; right: -160px; background: #71dca6; }
.ambient-two { bottom: -180px; left: -120px; background: #4e8e79; }

.shell { width: min(1160px, calc(100% - 36px)); margin: 0 auto; padding: 38px 0 68px; }
.login-wrap { min-height: calc(100vh - 106px); display: grid; place-items: center; }
.login-card {
  width: min(440px, 100%);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(18, 40, 33, 0.96), rgba(9, 23, 19, 0.96));
  box-shadow: var(--shadow);
}

.eyebrow, .kicker {
  margin: 0 0 7px;
  color: var(--mint);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.16em;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.65rem, 4vw, 2.35rem); letter-spacing: -0.04em; }
h2 { margin-bottom: 0; font-size: 1.16rem; letter-spacing: -0.02em; }
.lede, .panel-note { color: var(--muted); line-height: 1.65; }

form { display: grid; gap: 10px; margin-top: 28px; }
form label:not(.remember-row) { color: #c5d8cf; font-size: 0.86rem; font-weight: 650; }
input[type="text"], input[type="password"] {
  width: 100%;
  min-height: 48px;
  margin-bottom: 8px;
  padding: 0 14px;
  color: var(--text);
  border: 1px solid rgba(175, 211, 195, 0.2);
  border-radius: 11px;
  outline: none;
  background: rgba(1, 8, 6, 0.45);
}
input:focus { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(130, 224, 176, 0.12); }
.remember-row { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 0.9rem; }
.remember-row input { width: 17px; height: 17px; accent-color: var(--healthy); }
.form-error { margin: 2px 0; color: #ff9a9a; font-size: 0.88rem; }

.primary-button, .danger-button, .quiet-button, .icon-button, .restart-button {
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, opacity 140ms ease;
}
button:hover:not(:disabled) { transform: translateY(-1px); }
button:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: 0.42; }
.primary-button { min-height: 49px; margin-top: 8px; color: #072017; background: var(--mint); font-weight: 760; }
.quiet-button, .icon-button { padding: 9px 13px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.035); }
.danger-button { padding: 11px 16px; color: #2d0808; background: #f27878; font-weight: 750; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.topbar h1 { margin: 0; }
.topbar-actions { display: flex; gap: 8px; }

.overview-card, .panel, .issue-panel {
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--panel);
  box-shadow: 0 14px 45px rgba(0, 0, 0, 0.13);
}
.overview-card { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 23px 25px; }
.overview-main { display: flex; align-items: center; gap: 15px; }
.status-beacon { position: relative; width: 18px; height: 18px; border-radius: 50%; background: var(--unknown); box-shadow: 0 0 0 7px rgba(131, 150, 142, 0.1); }
.status-beacon.healthy { background: var(--healthy); box-shadow: 0 0 0 7px rgba(98, 217, 154, 0.11), 0 0 24px rgba(98, 217, 154, 0.45); }
.status-beacon.busy { background: var(--busy); box-shadow: 0 0 0 7px rgba(101, 185, 232, 0.11); }
.status-beacon.degraded { background: var(--degraded); box-shadow: 0 0 0 7px rgba(241, 189, 100, 0.11); }
.status-beacon.down { background: var(--down); box-shadow: 0 0 0 7px rgba(242, 112, 112, 0.11); }
.overall-label { margin-bottom: 3px; color: var(--muted); font-size: 0.86rem; }
.overall-summary { margin: 5px 0 0; color: #b7cdc2; font-size: 0.78rem; }
.overview-meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 0.78rem; text-align: right; }
.cache-label, .count-badge { padding: 4px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.055); }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 34px 2px 14px; }
.section-heading.compact { margin: 0 0 16px; align-items: center; }
.legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.76rem; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--unknown); }
.legend-dot.healthy { background: var(--healthy); }
.legend-dot.busy { margin-left: 8px; background: var(--busy); }

.chain-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.chain-card { min-height: 132px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(12, 28, 23, 0.75); }
.chain-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chain-index { color: #60786d; font: 700 0.68rem ui-monospace, SFMono-Regular, Consolas, monospace; }
.status-pill { padding: 4px 7px; border-radius: 999px; color: var(--unknown); background: rgba(131, 150, 142, 0.1); font-size: 0.68rem; font-weight: 750; }
.status-pill.healthy { color: var(--healthy); background: rgba(98, 217, 154, 0.09); }
.status-pill.busy { color: var(--busy); background: rgba(101, 185, 232, 0.09); }
.status-pill.degraded { color: var(--degraded); background: rgba(241, 189, 100, 0.09); }
.status-pill.down { color: var(--down); background: rgba(242, 112, 112, 0.1); }
.chain-card h3 { margin: 18px 0 7px; font-size: 0.95rem; }
.chain-card p { margin-bottom: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.55; }

.issue-panel { margin-top: 16px; padding: 20px; border-color: rgba(241, 189, 100, 0.26); background: rgba(73, 51, 18, 0.2); }
.issue-list { display: grid; gap: 7px; }
.issue-item { display: flex; gap: 9px; color: #e8d4a9; font-size: 0.83rem; line-height: 1.5; }
.issue-item::before { content: "•"; color: var(--degraded); }

.two-column { display: grid; grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr); gap: 12px; margin: 34px 0 12px; }
.panel { padding: 20px; }
.load-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.load-item { padding: 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.032); }
.load-item span { display: block; color: var(--muted); font-size: 0.7rem; }
.load-item strong { display: block; margin-top: 6px; font-size: 1rem; font-weight: 650; overflow-wrap: anywhere; }
.panel-note { margin: -4px 0 15px; font-size: 0.78rem; }
.restart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.restart-button { min-height: 76px; padding: 11px; text-align: left; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.035); }
.restart-button span, .restart-button small { display: block; }
.restart-button span { font-size: 0.82rem; font-weight: 720; }
.restart-button small { margin-top: 6px; color: var(--muted); font-size: 0.65rem; line-height: 1.35; }
.restart-button.danger { border-color: rgba(242, 112, 112, 0.2); }

.history-list { display: grid; }
.history-row { display: grid; grid-template-columns: 145px 150px minmax(0, 1fr) 70px; gap: 12px; padding: 11px 2px; border-top: 1px solid var(--line); font-size: 0.78rem; align-items: center; }
.history-row:first-child { border-top: 0; }
.history-time, .history-message { color: var(--muted); }
.history-result { text-align: right; color: var(--healthy); }
.history-result.failed { color: var(--down); }
.empty-state { padding: 14px 0; color: var(--muted); font-size: 0.82rem; }

.confirm-overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(0, 7, 5, 0.76); backdrop-filter: blur(7px); }
.confirm-card { width: min(440px, 100%); padding: 28px; border: 1px solid rgba(242, 112, 112, 0.26); border-radius: 18px; background: #11221d; box-shadow: var(--shadow); }
.warning-mark { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 18px; border-radius: 50%; color: #2d0808; background: #f27878; font-weight: 850; }
.confirm-card > p:not(.kicker) { color: var(--muted); line-height: 1.6; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 25px; }
.toast { position: fixed; z-index: 20; right: 22px; bottom: 22px; max-width: min(420px, calc(100% - 44px)); padding: 13px 16px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: #173229; box-shadow: var(--shadow); font-size: 0.84rem; }
.toast.error { border-color: rgba(242, 112, 112, 0.35); background: #3a1d1d; }

@media (max-width: 850px) {
  .chain-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two-column { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 24px, 1160px); padding-top: 22px; padding-bottom: 40px; }
  .login-wrap { min-height: calc(100vh - 62px); }
  .login-card { padding: 26px 21px; }
  .topbar { align-items: flex-start; }
  .topbar .eyebrow { max-width: 150px; }
  .overview-card { align-items: flex-start; flex-direction: column; padding: 19px; }
  .overview-meta { width: 100%; justify-content: space-between; text-align: left; }
  .chain-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chain-card { min-height: 125px; padding: 13px; }
  .restart-grid { grid-template-columns: 1fr; }
  .restart-button { min-height: 64px; }
  .history-row { grid-template-columns: 1fr auto; gap: 5px 10px; }
  .history-time, .history-message { grid-column: 1 / -1; }
  .history-result { grid-column: 2; grid-row: 1; }
  .section-heading { align-items: flex-start; }
  .legend { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
