:root {
  --bg: #060606;
  --paper: rgba(15, 15, 16, 0.86);
  --paper-soft: rgba(255, 255, 255, 0.03);
  --line: rgba(255, 255, 255, 0.18);
  --line-strong: rgba(255, 255, 255, 0.3);
  --text: #f5f5f5;
  --text-soft: #b5b5bc;
  --text-muted: #a5a5ab;
  --chrome: linear-gradient(140deg, #ffffff, #bdbdc4 48%, #ffffff);
  --ok: #9dd8ba;
  --ok-border: rgba(157, 216, 186, 0.34);
  --error: #ffc2c2;
  --error-border: rgba(255, 136, 136, 0.36);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 999px;
  --shadow: 0 24px 52px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: 'Manrope', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, #191919 0%, var(--bg) 46%, #000 100%),
    repeating-linear-gradient(
      -26deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 18px,
      rgba(0, 0, 0, 0) 18px,
      rgba(0, 0, 0, 0) 34px
    );
  overflow-x: hidden;
}

h1,
h2,
h3,
.metric-value,
button,
.eyebrow {
  font-family: 'Syne', sans-serif;
  letter-spacing: 0.01em;
}

code,
pre {
  font-family: 'JetBrains Mono', monospace;
}

.dot-overlay,
.hero-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.dot-overlay {
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 0.7px, transparent 0.7px);
  background-size: 4px 4px;
  opacity: 0.45;
}

.hero-glow {
  width: min(74vw, 980px);
  aspect-ratio: 1;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 68%);
  filter: blur(2px);
}

.layout {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 2rem));
  margin: 1.1rem auto 2rem;
  display: grid;
  gap: 0.9rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  backdrop-filter: blur(12px);
}

.hero {
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  left: 24px;
  right: 24px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.46), transparent);
}

.hero h1 {
  margin: 0.36rem 0 0.35rem;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.08;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.muted {
  margin: 0;
  color: var(--text-soft);
}

.muted code {
  color: #dedee2;
}

h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.1rem, 1.5vw, 1.4rem);
}

h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.login-form {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.7rem;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  max-width: 100%;
  background: rgba(0, 0, 0, 0.52);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0.64rem 0.78rem;
  min-width: 0;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

button {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: var(--chrome);
  color: #080808;
  font-weight: 700;
  padding: 0.62rem 1rem;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.96);
}

button:disabled {
  opacity: 0.62;
  cursor: wait;
}

button.danger {
  background: transparent;
  color: var(--text);
}

.toolbar {
  display: grid;
  gap: 0.55rem;
}

.toolbar-actions {
  display: flex;
  gap: 0.52rem;
  flex-wrap: wrap;
}

.status {
  margin: 0.72rem 0 0;
  border-radius: 12px;
  padding: 0.52rem 0.68rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: #d9d9df;
  font-size: 0.88rem;
}

.status.error {
  color: var(--error);
  border-color: var(--error-border);
  background: rgba(255, 120, 120, 0.08);
}

.status.success {
  color: var(--ok);
  border-color: var(--ok-border);
  background: rgba(120, 255, 176, 0.08);
}

.metrics {
  display: grid;
  gap: 0.68rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.metric {
  border-radius: var(--radius-lg);
}

.metric-label {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.metric-value {
  margin: 0.22rem 0 0;
  font-size: clamp(1.18rem, 2.3vw, 1.52rem);
  line-height: 1.05;
}

.section-head {
  display: grid;
  gap: 0.25rem;
  margin-bottom: 0.65rem;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.34);
  overflow: hidden;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  text-align: left;
  padding: 0.56rem 0.62rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

thead th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
}

tbody tr:last-child td {
  border-bottom: none;
}

.small,
td.small {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.wrap {
  overflow-wrap: anywhere;
}

.selector-row {
  margin-top: 0.82rem;
  display: grid;
  gap: 0.52rem;
}

.inline-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.inline-controls select {
  flex: 1;
  min-width: 0;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 0.68rem;
  margin-top: 0.86rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.subcard {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
  padding: 0.72rem 0.78rem;
}

.mini-value {
  margin: 0.2rem 0 0;
  font-size: 1rem;
  font-family: 'Syne', sans-serif;
}

.bars {
  display: grid;
  gap: 0.48rem;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(60px, auto) minmax(80px, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.bar-label {
  font-size: 0.8rem;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.bar-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.16);
}

.bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.3));
}

.bar-count {
  font-size: 0.78rem;
  font-weight: 700;
}

.empty {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.84rem;
}

details {
  margin-top: 0.9rem;
}

details summary {
  cursor: pointer;
  color: #e9e9eb;
  font-weight: 700;
}

pre {
  margin: 0.72rem 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #060606;
  color: #f4f4f4;
  padding: 0.68rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  max-height: 360px;
  font-size: 0.76rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.24rem 0.46rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.02);
}

.pill.on {
  color: var(--ok);
  border-color: var(--ok-border);
  background: rgba(120, 255, 176, 0.08);
}

.pill.off {
  color: var(--error);
  border-color: var(--error-border);
  background: rgba(255, 120, 120, 0.06);
}

@media (max-width: 900px) {
  .layout {
    width: calc(100% - 1rem);
    margin-top: 0.72rem;
  }

  .card {
    padding: 0.84rem 0.86rem;
    border-radius: 18px;
  }

  .hero::before {
    left: 14px;
    right: 14px;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions button {
    flex: 1 1 auto;
  }

  thead {
    display: none;
  }

  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tbody tr {
    padding: 0.62rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  tbody tr:last-child {
    border-bottom: none;
  }

  td {
    border-bottom: none;
    padding: 0.34rem 0;
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 0.55rem;
    align-items: start;
  }

  td::before {
    content: attr(data-label);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.68rem;
    line-height: 1.2;
    padding-top: 0.08rem;
  }

  td[data-label='']::before {
    content: '';
  }

  .pill {
    justify-self: start;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: minmax(54px, auto) minmax(70px, 1fr) auto;
  }
}
