:root {
  --bg-dark: #070a12;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-glass: rgba(56, 189, 248, 0.20);
  --border-sheen: rgba(0, 255, 163, 0.35);
  --accent-mint: #00ffa3;
  --accent-blue: #38bdf8;
  --accent-purple: #a855f7;
  --accent-pink: #f43f5e;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

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

body {
  background: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(0, 255, 163, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 25%, rgba(56, 189, 248, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 50% 80%, rgba(168, 85, 247, 0.06) 0%, transparent 50%);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  padding: 24px;
}

.container {
  max-width: 1300px;
  margin: 0 auto;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 28px;
}

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

.brand-logo {
  font-size: 26px;
  color: var(--accent-mint);
  text-shadow: 0 0 16px rgba(0, 255, 163, 0.4);
}

.brand-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-title span {
  color: var(--accent-mint);
}

.badge-tag {
  background: rgba(0, 255, 163, 0.12);
  border: 1px solid rgba(0, 255, 163, 0.3);
  color: var(--accent-mint);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-selector {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-mint), #05f29a);
  color: #070a12;
  font-weight: 600;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: transform 0.15s, opacity 0.15s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
  border-color: var(--border-sheen);
  transform: translateY(-2px);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-mint), transparent);
  opacity: 0.5;
}

.card-title {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -1px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--accent-mint);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  margin-bottom: 28px;
}

@media (max-width: 900px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  padding: 22px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.chart-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.chart-container {
  width: 100%;
  height: 240px;
  position: relative;
}

/* SVG Chart Elements */
.svg-trend-chart {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Distribution Bars */
.dist-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dist-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dist-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.dist-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.dist-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease-out;
}

/* Error Table */
.table-card {
  margin-bottom: 28px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

th {
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

td {
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge-error {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--accent-pink);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 11px;
}

/* Key Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  position: relative;
}

.modal h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.modal p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 20px;
}

.modal input {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  margin-bottom: 18px;
}

.modal input:focus {
  border-color: var(--accent-mint);
}
