:root {
  --bg: #f6f5f1;
  --ink: #21282c;
  --ink-soft: rgba(33, 40, 44, 0.58);
  --ink-faint: rgba(33, 40, 44, 0.34);
  --line: rgba(33, 40, 44, 0.16);
  --accent: #38997f;
  --warn: #a56a14;
  --down: #b54f45;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", "Noto Serif SC", Georgia, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", ui-sans-serif, system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
  --content: min(720px, calc(100% - 40px));
  --ease: cubic-bezier(0.2, 0.75, 0.18, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  width: var(--content);
  margin: 0 auto;
  padding: 0 0 64px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

h1,
p {
  margin: 0;
}

.mast,
main,
.refresh-note {
  width: 100%;
}

.mast {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 8px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand-name {
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
}

.brand-sub {
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
}

.refresh {
  min-height: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
}

.refresh:hover,
.refresh:focus-visible,
.brand:hover,
.brand:focus-visible {
  color: var(--accent);
}

.refresh:focus-visible,
.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.refresh[disabled] {
  cursor: wait;
  opacity: 0.55;
}

main {
  display: grid;
  gap: 36px;
  padding-top: 20px;
}

.overall {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.overall-state {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.overall-state strong {
  font-family: var(--display);
  font-size: 2.4rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
}

.overall-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 14px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-0.12em);
}

[data-status="checking"] .status-dot,
[data-status="unknown"] .status-dot {
  background: var(--ink-faint);
}

[data-status="degraded"] .status-dot,
[data-status="degraded"] .overall-state strong,
.service-table [data-status="degraded"] .service-state {
  color: var(--warn);
}

[data-status="degraded"] .status-dot {
  background: var(--warn);
}

[data-status="down"] .status-dot,
[data-status="down"] .overall-state strong,
.service-table [data-status="down"] .service-state {
  color: var(--down);
}

[data-status="down"] .status-dot {
  background: var(--down);
}

[data-status="ok"] .overall-state strong,
.service-table [data-status="ok"] .service-state {
  color: var(--accent);
}

.section-label {
  margin-bottom: 10px;
  color: var(--ink-faint);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.service-table {
  width: 100%;
  border-collapse: collapse;
}

.service-table th,
.service-table td {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: baseline;
}

.service-table thead th {
  color: var(--ink-faint);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.service-table td:nth-child(2),
.service-table th:nth-child(2),
.service-table td:nth-child(3),
.service-table th:nth-child(3),
.service-table td:nth-child(4),
.service-table th:nth-child(4) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.service-table td:nth-child(2),
.service-host,
.service-state {
  font-family: var(--mono);
  font-size: 0.86rem;
}

.service-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.service-label {
  font-size: 0.98rem;
}

.service-host {
  color: var(--ink-faint);
  font-size: 0.72rem;
}

.service-access {
  width: 3.25rem;
  color: var(--ink-faint);
  font-family: var(--display);
  font-size: 0.9rem;
}

.gate-switch {
  display: inline-flex;
  align-items: center;
  width: 26px;
  height: 14px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  vertical-align: middle;
}

.gate-switch::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 3px;
  border-radius: 50%;
  background: var(--ink-faint);
  transition: margin-left 0.2s var(--ease), background 0.2s var(--ease);
}

.gate-switch[aria-checked="true"] {
  border-color: var(--accent);
}

.gate-switch[aria-checked="true"]::after {
  margin-left: 13px;
  background: var(--accent);
}

.gate-switch:hover,
.gate-switch:focus-visible {
  border-color: var(--accent);
}

.gate-switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.gate-switch[disabled] {
  cursor: wait;
  opacity: 0.55;
}

.vitals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px 28px;
}

.vital-value {
  min-height: 2rem;
  margin-bottom: 8px;
  font-family: var(--display);
  font-size: 1.55rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.vital-value strong {
  font-weight: 500;
}

.vital-note {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.meter {
  height: 3px;
  margin: 0 0 10px;
  overflow: hidden;
  background: rgba(33, 40, 44, 0.12);
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.35s var(--ease);
}

.disk-panel[data-status="degraded"] .vital-value,
.host-panel[data-status="degraded"] .vital-value {
  color: var(--warn);
}

.disk-panel[data-status="down"] .vital-value,
.host-panel[data-status="down"] .vital-value {
  color: var(--down);
}

.disk-panel[data-status="degraded"] .meter span {
  background: var(--warn);
}

.disk-panel[data-status="down"] .meter span {
  background: var(--down);
}

.refresh-note {
  margin-top: 28px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 0.72rem;
}

[hidden] {
  display: none !important;
}

.mast-actions {
  display: flex;
  align-items: baseline;
  gap: 18px;
}

.lock {
  width: min(320px, 100%);
  margin: 0 auto;
  padding-top: 96px;
}

.auth-form {
  display: grid;
  gap: 18px;
  margin-top: 6px;
}

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  color: var(--ink-faint);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.field input {
  padding: 6px 0 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
  color: var(--ink);
  font: inherit;
}

.field input:focus {
  border-bottom-color: var(--accent);
  outline: none;
}

.form-submit {
  justify-self: start;
  min-height: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
}

.form-submit:hover,
.form-submit:focus-visible {
  color: var(--ink);
}

.form-submit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.form-note {
  min-height: 1.2em;
  color: var(--down);
  font-size: 0.85rem;
}

.form-note.ok {
  color: var(--accent);
}

@media (max-width: 620px) {
  .lock {
    padding-top: 64px;
  }

  .overall,
  .vitals {
    grid-template-columns: 1fr;
  }

  .overall {
    display: grid;
    gap: 10px;
  }

  .overall-meta {
    justify-content: flex-start;
  }

  .overall-state strong {
    font-size: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .meter span,
  .gate-switch::after {
    transition: none;
  }
}
