/* Stats Dashboard */
.dashboard {
  margin-bottom: 1.25rem;
  background: linear-gradient(180deg, var(--surface-elevated) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.9rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (min-width: 700px) {
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.kpi-card {
  background: rgba(15, 16, 20, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  min-width: 0;
}

.kpi-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.kpi-value {
  font-family: var(--font-story);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.kpi-value.accent {
  color: var(--accent);
}

.dashboard-bar {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.latest-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.4rem 0.75rem;
  border-radius: 9px;
  background: var(--accent-soft);
  border: 1px solid rgba(224, 159, 90, 0.35);
  color: var(--accent);
  font-size: 0.84rem;
  max-width: 100%;
  min-width: 0;
}

.latest-pill-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-toggle-btn {
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.84rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.stats-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.stats-panel {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.stats-panel.hidden {
  display: none;
}

@media (min-width: 820px) {
  .stats-panel {
    grid-template-columns: 1.4fr 1fr 1fr;
  }
}

.stats-card {
  background: rgba(15, 16, 20, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem;
  min-width: 0;
}

.stats-card-title {
  margin: 0 0 0.6rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent);
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.bar-row.dimmed {
  opacity: 0.45;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text);
}

.bar-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, #f0bd7f 100%);
}

/* Controls & Filters */
.controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.search-box {
  width: 100%;
  max-width: 440px;
  min-height: 44px;
  padding: 0.6rem 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  outline: none;
}

.search-box:focus {
  border-color: var(--accent);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.filter-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: 0.2rem;
}

.filter-chip {
  min-height: 44px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 0.84rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.filter-chip:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.filter-chip.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* Story Grid: 2 columns cleanly on 360px mobile, expanding on desktop */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
    gap: 1.15rem;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, border-color 0.15s;
  position: relative;
  min-width: 0;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.cover-wrap {
  aspect-ratio: 3 / 4;
  background: #13151b;
  position: relative;
  overflow: hidden;
}

.cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem;
  text-align: center;
  font-family: var(--font-story);
  font-size: 1rem;
  color: var(--text-muted);
  background: linear-gradient(160deg, #1b1e28 0%, #101218 100%);
}

.card-body {
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
  min-width: 0;
}

.card-title {
  font-family: var(--font-story);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
  word-break: break-word;
}

.card-body .chips {
  margin-top: auto;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}
