/* ── Components ── */
/* Shared reusable components: cards, badges, pills, toggles, avatars */

/* Pills */
.pill {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 500;
  background: var(--forest-pale);
  color: var(--forest);
  border-radius: 20px;
  padding: 0.18rem 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.pill-x {
  cursor: pointer;
  font-weight: 700;
  opacity: 0.6;
  font-size: 0.78rem;
  line-height: 1;
}
.pill-x:hover { opacity: 1; }

/* Badges */
.badge {
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  display: inline-block;
}
.badge-proposed { background: var(--amber-lt); color: var(--amber); }
.badge-approved { background: var(--teal-lt); color: var(--teal); }
.badge-funded { background: #F0D4B8; color: var(--amber-dk); }
.badge-implemented { background: var(--forest-pale); color: var(--forest); }
.badge-cat { background: var(--bg-alt); color: var(--text-mid); }
.badge-theme { background: var(--teal-lt); color: var(--teal); }

/* Entity tags */
.ent {
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 500;
  background: var(--teal-lt);
  color: var(--teal);
  padding: 0.1rem 0.45rem;
  border-radius: 20px;
  display: inline-block;
}

/* Stat cards */
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.stat-card-n {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--forest);
  line-height: 1;
}
.stat-card-l {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.1rem;
}

/* Avatar */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  color: white;
  flex-shrink: 0;
}

/* Star toggle (include in narrative) */
.star-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--border-dk);
  transition: all 0.15s;
  padding: 0.2rem;
  line-height: 1;
}
.star-toggle:hover {
  color: var(--amber);
  transform: scale(1.15);
}
.star-toggle.active {
  color: var(--amber);
}

/* Filter components */
.filter-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245,244,240,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 1.5rem;
}
.filter-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.filter-label {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-soft);
  margin-right: 0.2rem;
}
.f-btn {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.28rem 0.7rem;
  cursor: pointer;
  color: var(--text-mid);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s;
  white-space: nowrap;
}
.f-btn:hover { border-color: var(--forest); }
.f-btn.active { background: var(--forest); color: white; border-color: var(--forest); }
.f-btn .ct {
  font-size: 0.58rem;
  background: rgba(255,255,255,0.25);
  padding: 0.05rem 0.3rem;
  border-radius: 8px;
  font-weight: 700;
}
.f-drop {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 300;
  padding: 0.3rem 0;
  max-height: 280px;
  overflow-y: auto;
}
.f-drop.open { display: block; }
.f-opt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.32rem 0.7rem;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text);
  transition: background 0.1s;
}
.f-opt:hover { background: var(--bg); }
.f-opt input { accent-color: var(--forest); width: 14px; height: 14px; }
.filter-group { position: relative; }
.active-pills { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.clear-all {
  font-family: var(--font-display);
  font-size: 0.62rem;
  color: var(--amber);
  cursor: pointer;
  font-weight: 600;
  background: none;
  border: none;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-soft);
}
.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.3;
}
.empty-state-text {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 500;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-soft);
  font-family: var(--font-display);
  font-size: 0.8rem;
}
.loading::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--forest);
  border-radius: 50%;
  margin-left: 0.5rem;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
