/* SentiLab 设计变量与基础组件 */
:root {
  --side: #101a2b;
  --side-text: #9aa8c2;
  --side-head: #5f6d88;
  --bg: #f3f5f9;
  --card: #fff;
  --line: #e4e8ef;
  --line-2: #eef1f5;
  --ink: #16202f;
  --ink-2: #4b5566;
  --muted: #8a94a6;
  --primary: #2f54eb;
  --primary-2: #1d39c4;
  --primary-soft: #eef1ff;
  --pos: #16a34a; --pos-ink: #15803d; --pos-soft: #e8f6ec;
  --neg: #e5484d; --neg-ink: #c62f34; --neg-soft: #fdecec;
  --neu: #7c879b; --neu-ink: #5f6a7e; --neu-soft: #eef1f5;
  --warn: #d97706; --warn-soft: #fff5e6;
  --radius: 10px;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 外壳 ---------- */
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--side); color: var(--side-text);
  display: flex; flex-direction: column;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 14px; color: #fff;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: #3b5bff; color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--side-text); margin-top: 1px; }

.nav { flex: 1; padding-bottom: 12px; }
.nav-group {
  padding: 16px 22px 6px; font-size: 11px; letter-spacing: .08em; color: var(--side-head);
}
.nav a {
  position: relative; display: flex; align-items: center; gap: 10px;
  margin: 2px 10px; padding: 0 12px; height: 38px; border-radius: 8px;
  color: var(--side-text); font-size: 13.5px;
}
.nav a svg { width: 18px; height: 18px; opacity: .85; flex: none; }
.nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav a.active { background: rgba(91, 127, 255, .16); color: #fff; }
.nav a.active svg { opacity: 1; color: #8fa2ff; }
.nav a.active::before {
  content: ""; position: absolute; left: -10px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: #6e8bff;
}
.side-foot { padding: 14px 18px 18px; border-top: 1px solid rgba(255, 255, 255, .07); }
.proj { display: flex; align-items: center; gap: 10px; }
.proj-name { font-size: 13px; color: #e6ebf5; }
.proj-sub { font-size: 11.5px; color: var(--side-text); font-variant-numeric: tabular-nums; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: #27364f; color: #dbe2f0; display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
}

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 56px;
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.crumbs { font-size: 13.5px; color: var(--ink-2); }
.top-right { display: flex; align-items: center; gap: 14px; }
.top-right .avatar { background: var(--primary-soft); color: var(--primary); }
.env {
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px;
  border-radius: 13px; background: var(--pos-soft); color: var(--pos-ink); font-size: 12px;
}
.env.ghost { background: var(--neu-soft); color: var(--neu-ink); }
.env.st { background: #fff1e0; color: #b45309; }
.env.st .dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .16); }
.env.dev { background: #e9f8ef; color: #15803d; }
.env.dev .dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .16); }
.env.prod { background: #e8edff; color: var(--primary); }
.env.prod .dot { background: var(--primary); box-shadow: 0 0 0 3px rgba(47, 84, 235, .14); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 3px rgba(22, 163, 74, .15); }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: transparent;
  color: var(--ink-2); display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--line-2); }

.content { padding: 20px 24px 36px; }

/* ---------- 页头 ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px;
}
.page-head h1 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.page-head p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.page-head .actions { display: flex; align-items: center; gap: 8px; }

/* ---------- 栅格与卡片 ---------- */
.g { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.c-3 { grid-column: span 3; } .c-4 { grid-column: span 4; } .c-5 { grid-column: span 5; }
.c-6 { grid-column: span 6; } .c-7 { grid-column: span 7; } .c-8 { grid-column: span 8; }
.c-9 { grid-column: span 9; } .c-12 { grid-column: span 12; }
.mt { margin-top: 16px; }
.rel .img .mt { margin-top: 8px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card-t { font-size: 14px; font-weight: 600; }
.card-s { font-size: 12px; color: var(--muted); }
.card-b { padding: 12px 20px 16px; }
.card-b.flush { padding: 12px 0 0; }
.chart { height: 280px; }
.chart.tall { height: 320px; }
.chart.short { height: 220px; }

/* ---------- KPI ---------- */
.kpi { padding: 16px 20px 14px; }
.kpi .l { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi .v { font-size: 28px; font-weight: 600; line-height: 1.15; margin: 8px 0 6px; letter-spacing: -.01em; }
.kpi .v small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.kpi .d { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.delta svg { width: 13px; height: 13px; }
.delta.up { color: var(--pos-ink); }
.delta.down { color: var(--neg-ink); }

/* ---------- 控件 ---------- */
.btn {
  height: 34px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: #c9d0dc; color: var(--ink); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.lg { height: 40px; padding: 0 20px; font-size: 14px; }
.input, .select, .textarea {
  height: 34px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px;
  font: inherit; font-size: 13px; background: #fff; color: var(--ink); outline: none; min-width: 0;
}
.select { appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.textarea { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 84, 235, .12); }
.input.search { padding-left: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 11px center; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.query-hint { margin-top: 8px; font-size: 12px; color: var(--muted); }
.query-hint code { font-family: var(--mono); }
.query-error { margin-top: 6px; font-size: 12px; color: var(--neg-ink); }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--muted);
  padding: 10px 14px; background: #f8f9fb; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: #fafbfd; }
.tbl .r { text-align: right; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.muted { color: var(--muted); }
.tbl-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; font-size: 12.5px; color: var(--muted); }

.pager { display: flex; gap: 4px; }
.pg {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font: inherit; font-size: 12.5px; display: grid; place-items: center;
}
.pg:hover { border-color: #c9d0dc; color: var(--ink); }
.pg.on { background: var(--primary-soft); border-color: #c7d2fe; color: var(--primary); font-weight: 600; }
.pg.dis { opacity: .45; pointer-events: none; }

/* ---------- 小件 ---------- */
.chip {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 4px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.chip.pos { background: var(--pos-soft); color: var(--pos-ink); }
.chip.neg { background: var(--neg-soft); color: var(--neg-ink); }
.chip.neu { background: var(--neu-soft); color: var(--neu-ink); }
.chip.pri { background: var(--primary-soft); color: var(--primary); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.out { background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.meter { display: inline-block; width: 56px; height: 5px; border-radius: 3px; background: var(--line-2); overflow: hidden; vertical-align: middle; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.pred { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.miss { color: var(--neg-ink); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }

.bar-track { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }

.code {
  background: #0f172a; color: #e2e8f0; font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
  padding: 12px 96px 12px 14px; border-radius: 8px; overflow-x: auto; white-space: pre;
}
.code-wrap { position: relative; }
.code-wrap .btn { position: absolute; right: 8px; top: 8px; background: #1e293b; border-color: #334155; color: #cbd5e1; }
.code-wrap .btn:hover { background: #273449; color: #fff; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.list li:last-child { border-bottom: none; }
.list .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }

/* ---------- 标注工作台 ---------- */
.work { display: grid; grid-template-columns: 280px minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.sample {
  min-height: 260px; padding: 36px 40px; display: flex; align-items: center;
  font-size: 21px; line-height: 1.9; letter-spacing: .01em;
}
.sample .id { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 18px; letter-spacing: 0; }
.label-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 20px 18px; }
.lbtn {
  height: 96px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer;
  font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.lbtn strong { font-size: 15px; font-weight: 600; }
.lbtn kbd {
  font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 6px; background: #f8f9fb;
}
.lbtn.pos { border-top: 3px solid var(--pos); } .lbtn.pos strong { color: var(--pos-ink); }
.lbtn.neu { border-top: 3px solid var(--neu); } .lbtn.neu strong { color: var(--neu-ink); }
.lbtn.neg { border-top: 3px solid var(--neg); } .lbtn.neg strong { color: var(--neg-ink); }
.lbtn:hover { background: #fafbfd; border-color: var(--primary); }
.lbtn:active { transform: translateY(1px); }
.work-foot { display: flex; align-items: center; justify-content: space-between; padding: 0 20px 18px; font-size: 12.5px; color: var(--muted); }

/* ---------- 预测 ---------- */
.predict { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.predict .textarea { width: 100%; min-height: 170px; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chips button {
  height: 28px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line); background: #fff;
  font: inherit; font-size: 12.5px; color: var(--ink-2); cursor: pointer; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chips button:hover { border-color: var(--primary); color: var(--primary); }
.verdict { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.verdict .big { font-size: 30px; font-weight: 600; letter-spacing: -.01em; }
.verdict .conf { font-size: 12.5px; color: var(--muted); }
.prob { display: grid; grid-template-columns: 48px 1fr 52px; align-items: center; gap: 12px; padding: 7px 0; font-size: 13px; }
.prob-track { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.prob-track i { display: block; height: 100%; border-radius: 4px; transition: width .4s ease; }
.prob .v { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.explained {
  margin-top: 4px; padding: 18px 20px; border-radius: 8px; background: #f8f9fb;
  font-size: 17px; line-height: 2.1;
}
.hl { padding: 1px 0; border-radius: 3px; }
.hl.pos { background: rgba(22, 163, 74, .16); box-shadow: inset 0 -2px 0 rgba(22, 163, 74, .45); }
.hl.neg { background: rgba(229, 72, 77, .14); box-shadow: inset 0 -2px 0 rgba(229, 72, 77, .45); }
.hl.neu { background: rgba(47, 84, 235, .14); box-shadow: inset 0 -2px 0 rgba(47, 84, 235, .45); }
.sub-t { font-size: 12.5px; color: var(--muted); margin: 18px 0 6px; }
.hl-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.hl-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.placeholder { padding: 60px 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 发布时间线 ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 1px; background: var(--line); }
.rel { position: relative; padding: 4px 0 22px; }
.rel::before {
  content: ""; position: absolute; left: -21px; top: 10px; width: 9px; height: 9px; border-radius: 50%;
  background: #fff; border: 2px solid #c9d0dc;
}
.rel.current::before { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.rel-head { display: flex; align-items: center; gap: 10px; }
.rel-head .v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rel .d { font-size: 12px; color: var(--muted); margin-left: auto; }
.rel .img { margin: 8px 0 6px; word-break: break-all; }
.rel ul { margin: 8px 0 0; padding-left: 16px; font-size: 13px; color: var(--ink-2); }
.rel ul li { margin: 3px 0; }

@media (max-width: 1200px) {
  .c-3 { grid-column: span 6; } .c-4 { grid-column: span 6; } .c-5 { grid-column: span 6; }
  .predict { grid-template-columns: 1fr; }
  .work { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 64px minmax(0, 1fr); }
  .brand, .nav a span, .nav-group, .proj div { display: none; }
  .brand { justify-content: center; padding: 18px 0; }
  .nav a { justify-content: center; padding: 0; }
  .side-foot { display: none; }
  .c-3, .c-4, .c-5, .c-6, .c-7, .c-8, .c-9 { grid-column: span 12; }
  .content { padding: 16px; }
}
