:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --ink: #16191d;
  --muted: #697078;
  --line: #dfe3e7;
  --line-strong: #cbd1d6;
  --teal: #087f78;
  --teal-soft: #e7f5f3;
  --amber: #bd6b00;
  --amber-soft: #fff3dc;
  --red: #b42318;
  --sidebar: #191c20;
  --sidebar-muted: #aab0b6;
  --sidebar-width: 232px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--ink); background: var(--bg); font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
button, select { font: inherit; letter-spacing: 0; }
svg { width: 18px; height: 18px; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); display: flex; flex-direction: column; padding: 20px 14px; background: var(--sidebar); color: #fff; z-index: 20; }
.brand { display: flex; align-items: center; gap: 11px; height: 44px; padding: 0 8px; margin-bottom: 25px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; background: #fff; color: #15181b; font-size: 12px; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { color: var(--sidebar-muted); font-size: 11px; }
.primary-nav { display: grid; gap: 4px; }
.primary-nav a { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 12px; color: var(--sidebar-muted); border-left: 2px solid transparent; }
.primary-nav a:hover { color: #fff; background: #24282d; }
.primary-nav a.active { color: #fff; background: #262b30; border-left-color: #40c8bb; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 12px; color: var(--sidebar-muted); font-size: 12px; border-top: 1px solid #33383e; }
.sidebar-foot form { margin-left: auto; }
.logout-button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--sidebar-muted); cursor: pointer; }
.logout-button:hover { color: #fff; }
.logout-button svg { width: 16px; height: 16px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #44c7a6; box-shadow: 0 0 0 3px rgba(68,199,166,.12); }
.main-shell { margin-left: var(--sidebar-width); min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; height: 58px; display: flex; align-items: center; padding: 0 28px; background: rgba(255,255,255,.95); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.topbar-title { font-weight: 650; }
.topbar-date { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.menu-button { display: none; margin-right: 10px; }
.page-content { width: min(1640px, 100%); margin: 0 auto; padding: 28px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.compact-heading { align-items: center; margin-bottom: 18px; }
.eyebrow { margin: 0 0 5px; color: var(--teal); font-size: 10px; font-weight: 750; letter-spacing: 1.2px; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 750px; margin-bottom: 0; font-size: clamp(26px, 3vw, 38px); line-height: 1.12; font-weight: 730; letter-spacing: 0; }
h2 { margin-bottom: 0; font-size: 18px; line-height: 1.3; letter-spacing: 0; }
.heading-note { margin: 7px 0 0; color: var(--muted); }
.command-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 14px; border: 1px solid #252a2f; background: #202429; color: #fff; white-space: nowrap; cursor: pointer; }
.command-button:hover { background: #0d6f69; border-color: #0d6f69; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 28px; border: 1px solid var(--line); background: var(--surface); }
.metric { min-height: 122px; padding: 18px 20px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric > span, .metric small { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin: 11px 0 6px; font-size: 27px; font-weight: 720; font-variant-numeric: tabular-nums; }
.metric.accent { background: var(--teal-soft); }
.metric .metric-time { font-size: 17px; margin-top: 17px; }
.content-band { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line-strong); }
.content-band.no-top-border { margin-top: 0; padding-top: 0; border: 0; }
.section-heading { display: flex; justify-content: space-between; align-items: end; min-height: 42px; margin-bottom: 14px; }
.section-heading > a { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 12px; }
.section-heading > a:hover { color: var(--teal); }
.section-heading > a svg { width: 15px; height: 15px; }
.table-shell { overflow: auto; border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { height: 42px; padding: 0 11px; color: var(--muted); background: #fafbfb; border-bottom: 1px solid var(--line-strong); font-size: 11px; font-weight: 650; text-align: left; white-space: nowrap; }
td { padding: 10px 11px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fbfa; }
.numeric { text-align: right; white-space: nowrap; }
.strong-number { font-weight: 700; }
.rank-column { width: 52px; text-align: center; }
.rank-number { display: inline-grid; place-items: center; width: 27px; height: 27px; color: var(--muted); font-weight: 700; }
.rank-number.top { background: var(--amber-soft); color: var(--amber); }
.video-cell { display: flex; align-items: center; gap: 11px; min-width: 365px; max-width: 560px; }
.cover-link, .cover-empty { flex: 0 0 96px; width: 96px; height: 54px; overflow: hidden; background: #e9ecee; }
.cover-link img { display: block; width: 100%; height: 100%; object-fit: cover; }
.video-copy { min-width: 0; }
.video-title { display: -webkit-box; overflow: hidden; color: #1a1d21; font-weight: 630; line-height: 1.35; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.video-title:hover { color: var(--teal); }
.video-meta { display: flex; gap: 9px; margin-top: 5px; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; }
.video-meta span { overflow: hidden; text-overflow: ellipsis; }
.up-name { display: block; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td small { display: block; color: var(--muted); font-size: 10px; }
.rate-pill { display: inline-block; min-width: 55px; padding: 3px 6px; background: var(--teal-soft); color: #096c66; text-align: center; }
.delta { color: var(--muted); }
.delta.positive { color: var(--teal); font-weight: 650; }
.empty-state { padding: 30px !important; color: var(--muted); text-align: center; }
.split-band { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .7fr); gap: 28px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line-strong); }
.category-list { border: 1px solid var(--line); background: var(--surface); }
.category-row { display: grid; grid-template-columns: minmax(180px, 1fr) 110px 62px 20px; align-items: center; gap: 14px; min-height: 64px; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.category-row:last-child { border-bottom: 0; }
.category-row:hover { background: #f7fbfa; }
.category-row strong, .category-row small { display: block; }
.category-row small { color: var(--muted); font-size: 10px; }
.category-stat { text-align: right; }
.category-rate { color: var(--teal); font-weight: 680; text-align: right; }
.category-row svg { color: var(--muted); width: 15px; }
.hotword-panel { min-width: 0; }
.hotword-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-strong); }
.hotword-list li { display: grid; grid-template-columns: 25px minmax(0, 1fr) 28px 60px; align-items: center; gap: 7px; min-height: 42px; border-bottom: 1px solid var(--line); }
.hotword-list a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hotword-list a:hover { color: var(--teal); }
.hotword-rank { color: var(--muted); text-align: center; }
.heat-layer { color: var(--amber); font-weight: 700; }
.hotword-list li > span:last-child { color: var(--muted); font-size: 11px; text-align: right; }
.filter-bar { display: flex; align-items: end; gap: 10px; margin-bottom: 18px; padding: 13px; border: 1px solid var(--line); background: var(--surface); }
.filter-bar label { display: grid; gap: 5px; }
.filter-bar label span { color: var(--muted); font-size: 10px; font-weight: 650; }
select { min-width: 140px; height: 38px; padding: 0 32px 0 10px; border: 1px solid var(--line-strong); border-radius: 0; background: #fff; color: var(--ink); }
.run-table td:first-child { min-width: 220px; }
.run-table td:first-child strong, .run-table td:first-child small { display: block; }
.status-badge { display: inline-block; padding: 3px 7px; background: #edf0f2; color: var(--muted); font-size: 11px; }
.status-badge.success { background: var(--teal-soft); color: var(--teal); }
.status-badge.failed { background: #feeceb; color: var(--red); }
.status-badge.running { background: var(--amber-soft); color: var(--amber); }
.error-copy { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--red); }
.login-page { min-height: 100vh; display: grid; place-items: center; background: #eef1f2; }
.login-shell { width: min(420px, calc(100% - 28px)); }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; color: var(--ink); }
.login-brand .brand-mark { background: var(--sidebar); color: #fff; }
.login-brand strong, .login-brand small { display: block; }
.login-brand small { color: var(--muted); font-size: 11px; }
.login-panel { padding: 30px; border: 1px solid var(--line-strong); background: var(--surface); box-shadow: 0 16px 45px rgba(30,38,43,.08); }
.login-panel h1 { font-size: 29px; }
.login-note { margin: 8px 0 24px; color: var(--muted); }
.login-form { display: grid; gap: 9px; }
.login-form label { color: var(--muted); font-size: 11px; font-weight: 650; }
.login-form input { width: 100%; height: 43px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 0; outline: 0; font: inherit; }
.login-form input:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(8,127,120,.12); }
.login-form .command-button { width: 100%; margin-top: 8px; }
.login-error { margin: 2px 0 0; color: var(--red); font-size: 12px; }
.login-foot { margin: 13px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.ai-workspace { height: calc(100vh - 114px); min-height: 610px; display: grid; grid-template-columns: 260px minmax(0, 1fr); border: 1px solid var(--line-strong); background: var(--surface); }
.conversation-panel { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); background: #f8f9f9; }
.conversation-head { display: flex; align-items: center; justify-content: space-between; min-height: 84px; padding: 16px; border-bottom: 1px solid var(--line); }
.conversation-head h1 { font-size: 22px; }
.ai-status { display: flex; align-items: center; gap: 8px; margin: 12px; padding: 9px 10px; color: var(--muted); background: #eef1f2; font-size: 11px; }
.ai-status.ready { color: var(--teal); background: var(--teal-soft); }
.ai-status.offline .status-dot { background: var(--amber); }
.conversation-list { min-height: 0; overflow: auto; padding: 0 8px 12px; }
.conversation-item { width: 100%; display: block; padding: 11px 10px; border: 0; border-left: 2px solid transparent; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.conversation-item:hover { background: #eef1f2; }
.conversation-item.active { border-left-color: var(--teal); background: #e9f4f2; }
.conversation-item strong, .conversation-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-item strong { font-size: 12px; }
.conversation-item small, .conversation-placeholder { color: var(--muted); font-size: 10px; }
.conversation-placeholder { padding: 16px 10px; }
.chat-panel { min-width: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.chat-scroll { min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.chat-welcome { width: min(720px, calc(100% - 40px)); margin: 90px auto 30px; text-align: center; }
.welcome-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; margin-bottom: 16px; background: var(--teal-soft); color: var(--teal); }
.welcome-icon svg { width: 25px; height: 25px; }
.chat-welcome h2 { font-size: 25px; }
.chat-welcome > p:not(.eyebrow) { color: var(--muted); }
.prompt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 24px; text-align: left; }
.prompt-grid button { min-height: 58px; padding: 11px 13px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.prompt-grid button:hover { border-color: var(--teal); background: var(--teal-soft); }
.message-list { width: min(900px, calc(100% - 40px)); margin: 0 auto; padding: 25px 0 35px; }
.chat-message { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 18px; padding: 19px 0; border-bottom: 1px solid var(--line); }
.message-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.chat-message.assistant .message-label { color: var(--teal); }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; }
.message-body a { color: var(--teal); text-decoration: underline; text-underline-offset: 2px; }
.chat-message.pending .message-body { color: var(--muted); animation: pulse 1.4s ease-in-out infinite; }
.tool-trace { grid-column: 2; margin-top: 11px; border: 1px solid var(--line); background: #f8fafa; }
.tool-trace summary { padding: 9px 11px; color: var(--muted); font-size: 11px; cursor: pointer; }
.tool-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 9px 11px; border-top: 1px solid var(--line); }
.tool-row strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.tool-row span { font-size: 10px; }
.tool-row pre { grid-column: 1 / -1; max-height: 130px; overflow: auto; margin: 0; color: var(--muted); font-size: 10px; white-space: pre-wrap; }
.tool-ok { color: var(--teal); }
.tool-fail { color: var(--red); }
.chat-composer { padding: 13px 18px 16px; border-top: 1px solid var(--line-strong); background: #fafbfb; }
.composer-row { width: min(900px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) 42px; align-items: end; gap: 8px; margin: 0 auto; }
.composer-row textarea { min-height: 44px; max-height: 150px; resize: none; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 0; outline: 0; font: inherit; }
.composer-row textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(8,127,120,.1); }
.send-button { display: grid; place-items: center; width: 42px; height: 42px; border: 0; background: var(--sidebar); color: #fff; cursor: pointer; }
.send-button:disabled, .composer-row textarea:disabled { cursor: not-allowed; opacity: .55; }
.chat-composer > small { display: block; width: min(900px, 100%); margin: 7px auto 0; color: var(--muted); font-size: 10px; }
.ai-config-warning { width: min(900px, 100%); display: flex; align-items: center; gap: 8px; margin: 0 auto 9px; padding: 8px 10px; background: var(--amber-soft); color: #855000; font-size: 11px; }
.ai-config-warning svg { width: 15px; height: 15px; }
@keyframes pulse { 50% { opacity: .5; } }
@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric { border-bottom: 1px solid var(--line); }
  .metric:nth-child(3) { border-right: 0; }
  .split-band { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .18s ease; box-shadow: 12px 0 30px rgba(0,0,0,.2); }
  .menu-open .sidebar { transform: translateX(0); }
  .main-shell { margin-left: 0; }
  .menu-button { display: inline-grid; }
  .topbar { padding: 0 14px; }
  .topbar-date { display: none; }
  .page-content { padding: 20px 14px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  h1 { font-size: 27px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 105px; padding: 14px; }
  .metric:nth-child(2n) { border-right: 0; }
  .metric:nth-child(3) { border-right: 1px solid var(--line); }
  .metric:last-child { grid-column: 1 / -1; }
  .metric strong { font-size: 23px; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .filter-bar select { width: 100%; }
  .category-row { grid-template-columns: minmax(150px, 1fr) 75px 18px; }
  .category-rate { display: none; }
  .video-cell { min-width: 300px; }
  .cover-link, .cover-empty { flex-basis: 80px; width: 80px; height: 45px; }
  .ai-workspace { height: calc(100vh - 98px); min-height: 560px; grid-template-columns: 1fr; }
  .conversation-panel { display: none; }
  .chat-welcome { margin-top: 55px; }
  .prompt-grid { grid-template-columns: 1fr; }
  .chat-message { grid-template-columns: 1fr; gap: 5px; }
  .tool-trace { grid-column: 1; }
}
