/* ===== SFC 巡店检查系统 · 全局样式（浅色主题） ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --brand: #b91c1c;
  --brand-dark: #7f1d1d;
  --bg: #f4f5f7;
  --card: #ffffff;
  --line: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --ok: #16a34a;
  --warn: #d97706;
}
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff; padding: 12px 16px;
}
.topbar .brand-title { font-size: 16px; font-weight: 700; letter-spacing: .5px; }
.topbar .user-email { font-size: 12px; opacity: .85; margin-right: 8px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar .btn-bar {
  background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.55);
}
.topbar .btn-bar:hover { background: rgba(255,255,255,.3); }
.topbar #user-bar { display: flex; align-items: center; gap: 8px; }
/* 手机上顶栏按钮变多（我的记录 / 修改密码 / 退出），放不下时自动折到第二行 */
.topbar { flex-wrap: wrap; }
.topbar-right { margin-left: auto; }
@media (max-width: 480px) {
  .topbar { padding: 10px 12px; }
  .topbar .brand-title { font-size: 15px; }
  .topbar .btn.small { padding: 5px 9px; font-size: 12.5px; }
  .topbar .user-email { font-size: 11.5px; margin-right: 4px; }
}

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  padding: 10px 18px; font-size: 15px; font-weight: 600; transition: .15s;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: #fff; color: var(--brand); border-color: var(--brand); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* 卡片 */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card h2 {
  font-size: 16px; font-weight: 700; color: var(--brand-dark);
  padding-bottom: 8px; margin-bottom: 12px; border-bottom: 2px solid #fde8e8;
  display: flex; align-items: center; gap: 8px;
}
.card h2 .sec-num {
  background: var(--brand); color: #fff; border-radius: 6px;
  font-size: 12px; padding: 2px 7px; font-weight: 600;
}

/* 表单控件 */
input[type=text], input[type=email], input[type=password], input[type=datetime-local], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 15px; background: #fff; color: var(--text);
  outline: none; transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); }
textarea { resize: vertical; min-height: 84px; }
label.f-label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 5px; }

/* 是/否 单选（分段按钮） */
.yn-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px dashed #f0f0f0; }
.yn-row:last-of-type { border-bottom: none; }
.yn-q { flex: 1; font-size: 14.5px; }
.yn-q .q-no { color: var(--muted); margin-right: 4px; }
.yn-group { display: flex; gap: 0; flex-shrink: 0; margin-top: 1px; }
.yn-group button {
  border: 1px solid var(--line); background: #fff; padding: 5px 14px;
  font-size: 13.5px; cursor: pointer; color: var(--muted);
}
.yn-group button:first-child { border-radius: 7px 0 0 7px; }
.yn-group button:last-child { border-radius: 0 7px 7px 0; border-left: none; }
.yn-group button.on-yes { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 600; }
.yn-group button.on-no { background: #dc2626; border-color: #dc2626; color: #fff; font-weight: 600; }

/* 评分 */
.rating-group { display: flex; gap: 8px; margin-top: 6px; }
.rating-group button {
  flex: 1; padding: 9px 0; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 14px; cursor: pointer; color: var(--muted); font-weight: 600;
}
.rating-group button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 图片上传 */
.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.photo-item { position: relative; width: 86px; height: 86px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-item .del {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; border: none; font-size: 12px; line-height: 20px;
  cursor: pointer; text-align: center; padding: 0;
}
.photo-item .uploading {
  position: absolute; inset: 0; background: rgba(255,255,255,.7);
  display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted);
}
.add-photo {
  width: 86px; height: 86px; border: 1.5px dashed #c7cdd6; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; cursor: pointer; background: #fafbfc; gap: 2px;
}
.add-photo:hover { border-color: var(--brand); color: var(--brand); }
.add-photo .plus { font-size: 22px; line-height: 1; }
.add-photo .add-txt { font-size: 11px; text-align: center; line-height: 1.25; padding: 0 4px; }
.add-photo.full { opacity: .4; cursor: not-allowed; }

/* 提交条 */
.submit-bar {
  position: sticky; bottom: 0; z-index: 40; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(244,245,247,.92); backdrop-filter: blur(6px);
}
.submit-bar .btn { width: 100%; }

/* toast */
.toast {
  position: fixed; left: 50%; top: 18%; transform: translateX(-50%) translateY(-8px);
  background: rgba(31,41,55,.92); color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 14px; z-index: 999; opacity: 0; transition: .25s; pointer-events: none; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: rgba(22,101,52,.95); }
.toast.error { background: rgba(185,28,28,.95); }

/* ===== 登录页 ===== */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(160deg, #7f1d1d 0%, #b91c1c 55%, #dc2626 100%); }
.auth-card { background: #fff; border-radius: 16px; padding: 28px 24px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-logo { text-align: center; font-size: 13px; letter-spacing: 3px; color: var(--brand); font-weight: 700; }
.auth-title { text-align: center; font-size: 21px; font-weight: 800; margin: 4px 0 18px; }
.auth-tabs { display: flex; background: #f3f4f6; border-radius: 9px; padding: 3px; margin-bottom: 16px; }
.auth-tab { flex: 1; border: none; background: transparent; padding: 8px 0; font-size: 13.5px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600; }
.auth-tab.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form .btn { margin-top: 4px; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.code-row .btn { flex-shrink: 0; padding: 8px 12px; font-size: 13px; }
.auth-link { background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer; text-align: center; padding: 4px; }
.auth-link:hover { color: var(--brand); }
.auth-hint { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.7; }
.auth-err { color: var(--brand); font-size: 13px; min-height: 18px; margin-top: 10px; text-align: center; line-height: 1.6; }

/* 顶栏里的权限组标签（管理员 / 维护员 / 巡检员） */
.topbar .user-role-tag {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 99px;
  font-size: 11px; background: rgba(255,255,255,.22); color: #fff; opacity: .95;
}

/* ===== 强制修改初始密码（登录后必须完成） ===== */
.modal-mask.force-pwd { z-index: 200; }
.pwd-force-tip {
  background: #fff8e6; border: 1px solid #f2dfae; border-left: 3px solid #e0a800;
  border-radius: 0 8px 8px 0; padding: 10px 12px; font-size: 13px; color: #7a5c00;
  line-height: 1.75; margin-bottom: 12px;
}
.pwd-force-tip b { color: #a16207; }

/* ===== 后台 ===== */
.stat-row { display: flex; gap: 10px; margin: 12px; }
.stat-box { flex: 1; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.stat-box .num { font-size: 24px; font-weight: 800; color: var(--brand); }
.stat-box .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.filter-row { display: flex; gap: 8px; margin: 12px; justify-content: flex-end; }
.rec-item {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 15px; margin: 0 12px 10px; cursor: pointer; transition: .15s;
}
.rec-item:hover { border-color: var(--brand); box-shadow: 0 2px 8px rgba(185,28,28,.08); }
.rec-item .r1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rec-item .cinema { font-weight: 700; font-size: 15px; }
.rec-item .badge { background: #fde8e8; color: var(--brand-dark); font-size: 11.5px; padding: 2px 8px; border-radius: 99px; flex-shrink: 0; }
.rec-item .r2 { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.rec-item .rec-right { display: inline-flex; align-items: center; gap: 8px; }
.rec-item .rec-del {
  border: 1px solid #f3c9c9; background: #fff; color: var(--brand-dark);
  font-size: 11.5px; padding: 2px 9px; border-radius: 99px; cursor: pointer;
  font-family: inherit; line-height: 1.6; transition: .15s;
}
.rec-item .rec-del:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 详情弹层 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal {
  background: #fff; width: 100%; max-width: 760px; max-height: 88vh; border-radius: 16px 16px 0 0;
  display: flex; flex-direction: column;
}
@media (min-width: 700px) { .modal-mask { align-items: center; padding: 20px; } .modal { border-radius: 16px; max-height: 86vh; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head .t { font-weight: 700; font-size: 15.5px; }
.modal-body { overflow-y: auto; padding: 6px 16px 16px; }
.modal-foot { display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.modal-foot .btn { flex: 1; }
.modal .photo-grid img { cursor: zoom-in; }
.ans-no { color: #dc2626; font-weight: 700; }
.ans-yes { color: var(--ok); font-weight: 600; }
.detail-photo { width: 96px; height: 96px; }

.empty-tip { text-align: center; color: var(--muted); padding: 46px 0 30px; font-size: 14px; }

/* ===== 必填项校验提示 ===== */
.err-panel {
  margin: 12px; padding: 12px 14px 10px; border-radius: 12px;
  background: #fff5f5; border: 1px solid #f3c9c9; color: #7f1d1d;
}
.err-panel .err-title { font-weight: 700; font-size: 14px; color: var(--brand); margin-bottom: 6px; }
.err-panel ol { margin: 0; padding-left: 20px; font-size: 13.5px; line-height: 1.8; }
.err-panel li { cursor: pointer; border-bottom: 1px dashed rgba(185,28,28,.25); padding: 1px 0; }
.err-panel li:last-child { border-bottom: none; }
.err-panel li:hover { color: var(--brand); font-weight: 600; }

/* 未填写的位置标红（控件本身 / 是-否整块） */
.invalid { border-color: #dc2626 !important; background: #fff7f7 !important; }
.yn-block.invalid { background: #fff7f7; border-radius: 8px; padding: 6px 8px; margin: 0 -8px; }
.yn-block.invalid .q-no { color: #dc2626; font-weight: 700; }
.card.invalid { border-color: #f3c9c9 !important; background: #fff !important; box-shadow: 0 0 0 2px #fde8e8 inset; }

/* 修改模式提示条 */
.edit-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 12px; padding: 10px 14px; border-radius: 12px;
  background: #fff8e6; border: 1px solid #f2dfae; color: #8a6100; font-size: 13.5px;
  line-height: 1.5;
}
.edit-banner .btn { flex-shrink: 0; }

/* 我的记录弹层 */
.modal-body .rec-item { margin: 10px 0; }
.modal-body .rec-item:first-of-type { margin-top: 6px; }
.rec-item .rec-edit {
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  font-size: 11.5px; padding: 3px 10px; border-radius: 99px; cursor: pointer;
  font-family: inherit; line-height: 1.6; transition: .15s; white-space: nowrap;
}
.rec-item .rec-edit:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

/* ===== 修改密码 / 密码查看弹层 ===== */
.modal-narrow { max-width: 460px; }
.pwd-who { font-size: 13.5px; color: var(--muted); margin: 10px 0 2px; }
.pwd-who b { color: var(--text); }
.pwd-err {
  color: #dc2626; font-size: 13px; min-height: 18px; margin-top: 10px; line-height: 1.5;
}
.pwd-err:not(:empty) { background: #fff5f5; border: 1px solid #f3c9c9; border-radius: 8px; padding: 7px 10px; }
.pwd-tip { font-size: 12.5px; color: var(--muted); line-height: 1.7; margin-top: 8px; }

/* 人员管理里的密码显示 */
.pwd-cell {
  font-family: ui-monospace, Menlo, Consolas, "Courier New", monospace;
  font-size: 13.5px; letter-spacing: .5px; color: #6b7280;
  background: #f3f4f6; border-radius: 6px; padding: 1px 8px;
}
.pwd-cell.on { color: var(--brand-dark); background: #fdecef; font-weight: 700; letter-spacing: 0; }
.pwd-none { color: #9ca3af; font-size: 13px; }
.pwd-sub { color: #9ca3af; font-size: 12px; margin-left: 6px; }
