:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #eefcf7;
  --text: #0d0d0d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --green: #10a37f;
  --green-soft: #d7f7ed;
  --amber: #f5a524;
  --amber-soft: #fff4d8;
  --red: #ef6a5b;
  --red-soft: #ffe5e1;
  --gray: #9ca3af;
}

* {
  box-sizing: border-box;
}

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

.shell {
  width: min(670px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 72px;
}

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

.brand {
  color: var(--text);
  font-size: 28px;
  font-weight: 760;
  line-height: 1;
  text-decoration: none;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.status-banner {
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--surface);
}

.banner-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 16px;
  background: var(--green-soft);
}

.status-banner p {
  margin: 0;
  padding: 18px 16px;
  font-size: 15px;
  line-height: 1.5;
}

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

h1 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.3;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.3;
}

.status-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green);
}

.status-mark::after {
  content: "";
  width: 7px;
  height: 4px;
  border-bottom: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  transform: rotate(-45deg) translate(1px, -1px);
}

.state-operational {
  border-color: var(--green);
}

.state-operational .banner-head {
  background: var(--green-soft);
}

.state-operational .status-mark,
.dot.operational,
.bar.operational {
  background: var(--green);
}

.state-degraded {
  border-color: var(--amber);
}

.state-degraded .banner-head {
  background: var(--amber-soft);
}

.state-degraded .status-mark,
.dot.degraded,
.bar.degraded {
  background: var(--amber);
}

.state-down {
  border-color: var(--red);
}

.state-down .banner-head {
  background: var(--red-soft);
}

.state-down .status-mark,
.dot.down,
.bar.down {
  background: var(--red);
}

.state-unknown {
  border-color: var(--line-strong);
}

.state-unknown .banner-head {
  background: #f3f4f6;
}

.state-unknown .status-mark,
.dot.unknown,
.bar.unknown {
  background: var(--gray);
}

.system-card,
.component-card {
  overflow: hidden;
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.system-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid #f0f1f3;
}

.system-card-head span {
  color: var(--muted);
  font-size: 14px;
}

.system-row {
  display: block;
  width: 100%;
  padding: 16px;
  border: 0;
  border-bottom: 1px solid #f0f1f3;
  border-radius: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.system-row:hover {
  background: #fafafa;
}

.system-row:focus-visible {
  outline: 3px solid rgba(16, 163, 127, 0.22);
  outline-offset: -3px;
}

.system-row:last-child,
.component-row:last-child {
  border-bottom: 0;
}

.system-row-head {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.dot {
  position: relative;
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.dot::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 7px;
  height: 4px;
  border-bottom: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  transform: rotate(-45deg);
}

.system-name {
  min-width: 0;
  font-size: 15px;
  font-weight: 680;
}

.component-count {
  margin-left: 8px;
  color: var(--muted);
  font-weight: 460;
}

.uptime {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.uptime-bars {
  display: grid;
  grid-template-columns: repeat(56, minmax(3px, 1fr));
  gap: 3px;
  width: 100%;
}

.bar {
  height: 16px;
  border-radius: 1px;
  background: #e5e7eb;
}

.bar.pending {
  background: #eef0f2;
}

.component-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}

.component-table th {
  padding: 11px 16px;
  border-bottom: 1px solid #f0f1f3;
  color: var(--muted);
  font-size: 12px;
  font-weight: 620;
  text-align: left;
}

.component-table th:nth-child(2),
.component-table th:nth-child(3) {
  width: 132px;
}

.component-table td {
  padding: 13px 16px;
  border-bottom: 1px solid #f0f1f3;
  vertical-align: middle;
}

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

.component-identity {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.component-main {
  min-width: 0;
}

.component-main strong {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.component-main span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.component-meta {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-empty {
  color: var(--muted);
}

.component-dialog {
  width: min(620px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.component-dialog::backdrop {
  background: rgba(15, 23, 42, 0.38);
}

.dialog-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid #f0f1f3;
}

.dialog-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 22px;
  line-height: 1;
}

.dialog-close:focus-visible {
  outline: 3px solid rgba(16, 163, 127, 0.22);
  outline-offset: 2px;
}

.dialog-body {
  max-height: min(640px, 72vh);
  overflow: auto;
}

.dialog-service {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 10px;
  padding: 15px 16px;
  border-bottom: 1px solid #f0f1f3;
}

.dialog-service:last-child {
  border-bottom: 0;
}

.dialog-service-main strong {
  display: block;
  font-weight: 680;
}

.dialog-service-main span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.dialog-meta {
  grid-column: 2;
  display: grid;
  grid-template-columns: minmax(90px, auto) minmax(0, 1fr);
  gap: 7px 12px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.dialog-meta dt,
.dialog-meta dd {
  margin: 0;
}

.dialog-meta dd {
  color: var(--text);
  overflow-wrap: anywhere;
}

.dialog-empty {
  margin: 0;
  padding: 16px;
  color: var(--muted);
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 24px, 670px);
    padding-top: 22px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 24px;
  }

  .topbar-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .system-row-head {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .uptime {
    grid-column: 2;
  }

  .uptime-bars {
    grid-template-columns: repeat(28, minmax(4px, 1fr));
  }

  .component-table thead {
    display: none;
  }

  .component-table,
  .component-table tbody,
  .component-table tr,
  .component-table td {
    display: block;
    width: 100%;
  }

  .component-table tr {
    padding: 13px 16px;
    border-bottom: 1px solid #f0f1f3;
  }

  .component-table tbody tr:last-child {
    border-bottom: 0;
  }

  .component-table td {
    padding: 0;
    border-bottom: 0;
  }

  .component-table td + td {
    margin-top: 8px;
  }

  .component-meta::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.2;
  }

  .component-empty {
    padding: 0;
  }
}
