.analytics-page {
  min-height: 100vh;
  padding: 36px 10px 48px;
}

.analytics-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

.analytics-header,
.analytics-section,
.analytics-card {
  border: 1px solid var(--stroke);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.01)),
    rgba(10,10,10,0.36);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.analytics-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.analytics-card--accent {
  border-color: rgba(214, 70, 61, 0.32);
  background:
    linear-gradient(160deg, rgba(214, 70, 61, 0.1), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.01)),
    rgba(10,10,10,0.36);
}

.analytics-header {
  padding: 20px 24px;
  margin-bottom: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.analytics-breadcrumb {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.analytics-breadcrumb a {
  color: rgba(255, 255, 255, 0.86);
  text-decoration: none;
}

.analytics-breadcrumb span {
  margin-left: 6px;
}

.analytics-header h1 {
  margin: 0;
  font-family: 'Oswald', sans-serif;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.analytics-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.analytics-btn {
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(180deg, var(--red-2), var(--red));
  box-shadow: 0 16px 40px rgba(194, 53, 43, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.analytics-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
}

.analytics-btn--ghost {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.analytics-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.analytics-card--kpi {
  padding: 20px 20px 18px;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.analytics-card--wide {
  padding: 20px 20px 18px;
  min-height: 130px;
}

.analytics-card__label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.analytics-card__value {
  display: block;
  margin: 12px 0 6px;
  font-family: 'Oswald', sans-serif;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.03em;
  color: #fff;
}

.analytics-card__meta {
  margin: 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.analytics-source-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.analytics-data-warning {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(214, 70, 61, 0.55);
  border-radius: 12px;
  color: #ffb0aa;
  background: rgba(214, 70, 61, 0.1);
  font-size: 12px;
}

.analytics-source-card {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.018));
}

.analytics-source-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.analytics-source-card__title {
  margin: 0;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.analytics-source-card__tag {
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  font-weight: 700;
}

.analytics-source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.analytics-source-metric {
  min-width: 0;
}

.analytics-source-metric strong {
  display: block;
  color: #fff;
  font-family: 'Oswald', sans-serif;
  font-size: 26px;
  line-height: 1;
}

.analytics-source-metric span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.analytics-source-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.62);
  font-size: 12px;
  line-height: 1.35;
}

.analytics-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.analytics-delta--up {
  color: #4fd07a;
  background: rgba(79, 208, 122, 0.12);
}

.analytics-delta--down {
  color: #ff7a6e;
  background: rgba(255, 122, 110, 0.12);
}

.analytics-delta--flat {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}

.analytics-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* ── Trend toggles ── */

.analytics-section__header--row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.analytics-toggle-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.analytics-toggle-group--view {
  margin: 2px 0 18px;
}

.analytics-pill {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.analytics-pill:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.analytics-pill.is-active {
  background: linear-gradient(180deg, var(--red-2), var(--red));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(194, 53, 43, 0.3);
}

/* ── Line chart ── */

.analytics-line-chart {
  width: 100%;
  height: 180px;
  display: block;
}

.analytics-line-chart__labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  gap: 4px;
}

.analytics-line-chart__labels span {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.analytics-line-chart__labels b {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

/* ── Trend table ── */

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

.analytics-trend-table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--stroke);
}

.analytics-trend-table td {
  padding: 12px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.analytics-trend-table tr:last-child td {
  border-bottom: none;
}

.analytics-section {
  padding: 22px 24px 26px;
  margin-bottom: 22px;
}

.analytics-section__header h2 {
  margin: 0 0 4px;
  font-family: 'Oswald', sans-serif;
  font-size: 20px;
  letter-spacing: 0.03em;
}

.analytics-section__header p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.analytics-empty {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

/* ── Demographics ── */

.analytics-kpis--demographics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 0;
}

/* ── Side-by-side charts ── */

.analytics-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.analytics-split__title {
  margin: 0 0 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.analytics-chart--dense.analytics-bars,
.analytics-chart--dense .analytics-bars {
  height: 170px;
  gap: 6px;
}

.analytics-chart--dense .analytics-bar__track {
  max-width: 28px;
}

.analytics-chart--dense .analytics-bar__value,
.analytics-chart--dense .analytics-bar__label {
  font-size: 11px;
}

@media (max-width: 900px) {
  .analytics-kpis--demographics,
  .analytics-split {
    grid-template-columns: 1fr;
  }
}

/* ── Revenue bar chart ── */

.analytics-bars {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 220px;
  padding-top: 8px;
}

.analytics-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.analytics-bar__value {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 6px;
  white-space: nowrap;
}

.analytics-bar__track {
  flex: 1;
  width: 100%;
  max-width: 56px;
  display: flex;
  align-items: flex-end;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  overflow: hidden;
}

.analytics-bar__fill {
  width: 100%;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--red-2), var(--red));
  min-height: 4px;
}

.analytics-bar__label {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* ── Donut chart ── */

.analytics-donut-wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.analytics-donut {
  width: 160px;
  height: 160px;
  min-width: 160px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}

.analytics-donut__hole {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #0b0b0b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.analytics-donut__hole strong {
  font-family: 'Oswald', sans-serif;
  font-size: 22px;
  color: #fff;
}

.analytics-donut__hole span {
  font-size: 11px;
  color: var(--muted);
}

.analytics-donut__legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 160px;
}

.analytics-donut__legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.86);
}

.analytics-donut__legend-label {
  min-width: 90px;
}

.analytics-donut__legend-item strong {
  color: #fff;
}

.analytics-donut__legend-item small {
  color: var(--muted);
}

/* ── Leads funnel ── */

.analytics-funnel__rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.analytics-funnel__row {
  display: grid;
  grid-template-columns: 120px 1fr 110px;
  align-items: center;
  gap: 12px;
}

.analytics-funnel__label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.86);
}

.analytics-funnel__track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  height: 14px;
  overflow: hidden;
}

.analytics-funnel__fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--red), var(--red-2));
}

.analytics-funnel__row--converted .analytics-funnel__fill {
  background: linear-gradient(90deg, #2f8f4e, #36a754);
}

.analytics-funnel__row--rejected .analytics-funnel__fill {
  background: linear-gradient(90deg, #6b6b6b, #8a8a8a);
}

.analytics-funnel__count {
  font-size: 13px;
  text-align: right;
  color: #fff;
}

.analytics-funnel__count small {
  color: var(--muted);
}

.analytics-reasons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.analytics-reasons__col h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.analytics-reasons__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analytics-reasons__item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  font-size: 13px;
}

.analytics-reasons__item strong {
  color: #fff;
}

@media (max-width: 900px) {
  .analytics-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .analytics-source-summary {
    grid-template-columns: 1fr;
  }
  .analytics-reasons {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .analytics-kpis {
    grid-template-columns: 1fr;
  }
  .analytics-source-grid {
    grid-template-columns: 1fr;
  }
  .analytics-funnel__row {
    grid-template-columns: 90px 1fr 80px;
  }
}
