:root {
  --brand: #ffd60b;
  --brand-deep: #e8b500;
  --brand-soft: #fff6cc;
  --ink: #1a1a1a;
  --ink-2: #3a3a3c;
  --pos: #1a7f4b;
  --neg: #d93934;
}

* { font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif; }

body {
  -webkit-font-smoothing: antialiased;
  background: #faf9f5;
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--ink);
  border-radius: 18px;
  padding: 22px 26px;
  box-shadow: 0 10px 30px rgba(26, 26, 26, 0.18);
}

.brand-lockup { display: flex; align-items: center; gap: 16px; }
.brand-mark-img { width: 44px; height: 44px; display: block; }
.brand-divider { width: 1px; height: 38px; background: rgba(255, 255, 255, 0.16); }
.brand-wordmark { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: #fff; line-height: 1; }
.header-title { font-size: 15px; font-weight: 700; color: var(--brand); margin-top: 6px; line-height: 1.2; }
.header-sub { font-size: 12px; color: rgba(255, 255, 255, 0.55); margin-top: 3px; }

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

.badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-demo { background: rgba(255, 214, 11, 0.16); color: var(--brand); border: 1px solid rgba(255, 214, 11, 0.4); }
.badge-live { background: #1f9d57; color: #fff; }

.range-group {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 3px;
}
.range-btn {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  padding: 6px 14px;
  border-radius: 7px;
  transition: all 0.15s ease;
}
.range-btn.is-active { background: var(--brand); color: var(--ink); }
.range-btn:not(.is-active):hover { color: #fff; background: rgba(255, 255, 255, 0.1); }

.refresh-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  font-size: 17px;
  transition: all 0.15s ease;
}
.refresh-btn:hover { background: var(--brand); color: var(--ink); border-color: var(--brand); }

.notice {
  margin-top: 20px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #854d0e;
  font-size: 13px;
}

.card {
  background: #fff;
  border: 1px solid #ece9df;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 1px 2px rgba(26, 26, 26, 0.04);
}
.card-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.card-sub { font-size: 13px; color: #9a958a; margin-top: 2px; }

.kpi {
  background: #fff;
  border: 1px solid #ece9df;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(26, 26, 26, 0.04);
}
.kpi::before {
  content: "";
  display: block;
  width: 26px;
  height: 3px;
  border-radius: 999px;
  background: var(--brand);
  margin-bottom: 14px;
}
.kpi-label { font-size: 12px; font-weight: 600; color: #9a958a; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-size: 26px; font-weight: 800; color: var(--ink); margin-top: 8px; line-height: 1; }
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; }
.kpi-delta { font-weight: 700; display: inline-flex; align-items: center; gap: 2px; }
.kpi-delta.pos { color: var(--pos); }
.kpi-delta.neg { color: var(--neg); }
.kpi-delta.flat { color: #9a958a; }
.kpi-context { color: #9a958a; }

.metric-toggle, .range-group { user-select: none; }
.metric-toggle {
  display: inline-flex;
  gap: 4px;
  background: #f3f1ea;
  border-radius: 9px;
  padding: 3px;
}
.metric-btn {
  font-size: 12px;
  font-weight: 600;
  color: #6b665c;
  padding: 6px 12px;
  border-radius: 7px;
}
.metric-btn.is-active { background: var(--ink); color: var(--brand); }

.legend-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.legend-left { display: flex; align-items: center; gap: 9px; }
.legend-dot { width: 11px; height: 11px; border-radius: 3px; }
.legend-name { font-weight: 600; color: #2c2c2e; }
.legend-val { color: #9a958a; font-variant-numeric: tabular-nums; }

.bar-row { font-size: 13px; }
.bar-head { display: flex; justify-content: space-between; margin-bottom: 5px; }
.bar-name { font-weight: 600; color: #2c2c2e; }
.bar-meta { color: #9a958a; font-variant-numeric: tabular-nums; }
.bar-track { height: 9px; background: #efece3; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--brand); }

#top-users td { padding: 10px 0; border-top: 1px solid #f3f1ea; font-variant-numeric: tabular-nums; }
.user-name { font-weight: 600; color: var(--ink); }
.user-email { font-size: 11px; color: #9a958a; }
.team-pill { font-size: 11px; font-weight: 600; color: var(--ink); background: var(--brand-soft); padding: 3px 9px; border-radius: 999px; }

.prod-tile { background: #faf9f5; border: 1px solid #efece3; border-radius: 13px; padding: 15px; }
.prod-value { font-size: 21px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.prod-label { font-size: 12px; color: #6b665c; margin-top: 4px; }

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(250, 249, 245, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.spinner {
  width: 38px; height: 38px;
  border: 3px solid #e6e2d6;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none; }
