@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --accent: #2eb887;
  --accent-hover: color-mix(in srgb, var(--accent) 86%, #000);
  --accent-strong: color-mix(in srgb, var(--accent) 78%, #000);
  --accent-2: #f59e0b;
  --danger: #e5484d;

  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --sidebar: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e8eaee;

  --shadow: 0 2px 6px rgba(16, 24, 40, 0.04), 0 12px 28px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 12px 34px rgba(16, 24, 40, 0.14);

  --radius-input: 11px;
  --radius-card: 16px;

  --font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --accent-hover: color-mix(in srgb, var(--accent) 82%, #fff);
  --accent-strong: color-mix(in srgb, var(--accent) 72%, #fff);

  --bg: #0e141b;
  --surface: #171f28;
  --surface-2: #1f2833;
  --sidebar: #131a22;
  --text: #e7ecf0;
  --text-muted: #93a1ae;
  --border: #28323d;

  --shadow: 0 2px 8px rgba(0, 0, 0, 0.28), 0 14px 32px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

::selection {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
}

h1,
h2,
h3 {
  letter-spacing: -0.02em;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 64px;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
  min-width: 214px;
}

.brand-logo {
  height: 27px;
  width: auto;
  display: block;
}

:root[data-theme="dark"] .brand-logo-light {
  display: none;
}

:root:not([data-theme="dark"]) .brand-logo-dark {
  display: none;
}

.brand-product {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.topbar-nav a {
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
}

.topbar-nav a:hover,
.topbar-nav a.is-active {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.icon-btn:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.site-main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
}

@media (min-width: 1024px) {
  .site-main {
    padding: 30px 2rem 3rem;
  }
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.page-head h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.eyebrow-link {
  display: inline-block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-strong);
}

.window-control {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 9rem;
}

.window-control label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

input,
select,
button {
  font: inherit;
}

input,
select {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-input);
  padding: 0.55rem 0.75rem;
}

input:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}

button {
  border: 0;
  border-radius: var(--radius-input);
  background: var(--accent);
  color: #fff;
  padding: 0.55rem 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

button.ghost:hover:not(:disabled) {
  background: var(--surface-2);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 1.25rem;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.15rem 1.35rem;
}

.stat-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.stat-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.icon-tile {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 800;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-hint {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-strong);
}

.split-panels {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  margin-bottom: 1.25rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem 1.2rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 0.9rem;
}

.panel-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.panel-sub {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.chart {
  display: flex;
  align-items: end;
  gap: 0.28rem;
  min-height: 140px;
  padding-top: 0.5rem;
}

.chart-bar {
  flex: 1;
  min-width: 0;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(
    180deg,
    var(--accent),
    color-mix(in srgb, var(--accent) 72%, #1f8fbf)
  );
  position: relative;
  opacity: 0.95;
}

.chart-bar:hover {
  opacity: 1;
}

.chart-bar span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.25rem);
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  opacity: 0;
  pointer-events: none;
}

.chart-bar:hover span {
  opacity: 1;
}

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

.rank-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

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

.rank-meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.rank-track {
  grid-column: 1 / -1;
  height: 0.35rem;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.rank-fill {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.events-panel {
  margin-top: 0.1rem;
}

.events-head {
  flex-wrap: wrap;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.filters input,
.filters select {
  min-width: 8rem;
}

.filters input[type="search"] {
  min-width: 14rem;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 -0.2rem;
}

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

.events-table th,
.events-table td {
  text-align: left;
  padding: 0.85rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.events-table th {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.events-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.events-table tbody tr:hover {
  background: var(--surface-2);
}

.events-table tbody tr:last-child td {
  border-bottom: 0;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.badge {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 700;
}

.empty {
  color: var(--text-muted);
  padding: 1rem 0.2rem;
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 0.9rem;
  color: var(--text-muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1.2rem;
}

.detail-item {
  display: grid;
  gap: 0.25rem;
}

.detail-item.full {
  grid-column: 1 / -1;
}

.detail-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.detail-value {
  font-weight: 600;
  word-break: break-word;
}

.json-block {
  margin: 0;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  overflow: auto;
  max-height: 28rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.hero-banner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1.4rem 1.6rem;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(
    120deg,
    var(--accent),
    color-mix(in srgb, var(--accent) 72%, #1f8fbf)
  );
  box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 32%, transparent);
}

.hero-banner h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.hero-banner p {
  margin: 0;
  max-width: 36rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .stat-grid,
  .split-panels,
  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }

  .brand {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 0 1rem;
  }

  .page-head,
  .events-head {
    flex-direction: column;
    align-items: stretch;
  }

  .stat-grid,
  .split-panels,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .filters input,
  .filters select,
  .filters input[type="search"] {
    min-width: 0;
    width: 100%;
  }
}
