/* 国联客户评估 · 双版本后台 —— 移动优先样式 */
:root {
  --teal: #0f766e;
  --teal-dark: #0b5b55;
  --teal-soft: #e6f4f1;
  --ink: #16232b;
  --muted: #6b7c86;
  --line: #e3eaed;
  --bg: #f4f7f8;
  --card: #ffffff;
  --red: #dc2626;
  --orange: #ea580c;
  --gray: #9ca3af;
  --purple: #7c3aed;
  --green: #16a34a;
  --shadow: 0 2px 10px rgba(16, 40, 48, .06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
.boot { padding: 60px 20px; text-align: center; color: var(--muted); }

/* ---------- 通用 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 700; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; }
.pill.green { background: #e8f7ee; color: #137a3d; }
.pill.orange { background: #fff0e4; color: #b94a08; }
.pill.red { background: #fdeaea; color: #b91c1c; }
.pill.gray { background: #eef1f3; color: #64748b; }
.pill.purple { background: #f1eafe; color: #6d28d9; }
.pill.teal { background: var(--teal-soft); color: var(--teal-dark); }
.badge-level { color: #fff; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 10px 16px; font-weight: 600; min-height: 42px;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.98); opacity: .85; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: #fff; color: var(--red); border-color: #f4c7c7; }
.btn.solid-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink); outline: none; min-height: 42px;
}
textarea.input { min-height: 78px; resize: vertical; line-height: 1.5; }
.input:focus, select.input:focus, textarea.input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,118,110,.10); }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; font-weight: 600; color: #33424c; margin-bottom: 6px; }
.field .req { color: var(--red); margin-left: 3px; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.45; }
.field .unit { font-size: 12px; color: var(--muted); margin-left: 6px; font-weight: 400; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: none; }
.switch-row .label { font-size: 13.5px; font-weight: 600; }
.switch { position: relative; width: 46px; height: 27px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; z-index: 2; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: #cfd8dc; border-radius: 999px; transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::after { transform: translateX(19px); }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-top)) 18px calc(24px + var(--safe-bottom));
  background: linear-gradient(160deg, #0f766e 0%, #0b5b55 46%, #f4f7f8 46.1%, #f4f7f8 100%);
}
.login-card { width: 100%; max-width: 390px; background: #fff; border-radius: 18px; padding: 26px 22px 24px; box-shadow: 0 14px 40px rgba(8, 50, 46, .18); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-logo { width: 46px; height: 46px; border-radius: 12px; flex: none; }
.login-brand h1 { font-size: 19px; margin: 0; letter-spacing: .5px; }
.login-brand p { font-size: 11.5px; color: var(--muted); margin: 2px 0 0; }
.login-card .field { margin-bottom: 15px; }
.login-card .btn { margin-top: 6px; }
.login-err { color: var(--red); font-size: 13px; min-height: 20px; margin-top: 8px; }
.login-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); line-height: 1.6; }

/* ---------- 主框架 ---------- */
.appbar {
  position: sticky; top: 0; z-index: 30; background: var(--teal); color: #fff;
  padding: calc(10px + var(--safe-top)) 14px 10px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 2px 8px rgba(8, 60, 55, .16);
}
.appbar .logo { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.appbar h2 { font-size: 15.5px; margin: 0; font-weight: 700; letter-spacing: .3px; }
.appbar .sub { font-size: 10.5px; opacity: .82; line-height: 1.2; }
.appbar .role-pill { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.2); white-space: nowrap; }
.icon-btn { background: rgba(255,255,255,.16); border: none; color: #fff; width: 34px; height: 34px; border-radius: 9px; font-size: 15px; flex: none; display: grid; place-items: center; }
.icon-btn.text-btn { width: auto; padding: 0 10px; font-size: 12px; font-weight: 600; }
.page { padding: 14px 12px calc(84px + var(--safe-bottom)); max-width: 920px; margin: 0 auto; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: rgba(255,255,255,.97); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); display: flex;
  padding-bottom: var(--safe-bottom);
}
.tabbar button { flex: 1; border: none; background: transparent; padding: 8px 2px 7px; color: var(--muted); font-size: 10.5px; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 54px; }
.tabbar button .ic { font-size: 19px; line-height: 1; }
.tabbar button.active { color: var(--teal); font-weight: 700; }
.tabbar button > span { display: inline-flex; align-items: center; justify-content: center; gap: 3px; white-space: nowrap; }
.tab-badge { font-style: normal; font-size: 10px; font-weight: 700; line-height: 1; color: #fff; background: #e2483c; border-radius: 999px; padding: 2px 5px; min-width: 16px; text-align: center; }
.tel-link { color: var(--teal-dark); font-weight: 700; text-decoration: none; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.page-head h3 { margin: 0; font-size: 17px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--teal-dark); margin: 0 0 10px; display: flex; align-items: center; gap: 7px; }
.section-title::before { content: ''; width: 3px; height: 14px; background: var(--teal); border-radius: 2px; }
.panel { padding: 15px 14px; margin-bottom: 12px; }

/* ---------- 列表 ---------- */
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters .input { min-height: 38px; padding: 7px 10px; font-size: 13px; }
.filters .search { flex: 1 1 150px; }
.filters select { flex: 0 1 118px; }
.cust-item { padding: 13px 14px; margin-bottom: 10px; }
.cust-item .top { display: flex; align-items: flex-start; gap: 8px; }
.cust-item .name { font-size: 15px; font-weight: 700; line-height: 1.35; }
.cust-item .meta { font-size: 11.5px; color: var(--muted); margin-top: 5px; display: flex; gap: 10px; flex-wrap: wrap; }
.cust-item .nums { display: flex; gap: 14px; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); }
.cust-item .nums div { font-size: 11px; color: var(--muted); }
.cust-item .nums b { display: block; font-size: 15px; color: var(--ink); font-weight: 700; margin-top: 1px; }
.empty { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty .ic { font-size: 34px; display: block; margin-bottom: 10px; opacity: .5; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-box { padding: 13px; text-align: center; }
.stat-box b { display: block; font-size: 23px; color: var(--teal); line-height: 1.3; }
.stat-box span { font-size: 11.5px; color: var(--muted); }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12.5px; }
.bar-row .lbl { width: 82px; flex: none; }
.bar-row .track { flex: 1; height: 9px; background: #edf2f3; border-radius: 99px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--teal); border-radius: 99px; }
.bar-row .val { width: 34px; text-align: right; font-weight: 700; }

/* ---------- 问卷 ---------- */
.stepper { display: flex; gap: 5px; margin-bottom: 14px; }
.stepper div { flex: 1; text-align: center; font-size: 11px; color: var(--muted); padding-top: 7px; border-top: 3px solid #dde6e8; }
.stepper div.active { color: var(--teal); border-top-color: var(--teal); font-weight: 700; }
.stepper div.done { color: var(--teal-dark); border-top-color: #7cc4bb; }
.cond-hidden { display: none !important; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }
.form-actions .btn { flex: 1; }

/* ---------- 结果页 ---------- */
.result-hero { padding: 18px 16px; text-align: center; border-top: 4px solid var(--teal); }
.result-hero .lv { font-size: 22px; font-weight: 800; letter-spacing: 1px; }
.result-hero .concl { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.result-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.result-nums div { background: #f7fafb; border-radius: 9px; padding: 10px 4px; }
.result-nums b { display: block; font-size: 16px; color: var(--teal-dark); }
.result-nums span { font-size: 10.5px; color: var(--muted); }
.kv-list { margin: 0; }
.kv { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv .k { font-weight: 600; }
.kv .v { color: #465a64; margin-top: 3px; font-size: 12.5px; line-height: 1.6; }
.veto { background: #fff5f5; border-left: 3px solid var(--red); padding: 9px 11px; border-radius: 6px; margin-bottom: 7px; font-size: 12.5px; }
.calc-lines { background: #f7fafb; border-radius: 8px; padding: 11px 12px; font-size: 12px; line-height: 1.85; color: #3d505a; }
.product { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.product:last-child { border-bottom: none; }
.product .amt { color: var(--teal); font-weight: 700; white-space: nowrap; }
.sugg { padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.sugg:last-child { border-bottom: none; }
.sugg b { color: var(--teal-dark); }

/* ---------- 编辑 / 日志 / 账号 ---------- */
.edit-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.edit-head h3 { margin: 0; font-size: 17px; }
.sticky-save { position: sticky; bottom: calc(62px + var(--safe-bottom)); z-index: 20; display: flex; gap: 8px; padding: 10px 0 4px; background: linear-gradient(to top, var(--bg) 78%, rgba(244,247,248,0)); }
.sticky-save .btn { flex: 1; }
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item::before { content: ''; position: absolute; left: -16px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--teal); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--teal); }
.tl-item .hd { font-size: 12.5px; font-weight: 700; }
.tl-item .tm { font-size: 11px; color: var(--muted); margin-left: 6px; font-weight: 400; }
.tl-item .chg { font-size: 11.5px; color: #4a606b; background: #f7fafb; border-radius: 7px; padding: 7px 9px; margin-top: 6px; line-height: 1.6; }
.tl-item .chg em { font-style: normal; color: var(--muted); text-decoration: line-through; }
.tl-item .chg strong { color: var(--teal-dark); }
.acc-item { display: flex; align-items: center; gap: 10px; padding: 11px 13px; margin-bottom: 9px; }
.acc-item .nm { font-weight: 700; font-size: 14px; }
.acc-item .un { font-size: 11px; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.acc-avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--teal-soft); color: var(--teal-dark); display: grid; place-items: center; font-weight: 700; flex: none; }
.modal-mask { position: fixed; inset: 0; background: rgba(10,30,35,.45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 520px; border-radius: 18px 18px 0 0; padding: 20px 18px calc(20px + var(--safe-bottom)); max-height: 88vh; overflow-y: auto; }
.modal h3 { margin: 0 0 14px; font-size: 17px; }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-bottom)); transform: translateX(-50%) translateY(14px); background: #1d3139; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 90; max-width: 88vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.trash-item { opacity: .82; }
.link { color: var(--teal); font-weight: 600; cursor: pointer; }

@media (min-width: 700px) {
  .page { padding: 20px 20px calc(84px + var(--safe-bottom)); }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .login-wrap { background: linear-gradient(160deg, #0f766e 0%, #0b5b55 52%, #f4f7f8 52.1%, #f4f7f8 100%); }
}

/* ---------- 文档智能识别 ---------- */
.recog-bar { background: var(--teal-soft); border: 1px dashed #9fc7bf; border-radius: 10px; padding: 9px 11px; margin: 2px 0 12px; }
.recog-bar .btn.sm { margin: 0 6px 2px 0; }
.recog-tag { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 700; color: #fff; background: #b06a00; border-radius: 6px; padding: 1px 6px; vertical-align: middle; }
.field.recog-filled, .switch-field.recog-filled { background: #fffaf0; border-radius: 8px; }
.recog-low { box-shadow: 0 0 0 2px #ef4444 inset; }
.recog-low .recog-tag { background: #dc2626; }
