:root {
  --ink: #111827;
  --muted: #5b6472;
  --paper: #f6f7f2;
  --surface: rgba(255, 255, 252, 0.92);
  --surface-soft: rgba(255, 255, 252, 0.72);
  --line: rgba(17, 24, 39, 0.13);
  --line-strong: rgba(17, 24, 39, 0.24);
  --blue: #254f7a;
  --green: #28684f;
  --amber: #93601d;
  --red: #97343a;
  --shadow: 0 20px 58px rgba(17, 24, 39, 0.08);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(37, 79, 122, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(40, 104, 79, 0.08), transparent 40%),
    var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.topbar,
.shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding-inline: clamp(18px, 4vw, 52px);
}

.topbar {
  padding-top: clamp(18px, 3vw, 34px);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: clamp(18px, 3vw, 30px);
}

.site-nav a,
.status-pill,
.source-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--blue);
  font-size: 0.84rem;
  font-weight: 750;
  text-decoration: none;
}

.site-nav a {
  padding: 0 10px;
}

.title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 860;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2.35rem, 5vw, 4.8rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.status-pill {
  padding: 0 11px;
}

button {
  min-height: 38px;
  border: 1px solid rgba(37, 79, 122, 0.34);
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.shell {
  display: grid;
  gap: 18px;
  padding-top: 20px;
  padding-bottom: 54px;
}

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

.metrics article,
.source-board,
.feed-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metrics article {
  min-width: 0;
  padding: 15px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) minmax(150px, 190px) auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 252, 0.72);
}

.controls label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 780;
}

.controls input[type="search"],
.controls select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.controls .toggle {
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

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

.section-head > * {
  min-width: 0;
}

.section-head > span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
  text-align: right;
}

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

.source-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.66);
}

.source-card[data-state="error"] {
  border-color: rgba(151, 52, 58, 0.32);
  background: rgba(151, 52, 58, 0.05);
}

.source-card header {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.source-card strong {
  overflow-wrap: anywhere;
}

.source-state {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(40, 104, 79, 0.1);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 850;
}

.source-card[data-state="error"] .source-state {
  background: rgba(151, 52, 58, 0.1);
  color: var(--red);
}

.source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.source-link {
  justify-content: center;
  min-height: 30px;
  padding: 0 8px;
}

.feed-list {
  display: grid;
}

.feed-card {
  display: grid;
  grid-template-columns: minmax(120px, 168px) minmax(0, 1fr) minmax(130px, 180px);
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.feed-card:last-child {
  border-bottom: 0;
}

.feed-card[data-signal="high"] {
  background: linear-gradient(90deg, rgba(40, 104, 79, 0.06), transparent 48%);
}

.feed-time {
  display: grid;
  gap: 5px;
  align-content: start;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 760;
}

.feed-time strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.feed-main {
  min-width: 0;
}

.feed-main h3 {
  margin-bottom: 7px;
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.35;
}

.feed-main a {
  color: var(--ink);
  text-decoration: none;
}

.feed-main a:hover {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.feed-summary {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.58;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 780;
  overflow-wrap: anywhere;
}

.feed-side {
  display: grid;
  gap: 8px;
  align-content: start;
  justify-items: end;
  min-width: 0;
}

.source-badge {
  border-radius: 6px;
  padding: 6px 8px;
  background: rgba(37, 79, 122, 0.1);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 850;
  text-align: right;
  overflow-wrap: anywhere;
}

.origin-name {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
  text-align: right;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 28px 16px;
  color: var(--muted);
  font-weight: 760;
}

@media (max-width: 1080px) {
  .metrics,
  .source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .feed-card {
    grid-template-columns: minmax(104px, 140px) minmax(0, 1fr);
  }

  .feed-side {
    grid-column: 2;
    justify-items: start;
  }
}

@media (max-width: 720px) {
  .title-row,
  .metrics,
  .controls,
  .source-grid,
  .feed-card {
    grid-template-columns: 1fr;
  }

  .actions,
  .feed-side,
  .section-head > span {
    justify-content: start;
    justify-items: start;
    text-align: left;
  }

  .feed-side {
    grid-column: auto;
  }
}
