/* LiveNur palette */
:root {
  --bg: #051A10;
  --bg-2: #082416;
  --card: #0B2C1E;
  --card-2: #0E3825;
  --border: #143E2A;
  --text: #E8F2EC;
  --muted: #7FA08B;
  --gold: #C9A24E;
  --gold-soft: rgba(201, 162, 78, 0.15);
  --green-pos: #5CD68A;
  --red-neg: #E76A6A;
  --shadow: 0 1px 0 rgba(255,255,255,0.03), 0 8px 24px rgba(0,0,0,0.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(ellipse at top, #0a2818 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  min-height: 100vh;
  padding-bottom: 32px;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  position: sticky;
  top: 0;
  background: rgba(5, 26, 16, 0.85);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.moon { font-size: 22px; }
.brand h1 { margin: 0; font-size: 16px; font-weight: 600; color: var(--gold); letter-spacing: 0.2px; }
.subtitle { font-size: 11px; color: var(--muted); margin-top: 2px; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s;
}
.btn-ghost:hover { background: var(--card); }
.btn-ghost.spin { animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 0;
  display: grid;
  gap: 20px;
}

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.kpi:hover { transform: translateY(-1px); border-color: var(--gold-soft); }
.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  font-weight: 500;
}
.kpi-value {
  font-size: 28px;
  font-weight: 600;
  margin: 6px 0 4px;
  color: var(--text);
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.kpi-sub {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* Chart grid */
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.chart-wrap {
  position: relative;
  height: 220px;
}

/* Two-up rows */
.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 720px) { .row-2 { grid-template-columns: 1fr; } }

/* Activity / rates lists */
.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.activity-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.activity-list li:last-child { border-bottom: none; }
.activity-list span { color: var(--muted); font-size: 13px; }
.activity-list strong { color: var(--text); font-weight: 600; font-size: 16px; }

/* Country list */
.country-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.country-list li {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}
.country-flag {
  display: inline-block;
  font-size: 20px;
  line-height: 1;
}
.country-bar {
  height: 6px;
  background: var(--card-2);
  border-radius: 3px;
  overflow: hidden;
}
.country-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, #d8b87a 100%);
  border-radius: 3px;
}
.country-list li > strong {
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  min-width: 36px;
  text-align: right;
}

/* Events table */
.table-wrap { overflow-x: auto; }
table.events {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
table.events th, table.events td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.events th {
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.6px;
}
table.events tr:last-child td { border-bottom: none; }
table.events td.type { font-weight: 600; }
table.events td.type.INITIAL_PURCHASE,
table.events td.type.RENEWAL,
table.events td.type.TRIAL_CONVERTED { color: var(--green-pos); }
table.events td.type.CANCELLATION,
table.events td.type.EXPIRATION,
table.events td.type.REFUND { color: var(--red-neg); }
table.events td.type.TEST { color: var(--muted); font-style: italic; }

/* System health */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.health-grid div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.health-grid strong {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Footer */
footer {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 32px;
  padding: 0 20px;
}

/* Empty state styling */
.empty {
  color: var(--muted);
  font-style: italic;
  font-size: 13px;
  padding: 8px 0;
}
