:root {
  --page: #f4f6f8;
  --panel: #ffffff;
  --panel-alt: #f8fafb;
  --line: #dfe4e8;
  --line-strong: #cbd3da;
  --text: #18212b;
  --muted: #687584;
  --subtle: #8c98a5;
  --green: #158a55;
  --green-bg: #e8f7ef;
  --red: #d44343;
  --red-bg: #feeeee;
  --amber: #b66b08;
  --amber-bg: #fff4dc;
  --blue: #3267d6;
  --blue-bg: #edf3ff;
  --purple: #7257c8;
  --sidebar: #1d242c;
  --sidebar-line: #333c46;
  --sidebar-text: #e9edf1;
  --sidebar-muted: #9ba7b3;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--page);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--page);
}

button,
a {
  font: inherit;
}

button {
  letter-spacing: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid #151b21;
  color: var(--sidebar-text);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 72px;
  padding: 0 20px;
  border-bottom: 1px solid var(--sidebar-line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
  letter-spacing: 0;
}

.brand strong {
  font-size: 14px;
  line-height: 19px;
}

.brand small {
  color: var(--sidebar-muted);
  font-size: 11px;
  line-height: 16px;
}

.nav {
  padding: 16px 10px;
  overflow-y: auto;
}

.nav-label {
  margin: 22px 10px 8px;
  color: #7f8b97;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  color: var(--sidebar-muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--sidebar-text);
  background: #29313a;
}

.nav-item.active {
  color: #fff;
  background: #34404c;
}

.nav-icon {
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border: 1px solid #55616d;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
}

.nav-item.active .nav-icon {
  border-color: #75a0ff;
  color: #bcd0ff;
}

.provider-nav-dot {
  width: 8px;
  height: 8px;
  margin: 0 7px;
  border-radius: 50%;
  background: var(--provider-color, var(--blue));
}

.nav-subitem {
  min-height: 32px;
  padding-left: 42px;
  font-size: 11px;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--sidebar-line);
  color: var(--sidebar-muted);
  font-size: 11px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #30c77a;
  box-shadow: 0 0 0 3px rgba(48, 199, 122, 0.12);
}

.main {
  min-width: 0;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px 32px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 28px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-name {
  max-width: 140px;
  overflow: hidden;
  color: #40505f;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-button {
  color: var(--red);
}

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

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: #40505f;
  background: var(--panel);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover {
  border-color: #9eabb6;
  background: var(--panel-alt);
}

.icon-button.loading {
  animation: rotate 0.8s linear infinite;
}

.content {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px 32px 56px;
}

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

.summary-card {
  min-height: 112px;
  padding: 17px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.summary-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.summary-symbol {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  color: var(--symbol-color);
  background: var(--symbol-bg);
  font-size: 10px;
  font-weight: 800;
}

.summary-value {
  margin-top: 11px;
  font-size: 26px;
  font-weight: 750;
  line-height: 30px;
}

.summary-note {
  margin-top: 2px;
  color: var(--subtle);
  font-size: 11px;
}

.section {
  margin-top: 28px;
  scroll-margin-top: 20px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0 0 3px;
  font-size: 16px;
  line-height: 22px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.section-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

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

.endpoint-card {
  position: relative;
  min-width: 0;
  min-height: 112px;
  padding: 15px 15px 13px 18px;
  overflow: hidden;
  border: 1px solid var(--status-line, var(--line));
  border-radius: 7px;
  background: var(--status-bg, var(--panel));
}

.endpoint-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--status-color, var(--subtle));
}

.status-online {
  --status-color: var(--green);
  --status-bg: var(--green-bg);
  --status-line: #c2e7d3;
}

.status-offline {
  --status-color: var(--red);
  --status-bg: var(--red-bg);
  --status-line: #f3c7c7;
}

.status-degraded {
  --status-color: var(--amber);
  --status-bg: var(--amber-bg);
  --status-line: #efd9ab;
}

.status-unknown {
  --status-color: #82909e;
  --status-bg: #f1f3f5;
  --status-line: #d9dee3;
}

.endpoint-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.endpoint-name {
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  overflow-wrap: anywhere;
}

.status-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 11px;
  color: var(--status-color, var(--muted));
  background: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-weight: 750;
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-color, var(--subtle));
}

.endpoint-url {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  color: #536170;
  font-size: 11px;
  line-height: 16px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endpoint-url:hover {
  color: var(--blue);
  text-decoration: underline;
}

.endpoint-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 10px;
}

.provider-band {
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.provider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 16px;
  background: var(--panel-alt);
  border-bottom: 1px solid var(--line);
}

.provider-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.provider-color {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--provider-color, var(--blue));
}

.provider-title h3 {
  margin: 0;
  font-size: 13px;
}

.provider-stat {
  color: var(--muted);
  font-size: 11px;
}

.environment-group + .environment-group {
  border-top: 1px solid var(--line);
}

.environment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 8px 16px;
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
}

.environment-header h4 {
  margin: 0;
  font-size: 11px;
  font-weight: 750;
}

.environment-header span {
  color: var(--muted);
  font-size: 10px;
}

.server-table {
  width: 100%;
  border-collapse: collapse;
}

.server-row + .server-row {
  border-top: 1px solid var(--line);
}

.server-row td {
  padding: 14px 16px;
  vertical-align: top;
}

.server-identity {
  width: 230px;
}

.server-name-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--status-color, var(--subtle));
  box-shadow: 0 0 0 1px var(--status-color, var(--subtle));
}

.server-name {
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.server-subtitle {
  margin: 4px 0 0 17px;
  color: var(--muted);
  font-size: 10px;
  line-height: 15px;
}

.resources-cell {
  width: 350px;
}

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

.resource-head {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}

.resource-head strong {
  color: #394957;
}

.resource-track {
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: #e9edf0;
}

.resource-fill {
  height: 100%;
  width: var(--value);
  max-width: 100%;
  border-radius: inherit;
  background: var(--meter-color, var(--blue));
}

.resource-fill.warn {
  --meter-color: var(--amber);
}

.resource-fill.critical {
  --meter-color: var(--red);
}

.services {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 240px;
}

.service-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid var(--status-line, var(--line));
  border-radius: 5px;
  color: #41505e;
  background: var(--status-bg, var(--panel-alt));
  font-size: 10px;
  font-weight: 650;
}

.service-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-color, var(--subtle));
}

.incidents {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.incident-row {
  display: grid;
  grid-template-columns: 120px 110px minmax(180px, 1fr) minmax(180px, 2fr);
  gap: 16px;
  align-items: center;
  min-height: 50px;
  padding: 10px 16px;
  font-size: 11px;
}

.incident-row + .incident-row {
  border-top: 1px solid var(--line);
}

.incident-time,
.incident-kind {
  color: var(--muted);
}

.incident-name {
  font-weight: 700;
}

.incident-message {
  min-width: 0;
  color: #4e5d6a;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 28px 20px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.skeleton {
  min-height: 92px;
  border-color: #e6e9ec;
  background: #eceff2;
  animation: pulse 1.6s ease-in-out infinite;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 10px 13px;
  border: 1px solid #f0c2c2;
  border-radius: 6px;
  color: #892e2e;
  background: #fff1f1;
  font-size: 12px;
  box-shadow: 0 10px 28px rgba(32, 43, 53, 0.14);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.login-page {
  min-height: 100vh;
  background: var(--sidebar);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  overflow: hidden;
  border: 1px solid #d8dee3;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(7, 13, 20, 0.28);
}

.login-brand {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  color: var(--sidebar-text);
  background: #252e37;
  border-bottom: 1px solid #3b4651;
}

.login-brand strong,
.login-brand small {
  display: block;
  letter-spacing: 0;
}

.login-brand strong {
  font-size: 14px;
  line-height: 19px;
}

.login-brand small {
  color: var(--sidebar-muted);
  font-size: 11px;
  line-height: 16px;
}

.login-content {
  padding: 30px 30px 26px;
}

.access-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--green);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.login-content h1 {
  margin: 0;
  font-size: 24px;
  line-height: 30px;
}

.login-content > p {
  margin: 7px 0 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.login-form {
  display: grid;
}

.login-form label {
  margin: 0 0 6px;
  color: #384756;
  font-size: 11px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  height: 42px;
  margin-bottom: 15px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  outline: 0;
  color: var(--text);
  background: #fff;
  font: inherit;
  font-size: 14px;
  letter-spacing: 0;
}

.login-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(50, 103, 214, 0.12);
}

.login-error {
  min-height: 20px;
  margin: -2px 0 8px;
  color: var(--red);
  font-size: 11px;
  line-height: 16px;
}

.login-submit {
  height: 42px;
  border: 1px solid #2859bb;
  border-radius: 5px;
  color: #fff;
  background: var(--blue);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.login-submit:hover {
  background: #285bc2;
}

.login-submit:disabled {
  cursor: wait;
  opacity: 0.68;
}

.login-footer {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  color: var(--muted);
  background: var(--panel-alt);
  border-top: 1px solid var(--line);
  font-size: 10px;
}

.login-footer .status-dot {
  width: 7px;
  height: 7px;
  border-width: 1px;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.62;
  }
  50% {
    opacity: 1;
  }
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1120px) {
  .endpoint-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .server-row {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .server-row td {
    display: block;
    width: auto;
  }

  .server-row .services-cell {
    grid-column: 1 / -1;
    padding-top: 0;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
  }

  .brand {
    height: 60px;
  }

  .nav {
    display: flex;
    gap: 5px;
    padding: 8px 12px;
    overflow-x: auto;
  }

  .nav-label,
  .sidebar-footer {
    display: none;
  }

  #provider-nav {
    display: contents;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 34px;
    margin: 0;
    padding: 6px 10px;
    white-space: nowrap;
  }

  .nav-icon,
  .provider-nav-dot {
    display: none;
  }

  .nav-subitem {
    padding-left: 10px;
  }

  .topbar {
    min-height: 66px;
    padding: 12px 18px;
  }

  .account-name {
    display: none;
  }

  .content {
    padding: 18px 18px 44px;
  }

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

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

@media (max-width: 560px) {
  .topbar {
    align-items: end;
  }

  .eyebrow,
  .updated {
    display: none;
  }

  h1 {
    font-size: 19px;
  }

  .content {
    padding-inline: 12px;
  }

  .login-shell {
    padding: 14px;
  }

  .login-content {
    padding: 26px 22px 22px;
  }

  .summary-grid {
    gap: 8px;
  }

  .summary-card {
    min-height: 100px;
    padding: 14px;
  }

  .summary-value {
    font-size: 22px;
  }

  .endpoint-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: start;
  }

  .section-heading p {
    display: none;
  }

  .server-row {
    display: block;
  }

  .server-row td {
    padding: 12px;
  }

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

  .incident-row {
    grid-template-columns: 86px 1fr;
    gap: 5px 10px;
  }

  .incident-message {
    grid-column: 1 / -1;
  }

  .incident-kind {
    display: none;
  }
}
