/* 意向客户商机三页：确认需求 → 成本确认 → 方案报价 → 合同管理(入口)
   硬约束色：bg #F5F8FD / card #FFFFFF / nav #FFFCF6 / brand #1766D6 / orange #F59A00 / border #E4ECF7
   布局对齐 effect-triptych.png（BOSS 正式三联基准）。 */

/* —— 路由内壳层（仅 .app.opp-shell） —— */
body:has(.opp-page) {
  --page-bg: #F5F8FD;
  --border: #E4ECF7;
  --brand-primary: #1766D6;
  --brand-orange: #F59A00;
  --surface-warm: #FFFCF6;
  background: #F5F8FD;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
.app.opp-shell {
  /* side 为 position:fixed，第一列空位抵消侧栏宽度；禁止再给 workspace 加 margin-left */
  grid-template-columns: 126px minmax(0, 1fr);
  background: #F5F8FD;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
.app.opp-shell .side {
  width: 126px;
  padding: 10px 8px 8px;
  background: #FFFCF6 !important;
  border-right: 1px solid #E4ECF7;
}
.app.opp-shell .company-logo {
  width: 28px;
  height: 28px;
}
.app.opp-shell .side-brand {
  gap: 6px;
  min-height: 36px;
  padding: 0 2px 4px;
}
.app.opp-shell .side-brand .name { font-size: 12px; color: #17365F; }
.app.opp-shell .brand-sub { font-size: 8px; color: #8295B1; }
.app.opp-shell .side-status {
  margin: 6px 2px 10px;
  font-size: 8px;
}
.app.opp-shell .side-nav { gap: 2px; flex: 1; }
.app.opp-shell .side-nav a {
  min-height: 32px;
  gap: 7px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #294767;
}
.app.opp-shell .side-nav a .ico {
  display: inline-flex;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  align-items: center;
  justify-content: center;
  color: #1766D6;
}
.app.opp-shell .side-nav a .ico svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.app.opp-shell .side-nav a .ico svg .ico-fill {
  fill: currentColor;
  stroke: none;
}
.app.opp-shell .side-nav a:hover {
  background: #FFF3DE;
  color: #A76500;
}
.app.opp-shell .side-nav a.active {
  background: #F59A00 !important;
  color: #fff !important;
  box-shadow: none !important;
}
.app.opp-shell .side-nav a.active .ico,
.app.opp-shell .side-nav a.active .ico svg { color: #fff !important; stroke: currentColor; }
.app.opp-shell .side-user {
  min-height: 42px;
  padding: 8px 2px 0;
  border-top: 1px solid #E4ECF7;
}
.app.opp-shell .side-user .avatar {
  width: 24px;
  height: 24px;
  font-size: 10px;
}
.app.opp-shell .side-user .nm { font-size: 11px; }
.app.opp-shell .side-user .dept,
.app.opp-shell .side-role { font-size: 8px; }
.app.opp-shell .app-topbar {
  min-height: 44px;
  padding: 0 18px;
  border-bottom: 1px solid #E4ECF7;
  background: #FFFFFF;
  gap: 12px;
  overflow: visible;
}
.app.opp-shell .global-search {
  width: min(420px, 48%);
  min-width: 180px;
  height: 30px;
}
.app.opp-shell .global-search input {
  height: 30px;
  padding-left: 30px;
  font-size: 12px;
  background: #EEF4FC;
  border-radius: 999px;
  border: 1px solid #E4ECF7;
}
.app.opp-shell .global-search .search-icon {
  left: 10px;
  width: 13px;
  height: 13px;
}
.app.opp-shell .topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.app.opp-shell .topbar-icon {
  position: relative;
  width: 28px;
  height: 28px;
  color: #1766D6;
  overflow: visible;
}
.app.opp-shell .topbar-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.app.opp-shell .topbar-icon svg .ico-fill {
  fill: currentColor;
  stroke: none;
}
.app.opp-shell .topbar-badge {
  position: absolute;
  top: -1px;
  right: -4px;
  z-index: 1;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #E45858;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-sizing: border-box;
  pointer-events: none;
}
.app.opp-shell .topbar-profile-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #294767;
}
.app.opp-shell .topbar-profile-wrap .topbar-profile,
.app.opp-shell .topbar-profile {
  width: 28px;
  height: 28px;
  font-size: 11px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #F2DEB8;
  background: #FFF6E6;
  color: #8B5A08;
  font-weight: 700;
  text-decoration: none;
}
.app.opp-shell .topbar-profile-wrap .topbar-name {
  font-size: 12px;
  font-weight: 600;
  color: #294767;
  white-space: nowrap;
}
.app.opp-shell .topbar-profile-wrap .topbar-chevron {
  width: 10px;
  height: 10px;
  color: #8295B1;
}
/* ★ 关键修复：内容贴齐侧栏，禁止双倍左边距 */
.app.opp-shell .workspace {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: none;
  background: #F5F8FD;
  grid-column: 2;
}
.app.opp-shell .main {
  background: #F5F8FD;
  min-height: 0;
  flex: 1;
}

/* —— 页面骨架：吃满可用宽度 —— */
.opp-page {
  width: 100%;
  max-width: none;
  margin: 0;
  /* Leave room for the persistent test-identity switcher at the viewport
     edge so the final action row remains visible and tappable. */
  padding: 12px 20px 88px;
  box-sizing: border-box;
  overflow-x: hidden;
  color: #17365F;
  background: #F5F8FD;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  line-height: 1.45;
  min-height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
}
.opp-crumb {
  margin-bottom: 4px;
  color: #65758F;
  font-size: 11px;
}
.opp-crumb a {
  color: #1766D6;
  text-decoration: none;
}
.opp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.opp-head h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #1766D6;
}
.opp-head p {
  margin: 3px 0 0;
  color: #7186A4;
  font-size: 12px;
}
.opp-back { display: none; }

/* —— 三步流程条 + 独立合同入口 —— */
.opp-flow-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #E4ECF7;
  border-radius: 10px;
  background: #FFFFFF;
  box-shadow: 0 1px 4px rgba(33, 100, 180, 0.04);
}
.opp-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
}
.opp-step {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 2px 8px;
  border: 0;
  background: transparent;
  color: #8295B1;
  font-size: 12px;
  font-weight: 600;
}
.opp-step:after {
  content: "";
  position: absolute;
  left: calc(50% + 22px);
  right: calc(-50% + 22px);
  top: 50%;
  height: 2px;
  background: #CFE0F5;
  z-index: 0;
}
.opp-step:last-child:after { display: none; }
.opp-step b,
.opp-step span {
  position: relative;
  z-index: 1;
}
.opp-step b {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #EAF3FF;
  color: #5D7594;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
  border: 1px solid #D6E6F8;
}
.opp-step span {
  padding-right: 8px;
  background: #FFFFFF;
  white-space: nowrap;
}
.opp-step.on { color: #1766D6; }
.opp-step.on b {
  background: #1766D6;
  color: #fff;
  border-color: #1766D6;
}
.opp-step.done { color: #1766D6; }
.opp-step.done b {
  background: #1766D6;
  color: #fff;
  border-color: #1766D6;
  font-size: 12px;
}
.opp-step.done:after { background: #9FC2F5; }
.opp-contract-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #F3CF87;
  border-radius: 999px;
  background: #FFF8EA;
  color: #A76500;
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.opp-contract-link:hover,
.opp-contract-link.on {
  border-color: #F59A00;
  background: #FFF0D2;
  color: #8B5700;
}
.opp-contract-link small {
  color: #B9822C;
  font-size: 10px;
  font-weight: 600;
}
.opp-contract-link i {
  font-size: 14px;
  font-style: normal;
  line-height: 1;
}

/* —— 第一步：基本信息与资质上下堆叠 —— */
.opp-step1-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  flex: 0 0 auto;
  min-height: 0;
}
.opp-page-step-1 .opp-page-actions {
  /* This row belongs directly below the qualification card, aligned to the
     right as the final action for step one. */
  width: fit-content;
  max-width: 100%;
  margin: 0 0 0 auto;
  position: static;
}
.opp-basic-card,
.opp-qual-card {
  padding: 16px 18px;
  border-radius: 10px;
}
.opp-basic-card h2,
.opp-qual-card h2 { font-size: 14px; }
.opp-form.opp-form-step1 {
  grid-template-columns: minmax(220px, 1.25fr) minmax(180px, 1fr) minmax(160px, .75fr);
  gap: 12px 14px;
}
.opp-demand-form { align-items: start; }
.opp-demand-form .opp-date-range { display: block; }
.opp-demand-card h2 { margin-bottom: 14px; }
.opp-date-field { min-width: 0; }
.opp-date-field .opp-date-range { min-width: 0; }
.opp-date-field input { min-width: 0; }
.opp-qual-card .opp-card-sub { margin-bottom: 10px; }
.opp-qual-card .opp-note { margin-bottom: 0; }
.opp-safety-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
  margin: 0 0 11px;
  padding: 10px 12px;
  border: 1px solid #E4ECF7;
  border-radius: 7px;
  background: #F8FBFF;
}
.opp-safety-choice strong { color: #274D7D; }
.opp-safety-choice p { margin: 3px 0 0; color: #7186A4; font-size: 11px; }
.opp-safety-choice label { display:flex; align-items:center; gap:8px; color:#65758F; font-size:11px; white-space:nowrap; }
.opp-safety-choice select { width:auto; min-width:126px; max-width:170px; min-height:36px; padding:6px 28px 6px 10px; }

/* 需求确认页：方向推荐 + 资质目录 + 申请清单 */
.opp-section-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.opp-recommend-badge,.opp-target-limit { flex:0 0 auto; padding:4px 8px; border-radius:999px; background:#FFF3DE; color:#A76500; font-size:10px; font-weight:700; }
.opp-direction-card,.opp-target-card { padding:16px 18px; }
.opp-direction-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-top:12px; }
.opp-direction { display:grid; gap:5px; min-height:76px; padding:12px; text-align:left; border:1px solid #DCE8F7; border-radius:8px; background:#F8FBFF; color:#294767; cursor:pointer; font:inherit; transition:.15s ease; }
.opp-direction strong { color:#1D3153; font-size:13px; }
.opp-direction span { color:#526B8C; font-size:12px; line-height:1.45; }
.opp-direction-selected { min-height:13px; color:#1766D6; font-size:11px; font-weight:700; }
.opp-direction:hover,.opp-direction.active { border-color:#1766D6; background:#EEF5FF; box-shadow:0 0 0 2px rgba(23,102,214,.08); }
.opp-direction.active strong { color:#1766D6; }
.opp-direction-note { margin-top:9px; color:#526B8C; font-size:12px; }
.opp-target-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(280px,.42fr); gap:14px; margin-top:12px; }
.opp-catalog-tools { display:grid; grid-template-columns:180px minmax(0,1fr); gap:10px; margin-bottom:10px; }
.opp-catalog-tools label { display:grid; gap:4px; color:#526B8C; font-size:11px; font-weight:600; }
.opp-catalog-tools input,.opp-catalog-tools select { box-sizing:border-box; width:100%; height:34px; padding:6px 9px; border:1px solid #CAE0FB; border-radius:6px; background:#fff; color:#294767; font:inherit; }
.opp-catalog-list { display:grid; gap:7px; max-height:360px; overflow:auto; padding-right:3px; }
.opp-catalog-item { display:grid; grid-template-columns:minmax(180px,1fr) auto; align-items:center; gap:12px; min-width:0; min-height:54px; padding:9px 10px; border:1px solid #E4ECF7; border-radius:7px; background:#fff; color:#294767; }
.opp-catalog-profession { min-width:0; display:grid; gap:3px; }
.opp-catalog-profession strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
.opp-catalog-profession small { color:#8295B1; font-size:10px; }
.opp-level-options { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:7px; }
.opp-level-option { min-width:56px; min-height:44px; padding:7px 10px; border:1px solid #CADEFA; border-radius:7px; background:#F8FBFF; color:#294767; cursor:pointer; font:600 12px/1.2 inherit; }
.opp-level-option:hover,.opp-level-option.selected { border-color:#1766D6; background:#EEF5FF; color:#1766D6; }
.opp-level-option[data-pending-rule="1"] { border-style:dashed; color:#8295B1; background:#F6F8FB; }
.opp-direction:disabled { cursor:not-allowed; opacity:.68; box-shadow:none; }
.opp-direction:disabled:hover { border-color:#DCE8F7; background:#F8FBFF; }
.opp-direction:focus-visible,.opp-level-option:focus-visible,.opp-remove-target:focus-visible { outline:3px solid #174EA6; outline-offset:2px; }
.opp-cert-extra-card { padding:16px 18px; }
.opp-apply-summary { min-width:0; padding:12px; border:1px solid #E4ECF7; border-radius:8px; background:#FFFCF6; }
.opp-apply-summary h3 { display:flex; justify-content:space-between; gap:8px; margin:0; color:#1D3153; font-size:13px; }
.opp-apply-summary h3 b { color:#1766D6; font-size:11px; }
.opp-apply-summary > p { margin:5px 0 10px; color:#8295B1; font-size:10px; }
.opp-apply-item { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:9px 0; border-top:1px solid #E8EEF7; }
.opp-apply-item > div { min-width:0; display:grid; gap:2px; }
.opp-apply-item strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#294767; font-size:11px; }
.opp-apply-item span { color:#8295B1; font-size:10px; }
.opp-remove-target { flex:0 0 auto; width:24px; height:24px; border:0; border-radius:5px; background:#FFF0F0; color:#C35A5A; cursor:pointer; font-size:17px; line-height:1; }
.opp-summary-empty { padding:18px 6px; color:#8295B1; text-align:center; font-size:11px; }

@media (max-width: 860px) {
  .opp-direction-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .opp-target-layout { grid-template-columns:1fr; }
}
@media (max-width: 560px) {
  .opp-direction-grid { grid-template-columns:1fr; }
  .opp-catalog-item { grid-template-columns:1fr; }
  .opp-level-options { justify-content:flex-start; }
  .opp-catalog-tools { grid-template-columns:1fr; }
  .opp-section-head { display:block; }
  .opp-recommend-badge,.opp-target-limit { display:inline-block; margin-top:8px; }
}

/* —— 卡片 / 栅格 —— */
.opp-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  flex: 1 1 auto;
  min-height: 0;
}
.opp-page-step-1 .opp-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.opp-page-step-2 .opp-grid {
  grid-template-columns: minmax(240px, 0.34fr) minmax(0, 0.66fr);
}
.opp-card {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #E4ECF7;
  border-radius: 8px;
  background: #FFFFFF;
  box-shadow: 0 1px 4px rgba(33, 100, 180, 0.04);
}
.opp-card h2 {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 700;
  color: #1D3153;
}
.opp-card-sub {
  margin: 0 0 10px;
  color: #8295B1;
  font-size: 11px;
  line-height: 1.5;
}

/* —— 表单 —— */
.opp-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
.opp-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.opp-field.wide { grid-column: 1 / -1; }
.opp-field label {
  font-size: 12px;
  font-weight: 600;
  color: #526B8C;
}
.opp-required {
  color: #D66B28;
  font-weight: 700;
}
.opp-field input,
.opp-field select,
.opp-field textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 6px 10px;
  border: 1px solid #CAE0FB;
  border-radius: 6px;
  background: #FFFFFF;
  color: #294767;
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
}
.opp-field input[readonly],
.opp-field select:disabled {
  background: #F7FBFF;
  color: #7186A4;
}
.opp-field textarea {
  height: auto;
  min-height: 88px;
  resize: vertical;
  padding: 8px 10px;
}
.opp-contact-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.opp-contact-pair select { width: 100%; }
.opp-date-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
}
.opp-date-range > span {
  color: #8295B1;
  font-size: 11px;
}
.opp-char-count {
  justify-self: end;
  color: #8295B1;
  font-size: 11px;
}
.opp-char-count.warn { color: #C14B42; }

/* —— 空态 / 提示 —— */
.opp-empty {
  padding: 18px 12px;
  border: 1px dashed #D6E1EE;
  border-radius: 6px;
  background: #FBFCFE;
  color: #8295B1;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}
.opp-note {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #FFF8EC;
  color: #946C2F;
  font-size: 11px;
  line-height: 1.5;
}

/* —— 页面级底栏（移出卡片，右下） —— */
.opp-page-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 4px;
  flex: 0 0 auto;
}
.opp-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.opp-btn {
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #1766D6;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.opp-btn.secondary {
  border-color: #C5D8F0;
  background: #FFFFFF;
  color: #1766D6;
}
.opp-btn.warm {
  background: #F59A00;
  border-color: #F59A00;
  color: #fff;
}
.opp-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* —— 表格 —— */
.opp-qual-table-wrap,
.opp-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid #E4ECF7;
  border-radius: 6px;
  overflow: auto;
  background: #FFFFFF;
}
.opp-qual-table,
.opp-cost-table,
.opp-quote-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.opp-qual-table th,
.opp-qual-table td,
.opp-cost-table th,
.opp-cost-table td,
.opp-quote-table th,
.opp-quote-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #E3EEFB;
  text-align: left;
  font-size: 12px;
  vertical-align: middle;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
}
.opp-qual-table th,
.opp-cost-table th,
.opp-quote-table th {
  background: #F0F7FF;
  color: #597CA8;
  font-weight: 600;
  font-size: 12px;
}
.opp-qual-table th { color: #526B8C; }
.opp-qual-table tr:last-child td,
.opp-cost-table tr:last-child td,
.opp-quote-table tr:last-child td { border-bottom: 0; }

/* 资质表列宽 */
.opp-qual-table .col-no { width: 13%; }
.opp-qual-table .col-name { width: 17%; }
.opp-qual-table .col-level { width: 18%; }
.opp-qual-table .col-issuer { width: 18%; }
.opp-qual-table .col-issue { width: 11%; }
.opp-qual-table .col-expire { width: 13%; }
.opp-qual-table .col-status { width: 10%; }
.opp-qual-table td.col-no,
.opp-qual-table td.col-name,
.opp-qual-table td.col-level,
.opp-qual-table td.col-issuer {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* 成本表列宽 */
.opp-cost-table .col-role { width: 14%; }
.opp-cost-table .col-cert { width: 22%; }
.opp-cost-table .col-req { width: 14%; }
.opp-cost-table .col-count { width: 14%; }
.opp-cost-table .col-unit { width: 18%; }
.opp-cost-table .col-sub { width: 18%; }

/* 报价表列宽 */
.opp-quote-table .col-role { width: 16%; }
.opp-quote-table .col-count { width: 10%; }
.opp-quote-table .col-cost { width: 16%; }
.opp-quote-table .col-profit { width: 16%; }
.opp-quote-table .col-unit { width: 18%; }
.opp-quote-table .col-sub { width: 24%; }

/* 金额 / 人数右对齐 + tabular-nums */
.opp-qual-table .num,
.opp-cost-table .num,
.opp-quote-table .num,
.opp-cost-table td.col-req,
.opp-cost-table td.col-count,
.opp-cost-table td.col-unit,
.opp-cost-table td.col-sub,
.opp-quote-table td.col-count,
.opp-quote-table td.col-cost,
.opp-quote-table td.col-profit,
.opp-quote-table td.col-unit,
.opp-quote-table td.col-sub,
.opp-cost-table th.col-req,
.opp-cost-table th.col-count,
.opp-cost-table th.col-unit,
.opp-cost-table th.col-sub,
.opp-quote-table th.col-count,
.opp-quote-table th.col-cost,
.opp-quote-table th.col-profit,
.opp-quote-table th.col-unit,
.opp-quote-table th.col-sub {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.opp-cost-table td.col-unit input,
.opp-cost-table td.col-count input,
.opp-quote-table td.col-profit input {
  width: 100%;
  max-width: 88px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  display: block;
}
.opp-total strong,
.opp-kpi strong {
  font-variant-numeric: tabular-nums;
}
.opp-file-icon {
  display: inline-block;
  margin-right: 6px;
  color: #1766D6;
  font-size: 12px;
  vertical-align: -1px;
  line-height: 1;
}
.opp-file-icon svg {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: -2px;
}
.opp-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #DAF8E7;
  color: #19A762;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}
.opp-table-count {
  padding: 6px 10px;
  color: #7186A4;
  font-size: 11px;
  border-top: 1px solid #E3EEFB;
}
.opp-cost-table input {
  box-sizing: border-box;
  width: 72px;
  height: 28px;
  min-height: 0;
  padding: 3px 6px;
  border: 1px solid #CCE1FA;
  border-radius: 4px;
  font-size: 12px;
}
.opp-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0;
  padding: 8px 12px;
  border: 1px solid #E4ECF7;
  border-top: 0;
  border-radius: 0 0 6px 6px;
  background: #F0F6FF;
}
.opp-table-wrap + .opp-total { margin-top: -1px; }
.opp-total span {
  color: #526B8C;
  font-size: 12px;
  font-weight: 600;
}
.opp-total strong {
  font-size: 14px;
  color: #1766D6;
}

/* —— 第三页摘要 / 报价栅格 —— */
.opp-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #E4ECF7;
  border-radius: 8px;
  background: #F0F7FF;
  flex: 0 0 auto;
}
.opp-summary div {
  padding: 2px 4px;
  min-width: 0;
}
.opp-summary span {
  display: block;
  color: #8295B1;
  font-size: 11px;
}
.opp-summary strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 12px;
  color: #1D3153;
  font-weight: 600;
}
.opp-quote-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.66fr) minmax(260px, 0.34fr);
  gap: 12px;
  align-items: start;
  flex: 1 1 auto;
}
.opp-kpi {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 10px;
  padding: 10px 4px 0;
  border-top: 1px solid #EDF2F8;
}
.opp-kpi div {
  min-width: 100px;
  text-align: right;
}
.opp-kpi span {
  display: block;
  color: #8295B1;
  font-size: 11px;
}
.opp-kpi strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  color: #1D3153;
}
.opp-kpi .opp-kpi-final strong { color: #1766D6; }

.opp-status {
  min-height: 16px;
  margin-top: 6px;
  color: #A46B12;
  font-size: 11px;
}
.opp-status.ok { color: #188B72; }
.opp-status.bad { color: #C14B42; }
.opp-hidden { display: none !important; }
.opp-shortage { color: #C14B42; font-weight: 600; }

/* —— 第四步：合同入口 —— */
.opp-contract-entry { display: grid; gap: 10px; }
.opp-contract-entry .opp-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.opp-contract-entry .opp-meta div {
  padding: 10px 12px;
  border: 1px solid #E4ECF7;
  border-radius: 6px;
  background: #FFFFFF;
}
.opp-contract-entry .opp-meta span {
  display: block;
  color: #8295B1;
  font-size: 11px;
}
.opp-contract-entry .opp-meta strong {
  display: block;
  margin-top: 3px;
  font-size: 12px;
}

/* —— 窄屏 —— */
@media (max-width: 860px) {
  .app.opp-shell { display: block; }
  .app.opp-shell .side { position: static; width: 100%; height: auto; }
  .app.opp-shell .workspace {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .app.opp-shell .app-topbar {
    min-height: 48px;
    padding: 0 10px;
  }
  .opp-page { padding: 10px 10px 88px; min-height: 0; }
  .opp-flow-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
  }
  .opp-back {
    display: block;
    padding: 8px 10px;
    border: 1px solid #E4ECF7;
    border-radius: 6px;
    background: #FFFFFF;
    color: #1766D6;
    text-decoration: none;
    font-size: 12px;
    text-align: center;
  }
  .opp-head { flex-direction: column; align-items: stretch; }
  .opp-head h1 { font-size: 16px; }
  .opp-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    padding: 0;
  }
  .opp-step { min-width: 0; padding: 2px 3px; gap: 5px; font-size: 11px; }
  .opp-step b { width: 20px; height: 20px; }
  .opp-step:after {
    left: calc(50% + 18px);
    right: calc(-50% + 18px);
    top: 50%;
  }
  .opp-step span { padding-right: 3px; }
  .opp-contract-link { align-self: flex-end; }
  .opp-grid,
  .opp-page-step-1 .opp-grid,
  .opp-page-step-2 .opp-grid,
  .opp-quote-grid { grid-template-columns: 1fr; }
  .opp-form.opp-form-step1 { grid-template-columns: 1fr; }
  .opp-form-step1 .opp-field:nth-child(5),
  .opp-form-step1 .opp-field.wide { grid-column: auto; }
  .opp-form { grid-template-columns: 1fr; }
  .opp-field.wide { grid-column: auto; }
  .opp-contact-pair { grid-template-columns: 1fr; }
  .opp-summary { grid-template-columns: 1fr 1fr; }
  .opp-contract-entry .opp-meta { grid-template-columns: 1fr; }
  /* 宽表在手机上改为逐行卡片，避免固定 min-width 造成整页横向裁切。 */
  .opp-table-wrap,
  .opp-qual-table-wrap { overflow: visible; border: 0; background: transparent; }
  .opp-qual-table,
  .opp-cost-table,
  .opp-quote-table {
    display: block;
    min-width: 0;
    width: 100%;
  }
  .opp-qual-table thead,
  .opp-cost-table thead,
  .opp-quote-table thead { display: none; }
  .opp-qual-table tbody,
  .opp-cost-table tbody,
  .opp-quote-table tbody { display: grid; gap: 8px; }
  .opp-qual-table tr,
  .opp-cost-table tr,
  .opp-quote-table tr {
    display: block;
    padding: 8px 10px;
    border: 1px solid #E4ECF7;
    border-radius: 8px;
    background: #FFFFFF;
  }
  .opp-qual-table td,
  .opp-cost-table td,
  .opp-quote-table td {
    display: grid;
    grid-template-columns: minmax(98px, 42%) minmax(0, 1fr);
    align-items: center;
    width: auto !important;
    min-width: 0;
    max-width: none;
    padding: 6px 0;
    border-bottom: 1px solid #EDF2F8;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    text-align: left;
  }
  .opp-qual-table td:last-child,
  .opp-cost-table td:last-child,
  .opp-quote-table td:last-child { border-bottom: 0; }
  .opp-qual-table td::before,
  .opp-cost-table td::before,
  .opp-quote-table td::before {
    content: attr(data-label);
    color: #526B8C;
    font-size: 12px;
    font-weight: 600;
  }
  .opp-qual-table td.col-name strong,
  .opp-cost-table td.col-role,
  .opp-cost-table td.col-cert,
  .opp-quote-table td.col-role { overflow-wrap: anywhere; }
  .opp-remove-target { width:44px; height:44px; }
  .opp-qual-table td.col-name .opp-file-icon { display:none; }
  .opp-cost-table td.col-req,
  .opp-cost-table td.col-count,
  .opp-cost-table td.col-unit,
  .opp-cost-table td.col-sub,
  .opp-quote-table td.col-count,
  .opp-quote-table td.col-cost,
  .opp-quote-table td.col-profit,
  .opp-quote-table td.col-unit,
  .opp-quote-table td.col-sub { text-align: left; }
  .opp-cost-table td.col-count input,
  .opp-cost-table td.col-unit input,
  .opp-quote-table td.col-profit input {
    width: 100%;
    max-width: none;
    margin: 0;
    text-align: left;
  }
  .opp-status-pill { justify-self: start; }
  .opp-table-count { border-top: 0; padding: 8px 0 0; }
  .opp-page-actions {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .opp-page-actions .opp-btn:last-child { grid-column: 1 / -1; }
  .opp-kpi { justify-content: stretch; gap: 8px; }
  .opp-kpi div { flex: 1; min-width: 0; text-align: left; }
}

@media (max-width: 520px) {
  .opp-page { padding-left: 8px; padding-right: 8px; }
  .opp-card,
  .opp-basic-card,
  .opp-qual-card { padding: 13px 12px; }
  .opp-safety-choice { grid-template-columns: 1fr; }
  .opp-step { flex-direction: column; gap: 3px; text-align: center; }
  .opp-step:after { left: calc(50% + 13px); right: calc(-50% + 13px); }
  .opp-step span { padding-right: 0; }
  .opp-contract-link { align-self: stretch; justify-content: center; }
  .opp-summary { grid-template-columns: 1fr; }
  .opp-page-actions { grid-template-columns: 1fr; }
  .opp-page-actions .opp-btn:last-child { grid-column: auto; }
}
