:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #182230;
  --muted: #667085;
  --line: #d9e0ea;
  --brand: #2457d6;
  --brand-dark: #1742aa;
  --ok: #11845b;
  --warn: #b54708;
  --bad: #b42318;
  --shadow: 0 14px 40px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  min-height: 40px;
  padding: 0 16px;
}

button:hover {
  background: var(--brand-dark);
}

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.ghost:hover {
  background: #eef2f8;
}

.danger {
  background: #b42318;
}

.danger:hover {
  background: #912018;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px 20px 18px;
}

.eyebrow {
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.15;
  margin-bottom: 0;
}

h2 {
  font-size: 18px;
}

main {
  margin: 0 auto;
  max-width: 1180px;
  padding: 0 20px 40px;
}

.actions,
.dialog-actions,
.inline-form {
  align-items: center;
  display: flex;
  gap: 10px;
}

.summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 16px 0 18px;
}

.summary,
.auth-panel,
.empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary {
  padding: 18px;
}

.summary span {
  display: block;
  font-size: 30px;
  font-weight: 800;
}

.summary small {
  color: var(--muted);
}

.summary.ok span {
  color: var(--ok);
}

.summary.warn span {
  color: var(--warn);
}

.summary.muted span {
  color: var(--muted);
}

.server-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
}

.server-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
  padding: 18px;
}

.server-card header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.server-title {
  min-width: 0;
}

.server-title h2 {
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.host,
.meta {
  color: var(--muted);
  font-size: 14px;
}

.status {
  border-radius: 999px;
  color: #fff;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 9px;
  text-transform: uppercase;
}

.status-stack {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status.online {
  background: var(--ok);
}

.status.stale {
  background: var(--warn);
}

.status.never {
  background: var(--muted);
}

.metric-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px 0 12px;
}

.metric {
  background: #f8fafc;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  padding: 12px;
}

.metric strong {
  display: block;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.services {
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
}

.card-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.card-actions button {
  width: 100%;
}

.alerts {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.alert {
  background: #fff4ed;
  border: 1px solid #fedf89;
  border-radius: 8px;
  color: #93370d;
  font-size: 13px;
  line-height: 1.35;
  padding: 10px 12px;
}

.pill {
  background: #eef2f8;
  border-radius: 999px;
  color: #344054;
  font-size: 13px;
  padding: 6px 9px;
}

.pill.active {
  background: #d1fadf;
  color: #05603a;
}

.pill.inactive {
  background: #fee4e2;
  color: #912018;
}

.auth-panel,
.empty {
  padding: 22px;
}

.hidden {
  display: none !important;
}

dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(16, 24, 40, 0.28);
  max-width: 520px;
  width: calc(100% - 28px);
}

.wide-dialog {
  max-width: 980px;
}

.server-page-header {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 14px 0;
  padding: 18px;
}

.server-page-header h2 {
  margin-bottom: 6px;
}

dialog::backdrop {
  background: rgba(16, 24, 40, 0.44);
}

.dialog-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.dialog-head h2 {
  margin-bottom: 0;
}

.dialog-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 5px 0 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tab {
  background: #eef2f8;
  color: var(--text);
}

.tab.active {
  background: var(--brand);
  color: #fff;
}

.details-status {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.detail-stat {
  background: #f8fafc;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  padding: 12px;
}

.detail-stat strong {
  display: block;
  font-size: 20px;
}

.detail-stat span {
  color: var(--muted);
  font-size: 13px;
}

.chart-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  padding: 14px;
}

.chart-wide {
  grid-column: 1 / -1;
}

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

.chart-head h3 {
  font-size: 15px;
  margin: 0;
}

.chart-head span {
  color: var(--muted);
  font-size: 13px;
}

.services-pane {
  display: grid;
  gap: 14px;
}

.detail-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.detail-section h3 {
  font-size: 16px;
  margin: 0 0 12px;
}

.detail-section h4 {
  font-size: 14px;
  margin: 12px 0 8px;
}

.service-detail {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.service-detail:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.service-detail header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

pre {
  background: #101828;
  border-radius: 8px;
  color: #e4e7ec;
  font-size: 12px;
  line-height: 1.45;
  max-height: 240px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 720px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  padding: 9px 8px;
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 700;
}

.check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-group h4 {
  flex: 0 0 100%;
}

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

.wide-field {
  grid-column: 1 / -1;
}

.muted-text {
  color: var(--muted);
  margin-bottom: 0;
}

code {
  background: #eef2f8;
  border-radius: 6px;
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 3px 6px;
}

.list-box {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.list-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px;
}

.wizard-steps {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.wizard-step {
  background: #eef2f8;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 10px;
  text-align: center;
}

.wizard-step.active {
  background: var(--brand);
  color: #fff;
}

canvas {
  display: block;
  height: 220px;
  width: 100%;
}

.icon {
  align-items: center;
  background: #eef2f8;
  color: var(--text);
  display: inline-flex;
  font-size: 24px;
  height: 36px;
  justify-content: center;
  min-height: 36px;
  padding: 0;
  width: 36px;
}

label {
  color: var(--muted);
  display: grid;
  gap: 7px;
  font-size: 14px;
  margin-bottom: 14px;
}

input,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  padding: 11px 12px;
  width: 100%;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(36, 87, 214, 0.14);
}

textarea {
  height: 180px;
  resize: vertical;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

@media (max-width: 720px) {
  .topbar,
  .actions,
  .inline-form {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding-top: 20px;
  }

  .actions button,
  .inline-form button {
    width: 100%;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .details-status,
  .chart-grid,
  .settings-grid,
  .wizard-steps {
    grid-template-columns: 1fr;
  }

  .card-actions {
    grid-template-columns: 1fr;
  }

  .chart-wide {
    grid-column: auto;
  }
}
