:root {
  color-scheme: light;
  --bg: #eef2f5;
  --sidebar: #17212b;
  --sidebar-soft: #22303b;
  --surface: #ffffff;
  --surface-soft: #f6f8fa;
  --text: #1e272f;
  --muted: #66727e;
  --border: #d8e0e6;
  --blue: #2458a6;
  --green: #197348;
  --amber: #a96513;
  --red: #b33932;
  --violet: #6650a4;
  --shadow: 0 12px 28px rgba(27, 37, 46, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

h1 {
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: 0;
}

small {
  color: var(--muted);
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 22px 18px;
  background: var(--sidebar);
  color: #eaf0f4;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #e8f4ef;
  color: var(--green);
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #aebbc5;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-list a {
  display: flex;
  align-items: center;
  min-height: 38px;
  border-radius: 8px;
  padding: 8px 10px;
  color: #dce6ed;
}

.nav-list a:hover {
  background: var(--sidebar-soft);
  text-decoration: none;
}

.sidebar-note {
  display: grid;
  gap: 4px;
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-note span,
.sidebar-note small {
  color: #aebbc5;
}

.main {
  width: min(1500px, 100%);
  padding: 24px 28px 44px;
}

.page-head,
.section-title,
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-head {
  margin-bottom: 22px;
}

.page-head p,
.section-title p,
.panel-head p,
.muted {
  color: var(--muted);
}

.eyebrow,
.panel-label {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.head-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.head-meta span,
.tag,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 3px 8px;
  background: #edf2f6;
  color: #51606d;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.section {
  margin-top: 24px;
  scroll-margin-top: 18px;
}

.section-title {
  margin-bottom: 12px;
}

.section-title.compact {
  align-items: flex-end;
}

.panel,
.metric,
.step-card,
.agent-card,
.source-card,
.top3-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.today-grid {
  display: grid;
  align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 1fr);
  gap: 14px;
}

.command-panel,
.action-panel,
.check-panel {
  min-height: 0;
}

.check-panel {
  grid-column: 1 / -1;
}

.article-focus {
  display: grid;
  gap: 7px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.article-focus strong {
  font-size: 19px;
  line-height: 1.3;
}

.meta-row,
.button-row,
.source-counts,
.status-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-row span {
  display: inline-flex;
  min-height: 24px;
  border-radius: 8px;
  padding: 2px 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.button-row {
  margin-top: 16px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid #afc0d2;
  border-radius: 8px;
  padding: 7px 11px;
  background: #f7fbff;
  color: var(--blue);
  font-weight: 800;
}

.button.disabled {
  border-color: var(--border);
  background: #f1f4f6;
  color: #89949d;
  pointer-events: none;
}

.button.primary {
  background: var(--blue);
  color: #ffffff;
}

.button:hover {
  text-decoration: none;
}

.action-list,
.check-list,
.gate-list,
.settings-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.check-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.action-row,
.check-item,
.settings-list div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.action-row:last-child,
.check-item:last-child,
.settings-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.action-row p,
.check-item span,
.settings-list span {
  color: var(--muted);
  font-size: 12px;
}

.check-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.check-list .check-item {
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

.check-item div {
  display: grid;
  gap: 2px;
}

.action-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9aa7b2;
}

.action-dot.good {
  background: var(--green);
}

.action-dot.warn {
  background: var(--amber);
}

.action-dot.bad {
  background: var(--red);
}

.action-dot.info {
  background: var(--blue);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.metric {
  min-height: 82px;
  padding: 13px;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 27px;
  line-height: 1;
  overflow-wrap: anywhere;
}

.metric.danger strong {
  color: var(--red);
}

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

.step-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 94px;
  padding: 13px;
}

.step-num,
.rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #e9f1fb;
  color: var(--blue);
  font-weight: 800;
}

.step-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.agent-card {
  padding: 12px;
}

.agent-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.agent-title span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.agent-card p {
  margin-top: 7px;
}

.agent-card small {
  display: block;
  min-height: 38px;
  margin-top: 2px;
}

.progress {
  height: 7px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 8px;
  background: #e6ebef;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--green);
}

.two-column {
  display: grid;
  align-items: start;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
}

.publish-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.publish-summary div,
.meta-grid div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

.publish-summary span,
.meta-grid span {
  color: var(--muted);
  font-size: 12px;
}

.source-grid,
.strategy-grid {
  display: grid;
  gap: 12px;
}

.site-asset-panel {
  margin-bottom: 12px;
}

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

.site-asset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

.site-asset-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.site-asset-latest {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
}

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

.strategy-grid {
  grid-template-columns: minmax(320px, 0.95fr) repeat(3, minmax(220px, 1fr));
  align-items: stretch;
}

.source-card,
.top3-card {
  padding: 14px;
}

.source-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.source-counts {
  margin-top: 12px;
}

.source-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.data-viz {
  margin: 12px 0;
}

.viz-panel {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
}

.viz-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 10px;
}

.viz-cards div {
  display: grid;
  gap: 6px;
  min-height: 76px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

.viz-cards span,
.bar-row span {
  color: var(--muted);
  font-size: 12px;
}

.viz-cards strong {
  font-size: 26px;
  line-height: 1;
}

.viz-bars {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ebef;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.bar-track span.good {
  background: var(--green);
}

.bar-track span.warn {
  background: var(--amber);
}

.bar-track span.bad {
  background: var(--red);
}

.strategy-board {
  display: grid;
  align-content: start;
  gap: 14px;
  grid-row: span 2;
}

.strategy-lock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #b9cfdf;
  border-radius: 8px;
  padding: 12px;
  background: #f7fbff;
}

.strategy-lock strong {
  color: var(--blue);
}

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

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

.strategy-metrics div {
  display: grid;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

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

.strategy-rank-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  min-height: 190px;
}

.top3-card h3 {
  text-transform: capitalize;
}

.top3-body {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.top3-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.strategy-anchor,
.anchor-link {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  overflow-wrap: anywhere;
  border-radius: 8px;
  padding: 6px 9px;
  background: #eaf3fb;
  color: var(--blue);
  font-weight: 800;
}

.strategy-anchor:hover,
.anchor-link:hover {
  background: #dcecf8;
  text-decoration: none;
}

.strategy-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.strategy-stat-row span {
  border-radius: 8px;
  padding: 5px 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.sub-link {
  display: block;
  margin-top: 5px;
  color: var(--blue);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.article-links {
  display: grid;
  gap: 5px;
  margin-top: 7px;
}

.data-center-card {
  margin-top: 12px;
}

.data-center-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.data-center-grid,
.data-kpi-grid {
  display: grid;
  gap: 12px;
}

.data-center-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 14px;
}

.data-center-grid div {
  display: grid;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

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

.data-center-grid strong {
  font-size: 24px;
  line-height: 1;
}

.data-center-shell {
  grid-template-columns: 220px minmax(0, 1fr);
}

.data-main {
  width: min(1780px, 100%);
}

.data-kpi-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.data-control-panel {
  display: grid;
  gap: 14px;
}

.data-view-tabs {
  display: inline-flex;
  justify-self: start;
  border: 1px solid #afc0d2;
  border-radius: 8px;
  overflow: hidden;
}

.data-view-tabs button {
  min-height: 34px;
  border: 0;
  border-right: 1px solid #afc0d2;
  padding: 6px 12px;
  background: #f7fbff;
  color: var(--blue);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.data-view-tabs button:last-child {
  border-right: 0;
}

.data-view-tabs button.active {
  background: var(--blue);
  color: #ffffff;
}

.data-controls {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) repeat(4, minmax(150px, 0.7fr));
  gap: 10px;
}

.data-controls-expanded {
  grid-template-columns: minmax(240px, 1.35fr) repeat(4, minmax(132px, 0.72fr));
}

.data-controls label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.data-controls input,
.data-controls select {
  width: 100%;
  max-width: none;
}

.bulk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.bulk-toolbar span,
.bulk-toolbar button {
  min-height: 32px;
  border-radius: 8px;
}

.bulk-toolbar span {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 700;
}

.bulk-toolbar button {
  border: 1px solid #afc0d2;
  padding: 6px 10px;
  background: #f7fbff;
  color: var(--blue);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.bulk-toolbar button:hover {
  background: #eaf3fb;
}

.column-control {
  position: relative;
  margin-left: auto;
}

.column-menu {
  position: absolute;
  z-index: 10;
  right: 0;
  top: calc(100% + 8px);
  width: min(560px, calc(100vw - 48px));
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 32px rgba(26, 44, 61, 0.18);
}

.column-menu[hidden] {
  display: none;
}

.column-menu-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.column-menu-actions button {
  min-height: 30px;
  border: 1px solid #afc0d2;
  padding: 5px 9px;
  background: #f7fbff;
  color: var(--blue);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.column-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
  max-height: 280px;
  overflow-y: auto;
}

.column-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.3;
}

.column-options input[type="checkbox"] {
  width: 15px;
  height: 15px;
  min-height: 0;
}

.data-table-panel {
  padding: 0;
}

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 8px;
}

.data-table {
  min-width: 3260px;
  table-layout: auto;
  font-size: 12px;
}

.data-table th,
.data-table td {
  min-width: 92px;
  white-space: nowrap;
}

.data-table td {
  vertical-align: middle;
}

.data-table th {
  top: 0;
  z-index: 2;
  padding: 0;
}

.data-table th .sort-button {
  width: 100%;
  min-height: 42px;
  border: 0;
  padding: 10px 11px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.data-table th .sort-button:hover,
.data-table th .sort-button.active {
  color: var(--blue);
  background: #eaf3fb;
}

.data-table .col-select {
  width: 54px;
  min-width: 54px;
  text-align: center;
}

.data-table .col-date {
  width: 92px;
  min-width: 92px;
}

.data-table .col-milestone {
  width: 110px;
  min-width: 110px;
}

.data-table .col-job_id {
  width: 190px;
  min-width: 190px;
}

.data-table .col-article,
.data-table .col-target {
  width: 290px;
  min-width: 290px;
  white-space: normal;
}

.data-table .col-site_name {
  width: 160px;
  min-width: 160px;
  white-space: normal;
}

.data-table .col-category {
  width: 112px;
  min-width: 112px;
}

.data-table code {
  color: #40566a;
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
}

.data-table .table-link {
  color: var(--blue);
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.data-table .table-link:hover {
  text-decoration: underline;
}

.data-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
}

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

.filters label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  min-height: 34px;
  max-width: 220px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 9px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
}

.table-panel {
  min-width: 0;
}

.table-wrap {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 1060px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-soft);
  color: #42515e;
  font-size: 12px;
  font-weight: 800;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.good {
  background: #e7f4ec;
  color: var(--green);
}

.warn {
  background: #fff1dc;
  color: var(--amber);
}

.bad {
  background: #fdebe9;
  color: var(--red);
}

.neutral {
  background: #edf2f6;
  color: #51606d;
}

.info {
  background: #eeebfb;
  color: var(--violet);
}

.metric-line {
  color: var(--muted);
  font-size: 12px;
}

.status-counts {
  margin: -2px 0 10px;
}

.finding-list {
  display: grid;
  gap: 10px;
}

.finding {
  display: grid;
  gap: 4px;
  border-left: 4px solid var(--blue);
  background: var(--surface-soft);
  padding: 10px 12px;
}

.finding.high {
  border-left-color: var(--red);
}

.finding.medium {
  border-left-color: var(--amber);
}

.finding.low {
  border-left-color: var(--green);
}

.finding.info {
  border-left-color: var(--violet);
}

.empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1320px) {
  .today-grid,
  .two-column {
    grid-template-columns: 1fr;
  }

  .kpi-grid,
  .pipeline,
  .agent-grid,
  .source-grid,
  .site-asset-grid,
  .strategy-grid,
  .check-list,
  .data-center-grid,
  .data-kpi-grid,
  .data-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .strategy-board {
    grid-column: 1 / -1;
    grid-row: auto;
  }

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

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .data-center-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .sidebar-note {
    margin-top: 0;
  }

  .main {
    padding: 20px 14px 36px;
  }

  .page-head,
  .section-title,
  .panel-head,
  .section-title.compact {
    align-items: stretch;
    flex-direction: column;
  }

  .head-meta,
  .filters {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .kpi-grid,
  .pipeline,
  .agent-grid,
  .source-grid,
  .site-asset-grid,
  .strategy-grid,
  .check-list,
  .data-center-grid,
  .data-kpi-grid,
  .data-controls,
  .strategy-metrics,
  .viz-panel,
  .viz-cards,
  .publish-summary {
    grid-template-columns: 1fr;
  }

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

  .step-card,
  .action-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .step-card .tag,
  .action-row .tag {
    grid-column: 2;
    justify-self: start;
  }

  input,
  select {
    width: 100%;
    max-width: none;
  }
}
