:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-alt: #eef2f8;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #dbe3ef;
  --accent: #1d4ed8;
  --accent-soft: #e0ebff;
  --federal: #1d4ed8;
  --federal-bg: #e0ebff;
  --estadual: #0f766e;
  --estadual-bg: #ccfbf1;
  --municipal: #b45309;
  --municipal-bg: #fef3c7;
  --shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
  --radius: 12px;
}

:root[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-alt: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #263449;
  --accent: #60a5fa;
  --accent-soft: #172554;
  --federal: #60a5fa;
  --federal-bg: rgba(59, 130, 246, 0.18);
  --estadual: #2dd4bf;
  --estadual-bg: rgba(20, 184, 166, 0.18);
  --municipal: #fbbf24;
  --municipal-bg: rgba(245, 158, 11, 0.18);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 18px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.is-hidden {
  display: none !important;
}

/* Masthead */
.masthead {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  color: #f8fafc;
  padding: 24px 0 20px;
  border-bottom: 3px solid #3b82f6;
}

.masthead-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.brand-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #93c5fd;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25);
}

.brand-title {
  margin: 6px 0 4px;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.98rem;
  max-width: 640px;
}

.masthead-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.edition-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.85rem;
}

.meta-label {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: #93c5fd;
}

.meta-sub {
  color: #cbd5e1;
  font-size: 0.76rem;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.2);
}

.stats-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.stat-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.84rem;
}

.stat-num {
  font-weight: 700;
  font-size: 1rem;
}

/* Sticky filter bar */
.filter-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.filter-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sphere-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sphere-tab {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.sphere-tab.is-active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.search-controls {
  display: flex;
  gap: 8px;
  flex: 1 1 320px;
  max-width: 520px;
}

.search-input,
.date-select {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.88rem;
}

.search-input {
  flex: 1 1 auto;
  min-width: 160px;
}

.tag-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.tag-chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
}

.tag-chip.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* Main content */
.main-content {
  padding: 24px 18px 48px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.section-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.section-note {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.highlights-section {
  margin-bottom: 30px;
}

.highlights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.highlight-card,
.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top-width: 4px;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sphere-border-federal {
  border-top-color: var(--federal);
}

.sphere-border-estadual {
  border-top-color: var(--estadual);
}

.sphere-border-municipal {
  border-top-color: var(--municipal);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-federal {
  background: var(--federal-bg);
  color: var(--federal);
}

.badge-estadual {
  background: var(--estadual-bg);
  color: var(--estadual);
}

.badge-municipal {
  background: var(--municipal-bg);
  color: var(--municipal);
}

.inst-pill {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.edition-tag {
  margin-left: auto;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.highlight-title,
.card-title {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.35;
}

.highlight-title a,
.card-title a {
  color: var(--text);
  text-decoration: none;
}

.highlight-title a:hover,
.card-title a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.card-summary {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text);
}

.why-box {
  margin: 0;
  background: var(--surface-alt);
  border-left: 3px solid var(--accent);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.why-box strong {
  color: var(--text);
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-tag {
  font-size: 0.74rem;
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
}

.card-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.75rem;
  cursor: pointer;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.read-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.read-link:hover {
  text-decoration: underline;
}

.empty-state,
.empty-filter-state {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 18px 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: 14px;
}

.footer-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

@media (max-width: 680px) {
  .masthead-actions,
  .edition-meta {
    align-items: flex-start;
  }
}
