:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #68716d;
  --line: #dfe4df;
  --paper: #f5f6f2;
  --panel: #ffffff;
  --nav: #15221f;
  --nav-soft: #21312d;
  --accent: #d7ff4f;
  --accent-strong: #a9d800;
  --orange: #ff7a4d;
  --blue: #5377ff;
  --shadow: 0 10px 30px rgba(21, 34, 31, .06);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-size: 16px; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 30px 20px 24px; background: var(--nav); color: #f6f8f3; display: flex; flex-direction: column; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; margin: 0 8px 42px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; background: var(--accent); color: var(--nav); border-radius: 12px 12px 3px 12px; font-weight: 900; font-size: 1.35rem; }
.brand strong { display: block; letter-spacing: .17em; font-size: 1.05rem; }
.brand small { display: block; margin-top: 3px; color: #8fa09b; font-size: .66rem; letter-spacing: .08em; }
nav { display: grid; gap: 7px; }
.nav-item { display: flex; align-items: center; gap: 13px; min-height: 48px; padding: 0 14px; border-radius: 11px; color: #9fafaa; text-decoration: none; font-size: .92rem; font-weight: 650; transition: .18s ease; }
.nav-item:hover { color: white; background: rgba(255,255,255,.05); }
.nav-item.active { color: var(--nav); background: var(--accent); }
.nav-icon { width: 20px; text-align: center; font-size: 1.05rem; }
.sidebar-status { margin-top: auto; padding: 16px; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; background: var(--nav-soft); }
.eyebrow { color: #84908c; font-size: .7rem; letter-spacing: .13em; font-weight: 800; }
.status-line { display: flex; align-items: center; gap: 9px; margin: 10px 0 5px; font-size: .9rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #7c8985; box-shadow: 0 0 0 4px rgba(124,137,133,.14); }
.status-dot.healthy { background: var(--accent); box-shadow: 0 0 0 4px rgba(215,255,79,.12); }
.status-dot.stale { background: var(--orange); box-shadow: 0 0 0 4px rgba(255,122,77,.12); }
.sidebar-status small { color: #93a19d; line-height: 1.5; }
.sidebar-footer { margin: 18px 4px 0; color: #5f726c; font-size: .64rem; letter-spacing: .11em; }

main { min-width: 0; }
.topbar { height: 96px; padding: 0 clamp(24px, 4vw, 62px); border-bottom: 1px solid var(--line); background: rgba(245,246,242,.9); backdrop-filter: blur(12px); display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 8; }
.topbar h1 { margin: 5px 0 0; font-size: clamp(1.35rem, 2vw, 1.75rem); letter-spacing: -.035em; }
.breadcrumb { margin: 0; color: #89918e; font-size: .67rem; font-weight: 800; letter-spacing: .12em; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.live-pill { display: flex; align-items: center; gap: 7px; color: #56615d; font-size: .67rem; font-weight: 800; letter-spacing: .08em; }
.live-pill span { width: 7px; height: 7px; border-radius: 50%; background: #8db500; animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(141,181,0,.12); } }
.refresh-button, .clear-button { min-height: 40px; padding: 0 16px; border: 1px solid #cad1cc; border-radius: 9px; background: white; color: var(--ink); font-weight: 700; cursor: pointer; }
.refresh-button:hover, .clear-button:hover { border-color: var(--ink); }
.menu-button { display: none; border: 0; background: none; font-size: 1.3rem; }

.content { padding: 38px clamp(24px, 4vw, 62px) 72px; max-width: 1680px; margin: 0 auto; }
.page-section { display: none; }
.page-section.active-section { display: block; animation: appear .22s ease; }
@keyframes appear { from { opacity: .5; transform: translateY(4px); } }
.intro-row { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 26px; }
.intro-row p { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.7; }
.timestamp { flex: none; color: #8a928f; font-size: .76rem; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.metric-card { min-height: 150px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; width: 74px; height: 74px; border-radius: 50%; right: -34px; top: -34px; background: var(--card-accent, var(--accent)); opacity: .55; }
.metric-label { color: #6f7874; font-size: .78rem; font-weight: 700; }
.metric-value { display: block; margin: 15px 0 9px; font-size: clamp(1.8rem, 3vw, 2.55rem); line-height: 1; letter-spacing: -.055em; }
.metric-note { color: #8b9490; font-size: .73rem; }
.skeleton { background: linear-gradient(100deg,#fff 20%,#f0f2ee 40%,#fff 60%); background-size: 200% 100%; animation: shine 1.4s infinite; }
@keyframes shine { to { background-position: -200% 0; } }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr); gap: 14px; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.panel-heading { min-height: 77px; padding: 18px 22px; border-bottom: 1px solid #e9ede9; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 1.08rem; letter-spacing: -.02em; }
.panel-heading > h2 { margin: 0; }
.chart-total { text-align: right; }
.chart-total strong { display: block; font-size: 1.25rem; }
.chart-total small { color: var(--muted); font-size: .7rem; }
.trend-chart { min-height: 280px; padding: 20px 20px 8px; }
.trend-chart svg { width: 100%; height: 260px; overflow: visible; }
.grid-line { stroke: #edf0ed; stroke-width: 1; }
.area-fill { fill: url(#areaGradient); }
.trend-line { fill: none; stroke: #17211f; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.trend-dot { fill: var(--accent-strong); stroke: #fff; stroke-width: 2; }
.axis-label { fill: #8c9491; font-size: 10px; }
.topic-chart { padding: 24px 22px; display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 26px; min-height: 270px; }
.donut { width: 148px; height: 148px; border-radius: 50%; position: relative; }
.donut::after { content: ""; position: absolute; inset: 27px; border-radius: 50%; background: white; }
.donut-total { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; z-index: 1; font-weight: 850; font-size: 1.25rem; }
.donut-total small { display: block; color: var(--muted); font-size: .66rem; font-weight: 600; }
.legend { display: grid; gap: 14px; }
.legend-item { display: grid; grid-template-columns: 9px minmax(0,1fr) auto; align-items: center; gap: 9px; font-size: .8rem; }
.legend-item i { width: 8px; height: 8px; border-radius: 2px; }
.legend-item strong { font-size: .78rem; }
.text-button { border: 0; background: none; color: #53605b; font-size: .78rem; font-weight: 750; cursor: pointer; }
.text-button:hover { color: #000; text-decoration: underline; }
.compact-news-list, .run-list { min-height: 300px; }
.compact-news { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; padding: 16px 22px; border-bottom: 1px solid #edf0ed; text-decoration: none; }
.compact-news:last-child { border-bottom: 0; }
.compact-news:hover { background: #fafbf8; }
.compact-news h3 { margin: 0 0 7px; font-size: .9rem; line-height: 1.45; font-weight: 720; }
.news-meta { color: #7f8985; font-size: .7rem; display: flex; flex-wrap: wrap; gap: 8px; }
.topic-tag { display: inline-flex; padding: 3px 7px; border-radius: 4px; background: #edf3d8; color: #53620f; font-size: .63rem; font-weight: 800; text-transform: uppercase; }
.compact-time { color: #929a97; font-size: .68rem; white-space: nowrap; }
.run-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid #edf0ed; }
.run-item:last-child { border: 0; }
.run-state { width: 9px; height: 9px; border-radius: 50%; background: #a9b0ad; }
.run-state.success { background: #9fc500; }
.run-state.partial, .run-state.failed, .run-state.interrupted { background: var(--orange); }
.run-item strong { display: block; font-size: .78rem; }
.run-item small { color: var(--muted); font-size: .68rem; }
.run-count { text-align: right; color: #5f6965; font-size: .72rem; }

.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 22px; }
.section-heading h2 { margin: 6px 0 0; font-size: 1.7rem; letter-spacing: -.04em; }
.section-heading p { margin: 0; color: var(--muted); font-size: .82rem; }
.filter-panel { display: grid; grid-template-columns: minmax(240px, 2fr) repeat(4, minmax(130px, 1fr)) auto; gap: 10px; padding: 16px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow); }
.filter-panel label { min-width: 0; }
.filter-panel label > span { display: block; margin: 0 0 6px 2px; color: #747e7a; font-size: .68rem; font-weight: 750; }
.filter-panel input, .filter-panel select { width: 100%; height: 42px; padding: 0 12px; border: 1px solid #d8ddd9; border-radius: 8px; background: #fafbf9; color: var(--ink); outline: none; font-size: .82rem; }
.filter-panel input:focus, .filter-panel select:focus { border-color: #8da600; box-shadow: 0 0 0 3px rgba(169,216,0,.12); }
.filter-panel select { appearance: none; background-image: linear-gradient(45deg,transparent 50%,#67716d 50%),linear-gradient(135deg,#67716d 50%,transparent 50%); background-position: calc(100% - 16px) 18px,calc(100% - 12px) 18px; background-size: 4px 4px; background-repeat: no-repeat; padding-right: 28px; }
.clear-button { align-self: end; height: 42px; white-space: nowrap; }
.article-list { border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow); overflow: hidden; }
.article-card { display: grid; grid-template-columns: 144px minmax(0,1fr) auto; gap: 20px; min-height: 152px; padding: 18px; border-bottom: 1px solid #e9ede9; }
.article-card:last-child { border: 0; }
.article-image { width: 144px; height: 112px; border-radius: 9px; object-fit: cover; background: #e9ece8; }
.image-fallback { display: grid; place-items: center; color: #7d8883; font-weight: 900; letter-spacing: .1em; }
.article-body { min-width: 0; padding: 3px 0; }
.article-body h3 { margin: 8px 0 11px; font-size: 1rem; line-height: 1.5; }
.article-body h3 a { text-decoration: none; }
.article-body h3 a:hover { text-decoration: underline; text-decoration-color: var(--accent-strong); text-decoration-thickness: 2px; }
.article-source { color: #55615d; font-size: .74rem; font-weight: 750; }
.article-country { color: #8a928f; font-size: .72rem; }
.article-side { min-width: 112px; display: flex; flex-direction: column; align-items: end; justify-content: space-between; color: #7c8682; font-size: .7rem; }
.open-source { padding: 8px 11px; border: 1px solid #d8ddd9; border-radius: 7px; text-decoration: none; color: var(--ink); font-weight: 750; }
.open-source:hover { background: var(--accent); border-color: var(--accent); }
.pagination { display: flex; justify-content: center; align-items: center; gap: 7px; margin-top: 20px; }
.page-button { min-width: 38px; height: 38px; border: 1px solid #d6dcd7; border-radius: 8px; background: white; cursor: pointer; }
.page-button.active { background: var(--nav); color: white; border-color: var(--nav); }
.page-button:disabled { opacity: .42; cursor: default; }
.empty-state { padding: 70px 24px; text-align: center; color: var(--muted); }

.source-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.bar-list { padding: 18px 22px 24px; display: grid; gap: 17px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; font-weight: 650; }
.bar-value { color: #66716c; font-size: .7rem; }
.bar-track { grid-column: 1 / -1; height: 5px; background: #eef1ed; border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; min-width: 3px; background: var(--bar-color, var(--accent-strong)); border-radius: inherit; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; padding: 13px 16px; background: var(--nav); color: white; border-radius: 9px; box-shadow: 0 12px 40px rgba(0,0,0,.2); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; z-index: 20; font-size: .82rem; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-panel { grid-template-columns: repeat(3, 1fr); }
  .search-field { grid-column: span 2; }
  .source-grid { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .2s; width: 248px; box-shadow: 12px 0 40px rgba(0,0,0,.2); }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: block; cursor: pointer; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .filter-panel { grid-template-columns: repeat(2, 1fr); }
  .search-field { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .topbar { height: 82px; padding: 0 16px; }
  .topbar-actions .live-pill { display: none; }
  .refresh-button { padding: 0 10px; font-size: .76rem; }
  .content { padding: 24px 14px 56px; }
  .intro-row { display: block; }
  .timestamp { display: block; margin-top: 12px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { min-height: 128px; padding: 17px; }
  .metric-value { font-size: 1.7rem; }
  .topic-chart { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
  .section-heading { display: block; }
  .section-heading p { margin-top: 8px; }
  .filter-panel { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .article-card { grid-template-columns: 86px minmax(0,1fr); gap: 12px; padding: 14px; }
  .article-image { width: 86px; height: 82px; }
  .article-side { grid-column: 2; flex-direction: row; align-items: center; }
  .article-body h3 { font-size: .9rem; margin-top: 6px; }
}
