/* Theme variables now in brand.css */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  padding: 6rem clamp(1rem, 4vw, 3rem) 4rem;
  font-family: var(--font-sans);
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* Clean background - no decorations */
@media (max-width: 768px) {
  body {
    padding-top: 5rem;
  }
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  padding: 0.5rem 1rem;
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-radius: 999px;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform 0.2s ease;
  font-weight: 600;
}

.skip-link:focus-visible {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

main {
  width: min(1200px, 100%);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
}

/* ============================================================
   LANDING SEARCH HERO — Dominant centered entry point (SRCH-01)
   ============================================================ */

.landing-search-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.5rem 1rem 1rem;
  gap: 0.75rem;
}

.landing-hero-inner {
  max-width: 640px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.landing-hero-title {
  font-family: var(--font-serif, Georgia, serif);
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 400;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.landing-hero-subtitle {
  font-size: clamp(0.875rem, 2vw, 1.05rem);
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  line-height: 1.5;
}

/* Hero-elevated search bar styling */
.landing-search-hero + .radar-command .results-bar {
  max-width: 640px;
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 2px 12px -4px rgba(0, 0, 0, 0.12);
}

.landing-search-hero + .radar-command .command-search-input {
  font-size: 1rem;
  padding: 0.7rem 0;
}

/* Suggested query chips container below search */
.landing-hero-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 0 0;
  max-width: 640px;
  width: 100%;
}

.landing-hero-chip {
  appearance: none;
  border: 1px solid var(--stroke);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
  font-family: var(--font-sans);
  line-height: 1.4;
}

.landing-hero-chip:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--accent-warm);
}

.landing-hero-chip:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .landing-hero-chip {
    transition: none;
  }
}

/* ---- Landing / Results surface transition ---- */
.landing-search-hero {
  transition: opacity 0.25s ease, max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease;
  max-height: 500px;
  overflow: hidden;
}

.landing-search-hero[data-active-surface="full"],
.landing-search-hero[data-active-surface="filters"],
.landing-search-hero[data-active-surface="dropdown"],
.landing-search-hero[data-active-surface="preview"] {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

.results-section {
  transition: opacity 0.25s ease;
}

.results-section[data-active-surface="landing"] {
  opacity: 0.4;
}

@media (prefers-reduced-motion: reduce) {
  .landing-search-hero,
  .results-section {
    transition: none;
  }
}

/* Landing-positioned dataset tabs beneath search hero */
.landing-tabs {
  justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem 0 0;
  border-right: none;
  border-bottom: none;
}

.landing-tabs .view-tab {
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

.landing-tabs .view-tab[aria-selected="true"]::after {
  left: 0;
  right: 0;
  border-radius: 0 0 999px 999px;
}

@media (max-width: 600px) {
  .landing-search-hero {
    padding: 1.5rem 0.5rem 0.5rem;
  }

  .landing-hero-chips {
    gap: 0.4rem;
  }

  .landing-hero-chip {
    font-size: 0.75rem;
    padding: 0.35rem 0.7rem;
  }

  .landing-tabs .view-tab {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
  }
}

/* ============================================================
   RESULTS HEADER — Single unified toolbar
   Shneiderman: overview → zoom/filter → details on demand
   ============================================================ */

.radar-command {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 1rem;
}

/* ---- Primary bar: tabs · search · actions ---- */
.results-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  overflow: visible;
  position: relative;
}

/* Tabs */
.results-tabs {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
}

.view-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 0.85rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
  position: relative;
  white-space: nowrap;
}

.view-tab svg { display: none; }

.view-tab:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.view-tab[aria-selected="true"] {
  color: var(--text-primary);
  font-weight: 600;
  background: var(--bg-elevated);
}

.view-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0.85rem;
  right: 0.85rem;
  height: 2px;
  background: var(--accent-warm);
  border-radius: 1px;
}

.view-tab .tab-count {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.view-tab[aria-selected="true"] .tab-count {
  color: var(--accent-warm);
}

.view-tab:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent-primary);
}

/* Search — center, grows */
.results-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
  min-width: 0;
}

.results-search-icon {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.results-search:focus-within .results-search-icon {
  color: var(--accent-warm);
}

.command-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  color: var(--text-primary);
  outline: none;
  min-width: 0;
  padding: 0.55rem 0;
}

.command-search-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.search-clear-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.search-clear-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.search-clear-btn[hidden] {
  display: none;
}

.command-shortcut {
  display: none;
  padding: 0.15rem 0.4rem;
  background: var(--bg-primary);
  border: 1px solid var(--stroke);
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .command-shortcut { display: inline-block; }
}

.search-suggestion-list {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: var(--bg-secondary);
  box-shadow: 0 18px 36px -28px rgba(0, 0, 0, 0.55);
  z-index: 35;
}

.suggestion-group {
  margin: 0;
  padding: 0;
}

.suggestion-group + .suggestion-group {
  margin-top: 0.2rem;
}

.suggestion-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.4rem 0.55rem 0.2rem;
}

.suggestion-group-options {
  display: flex;
  flex-direction: column;
}

.search-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  appearance: none;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  gap: 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  line-height: 1.25;
  text-align: left;
  padding: 0.42rem 0.55rem;
}

.search-suggestion:hover,
.search-suggestion:focus-visible {
  outline: none;
  background: var(--bg-elevated);
}

.search-suggestion.is-active,
.search-suggestion[aria-selected="true"] {
  background: var(--bg-elevated);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-primary) 35%, transparent);
}

.suggestion-row-label {
  min-width: 0;
}

.suggestion-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--bg-primary);
  white-space: nowrap;
}

.suggestion-match {
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.08em;
}

.search-preview-option.preview-row {
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.6rem;
  padding: 0.52rem 0.55rem;
}

.preview-icon {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 0.5rem;
  border: 1px solid var(--stroke);
  background: var(--bg-primary);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.preview-icon svg {
  width: 0.95rem;
  height: 0.95rem;
}

.preview-content {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.preview-line-one {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  min-width: 0;
}

.preview-title {
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  font-weight: 600;
  color: var(--text-primary);
}

.preview-topic-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.06rem 0.42rem;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-primary));
  color: var(--text-secondary);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.2;
  flex: 0 0 auto;
}

.preview-line-two {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-overflow-row {
  margin-top: 0.18rem;
  border-top: 1px solid var(--stroke);
  padding-top: 0.2rem;
}

.preview-overflow-action {
  justify-content: center;
  font-weight: 600;
  color: var(--accent-primary);
}

.preview-row-shimmer {
  display: flex;
  gap: 0.6rem;
  padding: 0.52rem 0.55rem;
}

.preview-icon-shimmer {
  border-color: transparent;
  background: color-mix(in srgb, var(--bg-elevated) 84%, transparent);
}

.preview-row-shimmer .preview-topic-pill,
.preview-row-shimmer .preview-line-two,
.preview-row-shimmer .preview-title {
  color: transparent;
  border-color: transparent;
  border-radius: 999px;
}

.preview-row-shimmer .preview-title,
.preview-row-shimmer .preview-line-two {
  min-height: 0.68rem;
}

.preview-row-shimmer .preview-topic-pill {
  width: 3.2rem;
  min-height: 0.9rem;
}

.shimmer {
  position: relative;
  overflow: hidden;
  background: color-mix(in srgb, var(--bg-elevated) 84%, transparent);
}

.shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.45) 50%, transparent 100%);
  animation: preview-shimmer 1.2s ease-in-out infinite;
}

@keyframes preview-shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (max-width: 768px) {
  .preview-title {
    -webkit-line-clamp: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shimmer::after {
    animation: none;
  }
}

/* Actions — right */
.results-actions {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  border-left: 1px solid var(--stroke);
}

.filter-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.6rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.filter-toggle-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.filter-toggle-btn[aria-expanded="true"] {
  color: var(--accent-primary);
}

.filter-toggle-btn svg {
  width: 14px;
  height: 14px;
}

.filter-toggle-btn .chevron-icon {
  width: 10px;
  height: 10px;
  transition: transform 0.2s ease;
}

.filter-toggle-btn[aria-expanded="true"] .chevron-icon {
  transform: rotate(180deg);
}

.filter-count-badge {
  min-width: 14px;
  height: 14px;
  padding: 0 0.25rem;
  background: var(--accent-primary);
  border-radius: 7px;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-inverse);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-count-badge[hidden] { display: none; }

.clear-link {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.6rem 0.75rem;
  transition: color 0.12s ease;
  white-space: nowrap;
  border-left: 1px solid var(--stroke);
}

.clear-link:hover {
  color: var(--text-primary);
}

/* ---- Truth line — below the bar ---- */
.results-meta {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.4rem 0.25rem 0;
}

.stats-strip {
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: 0.25rem 0;
  margin-bottom: 0.5rem;
}

.meta-stat {
  font-size: 0.72rem;
  font-weight: 450;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.12s ease;
  padding: 0.2rem 0;
}

.meta-stat:hover {
  color: var(--text-secondary);
}

.meta-stat .stat-value {
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  font-size: inherit;
  line-height: inherit;
}

.meta-stat .stat-label {
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  text-transform: none;
}

.stat-highlight .stat-value {
  color: var(--accent-warm);
}

.stat-highlight .stat-label {
  color: var(--accent-warm);
}

.stat-highlight::before { display: none; }

.meta-sep {
  margin: 0 0.4rem;
  color: var(--stroke-strong);
  font-size: 0.6rem;
  user-select: none;
}

.stat-divider { display: none; }

.meta-live {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 450;
}

.live-ping {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #22c55e;
  position: relative;
}

.live-ping::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1px solid rgba(34, 197, 94, 0.4);
  animation: livePingRipple 3s ease-out infinite;
}

@keyframes livePingRipple {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .4; }
}

/* Number update flash */
.stat-value[data-counting="true"] {
  animation: countFlash 0.3s ease;
}

@keyframes countFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---- Quick filters — only 3 high-frequency ---- */
.quick-filters {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0;
}

.quick-action-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
}

.quick-action-chip:hover {
  border-color: var(--stroke-strong);
  color: var(--text-secondary);
}

.quick-action-chip.active {
  background: rgba(var(--accent-primary-rgb), 0.1);
  border-color: rgba(var(--accent-primary-rgb), 0.25);
  color: var(--accent-primary);
}

.quick-action-chip svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.chip-pulse {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
}

.chip-badge {
  padding: 0.05rem 0.25rem;
  background: rgba(239, 68, 68, 0.12);
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 700;
  color: #ef4444;
}

.chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chip-dot-new {
  background: var(--accent-secondary);
}

.quick-divider {
  width: 1px;
  height: 14px;
  background: var(--stroke);
}

/* Compare — contextual, hidden by default */
.compare-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid rgba(var(--accent-secondary-rgb), 0.25);
  border-radius: 6px;
  background: rgba(var(--accent-secondary-rgb), 0.06);
  color: var(--accent-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.compare-btn svg {
  width: 12px;
  height: 12px;
}

.compare-btn:hover {
  background: rgba(var(--accent-secondary-rgb), 0.12);
  border-color: rgba(var(--accent-secondary-rgb), 0.4);
}

.compare-btn .compare-count {
  min-width: 14px;
  height: 14px;
  padding: 0 0.2rem;
  background: var(--accent-secondary);
  border-radius: 7px;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-inverse);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.compare-btn .compare-count[hidden] { display: none; }

/* Clear all (hidden duplicate — JS compat) */
.clear-all-btn {
  display: none;
}

/* ---- Filter sidebar ---- */
.filter-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: min(360px, 85vw);
  height: 100vh;
  background: var(--bg-secondary);
  z-index: 1000;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--stroke);
}

.filter-sidebar.open {
  transform: translateX(0);
}

.filter-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.filter-sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.filter-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--stroke);
}

.filter-sidebar-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.filter-sidebar-close {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.filter-sidebar-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.filter-group {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 0.75rem;
  margin: 0;
}

.filter-group-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 0 0.25rem;
}

.filter-group-search {
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.filter-group-options {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-group-scrollable {
  max-height: 240px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.25rem 0.35rem;
  border-radius: 6px;
}

.filter-option:hover {
  background: var(--bg-tertiary);
}

.filter-date-range {
  display: flex;
  gap: 0.5rem;
}

.filter-date-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex: 1;
}

.filter-date-input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* ---- Applied filter badges ---- */
.filter-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
}

.filter-badges[hidden] {
  display: none !important;
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-tertiary);
  border-radius: 16px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.filter-badge button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.filter-badge button:hover {
  color: var(--text-primary);
}

.filter-clear-all {
  border: none;
  background: transparent;
  color: var(--accent-primary);
  font-size: 0.8125rem;
  cursor: pointer;
  padding: 0.25rem 0;
}

.filter-clear-all:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .filter-date-range {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .filter-sidebar,
  .filter-sidebar-backdrop {
    transition: none;
  }
}

/* ---- Light mode ---- */
[data-theme="light"] .results-bar {
  background: var(--bg-tertiary);
}

[data-theme="light"] .filter-panel-inner {
  background: var(--bg-tertiary);
}

[data-theme="light"] .filter-select {
  background: var(--bg-secondary);
}

[data-theme="light"] .date-chip {
  background: var(--bg-secondary);
}

[data-theme="light"] .date-input {
  background: var(--bg-secondary);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .results-bar {
    flex-wrap: wrap;
  }

  .results-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .results-search {
    width: 100%;
    padding: 0 0.5rem;
  }

  .results-actions {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--stroke);
  }

  .filter-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .view-tab {
    padding: 0.5rem 0.6rem;
    font-size: 0.75rem;
  }
}

/* Legacy compat — hide page-intro if present */
.page-intro { display: none; }

/* ========== YOUR PROGRESS - COMPACT STRIP + EXPANDABLE DRAWER ========== */

.achievements-panel {
  margin-top: 1rem;
  margin-bottom: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.achievements-summary,
.achievements-title,
.level-badge,
.achievements-progress {
  display: none;
}

.achievements-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

/* ========== COMPACT PROGRESS STRIP (56px) ========== */
.progress-strip {
  display: flex;
  align-items: center;
  gap: 0;
  height: 56px;
  padding: 0 1rem;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--stroke);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.progress-strip:hover {
  background: var(--bg-elevated);
}

.progress-strip-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  height: 100%;
  border-right: 1px solid var(--stroke);
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-strip-item:last-of-type {
  border-right: none;
}

.progress-strip-item .strip-icon {
  font-size: 1rem;
  line-height: 1;
}

.progress-strip-item .strip-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.progress-strip-item .strip-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.progress-strip-item.streak-active .strip-value {
  color: var(--accent-primary);
}

.progress-strip-item.streak-active .strip-icon {
  opacity: 1;
}

/* Thin inline XP bar in strip */
.progress-strip-xp {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.progress-strip-xp-bar {
  width: 120px;
  height: 4px;
  background: var(--stroke);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.progress-strip-xp-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 1px;
}

.progress-strip-xp-text {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--text-muted);
  white-space: nowrap;
}

/* Goal count in strip */
.progress-strip-goal {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--accent-primary);
}

/* Chevron toggle */
.progress-strip-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: auto;
  background: none;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}

.progress-strip-toggle:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.progress-strip-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform 0.25s ease;
}

.progress-strip-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* Hidden stat elements for JS compatibility */
.progress-stats-bar {
  display: none;
}

/* ========== EXPANDABLE DRAWER ========== */
.progress-drawer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 250ms ease-out;
  background: var(--bg-secondary);
}

.progress-drawer.open {
  max-height: 520px;
}

.progress-drawer-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--stroke);
}

.drawer-left {
  padding: 1rem;
  border-right: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.drawer-right {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Drawer activity section spans full width */
.drawer-activity {
  grid-column: 1 / -1;
  padding: 1rem;
  border-top: 1px solid var(--stroke);
}

/* ========== WELCOME STATE (inside drawer) ========== */
.welcome-state {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(var(--accent-primary-rgb), 0.06);
  border-bottom: 1px solid var(--stroke);
  grid-column: 1 / -1;
}

.welcome-state-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.welcome-state-content {
  flex: 1;
}

.welcome-state-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.welcome-state-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.welcome-state-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: var(--accent-primary);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-height: 36px;
  flex-shrink: 0;
}

.welcome-state-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--accent-primary-rgb), 0.4);
}

.welcome-state-cta svg {
  width: 14px;
  height: 14px;
}

.welcome-state-hint {
  display: none;
}

/* ========== QUICK START (inside drawer) ========== */
.quickstart-checklist {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-bottom: 1px solid var(--stroke);
  grid-column: 1 / -1;
}

.quickstart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--stroke);
}

.quickstart-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.quickstart-title-icon {
  font-size: 0.9rem;
}

.quickstart-progress-text {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-primary);
  font-family: var(--font-mono, ui-monospace, monospace);
}

.quickstart-items-wrapper {
  display: flex;
  flex-direction: column;
}

.quickstart-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  background: var(--bg-primary);
  cursor: pointer;
  transition: background 0.15s ease;
  min-height: 40px;
  border-bottom: 1px solid var(--stroke);
}

.quickstart-item:last-child {
  border-bottom: none;
}

.quickstart-item:hover {
  background: var(--bg-elevated);
}

.quickstart-item.completed {
  opacity: 0.5;
}

.quickstart-check {
  width: 20px;
  height: 20px;
  border: 2px solid var(--stroke-strong);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  color: transparent;
  transition: all 0.2s ease;
}

.quickstart-item.completed .quickstart-check {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-inverse);
}

.quickstart-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.quickstart-item.completed .quickstart-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.quickstart-reward {
  font-size: 0.8rem;
  font-weight: 800;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--accent-primary);
}

.quickstart-item.completed .quickstart-reward {
  opacity: 0.5;
}

/* ========== XP BAR (inside drawer - compact) ========== */
.xp-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.xp-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
}

.xp-level-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.xp-level {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
}

.xp-level-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.xp-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.125rem;
}

.xp-to-next {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--text-secondary);
  display: block;
}

.xp-bar-container {
  height: 8px;
  background: var(--stroke);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.xp-bar-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 2px;
  position: relative;
}

.xp-bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.3) 0%,
    rgba(255,255,255,0.1) 50%,
    transparent 100%
  );
  border-radius: 4px;
}

.xp-earned-today {
  font-size: 0.75rem;
  font-weight: 800;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--accent-primary);
  display: block;
}

/* ========== DAILY GOAL (inside drawer - compact) ========== */
.daily-challenge {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-elevated);
  border: 1.5px solid var(--accent-primary);
  border-radius: 8px;
  position: relative;
}

.daily-challenge.completed {
  border-color: var(--accent-primary);
  background: rgba(var(--accent-primary-rgb), 0.05);
}

.daily-challenge-icon {
  display: none;
}

.daily-challenge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.daily-challenge-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.daily-challenge-label::before {
  content: "\26A1";
  font-size: 0.85rem;
}

.daily-challenge.completed .daily-challenge-label {
  color: var(--accent-primary);
}

.daily-challenge.completed .daily-challenge-label::before {
  content: "\2713";
}

.daily-challenge-timer {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
}

.daily-challenge-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.daily-challenge-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.daily-challenge.completed .daily-challenge-text {
  text-decoration: line-through;
  opacity: 0.6;
}

.daily-challenge-reward {
  font-size: 0.8rem;
  font-weight: 900;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--accent-primary);
  white-space: nowrap;
}

.daily-challenge.completed .daily-challenge-reward {
  color: var(--accent-primary);
}

.daily-challenge-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.daily-challenge-bar {
  flex: 1;
  height: 6px;
  background: var(--stroke);
  border-radius: 3px;
  overflow: hidden;
}

.daily-challenge-bar-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.daily-challenge.completed .daily-challenge-bar-fill {
  background: var(--accent-primary);
}

.daily-challenge-count {
  font-size: 0.75rem;
  font-weight: 800;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--text-primary);
  min-width: 32px;
  text-align: right;
}

/* ========== STREAK (inside drawer - compact) ========== */
.streak-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(var(--accent-primary-rgb), 0.06);
  border-radius: 10px;
  position: relative;
}

.streak-section.active {
  background: rgba(var(--accent-primary-rgb), 0.1);
}

.streak-number-container {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.streak-icon {
  font-size: 1.5rem;
  line-height: 1;
  opacity: 0.3;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.streak-section.active .streak-icon {
  opacity: 1;
  transform: scale(1.1);
}

.streak-count {
  font-size: 2.25rem;
  font-weight: 900;
  color: var(--accent-primary);
  line-height: 1;
  letter-spacing: -0.03em;
}

.streak-section:not(.active) .streak-count {
  color: var(--text-muted);
}

.streak-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
}

.streak-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.streak-subtitle {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  display: none;
}

.streak-section.active .streak-subtitle {
  display: block;
  color: var(--accent-primary);
}

.streak-section.at-risk .streak-subtitle {
  display: block;
  color: var(--accent-primary);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.streak-days {
  display: flex;
  gap: 4px;
  margin-top: 0.25rem;
}

.streak-day {
  width: 24px;
  height: 24px;
  background: var(--bg-secondary);
  border: 2px solid var(--stroke);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.streak-day.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-inverse);
  transform: scale(1.05);
}

.streak-day.today {
  border-color: var(--text-primary);
  border-width: 2.5px;
}

.streak-day.today.active {
  border-color: var(--accent-primary);
}

/* ========== ACTIVITY DETAILS (inside drawer) ========== */
.activity-details {
  background: var(--bg-primary);
  overflow: hidden;
}

.activity-details-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background 0.15s ease;
  list-style: none;
  min-height: 36px;
}

.activity-details-summary::-webkit-details-marker {
  display: none;
}

.activity-details-summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  margin-right: 0.5rem;
  transition: transform 0.2s ease;
}

.activity-details[open] .activity-details-summary::before {
  transform: rotate(45deg);
}

.activity-details-summary:hover {
  background: var(--bg-elevated);
}

.total-xp-badge {
  font-size: 0.8rem;
  font-weight: 800;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--accent-primary);
}

.activity-details-body {
  padding: 0.75rem 1rem;
  padding-top: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ========== ACTIVITY HEATMAP ========== */
.activity-heatmap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.activity-heatmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.activity-heatmap-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.activity-heatmap-legend {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--text-muted);
}

.activity-legend-cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.activity-legend-cell[data-level="0"] { background: var(--stroke); }
.activity-legend-cell[data-level="1"] { background: rgba(var(--accent-primary-rgb), 0.3); }
.activity-legend-cell[data-level="2"] { background: rgba(var(--accent-primary-rgb), 0.5); }
.activity-legend-cell[data-level="3"] { background: rgba(var(--accent-primary-rgb), 0.75); }
.activity-legend-cell[data-level="4"] { background: var(--accent-primary); }

.activity-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 3px;
}

.activity-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--stroke);
  position: relative;
  transition: transform 0.15s ease;
}

.activity-cell:hover {
  transform: scale(1.2);
  z-index: 1;
}

.activity-cell[data-level="1"] { background: rgba(var(--accent-primary-rgb), 0.3); }
.activity-cell[data-level="2"] { background: rgba(var(--accent-primary-rgb), 0.5); }
.activity-cell[data-level="3"] { background: rgba(var(--accent-primary-rgb), 0.75); }
.activity-cell[data-level="4"] { background: var(--accent-primary); }

.activity-cell[data-today="true"] {
  box-shadow: inset 0 0 0 2px var(--text-primary);
}

.activity-cell::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-primary);
  border: 1px solid var(--stroke);
  border-radius: 4px;
  padding: 0.25rem 0.375rem;
  font-size: 0.65rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--text-secondary);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.activity-cell:hover::after {
  opacity: 1;
}

/* ========== STATS GRID (inside drawer) ========== */
.activity-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.activity-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--stroke);
}

.activity-stat-value {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}

.activity-stat-label {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ========== NEXT UNLOCK (inside drawer) ========== */
.next-unlock {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: rgba(var(--accent-secondary-rgb), 0.08);
  border: 1.5px dashed var(--accent-secondary);
  border-radius: 8px;
}

.next-unlock-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.next-unlock-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.next-unlock-progress {
  font-size: 0.8rem;
  font-weight: 800;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--accent-secondary);
}

/* ========== TOAST - HIGH CONTRAST notification ========== */
.achievement-toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: var(--accent-primary);
  color: white;
  padding: 1rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(var(--accent-primary-rgb), 0.4);
  border-radius: 12px;
}

.achievement-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.achievement-toast-xp {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 900;
  color: white;
  margin-left: auto;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
}

/* ========== LEVEL UP - MASSIVE celebration ========== */
.level-up-celebration {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-out;
}

.level-up-celebration.show {
  opacity: 1;
  pointer-events: auto;
}

.level-up-content {
  background: linear-gradient(135deg,
    var(--bg-secondary) 0%,
    var(--bg-primary) 100%
  );
  border: 3px solid var(--accent-primary);
  border-radius: 24px;
  padding: 3.5rem 5rem;
  text-align: center;
  transform: scale(0.8) translateY(40px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  box-shadow:
    0 0 60px rgba(var(--accent-primary-rgb), 0.3),
    0 20px 60px rgba(0, 0, 0, 0.4);
}

.level-up-celebration.show .level-up-content {
  transform: scale(1) translateY(0);
}

.level-up-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1rem;
}

.level-up-number {
  font-size: 8rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.04em;
  text-shadow: 0 4px 20px rgba(var(--accent-primary-rgb), 0.3);
}

.level-up-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-top: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.level-up-dismiss {
  margin-top: 2.5rem;
  padding: 1rem 3rem;
  background: var(--accent-primary);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.level-up-dismiss:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(var(--accent-primary-rgb), 0.5);
}

/* Hide the old elements we're replacing */
.streak-showcase { display: none !important; }
.achievements-grid { display: none !important; }
.streak-flame { display: none !important; }

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
  .activity-cell:hover {
    transform: none;
  }

  .xp-bar-fill::after,
  .xp-bar-fill {
    animation: none;
    transition: width 0.1s ease;
  }

  .xp-earned-today {
    animation: none;
  }

  .streak-main.at-risk {
    animation: none;
  }

  .streak-warning {
    animation: none;
  }

  .level-up-number {
    animation: none;
  }

  .achievement-toast {
    transition: opacity 0.1s ease;
    transform: none !important;
  }

  .achievement-toast.show {
    transform: none !important;
  }

  .progress-drawer {
    transition: none;
  }
}

/* ========== RESPONSIVE - STRIP ========== */
@media (max-width: 768px) {
  .progress-strip {
    flex-wrap: wrap;
    height: auto;
    min-height: 56px;
    padding: 0.5rem 1rem;
    gap: 0;
  }

  .progress-strip-item {
    height: auto;
    padding: 0.375rem 0.75rem;
  }

  .progress-strip-xp-bar {
    width: 80px;
  }

  .progress-drawer-inner {
    grid-template-columns: 1fr;
  }

  .drawer-left {
    border-right: none;
    border-bottom: 1px solid var(--stroke);
  }
}

@media (max-width: 480px) {
  .progress-strip-item .strip-label {
    display: none;
  }

  .progress-strip-xp-bar {
    width: 60px;
  }

  .progress-strip-xp-text {
    font-size: 0.68rem;
  }

  .activity-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .level-up-content {
    padding: 2rem 1.5rem;
    margin: 1rem;
  }

  .level-up-number {
    font-size: 4rem;
  }

  .achievement-toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }

  .next-unlock {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.375rem;
  }
}

/* ========== LIGHT MODE ========== */
[data-theme="light"] .achievements-panel {
  background: var(--bg-tertiary);
}

[data-theme="light"] .milestone-item {
  background: var(--bg-secondary);
}

[data-theme="light"] .activity-cell::after {
  background: var(--bg-tertiary);
}

[data-theme="light"] .quick-filter-btn {
  background: var(--bg-tertiary);
}

[data-theme="light"] .filter-badges {
  background: var(--bg-tertiary);
}

/* ========== CONTROL PANEL - Unified filters ========== */
.control-panel {
  position: relative;
  border-radius: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--stroke);
  padding: 1.5rem;
    display: flex;
    flex-direction: column;
  gap: 1.25rem;
  }

.control-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.view-toggle {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--bg-elevated);
  border-radius: 12px;
  border: 1px solid var(--stroke);
}

.view-chip {
  border-radius: 9px;
  padding: 0.6rem 1.25rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-chip[aria-selected="true"] {
  background: var(--accent-primary);
  color: var(--text-inverse);
  font-weight: 600;
}

.view-chip:hover:not([aria-selected="true"]) {
  color: var(--text-primary);
  background: rgba(var(--accent-primary-rgb), 0.08);
}

.view-chip:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.update-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.update-indicator svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.control-panel-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

@media (min-width: 900px) {
  .control-panel-body {
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
  }
}

.control {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.control label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

select,
input[type="search"] {
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--stroke);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.88rem;
  appearance: none;
  outline: none;
  transition: all 0.2s ease;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

select option {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

select:focus,
input[type="search"]:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.12);
}

select:hover,
input[type="search"]:hover {
  border-color: var(--stroke-strong);
}

/* ========== DATE RANGE FILTER ========== */
.date-range-section {
  padding: 1rem 0;
  border-top: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.date-range-section[hidden] {
  display: none !important;
}

.date-range-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.date-range-header label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.date-clear-btn {
  background: none;
  border: none;
  font-size: 0.75rem;
  color: var(--accent-primary);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.date-clear-btn:hover {
  background: rgba(var(--accent-primary-rgb), 0.1);
}

.date-clear-btn[hidden] {
  display: none;
}

.date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.date-preset {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.date-preset:hover {
  border-color: var(--stroke-strong);
  color: var(--text-primary);
}

.date-preset.active {
  background: rgba(var(--accent-primary-rgb), 0.12);
  border-color: rgba(var(--accent-primary-rgb), 0.3);
  color: var(--accent-primary);
}

.date-inputs {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.date-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 130px;
}

.date-input-group label {
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

input[type="date"] {
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--stroke);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.2s ease;
  width: 100%;
}

input[type="date"]:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.12);
}

input[type="date"]:hover {
  border-color: var(--stroke-strong);
}

/* Calendar icon styling */
input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.5;
  cursor: pointer;
  filter: invert(1);
}

[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: none;
}

.date-separator {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding-bottom: 0.65rem;
}

/* Active date range indicator */
.date-range-active-label {
  font-size: 0.75rem;
  color: var(--accent-primary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.date-range-active-label::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--accent-primary);
  border-radius: 50%;
}

/* Light mode */
[data-theme="light"] .date-preset {
  background: var(--bg-tertiary);
}

[data-theme="light"] input[type="date"] {
  background: var(--bg-tertiary);
}

@media (max-width: 640px) {
  .date-inputs {
  flex-direction: column;
    gap: 0.5rem;
  }

  .date-separator {
    display: none;
  }

  .date-input-group {
    width: 100%;
}
}

/* ========== SUMMARY STATS ========== */
.summary-stats {
    display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1rem 0 0;
  border-top: 1px solid var(--stroke);
}

.summary-stat {
    display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.summary-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-primary);
  font-variant-numeric: tabular-nums;
}

.summary-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Highlighted stat - draws attention */
.summary-stat.highlight .summary-stat-value {
  color: #f97316;
}

.summary-stat.highlight::after {
  content: "•";
  color: #f97316;
  margin-left: 0.35rem;
  animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* State filter banner */
.state-filter-banner[hidden] {
  display: none !important;
}

.state-filter-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  background: rgba(var(--accent-primary-rgb), 0.08);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.15);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.state-filter-banner strong {
  color: var(--accent-primary);
  font-weight: 600;
}

.clear-state-btn {
  margin-left: auto;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(var(--accent-primary-rgb), 0.25);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.clear-state-btn:hover {
  background: rgba(var(--accent-primary-rgb), 0.12);
  color: var(--text-primary);
  border-color: rgba(var(--accent-primary-rgb), 0.35);
}

[data-theme="light"] .state-filter-banner {
  background: rgba(var(--accent-primary-rgb), 0.06);
  border-color: rgba(var(--accent-primary-rgb), 0.15);
}

[data-theme="light"] .state-filter-banner strong {
  color: var(--accent-primary);
}

[data-theme="light"] .clear-state-btn {
  border-color: rgba(1, 113, 85, 0.2);
}

[data-theme="light"] .clear-state-btn:hover {
  background: rgba(1, 113, 85, 0.08);
}

/* ========== RESULTS SECTION - Information-dense, scannable ========== */
.results-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-heading-left {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1.3;
}

/* Live indicator next to heading */
.section-heading h2 em {
  font-style: normal;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.section-heading-caption {
  display: none;
}

.results-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.results-count strong {
  color: var(--text-primary);
  font-weight: 600;
}

.results-count-subtle {
  color: var(--text-muted);
  font-weight: 400;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.75rem;
}

.grid.full-results-layout {
  grid-template-columns: 1fr;
  max-width: 800px;
  margin: 0 auto;
  gap: 1rem;
}

.full-result-card {
  background: var(--bg-secondary);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.frc-main {
  display: flex;
  flex-direction: column;
}

.frc-title {
  margin: 0 0 0.25rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.frc-summary {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.frc-state-badge {
  display: inline-flex;
  align-items: center;
  text-transform: uppercase;
  background: var(--bg-tertiary);
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.frc-status-chip {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--stroke);
  color: var(--text-secondary);
}

.frc-topic-pill {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 12px;
  background: rgba(var(--accent-primary-rgb), 0.12);
  color: var(--accent-primary);
  font-weight: 500;
}

.frc-metadata-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.frc-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--stroke);
}

.frc-actions .bookmark-btn {
  min-height: 2rem;
  padding: 0.25rem 0.625rem;
}

.frc-compare-check {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.frc-compare-input {
  margin: 0;
}

.frc-open-link {
  margin-left: auto;
  font-size: 0.8125rem;
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
}

.frc-open-link:hover,
.frc-open-link:focus-visible {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .full-result-card {
    padding: 1rem;
  }

  .frc-actions {
    flex-wrap: wrap;
  }

  .frc-open-link {
    margin-left: 0;
  }
}

[data-theme="light"] .full-result-card {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 0.625rem;
  }
}

/* ========== COMPLETED BILLS PANEL ========== */
.completed-panel {
  margin-top: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  overflow: hidden;
}

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

.completed-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  color: var(--text-primary);
  transition: background 0.2s ease;
}

.completed-summary::-webkit-details-marker {
  display: none;
}

.completed-summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease, border-color 0.2s ease;
  flex: 0 0 auto;
  margin-left: auto;
}

.completed-panel[open] .completed-summary::after {
  transform: rotate(-135deg);
  border-color: var(--accent-primary);
}

.completed-summary:hover {
  background: var(--bg-elevated);
}

.completed-title {
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.completed-count {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.completed-body {
  padding: 0.25rem 1rem 1rem;
}

.completed-hint {
  margin: 0.5rem 0 0.75rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
}

[data-theme="light"] .completed-panel {
  background: var(--bg-tertiary);
}

[data-theme="light"] .completed-hint {
  color: rgba(0, 0, 0, 0.65);
}

/* ========== CARD DESIGN - Editorial, distinctive ========== */
/* Each card is a mini-document, not a generic container */

@property --card-index {
  syntax: '<integer>';
  initial-value: 0;
  inherits: false;
}

.card {
  --card-accent: var(--accent-primary);
  --card-accent-rgb: var(--accent-primary-rgb);
  --card-accent-ink: var(--text-inverse);

  position: relative;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--bg-secondary);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: none;
  transition: 
    transform 0.2s ease,
    border-color 0.15s ease,
    box-shadow 0.2s ease;
  transform: translateY(0);
  
  /* Clean fade in */
  animation: cardFadeIn 0.4s ease backwards;
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger delay */
.grid .card:nth-child(1) { animation-delay: 0ms; }
.grid .card:nth-child(2) { animation-delay: 30ms; }
.grid .card:nth-child(3) { animation-delay: 60ms; }
.grid .card:nth-child(4) { animation-delay: 90ms; }
.grid .card:nth-child(5) { animation-delay: 120ms; }
.grid .card:nth-child(6) { animation-delay: 150ms; }
.grid .card:nth-child(n+7) { animation-delay: 180ms; }

/* Left border accent - the signature element */
.card::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 3px;
  background: var(--card-accent);
  border-radius: 0 2px 2px 0;
  opacity: 0;
  transform: scaleY(0.6);
  transition: all 0.2s ease;
  z-index: 2;
}

.card:hover::before,
.card:focus-within::before {
  opacity: 1;
  transform: scaleY(1);
}

/* Hover state - subtle but clear */
.card:hover {
  transform: translateY(-2px);
  border-color: var(--stroke-strong);
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.1);
}

.card:active {
  transform: translateY(0);
  transition-duration: 0.1s;
}

.card:focus-within {
  border-color: var(--card-accent);
  box-shadow: 0 0 0 3px rgba(var(--card-accent-rgb), 0.1);
}

@media (prefers-reduced-motion: reduce) {
  .card {
    animation: none;
    transition: border-color 0.15s ease;
  }
  .card:hover { transform: none; }
}

/* Header zone - clean, information-first */
.card-header-zone {
  position: relative;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: transparent;
}

/* Body content area */
.card-body-zone {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  flex: 1;
}

/* ========== PETITION CARD ========== */
.card.petition-card {
  --card-accent: #ef4444;
  --card-accent-rgb: 239, 68, 68;
  --card-accent-ink: #ffffff;
}

.card.petition-card .card-meta-bar::after {
  content: "PETITION";
  display: inline-flex;
  align-items: center;
  margin-left: 0.5rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--card-accent);
  background: rgba(var(--card-accent-rgb), 0.1);
  border-radius: 4px;
}

/* ========== LIGHT THEME CARDS ========== */
[data-theme="light"] .card {
  background: var(--bg-tertiary);
  box-shadow: 
    0 1px 2px rgba(0, 0, 0, 0.03),
    0 4px 12px -4px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .card:hover {
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.04),
    0 12px 28px -8px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .card-header-zone {
  background: linear-gradient(180deg, 
    rgba(var(--card-accent-rgb), 0.04) 0%,
    transparent 100%
  );
}

/* ========== PETITION SOURCE LABEL ========== */
.petition-source-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(var(--card-accent-rgb), 0.08);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
}

.petition-source-label svg {
  width: 12px;
  height: 12px;
  opacity: 0.7;
  color: var(--card-accent);
}

[data-theme="light"] .petition-source-label {
  color: rgba(0, 0, 0, 0.55);
  background: rgba(var(--card-accent-rgb), 0.08);
}

/* ========== CARD CTAs - Clean, functional buttons ========== */
.card-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}

.card .pill-link {
  flex: 1 1 120px;
  min-width: 0;
  border-radius: 8px;
  padding: 0.65rem 0.875rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: center;
  text-decoration: none;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}

/* Subtle shine effect on hover */
.card .pill-link::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%,
    rgba(255, 255, 255, 0.12) 50%,
    transparent 100%
  );
  transition: left 0.4s ease;
}

.card .pill-link:hover::after {
  left: 100%;
}

.card .pill-link:active {
  transform: scale(0.98);
}

.card .pill-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--card-accent-rgb), 0.2);
}

/* Primary CTA - Clean, confident */
.pill-link.card-primary {
  background: var(--card-accent);
  border: none;
  color: var(--card-accent-ink);
}

.pill-link.card-primary:hover {
  filter: brightness(1.1);
}

.pill-link.card-primary:active {
  filter: brightness(0.95);
}

/* Arrow animation */
.pill-link.card-primary span {
  display: inline-block;
  transition: transform 0.15s ease;
}

.pill-link.card-primary:hover span {
  transform: translateX(2px);
}

/* Secondary CTA - Ghost style */
.pill-link.card-secondary {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--text-primary);
}

.pill-link.card-secondary:hover {
  background: rgba(var(--card-accent-rgb), 0.06);
  border-color: rgba(var(--card-accent-rgb), 0.25);
  color: var(--card-accent);
}

[data-theme="light"] .pill-link.card-primary {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .pill-link.card-secondary {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.75);
}

[data-theme="light"] .pill-link.card-secondary:hover {
  background: rgba(var(--card-accent-rgb), 0.08);
  border-color: rgba(var(--card-accent-rgb), 0.2);
  color: var(--card-accent);
}

/* Discuss icon styling */
.discuss-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.pill-link.card-secondary:hover .discuss-icon {
  opacity: 1;
  transform: scale(1.05);
}

.card > * {
  position: relative;
  z-index: 1;
}

/* ========== CARD ACTION BUTTONS ========== */

.card-action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 15;
  flex-shrink: 0;
  margin-left: auto;
}

/* Bookmark button - clean, minimal */
.bookmark-btn {
  position: relative;
  width: 32px;
  height: 32px;
  border: 1px solid var(--stroke);
  background: var(--bg-secondary);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  overflow: visible;
}

.bookmark-btn .bookmark-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.bookmark-btn:hover {
  border-color: rgba(var(--card-accent-rgb), 0.3);
  background: rgba(var(--card-accent-rgb), 0.06);
}

.bookmark-btn:hover .bookmark-icon {
  color: var(--card-accent);
}

.bookmark-btn:active {
  transform: scale(0.95);
}

/* Bookmarked state */
.bookmark-btn.bookmarked {
  background: rgba(var(--card-accent-rgb), 0.12);
  border-color: rgba(var(--card-accent-rgb), 0.3);
}

.bookmark-btn.bookmarked .bookmark-icon {
  color: var(--card-accent);
  fill: var(--card-accent);
}

.bookmark-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--card-accent-rgb), 0.2);
}

/* Light theme */
[data-theme="light"] .bookmark-btn {
  background: var(--bg-tertiary);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .bookmark-btn svg {
  color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .bookmark-btn:hover {
  background: rgba(var(--card-accent-rgb), 0.08);
}

[data-theme="light"] .bookmark-btn:hover svg,
[data-theme="light"] .bookmark-btn.bookmarked svg {
  color: var(--card-accent);
}

/* ========== BOOKMARK TOAST - Simple, clear ========== */
.bookmark-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-secondary);
  border: 1px solid var(--stroke);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.bookmark-toast::before {
  content: "✓";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-radius: 50%;
  font-weight: 700;
  font-size: 10px;
}

.bookmark-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== CARD CONTENT ========== */

/* Meta bar - Clean badge row */
.card-meta-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  position: relative;
}

/* State badge - Clean chip */
.card-meta-bar .state-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  background: rgba(var(--card-accent-rgb), 0.12);
  color: var(--card-accent);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  transition: background 0.15s ease;
}

.card:hover .card-meta-bar .state-badge {
  background: rgba(var(--card-accent-rgb), 0.18);
}

/* Bill number - Monospace styling */
.card-meta-bar .bill-number {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  border-radius: 5px;
  background: rgba(var(--card-accent-rgb), 0.05);
}

[data-theme="light"] .card-meta-bar .bill-number {
  color: rgba(0, 0, 0, 0.55);
  background: rgba(var(--card-accent-rgb), 0.06);
}

.card-meta-bar .separator {
  opacity: 0.25;
  font-size: 0.6rem;
}

[data-theme="light"] .card-meta-bar .state-badge {
  background: rgba(var(--card-accent-rgb), 0.1);
}

/* Title - Clean, readable */
.title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s ease;
}

.card:hover .title {
  color: var(--card-accent);
}

[data-theme="light"] .title {
  color: rgba(0, 0, 0, 0.85);
}

[data-theme="light"] .card:hover .title {
  color: var(--card-accent);
}

/* Meta grid - Clean spacing */
.meta-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem 1.5rem;
  padding: 0.25rem 0;
}

/* Meta field */
.meta-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 0 1 auto;
  min-width: 0;
}

.meta-field dt {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
}

.meta-field dd {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.45;
}

[data-theme="light"] .meta-field dt {
  color: rgba(0, 0, 0, 0.45);
}

[data-theme="light"] .meta-field dd {
  color: rgba(0, 0, 0, 0.7);
}

/* ========== COMMITTEE TAGS ========== */
.committee-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.committee-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(var(--card-accent-rgb), 0.06);
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.committee-tag:hover {
  background: rgba(var(--card-accent-rgb), 0.12);
  color: var(--card-accent);
}

[data-theme="light"] .committee-tag {
  background: rgba(0, 0, 0, 0.04);
  color: rgba(0, 0, 0, 0.6);
}

[data-theme="light"] .committee-tag:hover {
  background: rgba(var(--card-accent-rgb), 0.1);
  color: var(--card-accent);
}

/* Color variants - subtle, professional */
.committee-tag.color-0 {
  background: rgba(96, 165, 250, 0.08);
  color: #60a5fa;
}
.committee-tag.color-1 {
  background: rgba(167, 139, 250, 0.08);
  color: #a78bfa;
}
.committee-tag.color-2 {
  background: rgba(251, 146, 60, 0.08);
  color: #fb923c;
}
.committee-tag.color-3 {
  background: rgba(74, 222, 128, 0.08);
  color: #4ade80;
}
.committee-tag.color-4 {
  background: rgba(251, 113, 133, 0.08);
  color: #fb7185;
}
.committee-tag.color-5 {
  background: rgba(34, 211, 238, 0.08);
  color: #22d3ee;
}
.committee-tag.color-6 {
  background: rgba(250, 204, 21, 0.08);
  color: #facc15;
}
.committee-tag.color-7 {
  background: rgba(248, 113, 113, 0.08);
  color: #f87171;
}

[data-theme="light"] .committee-tag.color-0 { color: #2563eb; background: rgba(37, 99, 235, 0.08); }
[data-theme="light"] .committee-tag.color-1 { color: #7c3aed; background: rgba(124, 58, 237, 0.08); }
[data-theme="light"] .committee-tag.color-2 { color: #ea580c; background: rgba(234, 88, 12, 0.08); }
[data-theme="light"] .committee-tag.color-3 { color: #16a34a; background: rgba(22, 163, 74, 0.08); }
[data-theme="light"] .committee-tag.color-4 { color: #e11d48; background: rgba(225, 29, 72, 0.08); }
[data-theme="light"] .committee-tag.color-5 { color: #0891b2; background: rgba(8, 145, 178, 0.08); }
[data-theme="light"] .committee-tag.color-6 { color: #ca8a04; background: rgba(202, 138, 4, 0.08); }
[data-theme="light"] .committee-tag.color-7 { color: #dc2626; background: rgba(220, 38, 38, 0.08); }

/* ========== STATUS INDICATOR ========== */
.status-value {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

[data-theme="light"] .status-value {
  color: rgba(0, 0, 0, 0.7);
}

/* Status indicator dot */
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-dot.scheduled {
  background: var(--accent-primary);
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { 
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(var(--accent-primary-rgb), 0.4);
  }
  50% { 
    opacity: 0.8;
    box-shadow: 0 0 0 4px rgba(var(--accent-primary-rgb), 0);
  }
}

[data-theme="light"] .status-dot.scheduled {
  background: var(--accent-primary);
}

/* ========== BILL PROGRESS + TIMELINE ========== */
.bill-progress {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(var(--card-accent-rgb), 0.02);
}

[data-theme="light"] .bill-progress {
  background: rgba(var(--card-accent-rgb), 0.03);
}

.bill-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.bill-progress-stage {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: rgba(var(--accent-primary-rgb), 0.1);
  color: var(--accent-primary);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.18);
}

.bill-progress-stage .stage-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: stagePulse 2s ease-in-out infinite;
}

@keyframes stagePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.15); }
}

.bill-progress[data-stage="passed"] .bill-progress-stage {
  background: rgba(var(--accent-primary-rgb), 0.12);
  border-color: rgba(var(--accent-primary-rgb), 0.25);
}

.bill-progress[data-stage="passed"] .bill-progress-stage .stage-dot {
  animation: none;
}

.bill-progress-updated {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.bill-progress-updated .date-warning {
  color: var(--warning);
  font-size: 0.85em;
  cursor: help;
  white-space: nowrap;
}

/* Progress bar - cleaner segmented design */
.bill-progress-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 5px;
  margin-top: 0.1rem;
}

.bill-progress-segment {
  flex: 1;
  height: 100%;
  border-radius: 2px;
  background: var(--stroke);
  transition: background 0.25s ease, transform 0.2s ease;
}

.card:hover .bill-progress-segment {
  transform: scaleY(1.3);
}

[data-theme="light"] .bill-progress-segment {
  background: rgba(0, 0, 0, 0.07);
}

.bill-progress-segment.active {
  background: var(--card-accent);
}

.bill-progress-segment.current {
  position: relative;
  background: var(--card-accent);
}

.bill-progress-segment.current::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  animation: progressPulse 1.6s ease-in-out infinite;
}

@keyframes progressPulse {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.4; }
}

.bill-progress-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  font-size: 0.62rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
  margin-top: 0.25rem;
}

.bill-progress-labels span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s ease, font-weight 0.2s ease;
}

.bill-progress-labels span.current {
  color: var(--accent-primary);
  font-weight: 600;
}

.bill-progress[data-stage="unknown"] .bill-progress-segment {
  opacity: 0.4;
}

/* Next step guidance row */
.bill-progress-next {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.55rem;
  margin-top: 0.15rem;
  border-radius: 6px;
  background: rgba(var(--accent-warm-rgb), 0.06);
  border: 1px solid rgba(var(--accent-warm-rgb), 0.12);
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.bill-progress-next .next-icon {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  color: var(--accent-warm);
}

.bill-progress-next .next-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-right: 0.25rem;
}

[data-theme="light"] .bill-progress-next {
  background: rgba(var(--accent-warm-rgb), 0.05);
}

/* Timeline */
.bill-timeline {
  margin-top: 0.5rem;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: transparent;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.bill-timeline:hover {
  border-color: rgba(var(--card-accent-rgb), 0.25);
}

[data-theme="light"] .bill-timeline {
  background: rgba(0, 0, 0, 0.01);
}

.bill-timeline[open] {
  border-color: rgba(var(--card-accent-rgb), 0.3);
}

.bill-timeline-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-primary);
  transition: background 0.15s ease;
}

.bill-timeline-summary:hover {
  background: rgba(var(--card-accent-rgb), 0.04);
}

.bill-timeline-summary::-webkit-details-marker {
  display: none;
}

.bill-timeline-summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease, border-color 0.2s ease;
  flex: 0 0 auto;
}

.bill-timeline[open] .bill-timeline-summary::after {
  transform: rotate(-135deg);
  border-color: var(--card-accent);
}

.bill-timeline-meta {
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.bill-timeline-body {
  padding: 0 0.75rem 0.75rem;
  animation: timelineExpand 0.25s ease;
}

@keyframes timelineExpand {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bill-timeline-loading,
.bill-timeline-error {
  padding: 0.5rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.bill-timeline-error {
  color: #ef4444;
}

.bill-timeline-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bill-timeline-item {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--stroke);
}

.bill-timeline-item:last-child {
  border-bottom: none;
}

.bill-timeline-date {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bill-timeline-action {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.bill-timeline-chamber {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.5rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0.8;
}

/* ========== SIMILAR BILLS PANEL ========== */
.similar-bills {
  margin-top: 0.5rem;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: transparent;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.similar-bills:hover {
  border-color: rgba(var(--accent-secondary-rgb), 0.25);
}

.similar-bills[open] {
  border-color: rgba(var(--accent-secondary-rgb), 0.3);
}

.similar-bills-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
}

.similar-bills-summary:hover {
  background: rgba(var(--accent-secondary-rgb), 0.04);
  color: var(--text-primary);
}

.similar-bills-summary::-webkit-details-marker {
  display: none;
}

.similar-bills-summary .similar-icon {
  width: 14px;
  height: 14px;
  color: var(--accent-secondary);
  flex-shrink: 0;
}

.similar-bills-summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.similar-bills[open] .similar-bills-summary::after {
  transform: rotate(-135deg);
  border-color: var(--accent-secondary);
}

.similar-bills-list {
  padding: 0 0.5rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.similar-bill-item {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  background: var(--bg-elevated);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease, transform 0.15s ease;
}

.similar-bill-item:hover {
  background: var(--bg-elevated-hover);
  transform: translateX(2px);
}

.similar-bill-state {
  font-weight: 700;
  font-size: 0.68rem;
  color: var(--accent-secondary);
  padding: 0.15rem 0.35rem;
  background: rgba(var(--accent-secondary-rgb), 0.1);
  border-radius: 4px;
}

.similar-bill-number {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.similar-bill-title {
  font-size: 0.72rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.similar-bill-match {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--success);
  padding: 0.1rem 0.35rem;
  background: rgba(var(--accent-primary-rgb), 0.1);
  border-radius: 4px;
}

@media (max-width: 480px) {
  .similar-bill-item {
    grid-template-columns: auto 1fr auto;
  }
  .similar-bill-number {
    display: none;
  }
}

@media (max-width: 420px) {
  .bill-progress-labels {
    display: none;
  }
  .bill-timeline-item {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .bill-timeline-date {
    white-space: normal;
  }
}

/* ========== ACTIONS ROW ========== */
.actions-row {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding-top: 0.875rem;
  margin-top: auto;
  border-top: 1px solid var(--stroke);
}

[data-theme="light"] .actions-row .meta-label {
  color: rgba(0, 0, 0, 0.45);
}

.actions-row .meta-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
}

/* ========== CHIPS - Action indicators ========== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  border-radius: 6px;
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--stroke);
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: rgba(var(--card-accent-rgb), 0.25);
  background: rgba(var(--card-accent-rgb), 0.06);
  color: var(--card-accent);
}

[data-theme="light"] .chip {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.02);
  color: rgba(0, 0, 0, 0.65);
}

[data-theme="light"] .chip:hover {
  background: rgba(var(--card-accent-rgb), 0.08);
  border-color: rgba(var(--card-accent-rgb), 0.2);
  color: var(--card-accent);
}

/* Hearing chip - Important action */
.chip.hearing {
  background: rgba(var(--accent-primary-rgb), 0.08);
  border-color: rgba(var(--accent-primary-rgb), 0.2);
  color: var(--accent-primary);
  font-weight: 600;
}

/* Urgent hearing - High visibility with subtle pulse */
.chip.hearing.urgent {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
  animation: urgentPulse 2.5s ease-in-out infinite;
}

@keyframes urgentPulse {
  0%, 100% { 
    background: rgba(239, 68, 68, 0.1);
  }
  50% { 
    background: rgba(239, 68, 68, 0.15);
  }
}

[data-theme="light"] .chip.hearing {
  background: rgba(var(--accent-primary-rgb), 0.08);
  color: var(--accent-primary);
}

[data-theme="light"] .chip.hearing.urgent {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}

/* Email chip */
.chip.email {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--text-secondary);
}

a.chip.email {
  text-decoration: none;
  transition: all 0.15s ease;
}

a.chip.email:hover {
  color: var(--card-accent);
  border-color: rgba(var(--card-accent-rgb), 0.3);
  background: rgba(var(--card-accent-rgb), 0.06);
}

a.chip.email:focus-visible {
  outline: 2px solid rgba(var(--card-accent-rgb), 0.4);
  outline-offset: 2px;
}

/* ========== EMPTY / LOADING STATES ========== */
.empty,
.empty-state-enhanced,
.loading-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 3rem 2rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px dashed var(--stroke);
}

.empty[hidden],
.empty-state-enhanced[hidden],
.loading-state[hidden] {
  display: none !important;
}

.empty-state-enhanced {
  background: transparent;
  border: none;
  padding: 0;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  max-width: 400px;
  margin: 0 auto;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  color: var(--text-muted);
  opacity: 0.6;
}

.empty-state-title {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.empty-state-message {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.empty-state-clear-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  font-size: inherit;
  padding: 0;
}

/* ========== LOAD MORE / INFINITE SCROLL ========== */
.load-more-container {
  display: flex;
  justify-content: center;
  padding: 2.5rem 0 1rem;
}

.load-more-container[hidden] {
  display: none !important;
}

.load-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.75rem;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.load-more-btn:hover:not(:disabled) {
  border-color: var(--accent-primary);
  background: rgba(var(--accent-primary-rgb), 0.08);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

.load-more-btn:active:not(:disabled) {
  transform: translateY(0);
}

.load-more-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.load-more-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

.load-more-icon {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.load-more-btn:hover:not(:disabled) .load-more-icon {
  transform: translateY(2px);
}

.load-more-btn.loading .load-more-icon {
  animation: spin 0.8s linear infinite;
}

.scroll-sentinel {
  height: 1px;
  margin-top: 2rem;
  pointer-events: none;
  visibility: hidden;
  }

[data-theme="light"] .load-more-btn {
  background: var(--bg-tertiary);
}

[data-theme="light"] .load-more-btn:hover:not(:disabled) {
  background: rgba(var(--accent-primary-rgb), 0.06);
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  border-style: solid;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--stroke);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Card entrance animation */
@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
  }

.card {
  animation: cardFadeIn 0.35s ease-out backwards;
  }

.card:nth-child(1) { animation-delay: 0ms; }
.card:nth-child(2) { animation-delay: 40ms; }
.card:nth-child(3) { animation-delay: 80ms; }
.card:nth-child(4) { animation-delay: 120ms; }
.card:nth-child(5) { animation-delay: 160ms; }
.card:nth-child(6) { animation-delay: 200ms; }
.card:nth-child(7) { animation-delay: 240ms; }
.card:nth-child(8) { animation-delay: 280ms; }
.card:nth-child(9) { animation-delay: 320ms; }
.card:nth-child(n+10) { animation-delay: 350ms; }

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .control-panel-body {
    grid-template-columns: 1fr 1fr;
  }

  .summary-stats {
    gap: 1rem;
  }
}

@media (max-width: 640px) {
  body {
    padding: 5rem 1rem 3rem;
  }

  .control-panel {
    padding: 1rem;
  }

  .control-panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .view-toggle {
    width: 100%;
    justify-content: stretch;
  }

  .view-chip {
    flex: 1;
    text-align: center;
  }

  .control-panel-body {
    grid-template-columns: 1fr;
  }

  .summary-stats {
    flex-direction: column;
    gap: 0.75rem;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .achievements-grid {
    grid-template-columns: 1fr;
  }
}

/* ============ LIGHT MODE OVERRIDES ============ */
[data-theme="light"] body {
  background: var(--bg-primary);
}

[data-theme="light"] body::before {
  background-image: 
    linear-gradient(rgba(var(--accent-primary-rgb), 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-primary-rgb), 0.015) 1px, transparent 1px);
}

[data-theme="light"] body::after {
  opacity: 0.4;
}

/* Light mode — no hero-specific overrides needed */

[data-theme="light"] .card {
  background: var(--bg-tertiary);
}

[data-theme="light"] .card:hover {
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .control-panel {
  background: var(--bg-secondary);
  border-color: var(--stroke);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .view-chip[aria-selected="true"] {
  background: var(--accent-primary);
  color: #ffffff;
}

[data-theme="light"] select,
[data-theme="light"] input[type="search"] {
  background: var(--bg-tertiary);
}

[data-theme="light"] .summary-stat-value {
  color: var(--accent-primary);
}


[data-theme="light"] .empty,
[data-theme="light"] .empty-state-enhanced {
  background: var(--bg-tertiary);
  border-color: var(--stroke);
}

[data-theme="light"] .empty-action-btn {
  background: var(--bg-tertiary);
  border-color: var(--stroke-strong);
}

[data-theme="light"] .empty-action-btn:hover {
  background: rgba(var(--accent-primary-rgb), 0.06);
  border-color: var(--accent-primary);
}

[data-theme="light"] .bookmark-toast {
  background: var(--bg-tertiary);
  border-color: var(--stroke-strong);
}

/*
 * Legacy compare modal styles retained for rollback reference.
 * Superseded by the bottom drawer compare experience in Phase 06 Plan 03.
 */

/* ============ BILL COMPARISON DRAWER ============ */
.compare-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 60vh;
  background: var(--bg-secondary);
  border-top: 2px solid var(--stroke);
  z-index: 900;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -10px 26px rgba(0, 0, 0, 0.18);
}

.compare-drawer.open {
  transform: translateY(0);
}

.compare-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--stroke);
}

.compare-drawer-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.compare-drawer-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.compare-drawer-count {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.compare-drawer-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.compare-drawer-body {
  padding: 1rem 1.5rem;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.compare-table th {
  text-align: left;
  padding: 0.5rem;
  font-weight: 600;
  border-bottom: 2px solid var(--stroke);
}

.compare-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--stroke);
  vertical-align: top;
}

.compare-attr-label {
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  width: 120px;
}

@media (prefers-reduced-motion: reduce) {
  .compare-drawer {
    transition-duration: 0ms;
  }
}


/* ========== KEYBOARD SHORTCUTS MODAL ========== */
.shortcuts-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
}

.shortcuts-modal.show {
  display: block;
}

.shortcuts-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.shortcuts-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-primary);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 1.5rem;
  min-width: 320px;
  max-width: 90vw;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.shortcuts-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--stroke);
}

.shortcuts-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.shortcuts-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
}

.shortcuts-modal-close:hover {
  color: var(--text-primary);
}

.shortcuts-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.shortcut-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
}

.shortcut-row kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 0.25rem 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--stroke);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: var(--text-secondary);
}

.shortcut-row span {
  font-size: 0.875rem;
  color: var(--text-secondary);
}
