:root {
  color-scheme: light;
  --accent: #0877e8;
  --accent-soft: #eaf4ff;
  --ink: #17191d;
  --muted: #6d7480;
  --line: #e5e8ec;
  --surface: #ffffff;
  --page: #f5f6f8;
  --ok: #21a366;
  --warn: #d97706;
  --danger: #d63838;
  --shadow: 0 14px 36px rgba(16, 24, 40, 0.06);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

.dashboard {
  width: min(1400px, calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.page-head,
.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 3vw, 42px);
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.page-description {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.status-pill,
.run-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  min-width: 108px;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-pill i,
.run-status i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #9ca3af;
}

.status-pill[data-status="healthy"] i,
.source-row[data-status="success"] .run-status i {
  background: var(--ok);
}

.status-pill[data-status="running"] i,
.source-row[data-status="running"] .run-status i {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(8, 119, 232, 0.12);
}

.status-pill[data-status="attention"] i,
.source-row[data-status="partial"] .run-status i {
  background: var(--warn);
}

.source-row[data-status="failed"] .run-status i,
.source-row[data-status="interrupted"] .run-status i {
  background: var(--danger);
}

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

.metric-card {
  min-height: 132px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.metric-card.primary {
  border-color: #c9e1fb;
  background: linear-gradient(145deg, #f8fbff, var(--accent-soft));
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

.metric-card span {
  font-size: 13px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin: 13px 0 8px;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.05em;
}

.metric-card small {
  font-size: 12px;
}

.source-panel,
.article-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.source-panel {
  padding: 24px 28px 12px;
}

.article-panel {
  padding: 24px 28px 26px;
}

.panel-head {
  align-items: center;
  padding-bottom: 20px;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-head p strong {
  color: var(--ink);
}

.source-count {
  padding: 7px 10px;
  border-radius: 8px;
  background: #f2f4f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.source-table {
  border-top: 1px solid var(--line);
}

.table-row {
  display: grid;
  grid-template-columns:
    minmax(230px, 1.5fr) minmax(150px, 1fr) 0.7fr 0.45fr 0.45fr
    minmax(142px, 0.8fr);
  align-items: center;
  gap: 16px;
}

.table-header {
  min-height: 42px;
  color: #8a9099;
  font-size: 11px;
  font-weight: 700;
}

.source-row {
  min-height: 76px;
  border-top: 1px solid var(--line);
}

.source-name {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.source-mark {
  width: 4px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
}

.source-name a,
.source-domain {
  display: block;
}

.source-name a {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-name a:hover {
  color: var(--accent);
}

.source-domain,
.source-mode {
  color: var(--muted);
  font-size: 11px;
}

.source-domain {
  margin-top: 4px;
}

.run-status {
  color: var(--muted);
  font-size: 12px;
}

.run-status b {
  font-weight: 700;
}

.count {
  font-size: 19px;
  letter-spacing: -0.03em;
}

.limit-editor {
  display: flex;
  gap: 7px;
}

.limit-editor input {
  width: 58px;
  padding: 7px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
}

.limit-editor button,
.secondary-button,
.pagination button {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.limit-editor button:hover,
.secondary-button:hover,
.pagination button:hover:not(:disabled) {
  border-color: #b7d7f8;
  background: var(--accent-soft);
  color: var(--accent);
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.article-panel-head {
  border-bottom: 1px solid var(--line);
}

.article-controls {
  display: flex;
  align-items: center;
  gap: 9px;
}

.article-controls label {
  color: var(--muted);
  font-size: 12px;
}

.article-controls select {
  min-width: 160px;
  padding: 8px 30px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
}

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

.article-card {
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.article-card:nth-child(odd) {
  padding-right: 18px;
  border-right: 1px solid var(--line);
}

.article-card:nth-child(even) {
  padding-left: 18px;
}

.article-open {
  display: grid;
  width: 100%;
  grid-template-columns: 154px minmax(0, 1fr);
  gap: 16px;
  padding: 20px 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.article-open:hover .article-title {
  color: var(--accent);
}

.article-image {
  display: flex;
  width: 154px;
  height: 104px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px;
  background: #eef1f4;
}

.article-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-image.image-missing {
  color: #a1a8b1;
  font-size: 12px;
}

.article-copy {
  min-width: 0;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  color: #8a9099;
  font-size: 11px;
  white-space: nowrap;
}

.article-category {
  color: var(--accent);
}

.article-title,
.article-excerpt {
  display: block;
}

.article-title {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.article-excerpt {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding-top: 22px;
}

.pagination span {
  color: var(--muted);
  font-size: 12px;
}

.empty-state,
.list-loading {
  grid-column: 1 / -1;
  padding: 36px;
  color: var(--muted);
  text-align: center;
}

.article-dialog {
  width: min(980px, calc(100% - 32px));
  max-width: none;
  height: min(880px, calc(100% - 40px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
}

.article-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(2px);
}

.dialog-shell {
  position: relative;
  height: 100%;
  overflow: auto;
  padding: 44px 56px 54px;
}

.dialog-close {
  position: sticky;
  z-index: 2;
  top: 0;
  float: right;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
}

.dialog-loading {
  padding: 100px 0;
  color: var(--muted);
  text-align: center;
}

.dialog-kicker {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.dialog-content h2 {
  max-width: 820px;
  margin: 0 0 14px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.dialog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  color: var(--muted);
  font-size: 12px;
}

.dialog-excerpt {
  margin: 24px 0 0;
  color: #59616c;
  font-size: 16px;
  line-height: 1.75;
}

.dialog-cover {
  width: 100%;
  max-height: 520px;
  margin-top: 28px;
  border-radius: 14px;
  object-fit: cover;
}

.detail-body {
  width: 100%;
  min-height: 540px;
  margin-top: 30px;
  border: 0;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 22px;
  bottom: 22px;
  padding: 11px 15px;
  border-radius: 9px;
  background: #111827;
  color: white;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast[data-status="error"] {
  background: var(--danger);
}

.hidden {
  display: none !important;
}

@media (max-width: 1050px) {
  .table-row {
    grid-template-columns: minmax(220px, 1.6fr) 1fr 0.7fr 0.45fr 0.45fr;
  }

  .table-row > :last-child {
    grid-column: 2 / -1;
    padding-bottom: 12px;
  }

  .table-header > :last-child {
    display: none;
  }

  .article-open {
    grid-template-columns: 124px minmax(0, 1fr);
  }

  .article-image {
    width: 124px;
    height: 94px;
  }
}

@media (max-width: 760px) {
  .dashboard {
    width: min(100% - 28px, 720px);
    padding-top: 24px;
  }

  .page-head,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .table-header {
    display: none;
  }

  .source-panel,
  .article-panel {
    padding-inline: 18px;
  }

  .source-row {
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    padding-block: 14px;
  }

  .source-name,
  .source-mode {
    grid-column: 1 / -1;
  }

  .source-row > :last-child {
    grid-column: 1 / -1;
    padding-bottom: 0;
  }

  .article-card,
  .article-card:nth-child(odd),
  .article-card:nth-child(even) {
    padding-inline: 0;
    border-right: 0;
  }

  .article-list {
    grid-template-columns: 1fr;
  }

  .dialog-shell {
    padding: 34px 24px 42px;
  }
}

@media (max-width: 520px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 112px;
  }

  .article-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .article-controls select {
    flex: 1;
  }

  .article-open {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 12px;
  }

  .article-image {
    width: 104px;
    height: 88px;
  }
}
