/* =========================================================
   净值分析台 · 设计系统
   专业金融终端风格：近白底 + 深墨蓝 · 细边框 · 等宽数字
   ========================================================= */

:root {
  /* 主色 */
  --primary: #16324F;
  --primary-2: #2E6FA7;
  --primary-3: #4C8FCB;
  --primary-soft: #EAF2FA;

  /* 背景与表面 */
  --bg: #F6F8FA;
  --surface: #FFFFFF;
  --surface-2: #EEF3F8;
  --line: #E3EAF1;
  --line-strong: #D3DEE9;

  /* 文字 */
  --ink: #12212F;
  --ink-2: #4A5A6A;
  --ink-3: #8A98A6;

  /* 功能色：涨红跌绿 */
  --up: #C0392B;
  --up-soft: #FBEBE9;
  --down: #1E7B4F;
  --down-soft: #E9F5EF;
  --warn: #D89A2A;

  /* 圆角 / 阴影 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --sh-1: 0 1px 2px rgba(16, 33, 51, .04), 0 1px 1px rgba(16, 33, 51, .03);
  --sh-2: 0 4px 18px rgba(16, 33, 51, .06), 0 1px 3px rgba(16, 33, 51, .04);
  --sh-3: 0 18px 46px rgba(16, 33, 51, .13);

  --ease: cubic-bezier(.22, .61, .36, 1);
  --font: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

/* 关键：CSS 里给这些容器设了 display，必须让 hidden 属性优先 */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 460px;
  background:
    radial-gradient(900px 300px at 12% -10%, rgba(76, 143, 203, .13), transparent 70%),
    radial-gradient(700px 260px at 88% -18%, rgba(22, 50, 79, .10), transparent 72%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ================= 顶栏 ================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 28px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(140deg, #23496F 0%, #16324F 55%, #0E2237 100%);
  box-shadow: 0 6px 16px rgba(22, 50, 79, .28), inset 0 1px 0 rgba(255, 255, 255, .22);
  flex: none;
}

.brand-text h1 {
  font-size: 16px;
  line-height: 1.25;
  color: var(--primary);
}

.brand-text p {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.privacy-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #DCEBE2;
  background: #F2FAF6;
  color: #1E7B4F;
  font-size: 11.5px;
  letter-spacing: .02em;
}
.privacy-chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #1E7B4F;
  box-shadow: 0 0 0 3px rgba(30, 123, 79, .14);
  animation: pulse 2.6s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(30, 123, 79, .10); }
  50% { box-shadow: 0 0 0 5px rgba(30, 123, 79, .04); }
}

/* ================= 按钮 ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 12.5px; font-weight: 500;
  transition: transform .12s var(--ease), background .16s, box-shadow .18s, border-color .16s, color .16s;
  white-space: nowrap;
  outline: none;
}
.btn:focus-visible { box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(76, 143, 203, .55); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .42; cursor: not-allowed; }

.btn.primary {
  background: linear-gradient(180deg, #22486E, #16324F);
  color: #fff;
  box-shadow: 0 4px 12px rgba(22, 50, 79, .22), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.btn.primary:hover:not([disabled]) { background: linear-gradient(180deg, #2A5680, #1A3A5B); box-shadow: 0 8px 20px rgba(22, 50, 79, .28); }

.btn.ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.btn.ghost:hover:not([disabled]) { border-color: var(--primary-3); color: var(--primary); background: #FBFDFF; }

.btn.lg { height: 40px; padding: 0 22px; font-size: 13.5px; border-radius: 10px; }
.btn.full { width: 100%; }

.icon-btn {
  height: 24px; padding: 0 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: .04em;
  transition: .16s;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary-3); background: #F7FBFF; }

/* ================= 页面容器 ================= */
.page {
  position: relative;
  z-index: 1;
  max-width: 1560px;
  margin: 0 auto;
  padding: 26px 28px 44px;
}

/* ================= 空状态 ================= */
.empty-wrap { animation: rise .5s var(--ease) both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 348px;
  padding: 40px 24px;
  border-radius: var(--r-xl);
  border: 2px dashed #BBD3E7;
  background:
    radial-gradient(600px 220px at 50% 0%, rgba(76, 143, 203, .08), transparent 70%),
    linear-gradient(180deg, #FFFFFF, #FBFDFF);
  box-shadow: var(--sh-2);
  transition: border-color .2s, background .2s, transform .2s var(--ease), box-shadow .3s;
  outline: none;
  overflow: hidden;
  cursor: pointer;
}

.dropzone::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7);
  pointer-events: none;
}

.dz-glow {
  position: absolute;
  width: 520px; height: 520px;
  top: -260px; left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76, 143, 203, .16), transparent 62%);
  animation: breathe 2.8s var(--ease) infinite;
  pointer-events: none;
}
@keyframes breathe {
  0%, 100% { opacity: .55; transform: translateX(-50%) scale(.94); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.06); }
}

.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--primary-3);
  background:
    radial-gradient(600px 220px at 50% 0%, rgba(76, 143, 203, .13), transparent 70%),
    linear-gradient(180deg, #FFFFFF, #F7FBFF);
  transform: translateY(-2px);
  box-shadow: 0 22px 48px rgba(22, 50, 79, .11);
}
.dropzone.dragging {
  border-style: solid;
  border-color: var(--primary-2);
  background: var(--primary-soft);
}
.dropzone.dragging .dz-icon { transform: translateY(-4px); }

.dz-icon {
  width: 68px; height: 68px;
  display: grid; place-items: center;
  border-radius: 20px;
  color: var(--primary-2);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(22, 50, 79, .10);
  transition: transform .25s var(--ease);
  margin-bottom: 4px;
}

.dropzone h2 { font-size: 22px; color: var(--primary); letter-spacing: -.02em; }
.dz-sub { margin: 0; color: var(--ink-2); font-size: 13px; }
.dz-sub b { color: var(--primary-2); font-weight: 600; }

.dz-formats { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 6px 0 4px; }
.fmt-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 11.5px;
}
.fmt-pill i {
  font-style: normal;
  font-weight: 600;
  color: var(--primary-2);
  padding-right: 7px;
  border-right: 1px solid var(--line);
  line-height: 1;
}

.dz-actions { display: flex; gap: 10px; margin-top: 10px; }
.dz-foot { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-3); }

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.preview-card {
  position: relative;
  padding: 18px 18px 16px;
  border-radius: var(--r-lg);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .22s, border-color .2s;
}
.preview-card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: #D8E6F2; }
.preview-card::before {
  content: ""; position: absolute; left: 0; top: 0; width: 3px; height: 100%;
  background: linear-gradient(180deg, var(--primary-3), transparent);
  opacity: .5;
}
.pv-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--primary-3);
  letter-spacing: .12em;
  margin-bottom: 6px;
}
.preview-card h4 { font-size: 13.5px; color: var(--primary); margin-bottom: 4px; }
.preview-card p { margin: 0; font-size: 12px; color: var(--ink-2); line-height: 1.65; }

/* ================= 文件信息条 ================= */
.filebar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 16px;
  margin-bottom: 14px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .86);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  animation: rise .4s var(--ease) both;
}
.filebar-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.file-ico {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary-2);
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  border: 1px solid #D9E7F3;
}
.file-meta { display: flex; flex-direction: column; min-width: 0; }
.file-meta strong {
  font-size: 13px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw;
}
.file-meta span { font-size: 11.5px; color: var(--ink-3); }
.filebar-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 11px;
}
.tag b { color: var(--primary); font-weight: 600; }
.tag.warn { background: #FDF6E7; border-color: #F1E0BC; color: #94650F; }

/* ================= 布局 ================= */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 312px;
  gap: 14px;
  align-items: start;
}
.main-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.side-col {
  display: flex; flex-direction: column; gap: 14px;
}

/* ================= 卡片 ================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: 16px 18px;
  animation: rise .45s var(--ease) both;
  transition: box-shadow .22s, border-color .22s;
}
.card:hover { box-shadow: var(--sh-2); }

.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.card-head.tight { margin-bottom: 12px; }
.card-head h3 { font-size: 13.5px; color: var(--primary); letter-spacing: .01em; }
.card-tools { display: flex; align-items: center; gap: 8px; }
.card-hint { font-size: 11.5px; color: var(--ink-3); }
.card-hint b { color: var(--ink-2); font-weight: 600; }
.legend-note { font-size: 11.5px; color: var(--ink-3); }

/* ================= KPI 卡 ================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.kpi {
  position: relative;
  padding: 14px 15px 13px;
  border-radius: var(--r-md);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .22s, border-color .22s;
  animation: rise .5s var(--ease) both;
}
.kpi::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary-3), rgba(76, 143, 203, 0));
  opacity: 0;
  transition: opacity .2s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: #D8E6F2; }
.kpi:hover::before { opacity: 1; }

.kpi-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--ink-3);
  letter-spacing: .02em;
}
.q {
  width: 13px; height: 13px;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  border: 1px solid #D5E0EA;
  color: #93A3B2;
  font-size: 9px; font-weight: 700; font-style: normal;
  cursor: help;
  flex: none;
}
.q:hover { color: var(--primary-2); border-color: var(--primary-3); }

.kpi-val {
  margin-top: 6px;
  font-size: 27px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.kpi-val.pos { color: var(--up); }
.kpi-val.neg { color: var(--down); }
.kpi-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi-spark { display: block; width: 100%; height: 22px; margin-top: 8px; opacity: .9; }

/* ================= 区间收益 ================= */
.period-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.period-item {
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, #FBFDFF, #F6F9FC);
  border: 1px solid var(--line);
  transition: border-color .18s, background .18s;
}
.period-item:hover { border-color: #CFE0EE; background: #fff; }
.period-item span { display: block; font-size: 11px; color: var(--ink-3); }
.period-item strong {
  display: block; margin-top: 3px;
  font-size: 17px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.period-item strong.pos { color: var(--up); }
.period-item strong.neg { color: var(--down); }
.period-item strong.na { color: var(--ink-3); font-size: 13px; font-weight: 500; }

/* ================= 图表 ================= */
.chart { width: 100%; height: 360px; }
.chart-sm { height: 244px; }
.chart-lg { height: 420px; }
.chart-card .chart { height: 380px; }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ================= 明细表 ================= */
.detail-wrap { overflow-x: auto; }
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.detail-table th, .detail-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #F0F4F8;
  text-align: left;
  vertical-align: top;
}
.detail-table th {
  font-weight: 500; color: var(--ink-3);
  background: #FBFDFF;
  font-size: 11.5px;
  letter-spacing: .02em;
  position: sticky; top: 0;
}
.detail-table td:first-child { color: var(--ink-2); width: 26%; }
.detail-table td.v {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
}
.detail-table td.v.pos { color: var(--up); }
.detail-table td.v.neg { color: var(--down); }
.detail-table tr:last-child td { border-bottom: 0; }
.detail-table tr:hover td { background: #FBFDFF; }
.detail-section td {
  background: #F6F9FC;
  font-size: 11px;
  color: var(--primary-2);
  font-weight: 600;
  letter-spacing: .06em;
  padding: 6px 10px;
}

/* ================= 侧栏表单 ================= */
.side-card { padding: 14px 15px; }

.field { margin-bottom: 11px; }
.field:last-of-type { margin-bottom: 0; }
.field label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; color: var(--ink-3);
  margin-bottom: 5px;
  letter-spacing: .02em;
}
.field label b { color: var(--primary-2); font-weight: 600; font-variant-numeric: tabular-nums; }

select, input[type="date"] {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  transition: border-color .16s, box-shadow .16s;
  outline: none;
}
select:hover, input[type="date"]:hover { border-color: #BFD4E5; }
select:focus, input[type="date"]:focus {
  border-color: var(--primary-3);
  box-shadow: 0 0 0 3px rgba(76, 143, 203, .14);
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 99px;
  background: linear-gradient(90deg, var(--primary-3), #DCE6EF);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary-2);
  box-shadow: 0 2px 6px rgba(22, 50, 79, .22);
  cursor: pointer;
  transition: transform .12s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }

.side-note {
  margin: 9px 0 0;
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.55;
}
.side-btns { display: flex; flex-direction: column; gap: 7px; }

/* 基准上传 */
.bench-drop {
  display: flex; align-items: center; gap: 8px;
  min-height: 56px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px dashed #CADCEA;
  background: #FBFDFF;
  color: var(--ink-3);
  font-size: 11.5px;
  cursor: pointer;
  transition: .18s;
  outline: none;
}
.bench-drop:hover, .bench-drop:focus-visible, .bench-drop.dragging {
  border-color: var(--primary-3); background: var(--primary-soft); color: var(--primary-2);
}
.bench-plus {
  width: 22px; height: 22px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line-strong);
  font-size: 14px; line-height: 1;
  color: var(--primary-2);
}
.bench-result {
  margin-top: 9px;
  padding: 9px 10px;
  border-radius: 9px;
  background: linear-gradient(180deg, #F8FBFE, #F2F7FC);
  border: 1px solid #E1ECF5;
  font-size: 11.5px;
  color: var(--ink-2);
}
.bench-row { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.bench-row b { font-variant-numeric: tabular-nums; }
.bench-row b.pos { color: var(--up); }
.bench-row b.neg { color: var(--down); }

/* ================= 页脚 ================= */
.page-foot {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; gap: 12px;
  max-width: 1560px; margin: 0 auto;
  padding: 0 28px 26px;
  font-size: 11px; color: var(--ink-3);
}

/* ================= 拖拽遮罩 ================= */
.drag-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  background: rgba(22, 50, 79, .38);
  backdrop-filter: blur(3px);
  animation: fade .16s var(--ease);
}
.drag-overlay-inner {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 44px 64px;
  border-radius: var(--r-xl);
  background: rgba(255, 255, 255, .96);
  border: 2px dashed var(--primary-3);
  box-shadow: var(--sh-3);
}
.drag-overlay-inner p { margin: 0; font-size: 14px; font-weight: 600; color: var(--primary); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ================= 解析进度 ================= */
.busy {
  position: fixed; inset: 0; z-index: 95;
  display: grid; place-items: center;
  background: rgba(246, 248, 250, .72);
  backdrop-filter: blur(4px);
}
.busy-card {
  width: 320px;
  padding: 20px 22px;
  border-radius: var(--r-lg);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--sh-3);
  text-align: center;
}
.busy-bar {
  height: 3px; border-radius: 99px;
  background: #EDF2F7;
  overflow: hidden;
  position: relative;
}
.busy-bar i {
  position: absolute; inset: 0 auto 0 0;
  width: 38%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary-3), var(--primary-2));
  animation: slide 1.1s var(--ease) infinite;
}
@keyframes slide {
  0% { left: -40%; }
  100% { left: 100%; }
}
.busy-card p { margin: 12px 0 0; font-size: 12.5px; color: var(--ink-2); }

/* ================= 抽屉 ================= */
.drawer-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(18, 33, 47, .32);
  backdrop-filter: blur(2px);
  display: flex; justify-content: flex-end;
  animation: fade .18s var(--ease);
}
.drawer {
  width: min(520px, 92vw);
  height: 100%;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px rgba(16, 33, 51, .16);
  display: flex; flex-direction: column;
  animation: slideIn .26s var(--ease);
}
@keyframes slideIn { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h3 { font-size: 14px; color: var(--primary); }
.drawer-body { padding: 16px 20px 28px; overflow-y: auto; }
.gl-item { padding: 12px 0; border-bottom: 1px solid #F0F4F8; }
.gl-item:last-child { border-bottom: 0; }
.gl-item h4 { font-size: 12.5px; color: var(--primary); margin-bottom: 4px; }
.gl-item p { margin: 0; font-size: 12px; color: var(--ink-2); line-height: 1.7; }
.gl-item code {
  display: block; margin-top: 5px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: #37546F;
  background: #F5F9FC;
  border: 1px solid #E4EEF6;
  border-radius: 6px;
  padding: 6px 9px;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* ================= Toast ================= */
.toast {
  position: fixed;
  left: 50%; bottom: 30px;
  transform: translateX(-50%);
  z-index: 120;
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(18, 33, 47, .93);
  color: #fff;
  font-size: 12.5px;
  box-shadow: 0 14px 34px rgba(16, 33, 51, .3);
  animation: toastIn .22s var(--ease);
  max-width: 78vw;
  text-align: center;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ================= 本地档案 ================= */
.btn.sm { padding: 4px 10px; font-size: 11.5px; }
.count-badge {
  display: inline-block; min-width: 17px; height: 17px; margin-left: 6px; padding: 0 5px;
  border-radius: 99px; background: var(--primary); color: #fff;
  font-size: 10.5px; line-height: 17px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 99px;
  font-size: 11px; line-height: 1.7;
  background: #EEF3F8; color: var(--ink-3); border: 1px solid var(--line);
  white-space: nowrap;
}
.chip.ok { background: #EDF7F1; border-color: #CDE8D9; color: #1E7B4F; }
.chip.warn { background: #FDF6E7; border-color: #F1E0BC; color: #94650F; }
.chip.pending::before {
  content: ''; width: 6px; height: 6px; border-radius: 99px;
  background: currentColor; animation: chipPulse 1.1s ease-in-out infinite;
}
@keyframes chipPulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.arch-hint { margin: 0 0 9px; font-size: 11.5px; color: var(--ink-3); line-height: 1.65; }
.arch-hint b { color: var(--primary); font-weight: 600; }
.arch-last {
  display: flex; gap: 6px; align-items: flex-start;
  font-size: 11.5px; color: var(--ink-2); line-height: 1.55;
  background: #F7FAFC; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 9px; margin-bottom: 9px;
  word-break: break-all;
}
.arch-dot {
  width: 6px; height: 6px; border-radius: 99px;
  background: var(--down); margin-top: 5px; flex: none;
}
.arch-path {
  word-break: break-all; overflow-wrap: anywhere; white-space: normal;
  font-family: var(--mono); font-size: 10.5px; line-height: 1.6;
}

.drawer.drawer-wide { width: min(640px, 94vw); }
.arch-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.arch-count { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.arch-sub { margin: 0 0 12px; font-size: 11.5px; color: var(--ink-3); line-height: 1.65; }
.arch-list { display: flex; flex-direction: column; gap: 8px; }
.arch-item {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; background: #fff;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.arch-item:hover { border-color: var(--primary-3); box-shadow: 0 8px 20px rgba(22, 50, 79, .07); }
.arch-item-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.arch-name { font-size: 12.5px; font-weight: 600; color: var(--ink); word-break: break-all; }
.arch-meta {
  margin-top: 4px; font-size: 11px; color: var(--ink-3);
  display: flex; gap: 10px; flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.arch-acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.arch-acts .btn { font-size: 11.5px; padding: 4px 9px; }
.arch-empty { padding: 26px 8px; text-align: center; color: var(--ink-3); font-size: 12px; line-height: 1.9; }
.arch-empty b { color: var(--primary); }
.arch-snap {
  margin: 12px 0 0; padding: 14px 16px;
  background: #F8FBFD; border: 1px solid var(--line); border-radius: 10px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.85; color: var(--ink-2);
  white-space: pre-wrap; word-break: break-word;
  max-height: calc(100vh - 220px); overflow: auto;
}
.btn.danger { color: var(--up); border-color: #EAD3CF; }
.btn.danger:hover { background: #FCF3F1; border-color: #DCB8B1; color: #A8332B; }
.tag.ok { background: #EDF7F1; border-color: #CDE8D9; color: #1E7B4F; }

/* ================= 业绩对比 ================= */
.cmp-page { padding: 18px 0 8px; }
.cmp-layout {
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

/* 左栏：对比对象 */
.cmp-side { position: static; padding: 14px 14px 12px; }
.cmp-side .card-head { margin-bottom: 10px; }
.cmp-search { margin-bottom: 8px; }
.cmp-search input {
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  font-family: inherit;
  color: var(--ink);
  background: #F7FAFC;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.cmp-search input:focus { border-color: var(--primary-3); background: #fff; }
.cmp-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 560px; overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}
.cmp-list::-webkit-scrollbar { width: 6px; }
.cmp-list::-webkit-scrollbar-thumb { background: #D2DEE9; border-radius: 99px; }

.cmp-item {
  position: relative;
  display: block;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px 8px 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color .14s var(--ease), background .14s var(--ease), box-shadow .14s var(--ease);
}
.cmp-item:hover { border-color: var(--primary-3); background: #FBFDFF; }
.cmp-item.on {
  border-color: var(--primary-3);
  background: #F5FAFF;
  box-shadow: inset 3px 0 0 var(--primary-2);
}
.cmp-item.dis { opacity: .55; cursor: not-allowed; }
.cmp-item-top { display: flex; align-items: center; gap: 7px; }
.cmp-item-top input[type="checkbox"] {
  width: 14px; height: 14px; margin: 0; flex: none;
  accent-color: var(--primary-2); cursor: pointer;
}
.cmp-item-name {
  font-size: 12px; font-weight: 600; color: var(--ink);
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmp-item-meta {
  margin: 4px 0 0 21px;
  font-size: 10.5px; color: var(--ink-3);
  display: flex; gap: 8px; flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.cmp-item-sel {
  margin: 7px 0 0 21px;
  width: calc(100% - 21px);
  padding: 4px 7px;
  font-size: 11px;
  font-family: inherit;
  color: var(--ink-2);
  background: #F7FAFC;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}
.cmp-item-sel:focus { border-color: var(--primary-3); }
.cmp-item-err { color: var(--up); font-size: 10.5px; margin-left: 21px; }

/* 右栏 */
.cmp-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cmp-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 12px 16px;
}
.cmp-bar-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cmp-bar-info strong { font-size: 13px; color: var(--primary); }
.cmp-bar-info span { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cmp-bar-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cmp-inline {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink-3);
  white-space: nowrap;
}
.cmp-inline select {
  padding: 4px 8px;
  font-size: 11.5px;
  font-family: inherit;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}
.cmp-inline select:focus { border-color: var(--primary-3); }
.cmp-rf {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px 7px 3px 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.cmp-rf:focus-within { border-color: var(--primary-3); box-shadow: 0 0 0 2px rgba(76,143,203,.14); }
.cmp-rf input {
  width: 42px;
  padding: 0;
  font-size: 11.5px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  text-align: right;
  background: transparent;
  border: 0;
  outline: none;
  -moz-appearance: textfield;
}
.cmp-rf input::-webkit-outer-spin-button,
.cmp-rf input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cmp-rf i { font-style: normal; font-size: 11px; color: var(--ink-3); }

.seg {
  display: inline-flex;
  padding: 2px;
  background: #EEF3F8;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.seg-btn {
  padding: 4px 10px;
  font-size: 11.5px;
  font-family: inherit;
  color: var(--ink-3);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
}
.seg-btn:hover { color: var(--primary); }
.seg-btn.is-on {
  background: #fff; color: var(--primary);
  box-shadow: 0 1px 4px rgba(22, 50, 79, .10);
  font-weight: 600;
}

.cmp-warn {
  padding: 9px 14px;
  font-size: 11.5px; line-height: 1.6;
  color: #8A6318;
  background: #FDF8EC;
  border: 1px solid #F1E3C4;
  border-radius: 10px;
}
.cmp-warn::before { content: '!'; display: inline-block; margin-right: 6px; font-weight: 700; }

.cmp-empty { padding: 54px 20px; }
.cmp-empty-inner { max-width: 460px; margin: 0 auto; text-align: center; }
.cmp-empty-inner h4 { font-size: 14px; color: var(--primary); margin-bottom: 8px; }
.cmp-empty-inner p { font-size: 12px; color: var(--ink-3); line-height: 1.75; margin-bottom: 14px; }
.cmp-empty-acts { display: flex; gap: 8px; justify-content: center; }

/* 指标横向表 */
.cmp-table-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
  border-radius: 0 0 12px 12px;
}
.cmp-table-wrap::-webkit-scrollbar { height: 7px; }
.cmp-table-wrap::-webkit-scrollbar-thumb { background: #D2DEE9; border-radius: 99px; }
.cmp-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cmp-table th, .cmp-table td {
  padding: 9px 12px;
  text-align: right;
  border-bottom: 1px solid #F0F4F8;
}
.cmp-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: #F7FAFC;
  font-size: 11px; font-weight: 600; color: var(--ink-3);
  border-bottom: 1px solid var(--line);
}
.cmp-table th:first-child, .cmp-table td:first-child {
  position: sticky; left: 0; z-index: 1;
  text-align: left;
  background: #fff;
}
.cmp-table thead th:first-child { z-index: 3; background: #F7FAFC; }
.cmp-table tbody tr:hover td { background: #F8FBFF; }
.cmp-table tbody tr:hover td:first-child { background: #F8FBFF; }
.cmp-table td.best {
  background: #EDF7F1 !important;
  color: #17704A;
  font-weight: 600;
  position: relative;
}
.cmp-table td.best::after {
  content: '';
  position: absolute; top: 4px; right: 4px;
  width: 0; height: 0;
  border-top: 6px solid #2E9A66;
  border-left: 6px solid transparent;
}
.cmp-table .cmp-name { display: flex; align-items: center; gap: 7px; max-width: 220px; }
.cmp-dot { width: 8px; height: 8px; border-radius: 99px; flex: none; }
.cmp-table .cmp-nm-txt {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; color: var(--ink);
}
.cmp-table .pos { color: var(--up); }
.cmp-table .neg { color: var(--down); }
.cmp-table .muted { color: var(--ink-3); }
.cmp-table .sub-row td {
  border-bottom: 1px solid var(--line);
  font-size: 10.5px; color: var(--ink-3);
}
.cmp-group th {
  text-align: left;
  font-size: 10.5px; letter-spacing: .04em;
  color: var(--ink-3);
  background: #FBFDFF;
}
.cmp-range { margin-top: 2px; font-size: 10.5px; color: var(--ink-3); font-weight: 400; }
.cmp-chart-empty {
  height: 244px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  font-size: 12px; line-height: 1.9; color: var(--ink-3);
  background: #F8FBFD;
  border: 1px dashed #DDE7F0;
  border-radius: 10px;
  margin: 0 4px 4px;
}
.btn.on {
  background: #EEF3F8;
  color: var(--primary);
  border-color: #D7E4EF;
}

/* ================= 响应式 ================= */
@media (max-width: 1320px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi-val { font-size: 24px; }
}

@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side-col {
    position: static;
    max-height: none;
    overflow: visible;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .period-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .duo { grid-template-columns: 1fr; }
  .preview-grid { grid-template-columns: 1fr; }
  .cmp-layout { grid-template-columns: minmax(0, 1fr); }
  .cmp-list { max-height: 300px; }
  .cmp-bar { align-items: flex-start; }
}

@media (max-width: 760px) {
  .topbar { padding: 0 14px; height: 58px; }
  .brand-text p { display: none; }
  .privacy-chip { display: none; }
  .page { padding: 16px 14px 34px; }
  .dropzone { min-height: 280px; padding: 28px 16px; }
  .dropzone h2 { font-size: 18px; }
  .dz-formats { display: none; }
  .side-col { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-val { font-size: 21px; }
  .period-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart, .chart-card .chart { height: 280px; }
  .chart-sm { height: 240px; }
  .chart-lg { height: 260px; }
  .cmp-bar-tools { gap: 8px; }
  .filebar { flex-direction: column; align-items: flex-start; }
  .filebar-tags { justify-content: flex-start; }
  .file-meta strong { max-width: 68vw; }
  .page-foot { flex-direction: column; gap: 4px; padding: 0 14px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* =========================================================
   在线版 / 移动端增强
   ========================================================= */

/* 安装到桌面按钮：仅在可安装时由 js 显示 */
.install-btn {
  border-color: #C7DDF2;
  color: var(--primary-2);
  background: var(--primary-soft);
}
.install-btn:hover { background: #DCEBF9; border-color: #B4D3EE; }

/* 触屏设备：去掉点击蓝框，放大细小按钮热区 */
@media (hover: none) {
  .btn, .icon-btn, .dropzone { -webkit-tap-highlight-color: transparent; }
  .btn.sm { min-height: 34px; }
}

@media (max-width: 760px) {
  /* 顶栏改为两段式：品牌固定，操作区横向滑动，不被压缩变形 */
  .topbar {
    height: auto;
    min-height: 56px;
    padding:
      calc(6px + env(safe-area-inset-top, 0px))
      max(12px, env(safe-area-inset-right, 0px))
      6px
      max(12px, env(safe-area-inset-left, 0px));
    gap: 8px;
  }
  .brand { flex: 0 0 auto; gap: 9px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
  .brand-text h1 { font-size: 15px; }

  .topbar-actions {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 10px 2px 0;
  }
  .topbar-actions::-webkit-scrollbar { display: none; }
  .topbar-actions .btn {
    flex: 0 0 auto;
    height: 36px;
    padding: 0 12px;
    white-space: nowrap;
  }

  /* 首屏拖拽区：手机上整块可点，并限制竖屏高度 */
  .dropzone { cursor: pointer; }
  .page { padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px)); }
  .page-foot { padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }

  /* 抽屉从底部起，留出安全区 */
  .drawer { max-height: calc(100% - env(safe-area-inset-top, 0px)); }
  .drawer-body { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }

  /* 表格类内容允许横向滑动，避免撑破视口 */
  .card { min-width: 0; }
  .cmp-table-wrap { -webkit-overflow-scrolling: touch; }
}

@media (max-width: 420px) {
  .brand-text h1 { font-size: 14px; }
  .brand-mark { width: 28px; height: 28px; border-radius: 8px; }
  .topbar-actions .btn { height: 34px; padding: 0 10px; font-size: 12px; }
  .kpi-grid { gap: 8px; }
  .page { padding-left: 12px; padding-right: 12px; }
}

/* iOS Safari 地址栏会导致 100vh 抖动，用 dvh 兜底 */
@supports (height: 100dvh) {
  body { min-height: 100dvh; }
  .dropzone { min-height: min(280px, 52dvh); }
  .drawer-mask { height: 100dvh; }
}

/* 真机安装后（独立窗口）不需要再显示安装按钮 */
@media (display-mode: standalone) {
  .install-btn { display: none !important; }
}
