:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #181c22;
  --panel-soft: #20262e;
  --text: #f4f7fb;
  --muted: #9aa7b5;
  --line: #2b333d;
  --green: #40d98a;
  --amber: #f5b84b;
  --red: #ef5b67;
  --cyan: #35c5df;
  --blue: #5f8cff;
  --violet: #a78bfa;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(53, 197, 223, 0.18), transparent 34rem),
    linear-gradient(135deg, #0f1115 0%, #15171d 48%, #101820 100%);
  color: var(--text);
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.shell {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.status-strip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 28, 34, 0.78);
  color: var(--muted);
  box-shadow: var(--shadow);
}

.utility-button,
.danger-button,
.auth-panel button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 17, 21, 0.35);
  color: var(--text);
  cursor: pointer;
  padding: 0 12px;
  font-weight: 800;
}

.utility-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.utility-button:hover,
.auth-panel button:hover {
  border-color: rgba(53, 197, 223, 0.7);
}

.danger-button {
  border-color: rgba(239, 91, 103, 0.5);
  color: #ffc2c8;
}

.danger-button:hover {
  background: rgba(239, 91, 103, 0.14);
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.pulse,
.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--amber);
}

.pulse {
  box-shadow: 0 0 0 0 rgba(245, 184, 75, 0.45);
  animation: pulse 1.8s infinite;
}

.pulse.online,
.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(64, 217, 138, 0.42);
}

.pulse.offline,
.status-dot.offline,
.status-dot.critical {
  background: var(--red);
}

.status-dot.warning {
  background: var(--amber);
}

.divider {
  width: 1px;
  height: 18px;
  background: var(--line);
}

.overview,
.selected-overview {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

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

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

.metric,
.panel,
.toolbar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(32, 38, 46, 0.96), rgba(24, 28, 34, 0.96));
  box-shadow: var(--shadow);
}

.metric {
  min-height: 156px;
  padding: 18px;
}

.metric.primary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
}

.metric-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
  text-transform: uppercase;
}

.metric-head strong {
  color: var(--text);
  font-size: 1.9rem;
  line-height: 1;
}

.metric p {
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.ring {
  width: 118px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side, var(--panel) 72%, transparent 73%),
    conic-gradient(var(--green) calc(var(--value) * 1%), #303844 0);
}

.ring span {
  color: var(--text);
  font-size: 1.45rem;
  font-weight: 850;
}

.bar {
  height: 12px;
  margin-top: 42px;
  overflow: hidden;
  border-radius: 999px;
  background: #303844;
}

.bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  transition: width 300ms ease;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px;
}

.search {
  display: grid;
  gap: 7px;
  width: min(420px, 100%);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.search input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 17, 21, 0.52);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.search input:focus {
  border-color: var(--cyan);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 17, 21, 0.35);
  color: var(--muted);
  cursor: pointer;
  padding: 0 12px;
}

.segmented button.active {
  border-color: rgba(53, 197, 223, 0.7);
  background: rgba(53, 197, 223, 0.14);
  color: var(--text);
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.78fr) minmax(0, 2.2fr);
  gap: 16px;
}

.detail-stack {
  min-width: 0;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(280px, 0.8fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  padding: 18px;
}

.server-panel {
  align-self: start;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

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

.panel-note {
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}

.server-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 132px);
  overflow: auto;
  padding-right: 4px;
}

.server-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 17, 21, 0.32);
  cursor: pointer;
  padding: 12px;
  text-align: left;
}

.server-row:hover,
.server-row.active {
  border-color: rgba(53, 197, 223, 0.7);
  background: rgba(53, 197, 223, 0.1);
}

.server-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.server-main strong,
.server-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-main small,
.mini-metrics {
  color: var(--muted);
  font-size: 0.78rem;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  gap: 4px;
  text-align: right;
}

.mini-metrics b {
  color: var(--text);
  font-weight: 800;
}

.empty {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.chart-tools {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.auth-gate,
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at top left, rgba(53, 197, 223, 0.18), transparent 34rem),
    rgba(15, 17, 21, 0.92);
  z-index: 20;
}

.modal-backdrop {
  background: rgba(15, 17, 21, 0.72);
}

.auth-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(32, 38, 46, 0.98), rgba(24, 28, 34, 0.98));
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-panel.compact {
  width: min(390px, 100%);
}

.auth-panel h1,
.auth-panel h2 {
  margin: 0;
}

.auth-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-panel input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 17, 21, 0.52);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.auth-panel input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--cyan);
  padding: 0;
}

.auth-panel input:focus {
  border-color: var(--cyan);
}

.auth-panel > button,
.form-actions button:first-child {
  border-color: rgba(53, 197, 223, 0.7);
  background: rgba(53, 197, 223, 0.14);
}

.auth-message {
  min-height: 20px;
  margin: 0;
  color: #ffc2c8;
  line-height: 1.4;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-panel {
  width: min(470px, 100%);
}

.command-panel {
  width: min(720px, 100%);
}

.command-box {
  max-height: 260px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 17, 21, 0.72);
  color: #d6fbe7;
  padding: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.command-box code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
}

.check-row {
  display: inline-flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 9px !important;
  text-transform: none !important;
}

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

.resource-charts {
  display: grid;
  gap: 12px;
}

.chart-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #11161c;
}

.chart-title {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.chart-title span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.chart-title i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.chart-title strong {
  color: var(--text);
  font-size: 1rem;
}

.cpu-dot {
  background: var(--green);
}

.memory-dot {
  background: var(--cyan);
}

.disk-dot {
  background: var(--violet);
}

.time-range {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.time-range button {
  min-width: 42px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 17, 21, 0.35);
  color: var(--muted);
  cursor: pointer;
  padding: 0 9px;
}

.time-range button.active {
  border-color: rgba(53, 197, 223, 0.7);
  background: rgba(53, 197, 223, 0.14);
  color: var(--text);
}

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

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

.alert {
  padding: 13px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  line-height: 1.4;
}

.alert.good {
  border-left: 4px solid var(--green);
  color: #c7f6dc;
}

.alert.warn {
  border-left: 4px solid var(--amber);
  color: #ffe2a8;
}

.alert.danger {
  border-left: 4px solid var(--red);
  color: #ffc2c8;
}

.details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.process-panel {
  margin-bottom: 16px;
}

.process-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 17, 21, 0.32);
}

.process-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

.process-table th,
.process-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.process-table th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.process-table th button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  padding: 0;
  text-transform: inherit;
}

.process-table th button.active {
  color: var(--cyan);
}

.process-table td {
  color: var(--text);
  font-size: 0.88rem;
}

.process-table td:first-child {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.process-table tr:last-child td {
  border-bottom: 0;
}

.process-table .numeric {
  text-align: right;
}

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

dl div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 17, 21, 0.32);
}

dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-weight: 750;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 10px transparent;
  }

  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@media (max-width: 1180px) {
  .overview,
  .selected-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout,
  .grid,
  .details {
    grid-template-columns: 1fr;
  }

  .server-panel {
    position: static;
    max-height: none;
  }

  .server-list {
    max-height: 420px;
  }
}

@media (max-width: 760px) {
  .topbar,
  .toolbar {
    display: grid;
  }

  .overview,
  .selected-overview {
    grid-template-columns: 1fr;
  }

  .metric.primary {
    grid-template-columns: 1fr;
  }

  .ring {
    justify-self: center;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1500px);
    padding-top: 18px;
  }

  .status-strip {
    align-items: flex-start;
    flex-wrap: wrap;
    height: auto;
    padding: 12px;
  }

  .divider {
    display: none;
  }

  .mini-metrics {
    display: none;
  }

  dl {
    grid-template-columns: 1fr;
  }

  canvas {
    height: 280px;
  }
}
