:root {
  --background: #0F172A;
  --sidebar: #111827;
  --card: #1E293B;
  --primary: #2563EB;
  --success: #16A34A;
  --warning: #F59E0B;
  --danger: #DC2626;
  --text: #F8FAFC;
  --muted: #94A3B8;
  --line: rgba(148, 163, 184, 0.18);
  --soft: rgba(248, 250, 252, 0.06);
  --shadow: 0 18px 55px rgba(2, 6, 23, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  display: inline-block;
  max-width: 100%;
  padding: 2px 6px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
  font-size: 0.92em;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  width: 260px;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  padding: 24px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 34px;
}

.nav a {
  min-height: 42px;
  border-radius: 8px;
  color: #CBD5E1;
  padding: 10px 12px;
  transition: background 160ms ease, color 160ms ease;
}

.nav a:hover,
.nav a.active {
  background: rgba(37, 99, 235, 0.16);
  color: var(--text);
}

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

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 999px;
}

.status-dot.on {
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.16);
}

.status-dot.off {
  background: var(--warning);
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.16);
}

.main {
  width: calc(100% - 260px);
  min-height: 100vh;
  margin-left: 260px;
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: #93C5FD;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--text);
  line-height: 1.15;
}

h1 {
  font-size: clamp(28px, 3vw, 42px);
}

h2 {
  font-size: 19px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.pill,
.badge,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  white-space: nowrap;
}

.pill {
  border: 1px solid var(--line);
  background: var(--soft);
  color: #CBD5E1;
  padding: 5px 12px;
  font-size: 13px;
}

.badge {
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.12);
  color: #CBD5E1;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
}

.badge.success {
  border-color: rgba(22, 163, 74, 0.3);
  background: rgba(22, 163, 74, 0.16);
  color: #BBF7D0;
}

.badge.warning {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.16);
  color: #FDE68A;
}

.badge.danger {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.18);
  color: #FECACA;
}

.setup-card,
.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.setup-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
  gap: 24px;
  margin-bottom: 24px;
  padding: 22px;
}

.setup-card h2 {
  margin-bottom: 10px;
}

.setup-card p {
  max-width: 720px;
  margin: 0 0 12px;
  color: #CBD5E1;
}

.setup-grid {
  display: grid;
  gap: 10px;
}

.setup-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.45);
  padding: 12px;
}

.setup-grid span,
.setup-grid strong {
  display: block;
}

.setup-grid span {
  color: var(--muted);
  font-size: 12px;
}

.error-text {
  color: #FECACA !important;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

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

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 12px 0 6px;
  color: var(--text);
  font-size: clamp(22px, 2.2vw, 32px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.content-grid.lower {
  margin-top: 18px;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 82px;
  border-bottom: 1px solid var(--line);
  padding: 18px;
}

.link-button {
  border: 1px solid rgba(37, 99, 235, 0.45);
  background: rgba(37, 99, 235, 0.16);
  color: #BFDBFE;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  color: #E2E8F0;
}

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

.empty {
  color: var(--muted);
  text-align: center;
}

.service-list {
  display: grid;
}

.service-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
}

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

.service-row strong,
.service-row span {
  display: block;
}

.service-row span:not(.badge) {
  color: var(--muted);
  font-size: 13px;
}

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

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: 100%;
    min-height: auto;
  }

  .nav {
    grid-template-columns: repeat(5, minmax(110px, 1fr));
    overflow-x: auto;
  }

  .sidebar-footer {
    margin-top: 18px;
  }

  .main {
    width: 100%;
    margin-left: 0;
    padding: 20px;
  }

  .topbar,
  .setup-card,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 16px;
  }

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

  .metric-card {
    min-height: 116px;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

