:root {
  color-scheme: dark;
  --bg: #07111d;
  --bg-alt: #0b1726;
  --panel: rgba(11, 23, 38, 0.8);
  --line: rgba(165, 188, 214, 0.16);
  --text: #eff6ff;
  --muted: #8ea6c2;
  --gold: #d8b36a;
  --teal: #57d3c9;
  --red: #f4837b;
  --blue: #72a7ff;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(216, 179, 106, 0.18), transparent 26%),
    radial-gradient(circle at top left, rgba(87, 211, 201, 0.12), transparent 28%),
    linear-gradient(180deg, #0b1421 0%, #06101c 100%);
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

/* Site Directory */
.site-directory h2 { margin-bottom: 16px; }
.site-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.site-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-alt);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, transform 0.15s;
}
.site-card:hover {
  border-color: var(--accent, var(--gold));
  transform: translateY(-2px);
}
.site-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 6px;
}
.site-card strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 2px;
}
.site-market {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}
.site-url {
  display: block;
  font-size: 0.72rem;
  color: var(--gold);
  margin-top: 4px;
  font-family: "IBM Plex Mono", monospace;
}

/* Auth */
.auth-status {
  display: flex;
  align-items: center;
  gap: 12px;
}
.auth-badge {
  color: var(--teal);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
}
.logout-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
}
.logout-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.topbar,
.toolbar,
.metric-grid,
.auth-panel,
.range-group {
  display: flex;
  gap: 12px;
}

.topbar,
.toolbar {
  align-items: center;
  justify-content: space-between;
}

.topbar {
  margin-bottom: 20px;
}

.eyebrow,
.status-text,
th,
td,
label,
input,
button,
select {
  font-family: "IBM Plex Mono", monospace;
}

.eyebrow,
.status-text,
.card-heading p,
th {
  color: var(--muted);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.toolbar {
  margin-bottom: 20px;
  flex-wrap: wrap;
}

input,
button,
select {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(5, 11, 18, 0.65);
  color: var(--text);
  padding: 10px 12px;
}

button {
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(216, 179, 106, 0.6);
}

.range-btn.active,
#saveAuth,
#applyCustom {
  background: linear-gradient(135deg, rgba(216, 179, 106, 0.28), rgba(87, 211, 201, 0.14));
  border-color: rgba(216, 179, 106, 0.65);
}

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

.metrics,
.wide {
  grid-column: span 12;
}

.grid > .card:not(.wide):not(.metrics) {
  grid-column: span 6;
}

.metric-grid {
  flex-wrap: wrap;
}

.metric-grid article {
  flex: 1 1 180px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(5, 11, 18, 0.4);
  border: 1px solid rgba(165, 188, 214, 0.1);
}

.metric-grid span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-grid strong {
  font-size: clamp(1.8rem, 2.6vw, 2.6rem);
}

.metric-grid.small strong {
  font-size: 1.5rem;
}

.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  gap: 12px;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid rgba(165, 188, 214, 0.08);
  font-size: 0.86rem;
}

td:last-child,
th:last-child {
  text-align: right;
}

canvas {
  width: 100% !important;
  min-height: 280px;
}

@media (max-width: 960px) {
  .grid > .card:not(.wide):not(.metrics) {
    grid-column: span 12;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1440px);
  }

  .topbar,
  .toolbar,
  .auth-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .card-heading {
    flex-direction: column;
    align-items: flex-start;
  }
}

