/* 探险家道服 — 公共样式（v2：自 index.html 内联迁出 + 增量）
   状态色与 constants.STATUS_COLORS 保持一致；对账终态样式属 P1(R11) 届时补回 */

:root {
  --accent: #2f6fed;
  --border: #e5e7eb;
  --muted: #6b7280;
  --bg: #f5f6f8;
  --card: #ffffff;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: #1f2937;
  font-size: 14px;
  padding-bottom: 40px;
}
/* 登录页 / 身份选择页 */
.login-view {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: linear-gradient(160deg, #2f6fed 0%, #1e4fc7 100%);
}
.login-card {
  width: 100%; max-width: 340px; background: #fff; border-radius: 16px;
  padding: 28px 24px; box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.login-card h2 { font-size: 19px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-card .tip { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 20px; }
.login-card input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; margin-bottom: 12px;
}
.login-card button {
  width: 100%; padding: 12px; background: var(--accent); color: #fff; border: none;
  border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 4px;
}
.login-card .err { color: #c0392b; font-size: 13px; text-align: center; margin-top: 10px; min-height: 18px; }
/* 身份选择大按钮（师傅端） */
.pick-list { display: flex; flex-direction: column; gap: 10px; }
.pick-btn {
  padding: 14px; border: 1px solid var(--border); border-radius: 12px;
  font-size: 16px; font-weight: 600; background: #fff; cursor: pointer; text-align: left;
}
.pick-btn:active { background: #eef4ff; border-color: var(--accent); }
.pick-btn .sub { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; }
/* 顶部 */
.header {
  position: sticky; top: 0; z-index: 20;
  background: var(--accent); color: #fff;
  padding: 12px 16px 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.header .title { font-size: 17px; font-weight: 700; }
.header .sub { font-size: 12px; opacity: .85; margin-top: 3px; }
.header .user-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.header .user-row .me { font-size: 13px; opacity: .95; }
.header .user-row .me b { font-weight: 700; }
.header .logout { font-size: 12px; background: rgba(255,255,255,.2); color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.header .btn-update { font-size: 12px; background: #ffb800; color: #1a1a1a; font-weight: 700; border: 1px solid #e6a600; border-radius: 6px; padding: 4px 10px; cursor: pointer; margin-right: 6px; }
.header .btn-mini { font-size: 12px; background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 6px; padding: 4px 10px; cursor: pointer; margin-right: 6px; font-weight: 600; }
.header .btn-mini:active { background: rgba(255,255,255,.32); }
.header .update-msg { font-size: 11px; opacity: .92; margin-top: 6px; }
.header .stats { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.header .stat {
  background: rgba(255,255,255,.18); border-radius: 6px;
  padding: 3px 8px; font-size: 12px;
}
.header .stat b { font-weight: 700; }
/* R07 徽章可点击过滤 */
.header .stat.stat-link { cursor: pointer; border: 1px solid rgba(255,255,255,.25); }
.header .stat.stat-link.active { background: #fff; color: var(--accent); }
/* 筛选 */
.filters {
  position: sticky; top: 0; z-index: 10;
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 8px 12px;
}
.tabs { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.tab {
  flex: 0 0 auto; padding: 6px 12px; border-radius: 16px; font-size: 13px;
  border: 1px solid var(--border); background: #fff; color: #374151; cursor: pointer;
  white-space: nowrap;
}
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.tab .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.row2 { display: flex; gap: 8px; margin-top: 8px; }
.row2 select, .row2 input {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; background: #fff;
}
.row2 select { flex: 1; min-width: 0; }
.row2 input { flex: 1.4; min-width: 0; }
/* 列表 */
.list { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card .line1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card .vno { font-size: 16px; font-weight: 700; }
.card .vno .model { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.badge {
  flex: 0 0 auto; padding: 4px 10px; border-radius: 14px; font-size: 12px;
  font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: #fff;
}
.card .line2 { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.tag { font-size: 12px; color: var(--muted); background: #f3f4f6; padding: 2px 8px; border-radius: 4px; }
.tag.p1 { color: #c0392b; background: #fdecea; }
.tag.p2 { color: #b8860b; background: #fdf6e3; }
.tag.p3 { color: #1e7e34; background: #e8f5e9; }
.tag.p4 { color: #555; background: #eee; }
.tag.src { color: #1a3a5c; background: #e3edfb; font-weight: 600; }
.tag.assign { color: #1e7e34; background: #e8f5e9; font-weight: 600; }
.card .fault { margin-top: 8px; font-size: 13px; color: #374151; line-height: 1.5; }
.card .line3 { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); align-items: center; gap: 8px; }
.card .addr { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 13px; }
/* 卡片内小按钮 */
.mini-btn {
  padding: 5px 12px; border-radius: 8px; border: 1px solid var(--accent);
  background: #fff; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.mini-btn:active { background: var(--accent); color: #fff; }
/* v3 加急标记（独立 urgent，任何状态都能点） */
.tag.urgent { color:#8a1c22; background:#ffc7ce; border:1px solid #f5a5ae; font-weight:700; }
.card.urgent-card { border-left: 3px solid #e03a4e; }
.mini-btn.urgent-on { background:#e03a4e; border-color:#c02a3c; color:#fff; }
/* 师傅端快捷大按钮 */
.big-btn {
  display: block; width: 100%; margin-top: 10px; padding: 13px;
  border-radius: 12px; border: none; background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 700; cursor: pointer;
}
.big-btn:active { opacity: .85; }
.ghost-btn {
  display: block; width: 100%; margin-top: 8px; padding: 9px;
  border-radius: 10px; border: 1px dashed #b9c4d4; background: #fff; color: var(--muted);
  font-size: 13px; cursor: pointer;
}
/* 已完工折叠（师傅端） */
.done-header {
  margin: 14px 0 0; padding: 10px 12px; border-radius: 10px;
  background: #eceff3; color: var(--muted); font-size: 13px; text-align: center; cursor: pointer;
}
.done-box { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.card.done { opacity: .62; }
.card.done .vno, .card.done .fault { color: var(--muted); }
.done-note { text-align: center; color: var(--muted); font-size: 12px; padding: 10px 0; }
/* 状态徽章颜色（延续 Excel 语义；与 constants.STATUS_COLORS 保持一致） */
.s-新工单跟进 { background:#e6e0f0; border-color:#c9bde0; color:#4b3a6b; }
.s-可维修 { background:#fff; border-color:#cbd5e1; color:#374151; }
.s-已排单 { background:#bdd7ee; border-color:#9ec5e8; color:#1a3a5c; }
.s-待上传 { background:#fff2cc; border-color:#f0dfa0; color:#7a5c00; }
.s-已完工 { background:#e2efda; border-color:#c3ddb0; color:#2f5d1e; }
.s-机会工单跟进, .s-等待物料 { background:#fce4d6; border-color:#f0c8b2; color:#8a4a1c; }
.s-已对账 { background:#d9d9d9; border-color:#bfbfbf; color:#444444; }
.s-已取消 { background:#d9d9d9; border-color:#a6a6a6; color:#5b5b5b; text-decoration: line-through; }
/* 机会单转正提示条 + 弹层条目 */
.promote-bar {
  margin-top: 8px; padding: 8px 10px; border-radius: 8px;
  background: #fff7e6; border: 1px solid #f0dfa0; color: #7a5c00;
  font-size: 13px; display: none; align-items: center; justify-content: space-between; gap: 8px;
}
.promote-item {
  padding: 10px 0; border-bottom: 1px solid #eee; display: flex; flex-direction: column; gap: 6px;
}
.promote-item:last-child { border-bottom: none; }
.pi-row { font-size: 14px; }
.pi-sub { font-size: 12px; color: var(--muted); }
.pi-date { font-size: 12px; color: var(--muted); margin-left: 6px; }
.mini-btn.warn { border-color: #f0c8b2; color: #8a4a1c; }
/* 弹出选择器 */
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: none; align-items: flex-end;
}
.mask.show { display: flex; }
.sheet {
  width: 100%; background: #fff; border-radius: 16px 16px 0 0;
  padding: 16px 16px 24px; max-height: 78vh; overflow-y: auto;
}
.sheet h3 { font-size: 15px; margin-bottom: 12px; }
.sheet .opt {
  display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 10px;
  border: 1px solid var(--border); margin-bottom: 8px; cursor: pointer; font-size: 14px;
}
.sheet .opt .swatch { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border); flex: 0 0 auto; }
.sheet .opt:active { background: #f3f6fd; }
.sheet .cancel {
  margin-top: 8px; text-align: center; padding: 12px; color: var(--muted);
  border-top: 1px solid var(--border); cursor: pointer; font-size: 14px;
}
/* 派单面板 */
.worker-opt .wname { font-weight: 700; flex: 1; }
.worker-opt .wcount { font-size: 12px; color: var(--muted); background: #f3f4f6; padding: 3px 8px; border-radius: 10px; }
.worker-opt .avatar { font-size: 18px; }
.add-worker { display: flex; gap: 8px; margin-top: 10px; }
.add-worker input {
  flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; min-width: 0;
}
.loading { text-align: center; color: var(--muted); padding: 20px 0; font-size: 13px; }
/* 新建工单表单 */
.form label { display: block; font-size: 13px; color: #374151; margin: 10px 0 4px; font-weight: 600; }
.form label.req::after { content: " *"; color: #c0392b; }
.form input, .form select, .form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; background: #fff; font-family: inherit;
}
.form textarea { resize: vertical; }
.form .btn-primary {
  display: block; width: 100%; margin-top: 16px; padding: 13px;
  border-radius: 12px; border: none; background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 700; cursor: pointer;
}
.form-err { color: #c0392b; font-size: 13px; text-align: center; margin-top: 10px; min-height: 18px; }
.panel-hint { color: var(--muted); font-size: 13px; line-height: 1.8; padding: 8px 0; text-align: center; }
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.75); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; z-index: 60; display: none;
}
