:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #16181d;
  --ink2: #5b6472;
  --ink3: #8b95a5;
  --line: #e6e9ee;
  --brand: #1f6feb;
  --brand-soft: #eaf1fe;
  --warn: #d97706;
  --bad: #dc2626;
  --good: #16a34a;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 14px;
}

button { cursor: pointer; }

.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
}

.login-card h1 {
  font-size: 20px;
  margin: 0 0 6px;
  letter-spacing: -0.2px;
}

.login-card p.sub {
  margin: 0 0 24px;
  color: var(--ink3);
  font-size: 13px;
}

.login-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.login-tabs button {
  flex: 1;
  padding: 9px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  color: var(--ink2);
}

.login-tabs button.on {
  background: var(--brand-soft);
  border-color: #c7dbff;
  color: var(--brand);
  font-weight: 600;
}

/* ---------- 顶栏 ---------- */
.top {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.top-in {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.logo span { color: var(--brand); }

.tabs { display: flex; gap: 4px; flex: 1; }

.tabs button {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  border-radius: 8px;
  color: var(--ink2);
}

.tabs button.on {
  background: #f0f2f5;
  color: var(--ink);
  font-weight: 600;
}

.who {
  color: var(--ink3);
  font-size: 13px;
  white-space: nowrap;
}

.who b { color: var(--ink); }

/* ---------- 布局 ---------- */
.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 14px;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h2 .tag {
  font-size: 11px;
  font-weight: 400;
  color: var(--ink3);
  background: #f4f5f7;
  padding: 2px 7px;
  border-radius: 20px;
}

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: 1.4fr 1fr; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- 指标 ---------- */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }

.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.metric .k { font-size: 12px; color: var(--ink3); margin-bottom: 4px; }
.metric .v { font-size: 22px; font-weight: 650; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.metric .v small { font-size: 12px; font-weight: 400; color: var(--ink3); margin-left: 3px; }

/* ---------- 表单 ---------- */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; color: var(--ink2); margin-bottom: 5px; }

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}

input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 500;
  white-space: nowrap;
  transition: all .15s;
}

.btn:hover { border-color: #cfd6e0; background: #fafbfc; }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.pri:hover { background: #1a5fd0; }
.btn.danger { color: var(--bad); border-color: #f3c9c9; }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }

/* ---------- 计划卡 ---------- */
.camp {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  background: #fff;
}

.camp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.camp-name { font-weight: 600; }
.camp-meta { font-size: 12px; color: var(--ink3); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.camp-meta .mi { white-space: nowrap; }

.pill {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: #f0f2f5;
  color: var(--ink2);
  margin-right: 6px;
}

.pill.ok { background: #e8f7ee; color: var(--good); }
.pill.off { background: #fdeaea; color: var(--bad); }
.pill.bid { background: var(--brand-soft); color: var(--brand); }

.cres {
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  margin-top: 10px;
}

.cres-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.cres-script {
  font-size: 12px;
  color: var(--ink2);
  background: #fafbfc;
  border: 1px solid #f0f2f5;
  border-radius: 6px;
  padding: 8px 10px;
  max-height: 72px;
  overflow: hidden;
  white-space: pre-wrap;
}

/* ---------- 诊断理由 ---------- */
.diag {
  background: #fffbf2;
  border: 1px solid #f6e3c0;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 12px;
}

.diag h4 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--warn);
  font-weight: 600;
  letter-spacing: .2px;
}

.diag ul { margin: 0; padding-left: 18px; }
.diag li { margin-bottom: 6px; font-size: 13px; color: #5a4626; }
.diag li:last-child { margin-bottom: 0; }

/* ---------- 表格 ---------- */
.tw { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

th {
  text-align: right;
  font-weight: 500;
  color: var(--ink3);
  font-size: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th:first-child, td:first-child { text-align: left; }
td { text-align: right; padding: 9px 10px; border-bottom: 1px solid #f4f5f7; white-space: nowrap; }
tbody tr:hover { background: #fafbfc; }

td.name { font-weight: 500; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.mute { color: var(--ink3); }
.pos { color: var(--good); font-weight: 600; }
.neg { color: var(--bad); font-weight: 600; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- 水位线 ---------- */
.wl { display: flex; flex-direction: column; gap: 12px; }

.wl-item { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.wl-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.wl-name { font-weight: 600; }
.wl-num { font-variant-numeric: tabular-nums; color: var(--ink2); font-size: 12px; }

.bar { height: 7px; border-radius: 4px; background: #f0f2f5; position: relative; overflow: hidden; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--brand); }
.bar > u { position: absolute; top: 0; bottom: 0; width: 2px; background: #111; box-shadow: 0 0 0 1.5px #fff; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 20, 28, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px;
}

.modal h3 { margin: 0 0 4px; font-size: 16px; }
.modal p.hint { margin: 0 0 18px; font-size: 12px; color: var(--ink3); }

.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: #1a1d24;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}

.empty {
  text-align: center;
  color: var(--ink3);
  font-size: 13px;
  padding: 28px 0;
}

.note {
  font-size: 12px;
  color: var(--ink3);
  line-height: 1.7;
  margin-top: 8px;
}

/* ---------- 定向多选 ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 8px 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  user-select: none;
  transition: all .15s;
}
.chip-t { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.chip-q {
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 50%;
  border: 1px solid #d6dce5;
  background: #fff;
  color: var(--ink3);
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.chip-q:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.chip:hover { border-color: #cfd6e0; background: #fafbfc; }
.chip.on { background: var(--brand-soft); border-color: #b9d3ff; }
.chip.on .chip-t { color: var(--brand); }
.chip.on .chip-q { border-color: #b9d3ff; color: var(--brand); background: #fff; }

.chiptip {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  max-width: min(430px, calc(100vw - 28px));
  background: #1a1d24;
  color: #fff;
  padding: 11px 15px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.7;
  z-index: 300;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .26);
  cursor: pointer;
  animation: tipIn .16s ease-out;
}
.chiptip b { display: block; margin-bottom: 3px; font-size: 12.5px; }
.chiptip span { color: #c6cfdb; }
@keyframes tipIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes tipInMobile { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.field-label { font-size: 13px; font-weight: 600; color: var(--ink); margin: 0 0 7px; }
.field-label .pl { font-weight: 400; font-size: 12px; color: var(--ink3); margin-left: 6px; }
.field-block { margin-bottom: 16px; }

/* ---------- 策略卡片 ---------- */
.optcards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.optcard {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
  cursor: pointer;
  transition: all .15s;
}
.optcard:hover { border-color: #cfd6e0; background: #fafbfc; }
.optcard.on { border-color: #b9d3ff; background: var(--brand-soft); }
.oc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.oc-top b { font-size: 14px; color: var(--ink); }
.optcard.on .oc-top b { color: var(--brand); }
.oc-plain { font-size: 12px; color: var(--ink2); line-height: 1.6; margin-bottom: 6px; }
.oc-scene { font-size: 11px; color: var(--ink3); line-height: 1.5; }

/* ---------- 折叠说明 ---------- */
.q { margin-top: 6px; }
.q > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--brand);
  padding: 1px 0;
}
.q > summary::-webkit-details-marker { display: none; }
.q > summary i {
  width: 15px;
  height: 15px;
  flex: none;
  border-radius: 50%;
  background: var(--brand-soft);
  border: 1px solid #b9d3ff;
  color: var(--brand);
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.q[open] > summary i { background: var(--brand); border-color: var(--brand); color: #fff; }
.q-body {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--ink2);
  line-height: 1.75;
  background: #fafbfc;
  border-left: 2px solid #e3ebf7;
  padding: 8px 11px;
  border-radius: 0 6px 6px 0;
}
.q-eg { color: #7b8798; margin-top: 4px; }

/* 选填项折叠区：默认收起，视觉上像一个可添加的入口 */
.q-opt {
  margin: 6px 0 14px;
  border: 1px dashed #d9e0ea;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}
.q-opt[open] { border-style: solid; border-color: #cfe0f8; background: #fbfdff; }
.q-opt > summary { font-size: 13px; color: var(--ink2); font-weight: 500; }
.q-opt > summary i { background: #fff; }
.q-opt[open] > summary i { background: var(--brand); border-color: var(--brand); color: #fff; }
.q-opt .q-open { margin-top: 10px; }
.q-opt .q-body { border-left-color: #dbe6f7; }

/* ---------- 术语表 ---------- */
.glossary { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.glossary summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--brand);
  font-weight: 600;
  list-style: none;
}
.glossary summary::-webkit-details-marker { display: none; }
.glossary summary::before { content: '▸ '; }
.glossary[open] summary::before { content: '▾ '; }
.glossary dl { margin: 12px 0 0; }
.glossary dt { font-size: 12px; font-weight: 600; color: var(--ink); margin-top: 9px; }
.glossary dd { margin: 2px 0 0; font-size: 12px; color: var(--ink2); line-height: 1.7; }
.plain-table td { font-size: 12.5px; line-height: 1.7; }
.th-sub { font-size: 10px; font-weight: 400; color: var(--ink3); margin-top: 2px; letter-spacing: .02em; }
.wl-who { font-size: 11px; color: var(--ink3); line-height: 1.6; margin: 4px 0 8px; }

/* ---------- 定向预览 ---------- */
.preview {
  background: #f7f9fc;
  border: 1px solid #e3ebf7;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.9;
  color: var(--ink2);
  margin: 4px 0 14px;
}
.preview b { color: var(--ink); }
.preview .warnline { color: var(--warn); }

/* ---------- 漏斗拆解 ---------- */
.funnel { display: flex; flex-direction: column; gap: 4px; }
.fn-track { display: flex; height: 10px; background: #f1f5f9; border-radius: 5px; overflow: hidden; }
.fn-track.wide { flex: 1; height: 14px; }
.fn-seg { height: 100%; border-radius: 5px; transition: width .4s ease; }
.fn-legend { display: flex; gap: 12px; font-size: 11px; color: #64748b; flex-wrap: wrap; }
.fn-tip { font-size: 11px; color: #64748b; margin-top: 2px; }
.fn-tip.warn { color: #d97706; font-weight: 600; }

.funnel-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.fn-title { font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 10px; }
.fn-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.fn-label { width: 40px; font-size: 12px; color: #64748b; flex-shrink: 0; }
.fn-val { width: 60px; text-align: right; font-size: 12px; color: #334155; flex-shrink: 0; }
.fn-stages { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.fn-stage { display: flex; gap: 6px; align-items: center; font-size: 11px; background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 8px; }
.fn-stage.bad { border-color: #fcd34d; background: #fffbeb; }
.fn-stage-name { color: #334155; font-weight: 600; }
.fn-stage-actual { color: #0f172a; }
.fn-stage-target { color: #94a3b8; }
.fn-stage-gap { color: #d97706; font-weight: 600; }
.fn-bottleneck { margin-top: 10px; font-size: 12px; color: #b45309; background: #fffbeb; border: 1px solid #fcd34d; border-radius: 6px; padding: 8px 10px; }
.fn-bottleneck.ok { color: #047857; background: #ecfdf5; border-color: #6ee7b7; }

/* ---------- 学习期状态 ---------- */
.pill.learning { background: #fff4e0; color: #b45309; }
.pill.passed { background: #e8f7ee; color: var(--good); }
.pill.failed { background: #fdeaea; color: var(--bad); }

.cost-note {
  background: #fef2f2;
  border: 1px solid #f8d4d4;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: #9b2c2c;
  line-height: 1.7;
  margin-top: 10px;
}
.cost-note b { color: #7f1d1d; }

/* ---------- 对比块 ---------- */
.compare { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.compare > div { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.compare .k2 { font-size: 12px; color: var(--ink3); margin-bottom: 4px; }
.compare .v2 { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }


@media (max-width: 900px) {
  .grid.c2, .grid.c3, .grid.c4, .metrics { grid-template-columns: 1fr; }
  .top-in { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 8px 10px; }
  .logo { flex: none; }
  .who { flex: 1 1 auto; text-align: right; font-size: 12px; }
  .tabs {
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .tabs button { flex: none; white-space: nowrap; }
  .wrap { padding: 14px; }
}

@media (max-width: 640px) {
  body { font-size: 13.5px; }

  /* 弹窗更贴边，内容区更宽 */
  .mask { padding: 8px; align-items: flex-end; }
  .modal {
    max-width: 100%;
    max-height: calc(100vh - 16px);
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 14px;
  }
  .modal h3 { font-size: 15.5px; }
  .modal p.hint { margin-bottom: 14px; }

  /* 出价策略改单列，避免窄屏挤成两行字 */
  .optcards { grid-template-columns: 1fr; }
  .oc-plain { margin-bottom: 4px; }

  /* 定向标签收紧，一行能放两到三个 */
  .chips { gap: 7px; }
  .chip { padding: 7px 9px 7px 12px; }
  .chip-t { font-size: 13px; }

  /* 气泡贴在拇指可及的位置，并避开底部安全区 */
  .chiptip {
    bottom: calc(24px + env(safe-area-inset-bottom));
    left: 12px;
    right: 12px;
    transform: none;
    max-width: none;
    animation: tipInMobile .16s ease-out;
  }

  /* 表格横向滚动更顺 */
  .tw { -webkit-overflow-scrolling: touch; }
  th, td { padding: 8px; }

  /* 计划卡头部按钮换行，避免标题被挤断 */
  .camp-head { flex-direction: column; gap: 8px; }
  .camp-head .row { width: 100%; }

  /* 指标卡改成两列，省纵向空间 */
  .metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric { padding: 12px 14px; }
  .metric .v { font-size: 19px; }

  /* 只留主名，副名隐藏，表头不再两行 */
  .th-sub { display: none; }

  .toast { left: 12px; right: 12px; transform: none; bottom: calc(80px + env(safe-area-inset-bottom)); }
  .login-card { padding: 24px 20px; }
  .modal-foot { gap: 8px; }
  .modal-foot .btn { flex: none; }
}

