:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e3e6ea;
  --text: #1a1d21;
  --muted: #6b7380;
  --accent: #1f6feb;
  --accent-dark: #1859c1;
  --shortlist: #1a7f37;
  --maybe: #b58105;
  --skip: #7a7f87;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand h1 { margin: 0; font-size: 18px; }
.brand .sub { color: var(--muted); font-size: 12px; margin-left: 8px; }
.actions .btn { margin-left: 8px; }

.btn {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.btn:hover { background: #f0f2f5; }
.btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.tabs {
  display: flex;
  gap: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.tab {
  background: transparent;
  border: none;
  padding: 12px 18px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

main { padding: 0; }
.view { display: none; }
.view.active { display: flex; gap: 0; }
#view-shortlist.active, #view-truth.active, #view-top.active { display: block; padding: 24px; }

.filters {
  width: 220px;
  padding: 20px 18px;
  border-right: 1px solid var(--border);
  background: var(--panel);
  min-height: calc(100vh - 110px);
}
.filter-block { margin-bottom: 22px; }
.filter-block h3 {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.filter-block label { display: block; padding: 4px 0; font-size: 13px; cursor: pointer; }
.filter-block select { width: 100%; padding: 6px; border: 1px solid var(--border); border-radius: 4px; }
.filter-block input[type=search] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
}
.counts { font-size: 12px; color: var(--muted); padding-top: 12px; border-top: 1px solid var(--border); }

.content {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
}

.region-group { margin-bottom: 28px; }
.region-group h2 {
  margin: 0 0 10px;
  font-size: 15px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.story {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.story.shortlist { border-left: 3px solid var(--shortlist); }
.story.maybe { border-left: 3px solid var(--maybe); }
.story.skip { opacity: 0.55; }

.story .headline {
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 4px;
  line-height: 1.35;
}
.story .headline a { color: var(--text); text-decoration: none; }
.story .headline a:hover { color: var(--accent); }
.story .meta { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.story .meta .badge {
  display: inline-block;
  padding: 1px 6px;
  background: #eef1f5;
  border-radius: 3px;
  margin-right: 6px;
}
.paywall-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.paywall-badge.hard { background: #d73a3a; color: white; }
.paywall-badge.soft { background: #d99a1c; color: white; }
.paywall-badge.free { background: #1a7f37; color: white; }
.tier-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.tier-badge.pop { background: #b04a13; color: white; }
.tier-badge.popular { background: #777; color: white; }
.story .summary {
  color: #444;
  font-size: 13px;
  line-height: 1.5;
}
.story .actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
}
.story .actions .btn {
  padding: 4px 10px;
  font-size: 11px;
  min-width: 80px;
}
.btn.short.active { background: var(--shortlist); color: white; border-color: var(--shortlist); }
.btn.maybe.active { background: var(--maybe); color: white; border-color: var(--maybe); }
.btn.skip.active { background: var(--skip); color: white; border-color: var(--skip); }

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 18px;
  gap: 16px;
  flex-wrap: wrap;
}
.top-header h2 { margin: 0; font-size: 18px; }
.top-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.top-controls label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.top-controls select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 4px; }

.cluster {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
}
.cluster.shortlist { border-left: 3px solid var(--shortlist); }
.cluster.maybe { border-left: 3px solid var(--maybe); }
.cluster.skip { opacity: 0.55; }
.cluster .coverage {
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  text-align: center;
  min-width: 36px;
  white-space: nowrap;
}
.cluster .coverage.high { background: #b04a13; }
.cluster .coverage.med { background: var(--accent-dark); }
.cluster .headline { font-weight: 600; font-size: 14px; margin: 0 0 4px; line-height: 1.35; }
.cluster .headline a { color: var(--text); text-decoration: none; }
.cluster .headline a:hover { color: var(--accent); }
.cluster .meta { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.cluster .summary { color: #444; font-size: 13px; line-height: 1.5; margin-bottom: 6px; }
.cluster .source-list {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}
.cluster .actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
}
.cluster .actions .btn { padding: 4px 10px; font-size: 11px; min-width: 80px; }

.rank-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.rank-card .rank-stamp { font-size: 11px; color: var(--muted); margin-bottom: 12px; }
.rank-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 10px;
  align-items: start;
}
.rank-item:last-child { border-bottom: none; }
.rank-item .rank-num { font-weight: 600; color: var(--muted); font-size: 14px; }
.rank-item .rank-headline { font-weight: 600; font-size: 14px; line-height: 1.35; }
.rank-item .rank-headline a { color: var(--text); text-decoration: none; }
.rank-item .rank-headline a:hover { color: var(--accent); }
.rank-item .rank-why {
  font-size: 12.5px;
  color: #444;
  margin-top: 4px;
  line-height: 1.5;
}
.rank-item .rank-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.rank-item .rank-actions { display: flex; flex-direction: column; gap: 4px; }
.rank-item .rank-actions .btn { padding: 3px 8px; font-size: 11px; min-width: 80px; }

.shortlist-header, .truth-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.shortlist-header h2, .truth-header h2 { margin: 0; font-size: 18px; }
.shortlist-header label { margin-right: 10px; font-size: 13px; }
.shortlist-header input[type=date] { padding: 5px; border: 1px solid var(--border); border-radius: 4px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 18px;
  margin-bottom: 12px;
}
.summary-card { white-space: pre-wrap; line-height: 1.55; font-size: 13.5px; }
.summary-card .stamp { color: var(--muted); font-size: 11px; margin-bottom: 10px; }

.posts-heading {
  margin: 24px 0 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.truth-post {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 6px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.truth-post.shortlist { border-left: 3px solid var(--shortlist); }
.truth-post.maybe { border-left: 3px solid var(--maybe); }
.truth-post.skip { opacity: 0.55; }
.truth-post .when { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.truth-post .when a { color: var(--accent); text-decoration: none; margin-left: 6px; }
.truth-post .when a:hover { text-decoration: underline; }
.truth-post .body { font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.truth-post .actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
}
.truth-post .actions .btn {
  padding: 4px 10px;
  font-size: 11px;
  min-width: 80px;
}

.empty { color: var(--muted); padding: 24px 0; font-style: italic; text-align: center; }
.hidden { display: none !important; }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1a1d21;
  color: white;
  padding: 10px 16px;
  border-radius: 5px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
}
