/* ================= 工地账单 · 样式 ================= */
:root {
  --brand: #1f4e79;
  --brand-2: #2e6da4;
  --brand-soft: #eaf1f8;
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e3e8ef;
  --line-soft: #eef1f5;
  --text: #1c2430;
  --text-2: #5a6675;
  --text-3: #8b95a3;
  --ok: #1f8a4c;
  --ok-soft: #e8f6ed;
  --warn: #b26a00;
  --warn-soft: #fdf3e3;
  --bad: #c0392b;
  --bad-soft: #fdecea;
  --up: #c0392b;      /* 涨 = 红 */
  --down: #1f8a4c;    /* 跌 = 绿 */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 30, 54, .06), 0 6px 20px rgba(16, 30, 54, .06);
  --shadow-sm: 0 1px 2px rgba(16, 30, 54, .08);
  --nav-w: 208px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--brand-2); text-decoration: none; }
button { font-family: inherit; }

/* ---------- 启动屏 ---------- */
.boot {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(160deg, #1f4e79, #2e6da4);
  color: #fff; z-index: 200;
}
.boot-logo { font-size: 26px; font-weight: 700; letter-spacing: 3px; }
.boot-tip { font-size: 13px; opacity: .75; }

/* ================= 布局 ================= */
.shell { display: flex; min-height: 100vh; }
.side {
  width: var(--nav-w); flex: 0 0 var(--nav-w);
  background: #16283d; color: #cfd9e4;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-brand b { color: #fff; font-size: 17px; letter-spacing: 1px; display: block; }
.side-brand span { font-size: 11px; color: #8ba0b8; display: block; margin-top: 2px; }
.side-nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.side-sec { font-size: 11px; color: #6c8299; padding: 14px 10px 6px; letter-spacing: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px; color: #cfd9e4; margin-bottom: 2px; user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.on { background: var(--brand-2); color: #fff; font-weight: 600; }
.nav-item .ic { width: 18px; text-align: center; font-size: 15px; }
.nav-item .badge {
  margin-left: auto; background: #e8a33d; color: #3a2400;
  font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 9px;
}
.side-foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #8ba0b8; }
.side-foot .me { color: #fff; font-weight: 600; font-size: 13px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 650; flex: 1; }
.topbar .sub { font-size: 12px; color: var(--text-3); font-weight: 400; margin-left: 8px; }
.page { padding: 18px 20px 60px; max-width: 1400px; width: 100%; }

/* 移动端顶栏 */
.m-top {
  display: none; height: 52px; background: var(--brand); color: #fff;
  align-items: center; gap: 10px; padding: 0 14px; position: sticky; top: 0; z-index: 40;
}
.m-top b { font-size: 16px; flex: 1; }
.m-top .ic-btn { background: rgba(255,255,255,.14); border: 0; color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 13px; }
.m-bottom {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; height: 60px;
  background: #fff; border-top: 1px solid var(--line); z-index: 45;
  padding-bottom: env(safe-area-inset-bottom);
}
.m-bottom-in { display: flex; height: 60px; }
.m-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11px; color: var(--text-3); border: 0; background: none; padding: 0;
}
.m-tab .ic { font-size: 19px; line-height: 1; }
.m-tab.on { color: var(--brand-2); font-weight: 600; }

/* ================= 组件 ================= */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  margin-bottom: 16px; overflow: hidden;
}
.card-h {
  padding: 13px 16px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-h h3 { margin: 0; font-size: 14.5px; font-weight: 650; flex: 1; }
.card-h .hint { font-size: 12px; color: var(--text-3); }
.card-b { padding: 16px; }
.card-b.tight { padding: 10px 12px; }
.card-b.flush { padding: 0; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0,1fr)); }

/* KPI */
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.kpi .k-l { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .k-v { font-size: 24px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi .k-s { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.kpi.accent { background: linear-gradient(150deg, #1f4e79, #2e6da4); border-color: transparent; }
.kpi.accent .k-l, .kpi.accent .k-s { color: #b9d2ea; }
.kpi.accent .k-v { color: #fff; }
.kpi.warn { border-color: #f0d9b5; background: #fffdf8; }
.kpi.danger { border-color: #f3cdc7; background: #fffafa; }
.k-v.up { color: var(--up); }
.k-v.down { color: var(--down); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: #fff; color: var(--text); font-size: 13.5px; cursor: pointer;
  white-space: nowrap; transition: .15s; font-weight: 500;
}
.btn:hover { border-color: #c8d3e0; background: #fafcfe; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-p { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-p:hover { background: #1a4468; border-color: #1a4468; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #1a7541; border-color: #1a7541; }
.btn-bad { background: #fff; border-color: #e6b8b2; color: var(--bad); }
.btn-bad:hover { background: var(--bad-soft); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }

/* 表单 */
.field { margin-bottom: 13px; }
.field > label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; font-weight: 500; }
.field .tip { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
input[type=text], input[type=number], input[type=date], input[type=password],
input[type=email], input[type=tel], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; color: var(--text); background: #fff; outline: none;
  transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(46,109,164,.12); }
input[readonly] { background: #f7f9fc; color: var(--text-2); }
textarea { resize: vertical; min-height: 62px; }
select { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%238b95a3' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.row-3 > * { flex: 1; }
.inline { display: flex; align-items: center; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--brand-2); }

/* 表格 */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 9px 10px; background: #f7f9fc; color: var(--text-2);
  font-weight: 600; font-size: 12px; white-space: nowrap; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}
table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tbody tr:hover { background: #fafcfe; }
table.tbl tfoot td { font-weight: 700; background: #f7f9fc; border-top: 2px solid var(--line); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
table.tbl td input, table.tbl td select { padding: 5px 7px; font-size: 13px; }
table.tbl .col-act { white-space: nowrap; text-align: right; }

/* 标签 */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--line-soft); color: var(--text-2);
}
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.brand { background: var(--brand-soft); color: var(--brand); }
.tag.gray { background: #eef1f5; color: var(--text-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* 空态 */
.empty { text-align: center; padding: 44px 20px; color: var(--text-3); }
.empty .ic { font-size: 34px; opacity: .5; }
.empty p { margin: 10px 0 0; font-size: 13.5px; }

/* 提示条 */
.notice {
  display: flex; gap: 9px; padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 14px; align-items: flex-start;
}
.notice.info { background: var(--brand-soft); color: #1b4d78; }
.notice.warn { background: var(--warn-soft); color: #7a4a00; }
.notice.bad { background: var(--bad-soft); color: #8d2a1e; }
.notice.ok { background: var(--ok-soft); color: #146034; }
.notice .ic { flex: 0 0 auto; }

/* 进度/条形 */
.bar-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.bar-row .nm { flex: 0 0 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.bar-row .bar { flex: 1; height: 18px; background: #f0f3f7; border-radius: 5px; overflow: hidden; position: relative; }
.bar-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, #2e6da4, #4a8fd0); border-radius: 5px; }
.bar-row .bar i.ok { background: linear-gradient(90deg, #1f8a4c, #3fae72); }
.bar-row .bar i.warn { background: linear-gradient(90deg, #d98a12, #efb252); }
.bar-row .vl { flex: 0 0 auto; min-width: 84px; text-align: right; font-variant-numeric: tabular-nums; }

/* 上传区 */
.drop {
  border: 2px dashed #c3d0de; border-radius: var(--radius); background: #fafcfe;
  padding: 30px 20px; text-align: center; cursor: pointer; transition: .18s;
}
.drop:hover, .drop.over { border-color: var(--brand-2); background: var(--brand-soft); }
.drop .ic { font-size: 36px; color: #9db4cc; }
.drop b { display: block; margin-top: 8px; font-size: 15px; }
.drop span { font-size: 12.5px; color: var(--text-3); }
/* 拍照 / 相册两个按钮：放在上传框下面，手机上点得准 */
.up-pick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.up-pick .btn { flex: 1; min-width: 132px; justify-content: center; }
.photo-box { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #eef2f6; }
.photo-box img { display: block; width: 100%; max-height: 380px; object-fit: contain; }
.photo-box .rm { position: absolute; top: 8px; right: 8px; }

/* 识别中 */
.scanning { padding: 26px; text-align: center; }
.scan-line { height: 6px; background: #e8eef5; border-radius: 3px; overflow: hidden; margin: 16px auto; max-width: 320px; }
.scan-line i { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, #2e6da4, #7fb2e0); border-radius: 3px; animation: scan 1.1s ease-in-out infinite; }
@keyframes scan { 0% { transform: translateX(-110%); } 100% { transform: translateX(360%); } }
.spin { width: 26px; height: 26px; border: 3px solid #dbe5ef; border-top-color: var(--brand-2); border-radius: 50%; animation: rot .8s linear infinite; margin: 0 auto; }
@keyframes rot { to { transform: rotate(360deg); } }

/* 弹层 */
.modal-root { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-mask { position: absolute; inset: 0; background: rgba(18,28,42,.45); backdrop-filter: blur(2px); }
.modal {
  position: relative; background: #fff; border-radius: 14px; box-shadow: 0 18px 60px rgba(10,20,35,.28);
  width: 100%; max-width: 620px; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
}
.modal.wide { max-width: 940px; }
.modal.slim { max-width: 420px; }
.modal-h { padding: 15px 18px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; }
.modal-h h3 { margin: 0; font-size: 15.5px; flex: 1; }
.modal-h .x { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--text-3); cursor: pointer; padding: 0 4px; }
.modal-b { padding: 18px; overflow-y: auto; flex: 1; }
.modal-f { padding: 13px 18px; border-top: 1px solid var(--line-soft); display: flex; gap: 10px; justify-content: flex-end; background: #fbfcfe; }

/* 吐司 */
.toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #1c2430; color: #fff; padding: 10px 18px; border-radius: 22px;
  font-size: 13.5px; box-shadow: 0 8px 26px rgba(10,20,35,.3); animation: tin .22s ease-out;
  max-width: 88vw; text-align: center;
}
.toast.ok { background: #1a7541; }
.toast.bad { background: #a83224; }
.toast.warn { background: #8a5a10; }
@keyframes tin { from { opacity: 0; transform: translateY(-10px); } }

/* 登录页 */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(155deg, #1f4e79 0%, #2e6da4 55%, #4a8fd0 100%); }
.auth-card { background: #fff; border-radius: 16px; box-shadow: 0 24px 70px rgba(8,18,32,.3); width: 100%; max-width: 420px; overflow: hidden; }
.auth-head { padding: 26px 26px 6px; text-align: center; }
.auth-head .lg { font-size: 22px; font-weight: 700; color: var(--brand); letter-spacing: 2px; }
.auth-head p { margin: 6px 0 0; font-size: 12.5px; color: var(--text-3); }
.auth-tabs { display: flex; padding: 16px 26px 0; gap: 4px; }
.auth-tabs button {
  flex: 1; border: 0; background: none; padding: 9px 4px; font-size: 13.5px;
  color: var(--text-3); border-bottom: 2px solid transparent; cursor: pointer; font-weight: 500;
}
.auth-tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 650; }
.auth-body { padding: 18px 26px 26px; }
.auth-foot { padding: 0 26px 22px; font-size: 12px; color: var(--text-3); text-align: center; line-height: 1.7; }

/* 图表容器 */
.chart { width: 100%; overflow: hidden; }
.chart svg { display: block; width: 100%; height: auto; }

/* 明细行编辑器 */
.item-edit { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 9px; background: #fcfdff; }
.item-edit .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.item-edit .hd .idx { width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.item-edit .hd .del { margin-left: auto; }
.item-edit .g { display: grid; grid-template-columns: 2.2fr 1.2fr 1fr 1fr 1fr; gap: 8px; }
.item-edit .g > div > label { display: block; font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.item-edit .g > div > input, .item-edit .g > div > select { width: 100%; }
.match-hint { font-size: 11.5px; margin-top: 6px; }
.match-hint.ok { color: var(--ok); }
.match-hint.miss { color: var(--warn); }
/* 成本候选按钮：核对页黄条里「库里的同类」一键选用 */
.cost-cands { display: inline-block; margin-left: 6px; }
.cost-cand {
  color: #0b62d6; font-weight: 600; text-decoration: underline;
  margin-right: 8px; white-space: nowrap; cursor: pointer;
}
.cost-cand:hover { color: #084aa8; }
/* 人工写成本：点「自己填」展开的那一行 */
.cost-manual-box {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 6px; padding: 8px 10px; border: 1px dashed var(--warn); border-radius: 6px;
  background: #fffdf5; font-size: 12px;
}
.cost-manual-box .cm-label { font-weight: 600; color: var(--text-2); }
.cost-manual-box .cm-input { width: 110px; }
.cost-manual-box .cm-unit { color: var(--text-3); }
.cost-manual-box .cm-sync { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); cursor: pointer; }
.cost-manual-box .cm-sync input { width: auto; margin: 0; }
/* 金额 / 成本是自动算的只读格：灰底 + 禁用光标，跟可填的输入框一眼区分开 */
.item-edit input.ro-cell { background: var(--bg-2, #f2f4f8); color: var(--text-2); cursor: not-allowed; }
.se-sticky { position: sticky; bottom: 10px; z-index: 4; margin-top: 12px; background: #fff; box-shadow: 0 -8px 24px rgba(15,30,60,.10); }

/* SlipEditor 合计区（应收/成本/毛利/毛利率） */
.se-tots { text-align: center; }
.se-tot-l { font-size: 11.5px; color: var(--text-2); }
.se-tot-v { font-size: 19px; font-weight: 700; }

/* 核对弹层：左表单右原件 */
.rv-cols { display: flex; gap: 16px; align-items: flex-start; }
.rv-main { flex: 1.5; min-width: 0; }
.rv-side { flex: 1; min-width: 0; }

/* 待确认队列：手机端卡片（桌面隐藏） */
.rv-cards { display: none; }

/* 照片缩略 */
.thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); cursor: pointer; background: #eef2f6; }

/* 分段控件 */
.seg { display: inline-flex; background: #eef1f5; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 13px; border-radius: 7px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.seg button.on { background: #fff; color: var(--brand); font-weight: 600; box-shadow: var(--shadow-sm); }

/* 筛选条 */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .f { min-width: 130px; }
.filters .f label { display: block; font-size: 11.5px; color: var(--text-3); margin-bottom: 4px; }
.filters select, .filters input { padding: 7px 10px; font-size: 13px; }

/* 步骤 */
.steps { display: flex; align-items: center; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-3); }
.step i { width: 21px; height: 21px; border-radius: 50%; background: #e6ebf1; color: var(--text-3); display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; font-style: normal; }
.step.on { color: var(--brand); font-weight: 600; }
.step.on i { background: var(--brand); color: #fff; }
.step.done i { background: var(--ok); color: #fff; }
.step-line { flex: 1; min-width: 12px; height: 1px; background: var(--line); }

.cf-cell { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: 12px; }

/* ================= 响应式 ================= */
@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g5 { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 860px) {
  .side { display: none; }
  .m-top { display: flex; }
  .m-bottom { display: block; }
  .page { padding: 14px 13px 84px; }
  .topbar { display: none; }
  .g2, .g3, .g4, .g5 { grid-template-columns: 1fr; }
  .g5.keep2, .g4.keep2, .g3.keep2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .kpi .k-v { font-size: 21px; }
  .modal { max-height: 92vh; border-radius: 14px 14px 0 0; align-self: flex-end; max-width: 100%; }
  .modal-root { align-items: flex-end; padding: 0; }
  .item-edit .g { grid-template-columns: 1fr 1fr; }
  .item-edit .g > *:nth-child(1) { grid-column: 1 / -1; }
  .row { flex-wrap: wrap; }
  /* SlipEditor 顶部字段行：手机上两列排，不再硬挤 */
  .se-frow { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
  .se-frow > * { min-width: 0; }
  /* SlipEditor 合计区：手机上 2×2，数字缩小 */
  .se-tots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .se-tot-v { font-size: 16px; }
  /* 核对弹层：手机上竖排，原件照片放最上面方便对照 */
  .rv-cols { flex-direction: column; }
  .rv-main, .rv-side { width: 100%; flex: none; }
  .rv-side { order: -1; }
  /* 待确认队列：手机上隐藏表格，改卡片 */
  .rv-tbl { display: none; }
  .rv-cards { display: block; }
  .filters .f { flex: 1; min-width: 110px; }
  .auth-wrap { align-items: flex-start; padding: 12px; }
  .auth-card { margin-top: 12px; }
}
@media (max-width: 420px) {
  .g5.keep2, .g4.keep2, .g3.keep2 { grid-template-columns: 1fr; }
}

/* 待确认队列 · 手机卡片样式 */
.rv-card { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.rv-card:last-child { border-bottom: 0; }
.rv-card-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.rv-card-p { font-size: 14px; font-weight: 600; margin-top: 6px; }
.rv-card-m { font-size: 12px; color: var(--text-3); margin-top: 3px; line-height: 1.6; }
.rv-card-f { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 12.5px; color: var(--text-2); }

/* 打印：开票清单 */
@media print {
  .side, .m-top, .m-bottom, .topbar .btn, .no-print { display: none !important; }
  .page { padding: 0; }
  .card { border: 0; box-shadow: none; }
  body { background: #fff; }
}

/* ============================================================
 *  结算清单：A4 打印版式（#print-root 平时隐藏，点「打印」才填内容）
 * ============================================================ */
#print-root { display: none; }

.pr-doc {
  color: #000; background: #fff; font-size: 11.5px; line-height: 1.55;
  font-family: "Microsoft YaHei", "PingFang SC", "Heiti SC", "Noto Sans CJK SC", "Source Han Sans SC", "WenQuanYi Micro Hei", "WenQuanYi Zen Hei", sans-serif;
}
.pr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 2px solid #000; padding-bottom: 8px; }
.pr-co-name { font-size: 17px; font-weight: 700; letter-spacing: 1px; margin-bottom: 3px; }
.pr-co-line { font-size: 11px; color: #333; }
.pr-title { text-align: right; flex: 0 0 auto; }
.pr-title h2 { margin: 0; font-size: 19px; letter-spacing: 4px; }
.pr-no { font-size: 11px; color: #333; margin-top: 3px; white-space: nowrap; }

table.pr-info { width: 100%; border-collapse: collapse; margin: 8px 0; }
table.pr-info td { padding: 3px 2px; font-size: 11.5px; vertical-align: top; }

table.pr-tbl { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.pr-tbl th, table.pr-tbl td { border: 1px solid #333; padding: 4px 5px; font-size: 11px; word-break: break-all; }
table.pr-tbl th { background: #f0f0f0; font-weight: 700; text-align: center; }
table.pr-tbl td.c { text-align: center; }
table.pr-tbl td.r { text-align: right; }
table.pr-tbl .pr-rk { color: #444; }
table.pr-tbl tfoot td { font-weight: 700; }
table.pr-tbl tfoot .pr-upper { text-align: left; letter-spacing: 1px; }
.pr-pad td { height: 19px; }

.pr-rmk { margin-top: 8px; font-size: 11.5px; }
.pr-foot { display: flex; justify-content: space-between; gap: 20px; margin-top: 26px; font-size: 11.5px; }
.pr-tip { margin-top: 16px; font-size: 10.5px; color: #444; border-top: 1px dashed #999; padding-top: 6px; }

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body.printing { background: #fff !important; }
  body.printing .shell,
  body.printing .toast-wrap,
  body.printing .modal-root,
  body.printing #boot { display: none !important; }
  body.printing #print-root { display: block !important; }
}

/* ============================================================
 *  录单页：方式选择 / 多张照片 / 材料库选择器
 * ============================================================ */
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-b {
  text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 12px;
  padding: 16px 16px 15px; cursor: pointer; display: block; line-height: 1.5;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.mode-b:hover { border-color: var(--brand-2); background: #fbfdff; }
.mode-b.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 3px 14px rgba(46,109,164,.13); }
.mode-b .mb-ic { font-size: 24px; display: block; margin-bottom: 6px; }
.mode-b b { font-size: 14.5px; color: var(--text); display: block; }
.mode-b .mb-t { font-size: 12.5px; color: var(--text-2); display: block; margin-top: 3px; }

/* 已选照片 */
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; margin-top: 14px; }
.ph-item {
  position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: #f4f7fa; aspect-ratio: 3 / 4;
}
.ph-item img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.ph-badge {
  position: absolute; left: 6px; top: 6px; background: var(--brand); color: #fff;
  font-size: 10.5px; padding: 1px 7px; border-radius: 20px; letter-spacing: .5px;
}
.ph-ops { position: absolute; right: 4px; top: 4px; display: flex; gap: 4px; }
.ph-btn {
  border: 0; background: rgba(20,32,48,.62); color: #fff; border-radius: 7px;
  font-size: 11.5px; padding: 3px 7px; cursor: pointer; line-height: 1.3;
}
.ph-btn:hover { background: rgba(20,32,48,.82); }
.ph-btn.ph-del:hover { background: #a83224; }
.ph-size {
  position: absolute; left: 0; right: 0; bottom: 0; font-size: 10.5px; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.55)); padding: 10px 6px 3px; text-align: right;
}
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.chk input { width: auto; margin: 0; }

/* 材料与成本库选择器 */
.pl-list { max-height: 56vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.pl-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft); cursor: pointer;
}
.pl-row:last-child { border-bottom: 0; }
.pl-row:hover { background: var(--brand-soft); }
.pl-n { flex: 1; font-size: 13.5px; font-weight: 600; }
.pl-s { font-weight: 400; color: var(--text-3); font-size: 12px; }
.pl-t { font-size: 12px; color: var(--text-3); min-width: 78px; }
.pl-p { font-size: 12px; color: var(--text-2); text-align: right; white-space: nowrap; }

/* 单子详情 / 核对页的照片组 */
.pg-main { width: 100%; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.pg-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; margin-top: 6px; }
.pg-thumbs img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 7px;
  border: 1px solid var(--line); cursor: zoom-in; background: #eef2f6;
}
.pg-cap { font-size: 11.5px; color: var(--text-3); margin-top: 5px; text-align: center; }

/* ---------- 照片查看器（放大 / 缩小 / 旋转 / 下载） ---------- */
.pv-root {
  position: fixed; inset: 0; z-index: 260; display: flex; flex-direction: column;
  background: rgba(9, 15, 24, .94); color: #fff;
  -webkit-user-select: none; user-select: none;
}
.pv-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; background: rgba(0, 0, 0, .35); border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.pv-title { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.pv-count { font-size: 12px; font-weight: 400; color: rgba(255, 255, 255, .65); }
.pv-count b { color: #fff; font-size: 13px; }
.pv-no {
  font-family: var(--mono, ui-monospace, Consolas, monospace); font-size: 12px; font-weight: 500;
  background: rgba(255, 255, 255, .14); border-radius: 5px; padding: 2px 7px; color: #dce9f7;
}
.pv-tools { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.pv-b {
  border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .08); color: #fff;
  border-radius: 8px; padding: 6px 11px; font-size: 13px; line-height: 1.25; cursor: pointer;
  font-family: inherit; min-width: 36px; text-align: center;
}
.pv-b:hover { background: rgba(255, 255, 255, .22); border-color: rgba(255, 255, 255, .4); }
.pv-b:active { background: rgba(255, 255, 255, .3); }
.pv-b:disabled { opacity: .55; cursor: default; }
.pv-pct { min-width: 66px; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.pv-sep { width: 1px; height: 20px; background: rgba(255, 255, 255, .18); margin: 0 2px; }
.pv-dl { background: rgba(46, 109, 164, .55); border-color: rgba(120, 175, 230, .55); font-weight: 600; }
.pv-dl:hover { background: rgba(46, 109, 164, .85); }
.pv-stage {
  flex: 1; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center;
  touch-action: none; cursor: default;
}
.pv-stage:active { cursor: grabbing; }
.pv-img {
  position: absolute; left: 50%; top: 50%; max-width: none; max-height: none;
  /* origin 必须是 0 0：配合末尾的 translate(-50%,-50%) 才能让「中心 = stage中心 + 位移」成立，
     用默认 center 会被 origin 平移抵消出一块偏移（图片跑到右下角） */
  transform-origin: 0 0; will-change: transform; pointer-events: none;
  -webkit-user-drag: none; border-radius: 2px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
.pv-loading {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  font-size: 13px; color: rgba(255, 255, 255, .7); pointer-events: none;
}
.pv-root.pv-loading .pv-loading { display: flex; }
.pv-root.pv-loading .pv-img { opacity: .2; }
.pv-thumbs {
  display: flex; gap: 8px; padding: 10px 14px; overflow-x: auto; justify-content: center;
  background: rgba(0, 0, 0, .28); border-top: 1px solid rgba(255, 255, 255, .08);
}
.pv-thumbs img {
  width: 54px; height: 54px; object-fit: cover; border-radius: 7px; flex: 0 0 auto;
  border: 2px solid transparent; opacity: .55; cursor: pointer;
}
.pv-thumbs img.on { border-color: #fff; opacity: 1; }
.pv-tip { padding: 6px 14px 12px; text-align: center; font-size: 11.5px; color: rgba(255, 255, 255, .5); }

@media (max-width: 640px) {
  .pv-bar { padding: 8px 10px; gap: 8px; }
  .pv-tools { margin-left: 0; width: 100%; justify-content: space-between; }
  .pv-b { padding: 7px 9px; min-width: 34px; }
  .pv-pct { min-width: 56px; }
  .pv-thumbs img { width: 46px; height: 46px; }
}

@media (max-width: 640px) {
  .mode-pick { grid-template-columns: 1fr; }
  .ph-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  .pl-row { flex-wrap: wrap; gap: 4px 10px; }
  .pl-n { min-width: 100%; }
}

/* 结算清单页：小节标题 */
.sub-h { font-size: 13px; font-weight: 700; margin: 0 0 8px; }
.file-chip { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }

/* 设置页：AI 服务商快捷选择 */
.ai-vendors { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ai-vendor {
  font: inherit; font-size: 12.5px; line-height: 1;
  padding: 8px 12px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text-2);
  transition: background .15s, border-color .15s, color .15s;
}
.ai-vendor:hover { border-color: var(--brand-2); color: var(--text); }
.ai-vendor.on { background: var(--brand-2); border-color: var(--brand-2); color: #fff; font-weight: 600; }

/* 必填又没填时的高亮 */
textarea.miss { border-color: var(--bad, #d64545); background: #fff8f8; }

/* ============================================================
 *  账单明细：故障原因 / 改善方案 列 + 导出对账单相关
 * ============================================================ */
.lg-fx { font-size: 12px; line-height: 1.5; cursor: pointer; max-width: 240px; }
.lg-fx-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-fx-l .k {
  display: inline-block; font-size: 10.5px; font-weight: 700; color: var(--brand);
  background: var(--brand-soft, #eef4fa); border-radius: 4px; padding: 0 5px; margin-right: 5px;
}
.lg-fx-l + .lg-fx-l { margin-top: 3px; }
.lg-fx:hover { background: var(--brand-soft, #eef4fa); }

/* 设置页：公司 Logo */
.logo-box {
  display: flex; align-items: center; justify-content: center;
  min-height: 74px; border: 1.5px dashed var(--line); border-radius: 10px;
  background: #fbfdff; padding: 8px;
}
.logo-box img { max-height: 64px; max-width: 240px; object-fit: contain; }
.logo-box .logo-empty { font-size: 12px; color: var(--text-3); }

/* 结算清单打印抬头带 Logo */
.pr-co { display: flex; align-items: center; gap: 12px; }
.pr-logo { max-height: 52px; max-width: 180px; object-fit: contain; }

/* ---------- 报价单 / 入库单：行内编辑表格 ---------- */
table.tbl.tbl-edit td { padding: 5px 6px; vertical-align: top; }
table.tbl.tbl-edit td input { width: 100%; }
table.tbl.tbl-edit .match-hint { margin-top: 3px; line-height: 1.5; font-size: 11px; }
table.tbl.tbl-edit .match-hint .tag { font-size: 10.5px; padding: 0 4px; }
/* 报价 / 入库 编辑弹层里的卡片间距收紧一点，一屏能看全 */
#modal-root .card-h h3 { font-size: 14px; }
#modal-root .notice ul li { margin-bottom: 2px; }

/* 材料库选择面板：盖在「报价单 / 入库单」编辑弹层里面（不能新开弹层） */
.lib-panel { position: absolute; inset: 0; background: #fff; z-index: 30; display: flex; flex-direction: column; }
.lib-panel .lh {
  padding: 13px 16px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 10px; font-size: 14.5px; flex: 0 0 auto;
}
.lib-panel .lb { padding: 14px 16px; overflow-y: auto; flex: 1; }
.lib-panel .pl-list { max-height: none; border: 0; }

/* 弹层内部的小表单面板（新增客户 / 新增项目）：盖在当前弹层上，不动背后的编辑内容 */
.form-panel { position: absolute; inset: 0; background: #fff; z-index: 32; display: flex; flex-direction: column; }
.form-panel .lh {
  padding: 13px 16px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 10px; font-size: 14.5px; flex: 0 0 auto;
}
.form-panel .lh span { font-weight: 400; font-size: 12px; color: var(--text-3); }
.form-panel .lb { padding: 14px 16px; overflow-y: auto; flex: 1; }
.form-panel .lb .row { display: flex; gap: 12px; }
.form-panel .lf {
  padding: 12px 16px; border-top: 1px solid var(--line-soft);
  display: flex; justify-content: flex-end; gap: 10px; flex: 0 0 auto;
}
