:root {
  --ink: #141922;
  --muted: #5f6975;
  --paper: #f5f4ef;
  --surface: rgba(255, 255, 250, 0.84);
  --surface-strong: rgba(255, 255, 250, 0.96);
  --line: rgba(20, 25, 34, 0.14);
  --green: #2d6a4f;
  --blue: #294c7a;
  --amber: #936216;
  --red: #8f2d32;
  --shadow: 0 22px 60px rgba(20, 25, 34, 0.08);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(150deg, rgba(41, 76, 122, 0.09), transparent 32%),
    linear-gradient(28deg, rgba(147, 98, 22, 0.08), transparent 38%),
    linear-gradient(180deg, #fbfaf6 0%, var(--paper) 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

a {
  color: inherit;
}

.tax-shell {
  display: grid;
  gap: clamp(18px, 3vw, 30px);
  width: min(1440px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 50px) clamp(16px, 4vw, 46px) clamp(48px, 8vw, 86px);
}

.tax-header {
  padding-bottom: clamp(20px, 4vw, 34px);
  border-bottom: 1px solid var(--line);
}

.tax-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: clamp(22px, 4vw, 38px);
}

.tax-nav a,
.action-row a,
.action-row button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: rgba(255, 255, 250, 0.72);
  color: var(--blue);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 760;
  text-decoration: none;
}

.action-row button {
  background: var(--ink);
  color: #fffdfa;
  cursor: pointer;
}

.action-row button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
}

.kicker,
.panel-kicker {
  margin: 0;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 780;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 14px;
  font-size: clamp(2.6rem, 6vw, 5.4rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-top: 6px;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.08;
}

.sync-panel {
  display: grid;
  gap: 6px;
  min-width: min(280px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.sync-panel span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 720;
}

.sync-panel strong {
  color: var(--green);
  font-size: 1.65rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat-grid article {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: var(--surface);
}

.stat-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.stat-grid strong {
  display: block;
  margin-top: 14px;
  color: var(--blue);
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(130px, 180px)) auto auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.search-box,
.select-box {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.search-box span,
.select-box span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 780;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 11px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font: inherit;
}

.toggle-box {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 11px;
  background: rgba(41, 76, 122, 0.06);
  color: var(--blue);
  font-size: 0.84rem;
  font-weight: 760;
  white-space: nowrap;
}

.toggle-box input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--green);
}

.action-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.codex-summary {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(14px, 2.2vw, 20px);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.summary-top,
.aspect-head,
.content-map-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.summary-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  justify-content: flex-end;
}

.summary-controls span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 760;
}

.summary-controls button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--ink);
  color: #fffdfa;
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 760;
}

.summary-controls button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.summary-headline {
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 680;
  line-height: 1.6;
}

.content-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.content-map-card,
.aspect-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.content-map-card {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.content-map-card strong {
  font-size: 0.96rem;
}

.content-map-card p,
.representative-row span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.compact-list,
.summary-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.62;
}

.compact-list {
  font-size: 0.78rem;
}

.aspect-list {
  display: grid;
  gap: 12px;
}

.aspect-card {
  display: grid;
  gap: 14px;
  padding: clamp(14px, 2vw, 18px);
  border-left: 5px solid var(--green);
}

.aspect-head {
  align-items: start;
}

.aspect-head h3 {
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  line-height: 1.15;
}

.aspect-summary {
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.68;
}

.aspect-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.aspect-detail,
.aspect-representatives {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.aspect-detail h4,
.aspect-representatives h4 {
  margin: 0;
  color: var(--green);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.representative-items {
  display: grid;
  gap: 8px;
}

.representative-row {
  display: grid;
  gap: 3px;
  border-top: 1px solid rgba(20, 25, 34, 0.08);
  padding-top: 8px;
}

.representative-link {
  color: var(--blue);
  font-size: 0.9rem;
  font-weight: 760;
  line-height: 1.35;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.feed-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: clamp(14px, 2.6vw, 24px);
  align-items: start;
}

.feed-column,
.source-column {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.source-column {
  position: sticky;
  top: 16px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

#visible-count {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
}

.feed-list,
.source-list {
  display: grid;
  gap: 10px;
}

.feed-item,
.source-row,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.feed-item {
  display: grid;
  gap: 11px;
  padding: clamp(14px, 2vw, 18px);
}

.feed-item[data-reliability="A"] {
  border-left: 5px solid var(--green);
}

.feed-item[data-reliability="B"],
.feed-item[data-reliability="C"] {
  border-left: 5px solid var(--blue);
}

.feed-item[data-reliability="D"],
.feed-item[data-reliability="E"] {
  border-left: 5px solid var(--amber);
}

.feed-meta,
.feed-tags,
.source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid rgba(20, 25, 34, 0.1);
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 760;
}

.pill-strong {
  color: var(--green);
  background: rgba(45, 106, 79, 0.09);
}

.pill-error {
  color: var(--red);
  background: rgba(143, 45, 50, 0.08);
}

.feed-title {
  color: var(--ink);
  font-size: clamp(1.04rem, 1.7vw, 1.28rem);
  font-weight: 780;
  line-height: 1.32;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.feed-title:hover,
.feed-title:focus-visible {
  color: var(--blue);
}

.feed-summary {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.62;
  overflow-wrap: anywhere;
}

.source-row {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.source-row strong {
  font-size: 0.92rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.source-row p {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 22px;
  color: var(--muted);
  font-weight: 720;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1100px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(130px, 1fr) minmax(130px, 1fr);
  }

  .content-map,
  .aspect-detail-grid {
    grid-template-columns: 1fr;
  }

  .toggle-box,
  .action-row {
    grid-column: span 1;
  }
}

@media (max-width: 860px) {
  .title-row,
  .feed-layout,
  .summary-top,
  .aspect-head {
    grid-template-columns: 1fr;
  }

  .summary-top,
  .aspect-head {
    display: grid;
  }

  .summary-controls {
    justify-content: flex-start;
  }

  .source-column {
    position: static;
  }

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

@media (max-width: 640px) {
  .tax-shell {
    padding-inline: 14px;
  }

  .toolbar,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .action-row {
    justify-content: stretch;
  }

  .action-row a,
  .action-row button {
    flex: 1;
  }
}
