:root {
  --vfw-blue: #003f87;
  --vfw-blue-dark: #002d62;
  --vfw-red: #c8102e;
  --vfw-gold: #f3b61f;
  --vfw-bg: #f4f7fb;
  --vfw-card: #ffffff;
  --vfw-text: #172033;
  --vfw-muted: #5f6b7a;
  --vfw-line: #dce3ec;
  --vfw-success: #166534;
  --vfw-error: #b42318;
  --vfw-shadow: 0 10px 30px rgba(19, 42, 76, 0.09);
  --vfw-radius: 18px;
}

.vfw-civic-standalone {
  margin: 0;
  background: var(--vfw-bg);
  color: var(--vfw-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.vfw-civic-app,
.vfw-civic-app * {
  box-sizing: border-box;
}

.vfw-civic-app {
  max-width: 1180px;
  margin: 0 auto;
  color: var(--vfw-text);
  background: var(--vfw-bg);
  border: 1px solid var(--vfw-line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--vfw-shadow);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

.vfw-civic-standalone .vfw-civic-app {
  max-width: none;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.vfw-app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px clamp(18px, 4vw, 42px);
  color: #fff;
  background: linear-gradient(135deg, var(--vfw-blue-dark), var(--vfw-blue));
}

.vfw-app-brand {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 0;
}

.vfw-app-brand img {
  flex: 0 0 auto;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.vfw-app-brand h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  line-height: 1.12;
}

.vfw-app-kicker {
  margin: 0 0 3px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.vfw-install-button,
.vfw-primary-button,
.vfw-secondary-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.vfw-install-button {
  padding: 10px 17px;
  color: var(--vfw-blue-dark);
  background: #fff;
}

.vfw-primary-button {
  padding: 13px 22px;
  color: #fff;
  background: var(--vfw-red);
  box-shadow: 0 7px 18px rgba(200, 16, 46, 0.22);
}

.vfw-secondary-button {
  padding: 11px 18px;
  color: #fff;
  background: var(--vfw-blue);
}

.vfw-install-button:hover,
.vfw-primary-button:hover,
.vfw-secondary-button:hover {
  transform: translateY(-1px);
}

.vfw-install-button:disabled,
.vfw-primary-button:disabled,
.vfw-secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.vfw-app-disclaimer {
  padding: 13px clamp(18px, 4vw, 42px);
  color: #4d3c00;
  background: #fff8d9;
  border-bottom: 1px solid #f0df92;
  font-size: 0.92rem;
}

.vfw-app-tabs {
  display: flex;
  gap: 8px;
  padding: 12px clamp(12px, 3vw, 30px);
  overflow-x: auto;
  background: #fff;
  border-bottom: 1px solid var(--vfw-line);
  scrollbar-width: thin;
}

.vfw-app-tabs button {
  flex: 0 0 auto;
  padding: 10px 15px;
  color: var(--vfw-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 750;
}

.vfw-app-tabs button.is-active {
  color: #fff;
  background: var(--vfw-blue);
}

.vfw-app-main {
  padding: clamp(20px, 4vw, 44px);
}

.vfw-tab-panel[hidden] {
  display: none !important;
}

.vfw-panel-heading {
  max-width: 850px;
  margin-bottom: 22px;
}

.vfw-panel-heading h2 {
  margin: 0 0 8px;
  color: var(--vfw-blue-dark);
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.2;
}

.vfw-panel-heading p,
.vfw-subsection > p {
  margin: 0;
  color: var(--vfw-muted);
}

.vfw-ballot-form {
  padding: clamp(18px, 3vw, 28px);
  background: #fff;
  border: 1px solid var(--vfw-line);
  border-radius: var(--vfw-radius);
  box-shadow: var(--vfw-shadow);
}

.vfw-form-grid {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(220px, 1.3fr) minmax(220px, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.vfw-ballot-form label,
.vfw-bill-toolbar label {
  display: block;
}

.vfw-ballot-form label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--vfw-blue-dark);
  font-size: 0.9rem;
  font-weight: 750;
}

.vfw-ballot-form label em {
  color: var(--vfw-muted);
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 500;
}

.vfw-ballot-form input,
.vfw-ballot-form select,
.vfw-bill-toolbar input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--vfw-text);
  background: #fff;
  border: 1px solid #bfc9d7;
  border-radius: 10px;
  font: inherit;
}

.vfw-ballot-form input:focus,
.vfw-ballot-form select:focus,
.vfw-bill-toolbar input:focus,
.vfw-app-tabs button:focus-visible,
.vfw-primary-button:focus-visible,
.vfw-secondary-button:focus-visible,
.vfw-install-button:focus-visible,
.vfw-card-actions a:focus-visible {
  outline: 3px solid rgba(0, 63, 135, 0.3);
  outline-offset: 2px;
}

.vfw-live-status {
  min-height: 24px;
  margin: 15px 0;
  color: var(--vfw-muted);
  font-weight: 650;
}

.vfw-live-status.is-error {
  color: var(--vfw-error);
}

.vfw-live-status.is-success {
  color: var(--vfw-success);
}

.vfw-live-status.is-loading::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: vfw-spin 0.75s linear infinite;
}

@keyframes vfw-spin {
  to { transform: rotate(360deg); }
}

.vfw-result-notice,
.vfw-empty-card {
  padding: 16px 18px;
  color: #4a3d0b;
  background: #fffbea;
  border: 1px solid #eadb91;
  border-radius: 13px;
}

.vfw-empty-card p {
  margin: 0;
}

.vfw-result-header {
  margin: 24px 0 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--vfw-blue);
}

.vfw-result-header h3,
.vfw-contest-section > h3,
.vfw-bill-group > h3,
.vfw-subsection > h3 {
  margin: 0 0 7px;
  color: var(--vfw-blue-dark);
}

.vfw-contest-section,
.vfw-bill-group,
.vfw-subsection {
  margin-top: 30px;
}

.vfw-candidate-grid,
.vfw-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.vfw-candidate-card,
.vfw-info-card {
  min-width: 0;
  padding: 18px;
  background: var(--vfw-card);
  border: 1px solid var(--vfw-line);
  border-radius: var(--vfw-radius);
  box-shadow: 0 7px 20px rgba(19, 42, 76, 0.06);
}

.vfw-candidate-top {
  display: flex;
  align-items: center;
  gap: 13px;
}

.vfw-candidate-photo {
  width: 70px;
  height: 70px;
  flex: 0 0 70px;
  object-fit: cover;
  background: #eef2f7;
  border: 1px solid var(--vfw-line);
  border-radius: 50%;
}

.vfw-candidate-identity h4,
.vfw-info-card h3,
.vfw-info-card h4 {
  margin: 0 0 5px;
  color: var(--vfw-blue-dark);
  line-height: 1.25;
}

.vfw-info-card p,
.vfw-candidate-card p {
  margin: 9px 0 0;
}

.vfw-party-label {
  color: var(--vfw-muted);
  font-weight: 700;
}

.vfw-meta,
.vfw-source-note {
  color: var(--vfw-muted);
  font-size: 0.88rem;
}

.vfw-source-note {
  margin-top: 18px;
}

.vfw-card-eyebrow {
  margin-bottom: 7px;
  color: var(--vfw-red);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.vfw-rating-badge {
  display: inline-block;
  padding: 5px 10px;
  color: #123d1f;
  background: #e5f6e9;
  border: 1px solid #b8dfc2;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.vfw-scorecard-summary {
  color: var(--vfw-muted);
}

.vfw-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

.vfw-card-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 11px;
  color: var(--vfw-blue);
  text-decoration: none;
  background: #eef5ff;
  border: 1px solid #c9ddf7;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 750;
}

/* Make official legislative source links visually distinct from bill links. */
.vfw-official-sources .vfw-card-actions a {
  color: #6b4300;
  background: #fff3c4;
  border-color: #e3b64a;
}

.vfw-official-sources .vfw-card-actions a:hover,
.vfw-official-sources .vfw-card-actions a:focus-visible {
  color: #241600;
  background: var(--vfw-gold);
  border-color: #c99100;
}

.vfw-card-actions a:hover {
  color: #fff;
  background: var(--vfw-blue);
  border-color: var(--vfw-blue);
}

.vfw-card-actions a.vfw-report-link {
  color: #fff;
  background: var(--vfw-red);
  border-color: var(--vfw-red);
}

.vfw-bill-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.vfw-bill-toolbar label {
  flex: 1 1 420px;
}

.vfw-count-badge {
  display: inline-block;
  min-width: 28px;
  padding: 2px 8px;
  color: #fff;
  background: var(--vfw-blue);
  border-radius: 999px;
  font-size: 0.77rem;
  text-align: center;
  vertical-align: 2px;
}

.vfw-app-footer {
  padding: 18px clamp(18px, 4vw, 42px);
  color: rgba(255, 255, 255, 0.88);
  background: var(--vfw-blue-dark);
  font-size: 0.88rem;
}

.vfw-app-footer p {
  margin: 0;
}

.vfw-app-footer .vfw-platform-watermark {
  margin-top: 9px;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  opacity: 0.7;
}

.vfw-app-footer .vfw-platform-watermark a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.vfw-app-footer .vfw-platform-watermark a:hover,
.vfw-app-footer .vfw-platform-watermark a:focus-visible {
  opacity: 1;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 850px) {
  .vfw-form-grid {
    grid-template-columns: 1fr;
  }

  .vfw-candidate-grid,
  .vfw-card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .vfw-civic-app {
    border-radius: 0;
  }

  .vfw-app-header {
    align-items: flex-start;
    padding: 18px 16px;
  }

  .vfw-app-brand img {
    width: 46px;
    height: 46px;
  }

  .vfw-install-button {
    padding: 8px 11px;
    font-size: 0.82rem;
  }

  .vfw-app-main {
    padding: 20px 14px 32px;
  }

  .vfw-ballot-form,
  .vfw-candidate-card,
  .vfw-info-card {
    padding: 15px;
    border-radius: 14px;
  }

  .vfw-bill-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .vfw-secondary-button,
  .vfw-primary-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vfw-civic-app *,
  .vfw-civic-app *::before,
  .vfw-civic-app *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
