.evd-dashboard,
.evd-dashboard * {
  box-sizing: border-box;
}

.evd-dashboard {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  line-height: 1.45;
  color: #1a252f;
}

.ebd-hidden {
  display: none !important;
}

.evd-dashboard .app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
}

.evd-dashboard .app-header h1 {
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: 700;
  margin: 0 0 1rem;
}

.evd-dashboard .filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

@media (min-width: 640px) {
  .evd-dashboard .filter-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
  }
}

@media (min-width: 960px) {
  .evd-dashboard .filter-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.evd-dashboard .filter-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.evd-dashboard .filter-row label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #566573;
}

.evd-dashboard .filter-select {
  min-height: 44px;
  font-size: 1rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #cfd8dc;
  background: #fff;
  width: 100%;
}

@media (min-width: 640px) {
  .evd-dashboard .filter-row--ballot {
    grid-column: span 2;
  }
}

@media (min-width: 960px) {
  .evd-dashboard .filter-row--ballot {
    grid-column: span 2;
  }
}

.evd-dashboard .section-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.evd-dashboard .aggregate-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 1rem;
  row-gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.evd-dashboard .aggregate-panel-header .section-title {
  margin: 0;
  flex: 1 1 12rem;
  min-width: 0;
  line-height: 1.25;
}

.evd-dashboard .aggregate-panel {
  background: #fff;
  border-radius: 12px;
  padding: 1rem 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.evd-dashboard .kpi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

@media (min-width: 520px) {
  .evd-dashboard .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 720px) {
  .evd-dashboard .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.evd-dashboard .kpi-last-updated {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  justify-content: flex-end;
  text-align: right;
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 640px) {
  .evd-dashboard .aggregate-panel-header .kpi-last-updated {
    flex: 1 1 100%;
    justify-content: flex-start;
    text-align: left;
  }
  .evd-dashboard .aggregate-panel-header .kpi-last-updated-inner {
    align-items: flex-start;
  }
}

.evd-dashboard .kpi-last-updated-inner {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: flex-end;
}

.evd-dashboard .kpi-last-updated-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #78909c;
}

.evd-dashboard .kpi-last-updated-date {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a252f;
  line-height: 1.15;
}

.evd-dashboard .kpi-card {
  background: #f4f6f8;
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  border: 1px solid #eceff1;
}

.evd-dashboard .kpi-card-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.evd-dashboard .kpi-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2c3e50;
}

.evd-dashboard .kpi-icon svg {
  display: block;
}

.evd-dashboard .kpi-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.evd-dashboard .kpi-value {
  font-size: 1.28rem;
  font-weight: 700;
  color: #1a252f;
  line-height: 1.15;
}

.evd-dashboard .kpi-value--split {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.2rem;
  font-size: 1.05rem;
}

.evd-dashboard .kpi-voted-num { color: #0d47a1; }
.evd-dashboard .kpi-vs { font-weight: 600; font-size: 0.82em; color: #546e7a; }
.evd-dashboard .kpi-all-num { color: #1a252f; }
.evd-dashboard .kpi-voted-share {
  font-size: calc(0.72rem * 1.2);
  font-weight: 600;
  color: #546e7a;
}

.evd-dashboard .kpi-label {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.035em;
  color: #546e7a;
}

.evd-dashboard .chart-card {
  background: #fff;
  border-radius: 12px;
  padding: 0.6rem 0.6rem 0.45rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.evd-dashboard .chart-legend-footnote {
  margin: 0.4rem 0 0;
  padding: 0 0.35rem;
  text-align: center;
  font-size: 0.7rem;
  line-height: 1.35;
  color: #78909c;
  font-weight: 500;
}

.evd-dashboard .chart-body-flex,
.evd-dashboard .demo-chart-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
}

.evd-dashboard .donut-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
  justify-content: flex-start;
  margin-bottom: 1.25rem;
}

.evd-dashboard .donut-card {
  position: relative;
  flex: 1 1 280px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  --donut-chart-body-height: 220px;
}

.evd-dashboard .donut-card .chart-body-flex {
  flex: 0 0 var(--donut-chart-body-height);
  height: var(--donut-chart-body-height);
  min-height: var(--donut-chart-body-height);
  max-height: var(--donut-chart-body-height);
}

@media (min-width: 900px) {
  .evd-dashboard .donut-card {
    flex: 1 1 calc(50% - 0.625rem);
    max-width: calc(50% - 0.625rem);
  }
}

.evd-dashboard .demo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 900px) {
  .evd-dashboard .demo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

.evd-dashboard .demo-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 340px;
}

.evd-dashboard .demo-grid-bottom-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  --demo-bottom-row-card-height: 170px;
}

.evd-dashboard .demo-grid-bottom-row > .chart-card.demo-card {
  height: var(--demo-bottom-row-card-height);
  min-height: var(--demo-bottom-row-card-height);
  max-height: var(--demo-bottom-row-card-height);
}

@media (max-width: 899px) {
  .evd-dashboard .demo-grid-bottom-row {
    --demo-bottom-row-card-height: 206px; /* 170px + 20% for stacked mobile layout */
  }
}

@media (min-width: 900px) {
  .evd-dashboard .demo-grid-bottom-row {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
  .evd-dashboard .demo-grid-bottom-row > .chart-card.demo-card {
    grid-column: span 8;
  }
  .evd-dashboard .demo-grid-bottom-row .contact-card {
    grid-column: span 4;
  }
}

.evd-dashboard .demo-grid-bottom-row .contact-card {
  margin-top: 0;
  min-height: var(--demo-bottom-row-card-height);
  height: var(--demo-bottom-row-card-height);
  max-height: var(--demo-bottom-row-card-height);
  overflow-y: auto;
}

.evd-dashboard .demo-grid-bottom-row .contact-card-body {
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: center;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  text-align: center;
  padding: 0.6rem 0.6rem 0.45rem 0.35rem;
}

.evd-dashboard .demo-grid-bottom-row .contact-card-eyebrow {
  grid-row: 1;
  align-self: start;
}

.evd-dashboard .demo-grid-bottom-row .contact-card-text {
  grid-row: 2;
  align-self: center;
  min-height: 0;
  margin: 0;
  width: 100%;
  max-width: 100%;
  text-align: center;
  box-sizing: border-box;
  font-size: calc(0.98rem * 1.05 * 0.9);
  padding-inline: 6px;
}

@media (max-width: 899px) {
  .evd-dashboard .demo-grid-bottom-row .contact-card-body,
  .evd-dashboard .demo-grid-bottom-row .contact-card-eyebrow,
  .evd-dashboard .demo-grid-bottom-row .contact-card-text {
    text-align: center;
  }

  .evd-dashboard .demo-grid-bottom-row .contact-card-eyebrow {
    align-self: center;
    width: 100%;
  }
}

.evd-dashboard .chart-empty {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #78909c;
}

.evd-dashboard .demo-chart-heading {
  margin: 0;
  padding: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: #2c3e50;
  line-height: 1.2;
  flex: 0 0 auto;
}

.evd-dashboard .demo-card .chart-empty:not(.ebd-hidden) {
  position: absolute;
  inset: 0;
  min-height: 0;
  color: #78909c;
}

.evd-dashboard .demo-chart-empty-reason {
  margin: 0;
  font-size: inherit;
}

.evd-dashboard .donut-card .donut-card-empty:not(.ebd-hidden) {
  flex: 0 0 var(--donut-chart-body-height);
  height: var(--donut-chart-body-height);
  min-height: var(--donut-chart-body-height);
  max-height: var(--donut-chart-body-height);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #566573;
}

.evd-dashboard .donut-empty-title {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 6px;
  color: #566573;
}

.evd-dashboard .party-donut-empty-reason {
  margin: 0;
  font-size: 13px;
  opacity: 0.85;
  text-align: center;
}

.evd-dashboard .muted { color: #78909c; }
.evd-dashboard .error-text { color: #c0392b; font-weight: 600; }

.evd-dashboard .contact-card {
  position: relative;
  padding: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid #eceff1;
  overflow: hidden;
  display: flex;
  min-width: 0;
}

.evd-dashboard .contact-card-accent {
  width: 4px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #2980b9 0%, #1f618d 100%);
}

.evd-dashboard .contact-card-body {
  flex: 1;
  min-width: 0;
  padding: 1rem 1.1rem 1.15rem 1rem;
}

.evd-dashboard .contact-card-eyebrow {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: #2c3e50;
}

.evd-dashboard .contact-card-text {
  margin: 0;
  padding-inline: 20px;
  font-size: calc(0.98rem * 1.05);
  line-height: 1.55;
  color: #37474f;
}

.evd-dashboard .contact-card-text a {
  color: #1565c0;
  font-weight: 600;
}

.evd-dashboard .evd-dashboard-body {
  position: relative;
  min-height: 280px;
}

.evd-dashboard .evd-dashboard-body.is-loading .evd-data-panels {
  opacity: 0.35;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.2s ease;
}

.evd-dashboard .evd-dashboard-body.is-loading-initial .filter-bar,
.evd-dashboard .evd-dashboard-body.is-loading-initial .evd-data-panels {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.evd-dashboard .evd-loader {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(236, 240, 241, 0.92);
  border-radius: 12px;
}

/* Filter updates: center in viewport (body is tall when scrolled). */
.evd-dashboard .evd-dashboard-body.is-loading:not(.is-loading-initial) .evd-loader {
  position: fixed;
  inset: 0;
  z-index: 100000;
  border-radius: 0;
}

.evd-dashboard .evd-loader-inner {
  text-align: center;
  padding: 1.5rem;
}

.evd-dashboard .evd-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border: 3px solid #cfd8dc;
  border-top-color: #2980b9;
  border-radius: 50%;
  animation: evd-spin 0.75s linear infinite;
}

@keyframes evd-spin {
  to {
    transform: rotate(360deg);
  }
}

.evd-dashboard .evd-loader-text {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #566573;
  letter-spacing: 0.01em;
}

.evd-dashboard .demo-chart-wrap.evd-has-party-legend {
  padding-bottom: 28px;
}

.evd-dashboard .evd-party-legend {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: center;
  align-items: center;
  color: #2c3e50;
  font-size: 11px;
  pointer-events: none;
}

.evd-dashboard .evd-party-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.evd-dashboard .evd-party-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}
