:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #172033;
  --sub: #647084;
  --line: #d8dee8;
  --dark: #101828;
  --red: #d92d20;
  --teal: #0f766e;
  --blue: #175cd3;
  --violet: #6941c6;
  --amber: #b54708;
  --shadow: 0 18px 42px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #84caff;
  outline-offset: 2px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  background: var(--dark);
  color: #fff;
  overflow: auto;
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  color: var(--dark);
  font-weight: 800;
}

.brand strong { display: block; font-size: 16px; }
.brand span { display: block; color: #98a2b3; font-size: 12px; }

.nav {
  display: grid;
  gap: 8px;
}

.nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: #d0d5dd;
  transition: .18s ease;
}

.nav a:hover,
.nav a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.content {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 28px;
  background: rgba(244, 246, 248, .9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
}

.button.primary {
  background: var(--dark);
  color: #fff;
  border-color: var(--dark);
}

.update-button {
  gap: 7px;
  border-color: #a6f4c5;
  background: #ecfdf3;
  color: #067647;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #12b76a;
  box-shadow: 0 0 0 4px rgba(18, 183, 106, .14);
}

.update-drawer {
  position: fixed;
  right: 24px;
  top: 82px;
  z-index: 30;
  width: min(440px, calc(100vw - 32px));
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.update-drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid #dcfce7;
  background: #f0fdf4;
}

.update-drawer-head strong,
.update-drawer-head span {
  display: block;
}

.update-drawer-head span {
  color: #667085;
  font-size: 12px;
}

.update-drawer-body {
  padding: 14px;
}

.update-drawer-body p {
  margin: 10px 0 0;
  color: #475467;
  font-size: 13px;
}

.update-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #067647;
  font-weight: 700;
}

.update-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 26px;
}

.hero {
  padding: 34px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(16,24,40,.94), rgba(16,24,40,.72)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='500' viewBox='0 0 1200 500'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.14'%3E%3Cpath d='M0 420C180 300 330 300 500 380s330 110 520-20 260-140 380-80'/%3E%3Cpath d='M0 220C190 120 360 150 520 250s320 140 520 20 300-170 400-140'/%3E%3C/g%3E%3C/svg%3E");
  color: white;
  box-shadow: var(--shadow);
}

.hero h2 {
  margin: 0 0 12px;
  max-width: 920px;
  font-size: 34px;
  line-height: 1.22;
}

.hero p {
  margin: 0;
  max-width: 960px;
  color: #d0d5dd;
}

.section {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(16, 24, 40, .04);
}

.section h2 {
  margin: 0 0 16px;
  font-size: 22px;
}

.section h3 {
  margin: 18px 0 8px;
  font-size: 17px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.account-card {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform .18s ease, box-shadow .18s ease;
}

.account-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.account-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.metric-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.metric {
  min-width: 88px;
  padding: 9px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #eef2f6;
  color: var(--ink);
}

.metric strong {
  display: block;
  font-size: 17px;
  color: #101828;
  font-weight: 800;
}

.metric span {
  display: block;
  color: #344054;
  font-size: 12px;
  font-weight: 600;
}

.hero .metric {
  background: #ffffff;
  border-color: rgba(255, 255, 255, .92);
  box-shadow: 0 10px 24px rgba(16, 24, 40, .18);
}

.hero .metric strong {
  color: #111827;
}

.hero .metric span {
  color: #475467;
}

.error-state {
  max-width: 720px;
  margin: 48px auto;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  margin: 3px 4px 3px 0;
  border-radius: 999px;
  background: #eef2f6;
  color: #344054;
  font-size: 12px;
}

.tag.red { background: #fff1f0; color: var(--red); }
.tag.teal { background: #ecfdf3; color: var(--teal); }
.tag.blue { background: #eff4ff; color: var(--blue); }
.tag.violet { background: #f4f3ff; color: var(--violet); }
.tag.amber { background: #fffaeb; color: var(--amber); }

.notice {
  padding: 12px 14px;
  border: 1px solid #fedf89;
  border-radius: 8px;
  background: #fffaeb;
  color: #7a2e0e;
}

.threshold-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.threshold-card p {
  margin: 4px 0 0;
  color: #475467;
  font-size: 13px;
}

.threshold-metric {
  min-width: 150px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #dbeafe;
}

.threshold-metric span,
.threshold-title {
  display: block;
  color: #475467;
  font-size: 12px;
}

.threshold-metric strong {
  display: block;
  color: #175cd3;
  font-size: 22px;
  line-height: 1.2;
}

.threshold-title,
.threshold-rules {
  grid-column: 1 / -1;
}

.threshold-rules {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.threshold-rules span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1849a9;
  font-size: 12px;
}

.account-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.jump-panel {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 104px);
  overflow: auto;
}

.jump-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.jump-grid a,
.video-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #344054;
  font-size: 13px;
}

.video-next {
  padding: 7px 10px;
  margin-right: 8px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.input,
.select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

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

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #f8fafc;
  color: #344054;
  position: sticky;
  top: 64px;
  z-index: 2;
}

.video-card {
  scroll-margin-top: 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 14px;
  overflow: hidden;
}

.video-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.video-head h3 {
  margin: 0;
  font-size: 17px;
}

.video-body {
  padding: 16px;
}

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

.analysis-item {
  padding: 12px;
  border: 1px solid #eef2f6;
  border-radius: 8px;
  background: #fcfcfd;
}

.analysis-item strong {
  display: block;
  margin-bottom: 4px;
}

.per-video-evidence {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f6fef9;
}

.evidence-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.evidence-head strong {
  color: #05603a;
  font-size: 16px;
}

.evidence-head span {
  color: #475467;
  font-size: 12px;
}

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

.evidence-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 10px;
}

.evidence-box {
  padding: 10px;
  border: 1px solid #dcfce7;
  border-radius: 8px;
  background: #fff;
}

.evidence-box span {
  display: block;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
}

.evidence-box strong {
  display: block;
  margin: 3px 0;
  color: #101828;
  font-size: 14px;
}

.evidence-box p {
  margin: 0;
  color: #667085;
  font-size: 12px;
}

.evidence-list {
  padding: 12px;
  border: 1px solid #dcfce7;
  border-radius: 8px;
  background: #fff;
}

.evidence-list > strong {
  display: block;
  margin-bottom: 8px;
  color: #062b1f;
  font-size: 15px;
}

.evidence-list ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.evidence-list li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 8px;
  border-left: 3px solid #86efac;
  background: #f8fafc;
}

.evidence-list li span {
  color: #067647;
  font-weight: 800;
}

.evidence-list li p {
  margin: 0;
  color: #101828;
  line-height: 1.55;
}

.evidence-list li p strong {
  display: inline;
  margin-right: 6px;
  color: #101828;
}

.evidence-list li p em {
  display: block;
  margin-top: 2px;
  color: #667085;
  font-size: 12px;
  font-style: normal;
}

.evidence-list li b {
  color: #05603a;
  white-space: nowrap;
}

.evidence-list > p {
  margin: 0;
  color: #475467;
  line-height: 1.65;
}

.download-panel {
  margin: 10px 0;
  padding: 12px;
  border: 1px solid #d6e4ff;
  border-radius: 8px;
  background: #f5f9ff;
}

.download-panel p {
  margin: 4px 0 0;
  color: var(--sub);
  font-size: 13px;
}

.share-line {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.share-label {
  flex: 0 0 auto;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.share-url {
  flex: 1 1 280px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: #101828;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
}

.copy-link,
.tool-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--dark);
  padding: 7px 10px;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}

.copy-link:hover,
.tool-link:hover {
  border-color: #2f80ed;
  color: #2f80ed;
}

.copy-link:disabled {
  opacity: .65;
  cursor: not-allowed;
}

.tool-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.failover-panel {
  margin-top: 12px;
  padding: 10px;
  border: 1px dashed #fdb022;
  border-radius: 8px;
  background: #fffcf5;
}

.failover-panel strong {
  display: block;
  color: #93370d;
}

.failover-panel p {
  margin: 4px 0 0;
  color: #7a2e0e;
}

.topic-line {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}

.topic-source,
.topic-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  line-height: 1.2;
}

.topic-source {
  color: #475467;
  background: #eef2f6;
}

.topic-chip {
  color: #175cd3;
  background: #eff8ff;
  border: 1px solid #d1e9ff;
}

.quote {
  padding: 10px 12px;
  border-left: 3px solid var(--line);
  background: #f8fafc;
  margin: 8px 0;
  color: #344054;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 12px;
  cursor: pointer;
}

.tab.active {
  background: var(--dark);
  color: #fff;
  border-color: var(--dark);
}

.hidden { display: none !important; }

.footer-note {
  color: var(--sub);
  font-size: 13px;
  margin-top: 20px;
}

.site-footer {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 26px 26px;
  color: #667085;
  font-size: 13px;
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
  }
  .grid.cards,
  .grid.three,
  .grid.two,
  .account-layout,
  .analysis-grid {
    grid-template-columns: 1fr;
  }
  .jump-panel {
    position: relative;
    top: 0;
    max-height: none;
  }
}

@media (max-width: 640px) {
  .page { padding: 14px; }
  .topbar { padding: 12px 14px; align-items: flex-start; flex-direction: column; }
  .hero { padding: 22px; }
  .hero h2 { font-size: 26px; }
  th, td { font-size: 13px; padding: 8px; }
  .section { overflow-x: auto; }
  table { min-width: 680px; }
  .metric { min-width: 104px; }
}
