:root {
  --brand: #1677ff;
  --brand-dark: #0d5fd6;
  --brand-soft: #e8f1ff;
  --ok: #16a34a;
  --ok-soft: #e9f9ef;
  --warn: #d97706;
  --warn-soft: #fff7e6;
  --danger: #dc2626;
  --danger-soft: #feeceb;
  --bg: #f2f5f9;
  --card: #ffffff;
  --line: #e6ebf2;
  --text: #1b2430;
  --muted: #8792a4;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(22, 45, 80, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  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;
}

body { padding-bottom: env(safe-area-inset-bottom); }

[v-cloak] { display: none; }

/* ---------- 顶部 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, #1677ff 0%, #2b8cff 100%);
  color: #fff;
  padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
  box-shadow: 0 2px 12px rgba(22, 119, 255, 0.28);
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: .3px; }
.topbar .sub { font-size: 12px; opacity: .9; margin-top: 3px; }
.topbar .me { position: absolute; right: 14px; top: calc(16px + env(safe-area-inset-top)); font-size: 12px; background: rgba(255,255,255,.22); padding: 3px 9px; border-radius: 20px; }

.tabs { display: flex; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 19; }
.tabs button {
  flex: 1; border: 0; background: none; padding: 12px 0; font-size: 15px; color: var(--muted);
  font-family: inherit; position: relative; cursor: pointer;
}
.tabs button.active { color: var(--brand); font-weight: 600; }
.tabs button.active::after {
  content: ''; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 34px; height: 3px; border-radius: 3px; background: var(--brand);
}

/* ---------- 通用 ---------- */
.wrap { padding: 12px 12px 120px; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 12px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 8px; padding: 13px 14px;
  border-bottom: 1px solid var(--line); cursor: pointer; user-select: none;
}
.card-head .ico { font-size: 17px; }
.card-head .name { font-weight: 600; flex: 1; font-size: 15px; }
.card-head .badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: #f0f3f8; color: var(--muted); }
.card-head .badge.done { background: var(--ok-soft); color: var(--ok); }
.card-head .badge.bad { background: var(--danger-soft); color: var(--danger); }
.card-head .arrow { color: #bcc6d4; font-size: 12px; transition: transform .2s; }
.card-head .arrow.open { transform: rotate(90deg); }
.card-body { padding: 4px 14px 14px; }

.field { padding: 11px 0; border-bottom: 1px dashed #eef2f7; }
.field:last-child { border-bottom: 0; }
.field-label { font-size: 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 5px; }
.field-label .req { color: var(--danger); font-size: 12px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: #fafbfd; color: #46536a;
  border-radius: 9px; padding: 8px 15px; font-size: 14px; font-family: inherit; cursor: pointer;
  transition: all .15s;
}
.chip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.chip.on.bad { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.chip.taken, .chip:disabled { border-style: dashed; background: #f4f5f7; color: var(--muted); cursor: not-allowed; }
.chip:active { transform: scale(.97); }
.chip:disabled:active { transform: none; }

input[type=text], input[type=number], input[type=password], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
  font-size: 15px; font-family: inherit; color: var(--text); background: #fafbfd; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); background: #fff; }
textarea { resize: vertical; line-height: 1.6; }

/* ---------- 照片 ---------- */
.photo-row { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-slot {
  width: 96px; height: 96px; border-radius: 11px; border: 1px dashed #c8d3e2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; background: #fafcff; position: relative; overflow: hidden;
  cursor: pointer;
}
.photo-slot .cam { font-size: 22px; margin-bottom: 2px; }
.photo-slot.album { background: #f7faff; border-color: #cfe0f7; }
.photo-slot.filled { border-style: solid; border-color: var(--line); padding: 0; }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-slot .del {
  position: absolute; right: 2px; top: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 13px; line-height: 20px; text-align: center;
  border: 0; cursor: pointer;
}
.photo-slot .meta {
  position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.5); color: #fff;
  font-size: 10px; padding: 2px 4px; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.photo-slot .spin { font-size: 12px; color: var(--brand); }
.photo-slot.processing { border-color: var(--brand); background: var(--brand-soft); }
/* 文件选择器必须「可见但不可见」，不能用 display:none ——
   iOS Safari / 微信&企业微信 WebView 会忽略对 display:none 的 input 调 click()，
   表现为点了「现场拍照 / 相册选择」毫无反应。 */
.photo-input {
  position: absolute; left: -9999px; top: 0;
  width: 1px; height: 1px; opacity: 0; overflow: hidden;
  border: 0; padding: 0; margin: 0;
}

/* ---------- 按钮 ---------- */
.btn {
  border: 0; border-radius: 11px; padding: 13px 18px; font-size: 16px; font-family: inherit;
  font-weight: 600; width: 100%; cursor: pointer; transition: opacity .15s;
}
.btn:active { opacity: .85; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(22,119,255,.3); }
.btn-primary:disabled { background: #c3d3e8; box-shadow: none; }
.btn-ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-mini { width: auto; padding: 7px 14px; font-size: 13px; border-radius: 8px; }

.submit-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; align-items: center;
}
.submit-bar .info { font-size: 12px; color: var(--muted); flex: 1; }
.submit-bar .info b { color: var(--text); }
.submit-bar .btn { flex: 0 0 132px; padding: 12px 0; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(28,36,50,.94); color: #fff; padding: 13px 18px; border-radius: 12px;
  font-size: 14px; max-width: 84vw; z-index: 90; text-align: center; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}
.toast.ok { background: rgba(22,140,70,.96); }
.toast.err { background: rgba(190,40,40,.96); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(16,24,40,.5); z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 360px;
  text-align: center;
}
.modal .m-ico { font-size: 34px; }
.modal h3 { margin: 8px 0 6px; font-size: 17px; }
.modal p { color: #55617a; font-size: 14px; margin: 0 0 16px; line-height: 1.7; text-align: left; }
.modal .row { display: flex; gap: 10px; }

/* ---------- 底部动作面板：添加现场图片（拍照 / 相册） ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(16,24,40,.42); z-index: 85;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: #fff; width: 100%; max-width: 520px;
  border-radius: 18px 18px 0 0; padding: 8px 14px calc(14px + env(safe-area-inset-bottom));
}
.sheet-title { text-align: center; color: var(--muted); font-size: 13px; padding: 10px 0 8px; }
.sheet-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: #f7f9fc; border: 0; border-radius: 13px; padding: 14px 16px;
  font-family: inherit; text-align: left; cursor: pointer; margin-bottom: 8px;
}
.sheet-item:active { background: #eef3fa; }
.sheet-item .s-ico { font-size: 22px; }
.sheet-item .s-txt { display: flex; flex-direction: column; }
.sheet-item .s-txt b { font-size: 15px; color: var(--text); font-weight: 500; }
.sheet-item .s-txt em { font-style: normal; font-size: 12px; color: var(--muted); margin-top: 2px; }
.sheet-cancel {
  width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 13px;
  padding: 13px; font-size: 15px; font-family: inherit; color: #55617a; cursor: pointer;
}

/* ---------- 草稿恢复提示条 ---------- */
.draft-bar { display: flex; align-items: center; gap: 10px; }
.draft-bar .draft-txt { flex: 1; }
.btn-mini {
  flex: none; border: 1px solid rgba(0,0,0,.12); background: rgba(255,255,255,.72);
  color: inherit; border-radius: 9px; padding: 6px 10px; font-size: 12.5px;
  font-family: inherit; cursor: pointer; white-space: nowrap;
}

.empty { text-align: center; color: var(--muted); padding: 46px 0; font-size: 14px; }
.empty .big { font-size: 34px; display: block; margin-bottom: 8px; }

/* ---------- 身份选择 ---------- */
.login-wrap { padding: 26px 18px; }
.login-wrap h2 { font-size: 19px; margin: 6px 0 4px; }
.login-wrap .tip { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.user-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.user-item {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 15px 8px;
  text-align: center; font-size: 15px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow);
}
.user-item:active { background: var(--brand-soft); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 7px; font-weight: 700;
}

/* ---------- 记录列表 ---------- */
.rec {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 14px; margin-bottom: 10px; cursor: pointer;
}
.rec .r1 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rec .r1 .no { font-size: 12px; color: var(--muted); }
.rec .r1 .shift { font-size: 12px; padding: 1px 8px; border-radius: 20px; background: var(--brand-soft); color: var(--brand-dark); }
.rec .r1 .shift.NIGHT { background: #eef0ff; color: #4b45c6; }
.rec .r2 { font-size: 13px; color: #55617a; }
.rec .r3 { font-size: 12px; color: var(--muted); margin-top: 5px; display: flex; gap: 10px; flex-wrap: wrap; }
.tag-abn { color: var(--danger); background: var(--danger-soft); border-radius: 6px; padding: 0 6px; font-size: 12px; }
.tag-ok { color: var(--ok); background: var(--ok-soft); border-radius: 6px; padding: 0 6px; font-size: 12px; }

/* ---------- 详情 ---------- */
.detail-sec { margin-bottom: 14px; }
.detail-sec h4 { font-size: 14px; margin: 0 0 7px; padding-left: 8px; border-left: 3px solid var(--brand); }
.kv { display: flex; font-size: 13.5px; padding: 5px 0; border-bottom: 1px dashed #eef2f7; }
.kv .k { color: var(--muted); width: 46%; flex: 0 0 46%; }
.kv .v { flex: 1; word-break: break-word; }
.kv .v.bad { color: var(--danger); font-weight: 600; }
.detail-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.detail-photos img { width: 96px; height: 96px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); }

.notice {
  background: var(--warn-soft); color: #8a5b00; border-radius: 11px; padding: 10px 12px;
  font-size: 13px; margin-bottom: 12px; line-height: 1.6;
}
.notice.info { background: var(--brand-soft); color: var(--brand-dark); }
.notice.err { background: var(--danger-soft); color: #a92222; }
.err-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--danger); }
