:root {
  color-scheme: dark;
  --bg: #101314;
  --panel: #181d1c;
  --panel-2: #202725;
  --line: #33413d;
  --text: #edf3ef;
  --muted: #99aaa4;
  --green: #54d68a;
  --teal: #48c7c3;
  --amber: #e7b85c;
  --red: #eb6b67;
  --blue: #7ba7ff;
  --shadow: rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(72, 199, 195, 0.08), transparent 360px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

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

.topbar,
.section-heading,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar {
  margin-bottom: 22px;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.96;
}

h2 {
  font-size: 1.12rem;
}

.status-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  white-space: nowrap;
}

#refreshButton {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

#refreshButton:hover {
  border-color: var(--teal);
}

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

.metric-tile,
.panel,
.app-detail,
.app-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: 0 12px 36px var(--shadow);
}

.metric-tile {
  min-height: 142px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.label,
.facts dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.metric-tile strong {
  display: block;
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1;
}

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

.meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #0b0e0d;
}

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

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

.panel,
.app-detail {
  padding: 18px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

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

.facts div {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.facts dt,
.facts dd {
  margin: 0;
}

.facts dd {
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.server-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.server-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.server-row span {
  color: var(--muted);
  font-size: 0.84rem;
}

.apps-section {
  padding-top: 8px;
}

#appFilter {
  width: min(320px, 100%);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #0d1110;
  color: var(--text);
}

.apps-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.25fr);
  gap: 12px;
  align-items: start;
  margin-top: 14px;
}

.app-list {
  display: grid;
  gap: 10px;
}

.app-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  width: 100%;
  padding: 14px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.app-card[aria-selected="true"] {
  border-color: var(--teal);
  background: #1d2c29;
}

.app-card h3 {
  margin: 0 0 7px;
  font-size: 1rem;
}

.app-card p,
.app-detail p {
  margin: 0;
  color: var(--muted);
}

.state {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--amber);
}

.state.running {
  background: var(--green);
}

.state.active {
  background: var(--green);
}

.state.unknown {
  background: var(--muted);
}

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

.mini-metric {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.mini-metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.mini-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.info-table {
  display: grid;
  gap: 8px;
}

.info-table div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.info-table dt,
.info-table dd {
  margin: 0;
}

.info-table dt {
  color: var(--muted);
}

.info-table dd {
  overflow-wrap: anywhere;
}

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

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

  .topbar,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .overview,
  .split,
  .apps-layout,
  .facts,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .metric-tile {
    min-height: 118px;
  }

  .info-table div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
