:root {
  --teal: #0f766e;
  --teal-d: #0c5d56;
  --teal-l: #e6f4f1;
  --bg: #f4f6f8;
  --card: #ffffff;
  --line: #e3e8ec;
  --txt: #1f2933;
  --mut: #6b7785;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --gray: #94a3b8;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--txt);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 64px;
}
.app-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 12px;
  background: var(--teal); color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.app-bar h1 { font-size: 17px; font-weight: 600; flex: 1; margin: 0; text-align: center; }
.icon-btn {
  background: transparent; border: none; color: #fff; font-size: 15px; cursor: pointer;
  padding: 6px 8px; border-radius: 8px; min-width: 44px;
}
.icon-btn:active { background: rgba(255,255,255,.18); }

#view { padding: 12px; max-width: 880px; margin: 0 auto; }
.loading { text-align: center; color: var(--mut); padding: 40px 0; }

/* 卡片 / 列表 */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(16,24,40,.04);
}
.card.tap { cursor: pointer; transition: transform .06s; }
.card.tap:active { transform: scale(.99); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.muted { color: var(--mut); font-size: 13px; }
.small { font-size: 12px; }
.title { font-size: 16px; font-weight: 600; }
.sub { color: var(--mut); font-size: 13px; margin-top: 4px; line-height: 1.5; }

/* 状态徽标 */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.b-进行中 { background: #dcfce7; color: #15803d; }
.b-已完工 { background: #e0f2fe; color: #0369a1; }
.b-暂停 { background: #fef3c7; color: #b45309; }
.b-未开工 { background: #f1f5f9; color: #475569; }
.b-待接单 { background: #fef3c7; color: #b45309; }
.b-已派工 { background: #dbeafe; color: #1d4ed8; }
.b-实施中 { background: #ccfbf1; color: #0f766e; }
.b-已完成 { background: #dcfce7; color: #15803d; }

/* 进度条 */
.bar { height: 8px; background: #eef2f5; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg,#0f766e,#14b8a6); }
.bar-text { font-size: 12px; color: var(--mut); margin-top: 4px; }

/* 底部导航 */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex; align-items: stretch; justify-content: space-around;
  height: 60px; padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--line);
  box-shadow: 0 -2px 10px rgba(0,0,0,.05);
}
.nav-btn {
  flex: 1; border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11px; color: var(--mut);
}
.nav-btn span { font-size: 11px; }
.nav-btn.active { color: var(--teal); font-weight: 600; }
.nav-btn.fab { justify-content: center; }
.nav-btn.fab::before {
  content: "＋"; font-size: 26px; line-height: 1;
  width: 46px; height: 46px; margin-top: -18px; border-radius: 50%;
  background: var(--teal); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(15,118,110,.4);
}

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--txt); font-size: 14px; cursor: pointer; font-weight: 500;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn.block { width: 100%; }
.btn.danger { color: var(--red); border-color: #fecaca; }
.btn.sm { padding: 7px 10px; font-size: 13px; }

/* 表单 */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--mut); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--txt);
}
.field textarea { min-height: 76px; resize: vertical; }
.field .req { color: var(--red); }

/* 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.stat b { font-size: 22px; color: var(--teal); display: block; }
.stat span { font-size: 12px; color: var(--mut); }

/* 日志条目 */
.log-item { border-left: 3px solid var(--teal); }
.log-date { font-weight: 600; }
.chip { display: inline-block; background: var(--teal-l); color: var(--teal-d); border-radius: 6px; padding: 1px 7px; font-size: 12px; margin-right: 6px; }

/* 搜索框 */
.search { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; margin-bottom: 12px; }

/* 空状态 */
.empty { text-align: center; color: var(--mut); padding: 48px 16px; }
.empty .big { font-size: 40px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 40; background: rgba(15,23,42,.5);
  display: none; align-items: flex-end; justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  animation: up .18s ease;
}
@keyframes up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal h2 { margin: 0 0 14px; font-size: 18px; }
.modal .actions { display: flex; gap: 10px; margin-top: 8px; }
.modal .actions .btn { flex: 1; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%);
  background: rgba(15,23,42,.92); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 14px; z-index: 60; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90%;
}
.toast.show { opacity: 1; }

/* 桌面端底部导航收起为顶部 */
@media (min-width: 720px) {
  .bottom-nav { max-width: 880px; left: 50%; transform: translateX(-50%); border-radius: 14px 14px 0 0; }
}

/* 现场照片 */
.thumb-wrap { position: relative; display: inline-block; margin: 0 6px 6px 0; }
.thumb-x {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; cursor: pointer; line-height: 1; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.thumbs { display: flex; flex-wrap: wrap; margin-top: 8px; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.img-grid img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 10px; }
.viewer img { max-width: 100%; border-radius: 8px; margin: 4px 0; }
.field input[type=file] { padding: 8px; font-size: 13px; }

/* 登录 */
.login { max-width: 420px; margin: 28px auto 0; text-align: center; }
.login-logo { font-size: 52px; }
.login-title { font-size: 22px; font-weight: 700; margin-top: 6px; }
.login-sub { color: var(--mut); font-size: 14px; margin-top: 4px; }
.login-err { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 16px; text-align: center; }

/* 修改记录（审计） */
.hist-list { margin-top: 4px; }
.hist-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); gap: 10px; }
.hist-row:first-child { border-top: none; }
.hist-act { display: inline-block; background: var(--teal-l); color: var(--teal-d); border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; }

/* 派工单流转时间线 */
.timeline { margin-top: 4px; }
.tl-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.tl-item:last-child { border-bottom: none; }
.tl-dot { font-size: 18px; width: 24px; text-align: center; flex: none; }
.tl-body { flex: 1; }
.tl-act { font-weight: 600; color: var(--teal-d); }
.tl-meta { color: var(--muted); font-size: 12px; margin-top: 1px; }
.tl-extra { margin-top: 3px; font-size: 13px; }
.tl-note { margin-top: 2px; font-size: 12px; color: #666; }
