:root {
  color-scheme: dark;
  --bg: #0c1118;
  --surface: #131b25;
  --elevated: #1a2532;
  --line: #283444;
  --text: #e7edf5;
  --muted: #97a7bb;
  --accent: #6ee7bd;
  --ink: #092b22;
  --red: #ff8993;
  --yellow: #f8ca75;
  --blue: #86b8ff;
  --shadow: 0 20px 70px #0004;
  font:
    16px/1.5 Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
body.light {
  color-scheme: light;
  --bg: #f2f5f8;
  --surface: #fff;
  --elevated: #edf2f6;
  --line: #d7e0e9;
  --text: #172a3b;
  --muted: #50667b;
  --accent: #087756;
  --ink: #fff;
  --red: #bb263b;
  --yellow: #8d5b07;
  --blue: #215fae;
  --shadow: 0 20px 70px #1231;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 14px;
  color: var(--text);
  background: var(--elevated);
  font-weight: 550;
}
button:hover {
  filter: brightness(1.15);
  border-color: var(--muted);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
}
.danger {
  color: var(--red);
}
a {
  color: var(--accent);
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  padding: 10px 12px;
  min-height: 44px;
}
textarea {
  min-height: 90px;
  resize: vertical;
}
label {
  display: grid;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--muted);
}
input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 1.8rem;
  letter-spacing: -0.04em;
}
h2 {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
h3 {
  font-size: 1rem;
}
small,
.small {
  font-size: 0.8125rem;
}
.muted {
  color: var(--muted);
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.875rem;
}
.layout {
  display: grid;
  grid-template-columns: 226px 1fr;
  min-height: 100vh;
}
.sidebar {
  border-right: 1px solid var(--line);
  padding: 28px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 30px;
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 700;
}
.brand img {
  width: 34px;
  height: 34px;
}
.brand small {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-top: 5px;
}
.nav {
  display: grid;
  gap: 6px;
}
.nav button {
  text-align: left;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.875rem;
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 44px;
}
.nav button.active {
  background: var(--elevated);
  color: var(--accent);
}
.nav svg {
  width: 18px;
  height: 18px;
}
.sidebar-footer {
  margin-top: auto;
  padding: 20px 10px 0;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--muted);
}
.sidebar-footer button {
  margin-top: 12px;
  width: 100%;
}
.main {
  min-width: 0;
}
.topbar {
  height: 72px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  background: var(--surface);
  gap: 10px;
}
.crumb {
  font-size: 0.875rem;
  color: var(--muted);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.content {
  padding: 32px 34px;
  max-width: 1800px;
  margin: auto;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
}
.page-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.875rem;
}
.actions {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}
.summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  background: var(--surface);
}
.stat .number {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  margin-top: 6px;
}
.stat .label {
  font-size: 0.875rem;
  color: var(--muted);
}
.good {
  color: var(--accent);
}
.warning {
  color: var(--yellow);
}
.critical {
  color: var(--red);
}
.unknown,
.offline {
  color: var(--muted);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid currentColor;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 0.75rem;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  background: currentColor;
  border-radius: 50%;
}
.HEALTHY {
  color: var(--accent);
}
.WARNING {
  color: var(--yellow);
}
.CRITICAL {
  color: var(--red);
}
.UNKNOWN,
.OFFLINE {
  color: var(--muted);
}
.INFO {
  color: var(--blue);
}
.healthbar {
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 16px;
  margin: 0 0 22px;
  font-size: 0.8125rem;
  flex-wrap: wrap;
}
.healthbar strong {
  font-size: 0.875rem;
}
.healthbar .push {
  margin-left: auto;
}
.notice {
  border: 1px solid var(--yellow);
  background: var(--surface);
  color: var(--yellow);
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.875rem;
}
.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.filters input {
  max-width: 380px;
}
.filters select {
  max-width: 180px;
}
.server-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.server-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  overflow: hidden;
}
.card-head {
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}
.server-title {
  background: none;
  border: 0;
  padding: 0;
  font-size: 1rem;
  text-align: left;
}
.server-title:hover {
  color: var(--accent);
}
.hostname {
  color: var(--muted);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
  margin-top: 4px;
}
.card-body {
  padding: 17px 20px;
}
.queue-line {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 12px;
}
.metric-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 3px;
}
.metric-val {
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.metric-val.large {
  font-size: 1.9rem;
  line-height: 1.1;
}
.resource-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 22px;
}
.resource-title {
  font-size: 0.8125rem;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
}
progress {
  width: 100%;
  height: 5px;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--elevated);
  display: block;
  margin-top: 7px;
}
progress::-webkit-progress-bar {
  background: var(--elevated);
}
progress::-webkit-progress-value {
  background: var(--blue);
}
progress::-moz-progress-bar {
  background: var(--blue);
}
.services {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.75rem;
  margin-top: 18px;
  color: var(--muted);
}
.services b {
  font-weight: 500;
}
.card-reason {
  font-size: 0.8125rem;
  margin-top: 15px;
  min-height: 20px;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 11px 20px;
  font-size: 0.75rem;
  color: var(--muted);
  gap: 10px;
}
.card-footer button {
  padding: 5px 10px;
  font-size: 0.8125rem;
}
.section-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  margin: 26px 0 12px;
}
.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 20px;
  min-width: 0;
}
.empty {
  text-align: center;
  padding: 70px 25px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.empty h2 {
  margin-bottom: 10px;
}
.empty p {
  color: var(--muted);
  max-width: 500px;
  margin: 0 auto 25px;
}
.split {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
.tabs {
  display: flex;
  gap: 4px;
  overflow: auto;
  margin: 15px 0 24px;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
  white-space: nowrap;
  padding: 12px 15px;
}
.tabs button.active {
  color: var(--accent);
  box-shadow: inset 0 -2px var(--accent);
}
.chart {
  width: 100%;
  height: 230px;
  margin-top: 18px;
}
.chart text {
  fill: var(--muted);
  font-size: 12px;
}
.chart line {
  stroke: var(--line);
}
.chart path {
  stroke: var(--accent);
  stroke-width: 2;
  fill: none;
}
.chart .area {
  fill: var(--accent);
  opacity: 0.07;
  stroke: none;
}
.chart-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chart-title select {
  width: auto;
  padding: 5px 10px;
  font-size: 0.875rem;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.875rem;
}
th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
tr:last-child td {
  border-bottom: 0;
}
.table-wrap {
  overflow: auto;
}
.kv {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 0;
  font-size: 0.875rem;
}
.kv > div {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.kv > div:nth-child(odd) {
  color: var(--muted);
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.8125rem;
  background: var(--bg);
  border-radius: 8px;
  padding: 16px;
  max-height: 550px;
  overflow: auto;
}
.incident {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  display: flex;
  gap: 15px;
}
.incident:last-child {
  border: 0;
}
.incident p {
  font-size: 0.875rem;
  margin-top: 5px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.full {
  grid-column: 1/-1;
}
.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-direction: row;
  font-size: 0.875rem;
}
.checkline input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}
.form-section {
  font-size: 0.875rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin: 24px 0 15px;
  color: var(--text);
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
dialog {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px;
  width: min(740px, calc(100% - 30px));
  max-height: 90vh;
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: #0009;
  backdrop-filter: blur(3px);
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.dialog-head button {
  background: none;
  padding: 4px 12px;
}
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  max-width: 410px;
  width: 100%;
  padding: 35px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.login-card .brand {
  padding: 0 0 30px;
}
.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: 7px;
}
.login-card form {
  display: grid;
  gap: 18px;
  margin-top: 26px;
}
.login-card small {
  display: block;
  margin-top: 24px;
  color: var(--muted);
}
#toast {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 10;
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px 20px;
  max-width: 420px;
  font-size: 0.875rem;
  display: none;
}
.error {
  color: var(--red);
  font-size: 0.875rem;
}
.history-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.mb {
  margin-bottom: 20px;
}
@media (min-width: 1550px) {
  .server-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 1050px) {
  .layout {
    grid-template-columns: 185px 1fr;
  }
  .content {
    padding: 25px 20px;
  }
  .topbar {
    padding: 0 20px;
  }
  .server-grid {
    grid-template-columns: 1fr;
  }
  .summary {
    gap: 8px;
  }
  .stat {
    padding: 14px;
  }
  .split {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 700px) {
  .layout {
    display: block;
  }
  .sidebar {
    height: auto;
    position: static;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand {
    padding: 0 5px 15px;
  }
  .nav {
    display: flex;
    overflow: auto;
  }
  .nav button {
    white-space: nowrap;
  }
  .nav svg,
  .sidebar-footer {
    display: none;
  }
  .topbar {
    height: 56px;
  }
  .content {
    padding: 24px 15px;
  }
  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
  }
  .summary {
    grid-template-columns: repeat(3, 1fr);
  }
  .stat .number {
    font-size: 1.6rem;
  }
  .filters {
    flex-wrap: wrap;
  }
  .filters input {
    max-width: none;
  }
  .filters select {
    flex: 1;
    max-width: none;
  }
  .form-grid,
  .history-grid {
    grid-template-columns: 1fr;
  }
  .full {
    grid-column: auto;
  }
  .queue-line {
    gap: 6px;
  }
  .resource-row {
    gap: 12px;
  }
  .top-actions .username {
    display: none;
  }
  h1 {
    font-size: 1.6rem;
  }
  .healthbar {
    gap: 10px;
  }
  .healthbar .push {
    margin-left: 0;
  }
  .card-head,
  .card-body {
    padding: 16px;
  }
  .card-footer {
    padding: 11px 16px;
  }
  .chart {
    height: 200px;
  }
}
