/* 工地协同 - 简约黑白灰设计（无彩色图标） */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink: #191919; --sub: #666; --faint: #999;
  --line: #e4e4e1; --bg: #f6f6f4; --card: #fff;
  --card2: #fcfcfa;      /* 嵌套卡片（编辑器项） */
  --soft: #fafaf8;       /* 浅色区块（验收清单） */
  --row-line: #f0f0ed;   /* 行分隔线 */
  --row-line2: #ecece9;  /* 虚线分隔 */
  --line-strong: #c9c9c6;/* 强边框 */
  --btn-text: #fff;      /* 反色按钮文字 */
  --err-bg: #f2f2f0;
  --footer: #c5c5c2;
}
html[data-theme="dark"] {
  --ink: #e6e6e3; --sub: #a3a39e; --faint: #77776f;
  --line: #383836; --bg: #121211; --card: #1c1c1b;
  --card2: #212120; --soft: #252524;
  --row-line: #2d2d2b; --row-line2: #3a3a38;
  --line-strong: #5a5a54;
  --btn-text: #121211;
  --err-bg: #2b2323;
  --footer: #555550;
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6;
  transition: background-color .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }

/* 顶栏 */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); transition: background-color .25s ease; }
.topbar .wrap { display: flex; align-items: center; gap: 22px; height: 54px; }
.brand { font-weight: 700; letter-spacing: 1px; font-size: 16px; }
.brand span { color: var(--faint); font-weight: 400; }
.topnav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.topnav a { padding: 6px 10px; color: var(--sub); white-space: nowrap; font-size: 14px; }
.topnav a.on, .topnav a:hover { color: var(--ink); }
.topnav a.on { border-bottom: 2px solid var(--ink); }
.topuser { font-size: 13px; color: var(--sub); display: flex; gap: 10px; align-items: center; }
.topuser a:hover { color: var(--ink); }

/* 主题切换 */
.theme-toggle { border: 1px solid var(--line); background: var(--card); color: var(--sub);
  border-radius: 99px; padding: 3px 12px; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.theme-toggle:hover { color: var(--ink); border-color: var(--ink); }

main.wrap { padding: 24px 16px 60px; }

/* 卡片与标题 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 16px; transition: background-color .25s ease, border-color .25s ease; }
.card h2 { font-size: 16px; margin-bottom: 4px; }
.card .hint { color: var(--sub); font-size: 13px; margin-bottom: 14px; }
.pagehead { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 0 18px; flex-wrap: wrap; gap: 8px; }
.pagehead h1 { font-size: 21px; letter-spacing: .5px; }
.pagehead .sub { color: var(--faint); font-size: 13px; }

/* 按钮 */
.btn { display: inline-block; border: 1px solid var(--ink); background: var(--ink); color: var(--btn-text);
  padding: 8px 18px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.btn:hover { opacity: .85; }
.btn.outline { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.btn.outline:hover { border-color: var(--ink); opacity: 1; }
.btn.small { padding: 4px 12px; font-size: 13px; }
.btn.ghost { border: none; background: none; color: var(--sub); padding: 4px 6px; }
.btn.ghost:hover { color: var(--ink); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* 表单 */
label { display: block; font-size: 13px; color: var(--sub); margin: 12px 0 5px; }
label b { color: var(--ink); font-weight: 600; }
input[type=text], input[type=tel], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 14px; background: var(--card); color: var(--ink); font-family: inherit;
  transition: background-color .25s ease, border-color .25s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }
textarea { min-height: 84px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column:  1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--faint); font-weight: 500; font-size: 12.5px;
  padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 8px; border-bottom: 1px solid var(--row-line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }

/* 徽章（全灰阶） */
.badge { display: inline-block; padding: 2px 10px; border: 1px solid var(--line);
  border-radius: 99px; font-size: 12px; color: var(--sub); background: var(--card); white-space: nowrap; }
.badge.b-dark { background: var(--ink); color: var(--btn-text); border-color: var(--ink); }
.badge.b-bold { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.badge.b-dash { border-style: dashed; color: var(--ink); }

/* 步骤进度 */
.step { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--row-line); }
.step:last-child { border-bottom: none; }
.step-no { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  color: var(--faint); flex: none; background: var(--card); }
.step.passed .step-no { background: var(--ink); color: var(--btn-text); border-color: var(--ink); }
.step.rectify .step-no { border-style: dashed; border-color: var(--ink); color: var(--ink); }
.step-body { flex: 1; min-width: 0; }
.step-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-head h3 { font-size: 15px; }
.step-desc { color: var(--sub); font-size: 13px; margin: 6px 0 10px; }
.step-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.wait-tag { font-size: 12.5px; color: var(--faint); }
.acc-list { background: var(--soft); border: 1px solid var(--row-line); border-radius: 8px; padding: 10px 14px; font-size: 13px; }
.acc-list li { list-style: none; padding: 4px 0; color: var(--sub); display: flex; gap: 8px; }
.acc-list li b { color: var(--ink); font-weight: 500; }
.acc-list li .std { color: var(--faint); }

/* 自检行 */
.check-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--row-line2); }
.check-row:last-child { border-bottom: none; }
.check-row .name { font-size: 14px; flex: 1; }
.check-row .name small { display: block; color: var(--faint); }
.check-row select { width: 110px; flex: none; }

/* 照片 */
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photos img { width: 92px; height: 92px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.file-label { display: inline-block; border: 1px dashed var(--line-strong); border-radius: 6px;
  padding: 8px 14px; font-size: 13px; color: var(--sub); cursor: pointer; margin-top: 8px; }
.file-label:hover { border-color: var(--ink); color: var(--ink); }
.file-label input { display: none; }

/* 上传预览（选择照片后即时显示） */
.upload-preview { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.upload-preview:empty { display: none; }
.up-cell { position: relative; width: 92px; height: 92px; flex: none; }
.up-cell img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line); display: block; }
.up-del { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px;
  line-height: 20px; text-align: center; background: rgba(0, 0, 0, .72); color: #fff;
  border-radius: 50%; cursor: pointer; font-size: 15px; user-select: none; }
.up-del:hover { background: #c0392b; }
.upload-hint { margin-top: 8px; font-size: 12.5px; color: var(--sub); }
.upload-hint.warn { color: #d35450; font-weight: 600; }
button:disabled { opacity: .55; cursor: not-allowed; }

/* 统计 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.stat .num { font-size: 26px; font-weight: 700; letter-spacing: 1px; }
.stat .lab { color: var(--faint); font-size: 12.5px; margin-top: 2px; }

/* 消息提示 */
.flash { border: 1px solid var(--line); background: var(--card); border-left: 3px solid var(--ink);
  padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 14px; }
.flash.err { border-left-color: var(--ink); background: var(--err-bg); }

/* 登录 */
.login-box { max-width: 380px; margin: 9vh auto 0; }
.login-box .brand { font-size: 22px; display: block; text-align: center; margin-bottom: 6px; }
.login-box .sub { text-align: center; color: var(--faint); font-size: 13px; margin-bottom: 22px; }
.login-tips { color: var(--faint); font-size: 12px; margin-top: 16px; line-height: 1.9; }

/* 编辑器（工种DIY） */
.ed-item { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 12px; background: var(--card2); }
.ed-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.ed-head .tag { font-size: 12px; color: var(--faint); }
.ed-sub { border: 1px dashed var(--line); border-radius: 6px; padding: 8px 10px; margin: 8px 0; background: var(--card); }
.ed-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.inline-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.divider { border: none; border-top: 1px solid var(--line); margin: 22px 0; }

/* 编辑器：折叠卡片 / 排序 / 汇总 */
.ed-item .ed-body { display: none; }
.ed-item.open .ed-body { display: block; }
.ed-item.open { border-color: var(--line-strong); }
.ed-head.toggle { cursor: pointer; user-select: none; padding: 2px 0; }
.ed-head.toggle .ed-head-l { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.ed-caret { color: var(--faint); font-size: 12px; transition: transform .15s; flex: none; }
.ed-item.open > .ed-head .ed-caret { transform: rotate(90deg); }
.ed-title { font-size: 14px; font-weight: 600; color: var(--ink); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.ed-count { font-size: 12px; color: var(--faint); border: 1px solid var(--line);
  border-radius: 99px; padding: 1px 8px; white-space: nowrap; background: var(--card); }
.ed-head-r { display: flex; gap: 2px; align-items: center; flex: none; }
.ed-head-r .mv { font-size: 14px; padding: 2px 9px; }
.ed-sub-ops { display: flex; gap: 2px; justify-content: flex-end; margin-top: 6px; }
.ed-sub-ops .mv { font-size: 14px; padding: 2px 9px; }
/* 施工标准参考图（工人/监理端展示 + 编辑器内管理） */
.ref-grid { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.ref-grid:empty { display: none; }
.ref-grid a { display: inline-block; }
.ref-grid img { width: 76px; height: 76px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--line); display: block; }
.ref-grid img:hover { border-color: var(--ink); }
.ref-item { position: relative; }
.ref-item .up-del { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px;
  line-height: 20px; text-align: center; background: rgba(0, 0, 0, .72); color: #fff;
  border-radius: 50%; cursor: pointer; font-size: 15px; user-select: none; }
.ref-item .up-del:hover { background: #c0392b; }

.ed-toolbar { display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap; margin: 10px 0 12px; }

/* 二维码页 */
.qr-box { text-align: center; padding: 30px 16px; }
.qr-box img.qr { width: 260px; height: 260px; }
.qr-box .url { color: var(--faint); font-size: 12px; word-break: break-all; margin-top: 10px; }

/* 客户免登录查看页 */
.cv-wrap { max-width: 720px; padding-top: 26px; }
.cv-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cv-hero h1 { font-size: 22px; margin-bottom: 4px; }
.cv-hero .sub { color: var(--sub); font-size: 13.5px; }
.cv-overall { display: flex; align-items: center; gap: 18px; margin-top: 20px;
  padding-top: 18px; border-top: 1px solid var(--line); }
.cv-overall-num { font-size: 46px; font-weight: 700; line-height: 1; color: var(--ink);
  letter-spacing: -1px; flex: none; }
.cv-overall-num i { font-style: normal; font-size: 20px; font-weight: 600; margin-left: 2px; }
.cv-overall-bar { flex: 1; min-width: 0; }
.cv-overall-text { margin-top: 8px; font-size: 13px; color: var(--sub); }
.cv-bar { height: 8px; border-radius: 99px; background: var(--row-line); overflow: hidden; }
.cv-bar span { display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #4a7ba6, #5d94c4); transition: width .4s; }
.cv-trades { display: grid; gap: 16px; }
.cv-trade-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  margin-bottom: 7px; }
.cv-trade-head b { font-size: 14.5px; }
.cv-trade-pct { font-size: 12.5px; color: var(--sub); white-space: nowrap; }
.cv-trade-cur { margin-top: 7px; font-size: 12.5px; color: var(--faint); }
.cv-timeline { margin-top: 16px; position: relative; padding-left: 18px; }
.cv-timeline::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px;
  width: 2px; background: var(--line); border-radius: 2px; }
.cv-tl-item { position: relative; padding-bottom: 22px; }
.cv-tl-item:last-child { padding-bottom: 4px; }
.cv-tl-dot { position: absolute; left: -18px; top: 5px; width: 10px; height: 10px;
  border-radius: 50%; background: #4a7ba6; border: 2px solid var(--bg); box-sizing: content-box;
  margin-left: 0; }
.cv-tl-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  flex-wrap: wrap; margin-bottom: 8px; }
.cv-tl-meta b { font-size: 14px; }
.cv-tl-meta span { font-size: 12.5px; color: var(--faint); }
.cv-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.cv-photos a { display: block; aspect-ratio: 1; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line); }
.cv-photos img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .15s; }
.cv-photos img:hover { opacity: .85; }
.cv-empty { color: var(--faint); font-size: 13.5px; padding: 26px 0; text-align: center; }
.cv-foot { text-align: center; color: var(--footer); font-size: 12px; padding: 26px 0 34px; }
@media (max-width: 480px) {
  .cv-overall { gap: 14px; }
  .cv-overall-num { font-size: 38px; }
  .cv-photos { grid-template-columns: repeat(3, 1fr); }
}

.list-tile { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 14px 4px; border-bottom: 1px solid var(--row-line); }
.list-tile:last-child { border-bottom: none; }
.list-tile h3 { font-size: 15px; }
.list-tile .meta { color: var(--faint); font-size: 12.5px; margin-top: 2px; }

/* 未保存修改守卫对话框 */
.ug-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center; z-index: 1000; }
.ug-dialog { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 22px; max-width: 400px; width: calc(100% - 40px); }
.ug-dialog h3 { font-size: 16px; margin-bottom: 6px; }
.ug-dialog p { color: var(--sub); font-size: 13.5px; margin-bottom: 18px; }
.ug-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

@media print {
  .topbar, .noprint, main .card:not(.qr-card) { display: none !important; }
  body { background: #fff; }
}
footer { text-align: center; color: var(--footer); font-size: 12px; padding: 30px 0; }
