/* ============================================================
   渔业统计年鉴 · 智能数据工作台 — 设计系统
   ============================================================ */
:root {
  --bg: #eef1f6;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --line: #e3e8f0;
  --ink: #16233a;
  --ink-2: #3d4c66;
  --muted: #7b8aa3;
  --brand: #0e5fd8;
  --brand-weak: #e8f0fe;
  --teal: #0aa2a2;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --danger: #b91c1c;
  --shadow: 0 1px 2px rgba(22,35,58,.05), 0 4px 16px rgba(22,35,58,.06);
  --radius: 12px;
  --sidebar-w: 232px;
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
/* display 显式设置会覆盖 hidden 属性，需显式还原 */
[hidden] { display: none !important; }

/* ===== 布局骨架 ===== */
.shell { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0c1a30 0%, #0f2544 100%);
  color: #cfe0f5;
  display: flex; flex-direction: column;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(135deg, #1d6ee0, #0aa2a2);
  display: grid; place-items: center;
  font-size: 20px; font-weight: 700; color: #fff;
  box-shadow: 0 4px 12px rgba(13, 94, 216, .35);
}
.brand-name { font-size: 15px; font-weight: 600; color: #fff; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: #8fa8c9; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px;
  color: #b9cbe4; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(29,110,224,.28); color: #fff; font-weight: 600; }
.nav-ico { width: 18px; text-align: center; opacity: .9; }
.nav-badge {
  margin-left: auto; background: #d97706; color: #fff;
  font-size: 10px; padding: 1px 7px; border-radius: 99px;
}
.sidebar-foot { margin-top: auto; padding: 0 8px; }
.cov-badge {
  display: inline-block; font-size: 11px; color: #9fd6c0;
  background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.25);
  padding: 4px 10px; border-radius: 99px; margin-bottom: 10px;
}
.foot-note { font-size: 10.5px; line-height: 1.7; color: #64809f; }

/* ===== 通用视图 ===== */
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.view-head { padding: 22px 30px 8px; }
.view-head h2 { margin: 0 0 4px; font-size: 21px; }
.view-head p { margin: 0; color: var(--muted); font-size: 13px; }

/* ===== 问答视图 ===== */
.view-ask { height: 100vh; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 26px 0 10px; }
.chat-inner, .welcome { max-width: 880px; margin: 0 auto; padding: 0 30px; }

.welcome-hero h1 { font-size: 30px; margin: 10px 0 10px; letter-spacing: 1px; }
.welcome-hero p { color: var(--ink-2); margin: 0 0 22px; max-width: 640px; line-height: 1.8; }
.tier-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.tier-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tier-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c6d6f0; }
.tier-tag { font-size: 11px; font-weight: 700; letter-spacing: .5px; margin-bottom: 8px; }
.tier-tag.t1 { color: var(--brand); }
.tier-tag.t2 { color: var(--teal); }
.tier-tag.t3 { color: var(--amber); }
.tier-q { font-size: 14.5px; font-weight: 600; line-height: 1.5; margin-bottom: 8px; }
.tier-desc { font-size: 12px; color: var(--muted); }
.hot-block { margin-bottom: 30px; }
.hot-title { font-size: 12px; color: var(--muted); margin-bottom: 10px; letter-spacing: 1px; }
.hot-list { display: flex; flex-wrap: wrap; gap: 8px; }
.hot-chip {
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-2);
  font-size: 12.5px; padding: 6px 13px; border-radius: 99px; cursor: pointer;
  transition: all .15s;
}
.hot-chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-weak); }

/* 对话流 */
.msg-user { display: flex; justify-content: flex-end; margin: 18px 0 10px; }
.msg-user .bubble {
  background: var(--brand); color: #fff;
  padding: 10px 16px; border-radius: 14px 14px 3px 14px;
  font-size: 14.5px; max-width: 70%;
  box-shadow: 0 2px 8px rgba(14,95,216,.25);
}
.msg-bot { margin: 6px 0 22px; }

.answer-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.answer-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted);
}
.answer-type { font-weight: 700; }
.answer-type.at-faq { color: var(--ok); }
.answer-type.at-fast { color: var(--brand); }
.answer-type.at-nlq { color: #7c3aed; }
.answer-body { padding: 16px 18px 6px; font-size: 14.5px; line-height: 1.9; }
.answer-body strong { color: var(--brand); }
.answer-chart { height: 360px; padding: 6px 10px 2px; }
.answer-table-wrap { padding: 0 18px 8px; }
.data-table { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.data-table th, .data-table td { border: 1px solid var(--line); padding: 5px 10px; text-align: right; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th { background: var(--panel-2); color: var(--ink-2); font-weight: 600; }
.answer-suggest { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 18px 14px; }
.suggest-chip {
  font-size: 12px; color: var(--brand); background: var(--brand-weak);
  border: 1px solid #d4e3fb; padding: 4px 12px; border-radius: 99px; cursor: pointer;
}
.suggest-chip:hover { background: #d9e8fc; }
.answer-source {
  padding: 9px 18px; border-top: 1px dashed var(--line);
  font-size: 11px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap;
}
.src-verified { color: var(--ok); }

/* 解读卡（问答内附 / 探索页） */
.insight-block { padding: 4px 0 2px; }
.insight-lead {
  font-size: 12.5px; color: var(--muted); font-weight: 600;
  padding: 10px 18px 6px; display: flex; align-items: center; gap: 7px;
  border-top: 1px dashed var(--line); margin-top: 8px;
}
.insight-lead::before { content: "◆"; color: var(--amber); font-size: 10px; }
.insight-cards { padding: 0 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.explore-insights { padding: 0 0 6px; }
.explore-insights .insight-lead { padding: 12px 20px 6px; }
.explore-insights .insight-cards { padding: 0 20px 14px; }
.insight-card {
  border: 1px solid #f1dfb6; background: #fffdf5;
  border-radius: 10px; padding: 12px 14px;
}
.insight-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.insight-card-title { font-weight: 700; font-size: 13.5px; color: var(--amber); flex: 1; }
.insight-card-sum { font-size: 13px; line-height: 1.8; color: var(--ink-2); }
.insight-more { font-size: 12px; margin-top: 6px; align-self: flex-start; }

/* 状态徽标 */
.pill { font-size: 10.5px; padding: 2px 9px; border-radius: 99px; font-weight: 600; white-space: nowrap; }
.pill-draft { background: var(--amber-bg); color: var(--amber); border: 1px solid #f3e0ac; }
.pill-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #bbe7c8; }

/* 输入条 */
.chat-input-bar { padding: 12px 30px 18px; background: linear-gradient(transparent, var(--bg) 30%); }
.chat-input-wrap {
  max-width: 880px; margin: 0 auto; display: flex; gap: 10px;
  background: var(--panel); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 8px 8px 8px 18px;
  box-shadow: var(--shadow); transition: border-color .15s;
}
.chat-input-wrap:focus-within { border-color: var(--brand); }
.chat-input-wrap input {
  flex: 1; border: none; outline: none; font-size: 15px; background: transparent; color: var(--ink);
}
.ask-btn {
  background: var(--brand); color: #fff; border: none; cursor: pointer;
  padding: 10px 26px; border-radius: 10px; font-size: 14.5px; font-weight: 600;
  transition: background .15s;
}
.ask-btn:hover { background: #0b4fb5; }
.ask-btn:disabled { background: #9db8e3; cursor: wait; }
.input-hint { max-width: 880px; margin: 8px auto 0; font-size: 11px; color: var(--muted); text-align: center; }

/* loading */
.thinking { display: flex; gap: 8px; align-items: center; padding: 14px 4px; color: var(--muted); font-size: 13px; }
.thinking .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); animation: blink 1.2s infinite; }
.thinking .dot:nth-child(2) { animation-delay: .2s; }
.thinking .dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .25; } 40% { opacity: 1; } }

/* ===== 探索视图 ===== */
.view-explore { padding-bottom: 30px; }
.explore-panel { margin: 16px 30px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.explore-steps {
  padding: 12px 20px; margin-bottom: 2px;
  font-size: 13px; color: var(--ink-2); line-height: 1.8;
  background: linear-gradient(90deg, var(--brand-weak), transparent);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}
.explore-steps b { color: var(--brand); }
.explore-controls { padding: 18px 20px 8px; border-bottom: 1px solid var(--line); }
.ctrl-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ctrl-row > label { font-size: 12px; color: var(--muted); font-weight: 600; }
.ctrl-row select {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
  font-size: 13px; color: var(--ink); background: #fff; outline: none; min-width: 140px;
}
.ctrl-row select:focus { border-color: var(--brand); }
.dim { color: var(--muted); font-size: 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px; padding: 4px 12px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); transition: all .12s;
  user-select: none;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: none; background: #fff; padding: 6px 16px; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.seg button.active { background: var(--brand); color: #fff; }
.explore-chart { height: 480px; padding: 8px 6px 0; }
.explore-source { padding: 8px 20px 14px; font-size: 11px; color: var(--muted); }

/* ===== 渔业问答子标签 ===== */
.qa-tabs { display: flex; gap: 4px; padding: 0 30px; margin-top: 4px;
  border-bottom: 1px solid var(--line); }
.qa-tab { border: none; background: transparent; padding: 9px 18px; font-size: 14px;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
  font-weight: 600; }
.qa-tab:hover { color: var(--ink); }
.qa-tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ===== 最佳答案视图 ===== */
.view-best { padding-bottom: 40px; }
.best-toolbar { padding: 10px 30px 4px; }
.best-search {
  width: 100%; max-width: 560px; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 14px; font-size: 13.5px; color: var(--ink); background: #fff; outline: none;
}
.best-search:focus { border-color: var(--brand); }
.best-list { margin: 14px 30px 0; display: flex; flex-direction: column; gap: 10px; }
.best-item {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 18px; cursor: pointer;
  transition: border-color .15s, transform .12s;
}
.best-item:hover { border-color: #c6d6f0; transform: translateX(2px); }
.best-item-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 5px; }
.best-qid { font-size: 12px; font-weight: 800; color: var(--teal); }
.best-part { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); padding: 1px 8px; border-radius: 99px; }
.best-q { font-size: 14.5px; font-weight: 700; }
.best-item .models { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.model-badge { font-size: 11px; background: var(--brand-bg); color: var(--brand);
  border: 1px solid #cfe0fb; padding: 1.5px 9px; border-radius: 99px; font-weight: 600; }

/* 渔业问答条目（统一列表） */
.qa-item { cursor: pointer; padding: 10px 14px; border-radius: 8px;
  border-bottom: 1px solid var(--line); transition: background .12s; }
.qa-item:hover { background: var(--brand-bg); }
.qa-item-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qa-item-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.mini-tag { font-size: 10.5px; color: var(--muted); background: #f0f3f8;
  padding: 1px 7px; border-radius: 99px; }
.mini-tag.ins { color: var(--brand); background: var(--brand-bg); }
.qa-years { font-size: 10.5px; color: var(--muted); margin-left: 6px; }
.best-detail-mask { position: fixed; inset: 0; background: rgba(10,20,40,.45);
  display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 26px; }
.best-detail { background: var(--panel); border-radius: 14px; width: min(920px, 100%);
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(10,20,40,.3); }
.best-detail-head { position: sticky; top: 0; background: var(--panel); z-index: 2;
  padding: 20px 26px 12px; border-bottom: 1px solid var(--line); }
.best-detail-head h3 { margin: 8px 0 0; font-size: 17px; line-height: 1.5; }
.best-detail-body { padding: 16px 26px 28px; }
.ans-block { margin-bottom: 22px; }
.ans-block-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ans-section { margin: 14px 0 6px; }
.ans-section-tag { display: inline-block; font-size: 11px; font-weight: 700; color: #fff;
  background: var(--teal); padding: 2px 10px; border-radius: 6px; margin-bottom: 6px; }
.md { font-size: 13.8px; line-height: 1.9; color: var(--ink-2); }
.md h3, .md h4 { color: var(--ink); margin: 12px 0 6px; font-size: 14px; }
.md table { border-collapse: collapse; font-size: 12.6px; margin: 10px 0; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; }
.md th { background: var(--panel-2); white-space: nowrap; }
.md strong { color: var(--brand); }
.md ul, .md ol { padding-left: 22px; margin: 6px 0; }
.md li { margin: 3px 0; }

/* ===== 解读时间轴 ===== */
.view-insights { padding-bottom: 40px; }
.insights-toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px 30px 4px; }
.ins-status-legend { display: flex; gap: 8px; margin-left: auto; }
.timeline { margin: 14px 30px 0; position: relative; padding-left: 26px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(#c8d7f2, #dbe6f7);
}
.tl-item { position: relative; margin-bottom: 14px; }
.tl-item::before {
  content: ""; position: absolute; left: -25px; top: 22px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 1px #c8d7f2;
}
.tl-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; cursor: pointer;
  transition: border-color .15s, transform .12s;
}
.tl-card:hover { border-color: #c6d6f0; transform: translateX(2px); }
.tl-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.tl-year { font-size: 12px; font-weight: 800; color: var(--brand); letter-spacing: .5px; }
.tl-type { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); padding: 1px 8px; border-radius: 99px; }
.tl-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.tl-summary { font-size: 13px; color: var(--ink-2); line-height: 1.8; }

/* ===== 说明视图 ===== */
.view-about { padding-bottom: 40px; }
.about-grid { margin: 16px 30px; display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.about-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.about-card h3 { margin: 0 0 10px; font-size: 15px; }
.about-card p, .about-card li { font-size: 13px; color: var(--ink-2); line-height: 1.9; }
.about-card ul { padding-left: 18px; margin: 6px 0; }
.about-card .mono { font-family: Consolas, Menlo, monospace; font-size: 12px; background: var(--panel-2); padding: 2px 6px; border-radius: 5px; }

/* ===== 弹层 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(10,20,40,.45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 30px;
}
.modal {
  background: var(--panel); border-radius: 14px; max-width: 780px; width: 100%;
  max-height: 86vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(10,20,40,.3);
}
.modal-head {
  position: sticky; top: 0; background: var(--panel);
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 24px 12px; border-bottom: 1px solid var(--line); z-index: 2;
}
.modal-head h3 { margin: 8px 0 0; font-size: 17px; line-height: 1.5; }
.icon-btn { border: none; background: var(--panel-2); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 14px; }
.modal-body { padding: 18px 24px 26px; }
.modal-body h4 { font-size: 13.5px; color: var(--brand); margin: 18px 0 8px; }
.modal-body p { font-size: 13.5px; line-height: 2; color: var(--ink-2); margin: 8px 0; }
.ev-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.ev-table td, .ev-table th { border: 1px solid var(--line); padding: 6px 10px; text-align: right; }
.ev-table td:first-child, .ev-table th:first-child { text-align: left; }
.ev-table th { background: var(--panel-2); }
.review-row { margin-top: 20px; padding-top: 14px; border-top: 1px dashed var(--line); display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); }
.review-btn { border: 1px solid var(--ok); background: var(--ok-bg); color: var(--ok); border-radius: 8px; padding: 6px 14px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.review-btn:hover { background: #c9f0d5; }
.src-list { font-size: 12.5px; color: var(--muted); line-height: 2; padding-left: 18px; margin: 6px 0; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static; flex-direction: row;
    align-items: center; padding: 10px 14px; gap: 8px;
  }
  .brand { padding: 0 8px 0 0; }
  .brand-text { display: none; }
  .nav { flex-direction: row; margin: 0; flex: 1; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { padding: 8px 10px; white-space: nowrap; flex: 0 0 auto; }
  .sidebar-foot { display: none; }
  .tier-cards { grid-template-columns: 1fr; }
  .view-head, .insights-toolbar { padding-left: 16px; padding-right: 16px; }
  .explore-panel, .about-grid, .timeline { margin-left: 16px; margin-right: 16px; }
  .chat-inner, .welcome { padding: 0 16px; }
  .best-toolbar { padding-left: 16px; padding-right: 16px; }
  .best-list { margin-left: 16px; margin-right: 16px; }
  /* 移动端：页面级滚动 + 输入条 sticky 跟随 */
  .view-ask { height: auto; min-height: calc(100vh - 62px); }
  .chat-scroll { overflow: visible; }
  .chat-input-bar {
    position: sticky; bottom: 0;
    background: var(--bg);
  }
  .answer-chart { height: 280px; }
}
