:root {
  color-scheme: dark;
  --bg: #05070a;
  --panel: rgba(12, 16, 22, 0.86);
  --panel-strong: rgba(16, 22, 30, 0.94);
  --line: rgba(255, 255, 255, 0.09);
  --text: #f7fbff;
  --muted: #8e9aaa;
  --cyan: #00d4ff;
  --green: #23ff87;
  --yellow: #ffe45c;
  --purple: #b28cff;
  --red: #ff4d6d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    linear-gradient(rgba(255, 255, 255, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(135deg, #071015 0%, #08080d 48%, #0c0912 100%);
  background-size:
    32px 32px,
    32px 32px,
    auto;
}

button {
  font: inherit;
}

.page-shell {
  width: min(1420px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 3vw, 3.4rem);
  line-height: 1;
}

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

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.86rem;
  font-weight: 800;
}

.pill-ok {
  color: #0a140e;
  border-color: rgba(35, 255, 135, 0.82);
  background: linear-gradient(135deg, var(--green), var(--cyan));
}

.pill-bad {
  color: #fff;
  border-color: rgba(255, 77, 109, 0.62);
  background: rgba(255, 77, 109, 0.16);
}

.pill-wait {
  color: var(--yellow);
  border-color: rgba(255, 228, 92, 0.42);
}

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0, 212, 255, 0.35);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.065);
  cursor: pointer;
}

.icon-button:hover {
  border-color: rgba(35, 255, 135, 0.6);
  box-shadow: 0 0 18px rgba(35, 255, 135, 0.18);
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.summary-grid,
.dashboard-grid {
  display: grid;
  gap: 14px;
}

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

.dashboard-grid {
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.75fr);
  align-items: stretch;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025)),
    var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 16px 38px rgba(0, 0, 0, 0.25);
}

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

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel {
  min-height: 310px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(0, 212, 255, 0.06), transparent 42%),
    var(--panel-strong);
}

.chart-panel {
  grid-row: span 2;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-header h2 {
  font-size: 1.1rem;
}

.panel-header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.9rem;
}

.chart-wrap {
  height: 430px;
  min-height: 300px;
}

#usageChart {
  width: 100%;
  height: 100%;
  display: block;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.88rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--c);
  box-shadow: 0 0 14px var(--c);
}

.rank-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank-item {
  position: relative;
  min-height: 50px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.rank-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w);
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.22), rgba(35, 255, 135, 0.1));
}

.rank-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  height: 100%;
  padding: 10px 12px;
}

.rank-index {
  color: var(--cyan);
  font-weight: 900;
}

.rank-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.rank-total {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  text-align: center;
}

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

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

  .chart-panel {
    grid-row: auto;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 24px, 560px);
    padding-top: 18px;
  }

  .topbar,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    gap: 8px;
  }

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

  .chart-wrap {
    height: 320px;
  }
}
