:root {
  --bg: #f3f4f6;
  --card: #fff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e7e9ee;
  --side: 252px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
}
aside {
  width: var(--side);
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex: none;
}
.brand {
  margin: 0;
  padding: 18px 16px 0;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.45;
}
nav { padding: 12px 12px 18px; overflow: auto; }
.group {
  margin: 16px 10px 6px;
  color: #9aa1ad;
  font-size: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.blue { background: #3b82f6; }
.teal { background: #14b8a6; }
.amber { background: #f59e0b; }
nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #374151;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  margin: 2px 0;
}
nav a svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; flex: none; }
nav a.active { background: #111827; color: #fff; }
#fold {
  margin-top: auto;
  border: 0;
  background: transparent;
  color: #6b7280;
  text-align: left;
  padding: 14px 18px 18px;
  cursor: pointer;
  font-size: 13px;
}
body.folded aside { width: 76px; }
body.folded .brand { display: none; }
body.folded .group, body.folded nav a span, body.folded #fold { font-size: 0; }
body.folded nav a { justify-content: center; }
main { flex: 1; padding: 28px 28px 56px; min-width: 0; }
h1 { font-size: 20px; margin: 0 0 6px; font-weight: 650; }
.sub { color: var(--muted); margin: 0 0 16px; font-size: 13px; line-height: 1.55; }
.kpis, .charts { display: grid; gap: 12px; margin-bottom: 12px; }
.kpis { grid-template-columns: repeat(3, 1fr); }
.kpis.four { grid-template-columns: repeat(4, 1fr); }
.charts { grid-template-columns: 1fr 1fr; }
.card {
  background: var(--card);
  border-radius: 18px;
  padding: 16px 18px 14px;
  min-width: 0;
}
.card h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.kpi span, .hint { color: var(--muted); font-size: 13px; }
.kpi b { display: block; font-size: 28px; margin: 6px 0 2px; font-weight: 650; letter-spacing: -0.03em; }
.kpi em { font-style: normal; color: var(--muted); font-size: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; align-items: end; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input, select {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--ink);
}
.table-wrap { overflow: auto; max-height: 560px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; border-bottom: 1px solid #e5e7eb; text-align: left; white-space: nowrap; vertical-align: top; }
th { color: #6b7280; font-weight: 600; position: sticky; top: 0; background: #fff; }
tr.click { cursor: pointer; }
tr.click:hover, tr.on { background: #f8fafc; }
.tag { display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: 12px; background: #f3f4f6; }
.tag.pos { background: #ecfdf3; color: #15803d; }
.tag.neu { background: #f3f4f6; color: #4b5563; }
.tag.neg { background: #fef2f2; color: #b91c1c; }
.clip { max-width: 360px; white-space: normal; color: #4b5563; }
.align-top { display: flex; justify-content: space-between; gap: 16px; align-items: center; background: #143d3a; color: #f3faf6; border-radius: 16px; padding: 16px 18px; margin-bottom: 12px; }
.align-top h2 { margin: 0 0 4px; font-size: 18px; }
.align-top p { margin: 0; }
.align-top button { color: #e7f6f1; background: transparent; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.align-top button:disabled { opacity: .35; cursor: default; }
.align-nav { display: flex; gap: 8px; }
.align-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 12px; }
.align-kpis div { background: #f4faf7; border: 1px solid #d5ebe3; border-radius: 12px; padding: 10px 12px; }
.align-kpis span { color: #5f756e; font-size: 12px; }
.align-kpis b { display: block; margin-top: 4px; font-size: 18px; }
.q1-wavebox { height: 72px; }
.q1-strips { margin-top: 8px; }
.q1-strips p { margin: 8px 0 3px; font-size: 12px; color: #6b7280; }
.q1-strips img { width: 100%; height: 26px; object-fit: fill; display: block; border-radius: 4px; pointer-events: none; }
.q1-strips img.vision { height: 34px; }
.q1-wave { width: 100%; height: 72px; display: block; }
#q1time { cursor: pointer; }
.q1-slots { max-height: 560px; overflow: auto; }
.slot-table { font-size: 13px; }
.slot-table th, .slot-table td { white-space: nowrap; }
.q1-slots tr { cursor: pointer; }
.q1-slots tr.on td { background: #e5f6f0; }
.q1-list { max-height: none; overflow: visible; }
.q1-list td { height: 44px; vertical-align: middle; }
.q1-list td.clip { max-width: 480px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars { display: grid; gap: 8px; }
.bars > div { display: grid; grid-template-columns: 48px minmax(0, 1fr) 64px; gap: 8px; align-items: center; font-size: 12px; }
.bars.wide > div { grid-template-columns: 148px minmax(0, 1fr) 88px; }
.track { height: 8px; width: 100%; background: #eef1f4; border-radius: 99px; overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 99px; }
.pager { display: flex; gap: 8px; margin-top: 10px; }
.pager button, .linkish {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
}
.matrix { display: grid; grid-template-columns: 64px repeat(3, 1fr); gap: 6px; align-items: center; }
.matrix b { background: #f8fafc; border-radius: 8px; padding: 10px; text-align: center; }
svg.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: #4b5563; margin-bottom: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 4px; }
.att4-list { max-height: 280px; }
.att4-list table { table-layout: fixed; }
.att4-list th:nth-child(1), .att4-list td:nth-child(1) { width: 12%; }
.att4-list th:nth-child(2), .att4-list td:nth-child(2) { width: 14%; }
.att4-list th:nth-child(3), .att4-list td:nth-child(3) { width: 16%; }
.att4-list th:nth-child(4), .att4-list td:nth-child(4) { width: 16%; }
.att4-list th:nth-child(5), .att4-list td:nth-child(5) { width: 16%; }
.stage { display: grid; grid-template-columns: minmax(300px, 0.82fr) minmax(0, 1.45fr); gap: 36px; align-items: start; }
.q1-stage { grid-template-columns: minmax(280px, 1.2fr) minmax(0, 1fr); }
.q1-stage video.player { max-height: 560px; }
.stage-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.stage-head h3 { margin: 0 0 4px; }
.stage-side h3, .stage-main h3 { margin: 16px 0 8px; }
video.player { width: 100%; max-height: 420px; background: #111; border-radius: 12px; display: block; }
.detail-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; margin-top: 12px; }
.quote { color: #6b7280; line-height: 1.55; margin: 8px 0; }
.alignbox { position: relative; }
.alignbox svg.links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.chips { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px 6px; padding: 4px 0 20px; }
#q1tok > .playhead { position: absolute; top: 0; bottom: 0; width: 1.5px; margin-left: -1px; background: #ef4444; z-index: 6; pointer-events: none; }
.q1-tokline { position: relative; margin-top: 4px; }
.q1-tokline .axis { cursor: default; }
.q1-tokline .tok { cursor: pointer; }
.chip { position: relative; z-index: 1; border: 1px solid #e5e7eb; background: #fff; border-radius: 999px; padding: 3px 10px; font-size: 13px; color: #4b5563; cursor: pointer; }
.chip.on { color: #059669; border-color: #34d399; background: #ecfdf5; }
.axis { position: relative; z-index: 1; cursor: pointer; margin-top: 2px; }
.axis-track { position: relative; height: 26px; border-top: 1px solid #e5e7eb; }
.sec { position: absolute; top: 0; width: 1px; height: 6px; background: #d1d5db; pointer-events: none; }
.playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #ef4444; pointer-events: none; z-index: 3; }
.ticks { position: relative; height: 16px; }
.ticks span { position: absolute; top: 0; font-size: 10px; color: #9ca3af; white-space: nowrap; transform: translateX(-50%); }
.ticks span.start { transform: translateX(0); }
.ticks span.end { transform: translateX(-100%); }
.wave-line { position: relative; height: 72px; cursor: pointer; touch-action: none; }
.wave-line .wave { width: 100%; height: 72px; display: block; }
.wave-line > .playhead { top: 0; height: 72px; bottom: auto; }
.curve-title { margin: 10px 0 6px; font-size: 14px; }
.time-col, .wave-line, #textvis, #textvis *, #q1time, #q1time *, .quote, .chips, .chip, .pill, .ticks, .axis {
  user-select: none;
  -webkit-user-select: none;
}
body.scrubbing, body.scrubbing * {
  user-select: none !important;
  -webkit-user-select: none !important;
}
.time-col { position: relative; cursor: pointer; touch-action: none; }
.time-col.dragging { cursor: grabbing; }
.time-col > .playhead { position: absolute; top: 0; bottom: 0; width: 1.5px; margin-left: -1px; background: #ef4444; z-index: 6; pointer-events: none; }
.curve-row { position: relative; height: 86px; margin-top: 8px; }
.curve-row svg { position: absolute; left: 0; right: 0; top: 16px; width: 100%; height: 52px; display: block; }
.curve-meta { position: absolute; left: 0; top: 0; font-size: 12px; display: flex; gap: 4px; align-items: center; z-index: 2; }
.curve-meta i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.curve-side { position: absolute; right: 0; top: 0; font-size: 11px; color: #9ca3af; z-index: 2; }
.pill { position: absolute; top: 34px; transform: translateX(-50%); font-size: 10px; line-height: 16px; padding: 0 6px; border: 1px solid; border-radius: 999px; background: rgba(255,255,255,0.94); pointer-events: none; white-space: nowrap; z-index: 2; }
.tok { position: absolute; top: 8px; height: 10px; background: #34d399; border-radius: 99px; min-width: 4px; }
.tok.on { background: #059669; height: 14px; top: 4px; }
.wave { cursor: pointer; }
@media (max-width: 980px) {
  .kpis, .charts, .detail-grid, .stage, .align-kpis { grid-template-columns: 1fr; }
  aside { display: none; }
}
