:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --primary: #e8552d;
  --primary-d: #c8431f;
  --text: #1f2329;
  --muted: #8a9099;
  --line: #e8ebf0;
  --orange: #f2884b; /* 待整改 */
  --blue: #3a8ee6;   /* 整改中 */
  --green: #2bab63;  /* 已整改 */
  --red: #e23b3b;    /* 逾期 */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px;
  max-width: 480px; margin: 0 auto; min-height: 100vh;
}
.hidden { display: none !important; }
input, select, textarea, button { font-family: inherit; font-size: 15px; }
input, select, textarea {
  width: 100%; padding: 12px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 76px; }

/* 登录 */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; background: var(--card); border-radius: 18px; padding: 28px 22px; box-shadow: 0 8px 30px rgba(0,0,0,.06); }
.auth-logo { font-size: 26px; font-weight: 800; text-align: center; color: var(--primary); }
.auth-sub { text-align: center; color: var(--muted); margin: 6px 0 18px; font-size: 14px; }
.tabs { display: flex; background: #f0f2f5; border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.tab { flex: 1; border: none; background: transparent; padding: 10px; border-radius: 9px; color: var(--muted); font-weight: 600; cursor: pointer; }
.tab.active { background: #fff; color: var(--primary); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.form { display: flex; flex-direction: column; gap: 12px; }
.btn-primary {
  width: 100%; padding: 13px; border: none; border-radius: 11px; background: var(--primary);
  color: #fff; font-weight: 700; font-size: 16px; cursor: pointer; margin-top: 4px;
}
.btn-primary:active { background: var(--primary-d); }
.hint { min-height: 18px; color: var(--red); font-size: 13px; text-align: center; }
.reg-tip { font-size: 12px; color: var(--muted); line-height: 1.6; margin-top: 4px; }

/* 主页（落地页） */
.hero { width: 100%; max-width: 420px; text-align: center; padding: 40px 26px; }
.hero-logo {
  width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 24px;
  background: linear-gradient(135deg, #ff6b35, #ff3d3d); color: #fff;
  font-size: 44px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(255,77,61,.32);
}
.hero-title { font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: .5px; }
.hero-sub { color: var(--muted); margin: 10px 0 30px; font-size: 14px; line-height: 1.6; }
.btn-hero {
  width: 100%; padding: 15px; border: none; border-radius: 13px;
  background: linear-gradient(135deg, #ff6b35, #ff3d3d); color: #fff;
  font-weight: 800; font-size: 17px; cursor: pointer; box-shadow: 0 8px 22px rgba(255,77,61,.30);
}
.btn-hero:active { transform: translateY(1px); }
.hero-link {
  display: block; width: 100%; margin-top: 14px; padding: 13px; border: 1px solid var(--border);
  border-radius: 13px; background: var(--card); color: var(--primary); font-weight: 700; font-size: 15px; cursor: pointer;
}
.hero-tip { color: var(--muted); font-size: 12px; margin-top: 22px; }
.back-home {
  width: 100%; margin-top: 16px; padding: 11px; border: none; border-radius: 11px;
  background: #f0f2f5; color: var(--muted); font-size: 14px; cursor: pointer;
}

/* 应用 */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.topbar { position: sticky; top: 0; background: var(--primary); color: #fff; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; z-index: 5; }
.topbar-title { font-size: 17px; font-weight: 700; }
.topbar-user { font-size: 12px; opacity: .9; max-width: 45%; text-align: right; }
.view { flex: 1; padding: 14px; padding-bottom: 80px; }
.bottomnav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: flex; background: #fff; border-top: 1px solid var(--line); }
.navitem { flex: 1; text-align: center; padding: 9px 0 7px; color: var(--muted); font-size: 12px; cursor: pointer; }
.navitem .ni { font-size: 20px; display: block; }
.navitem.active { color: var(--primary); font-weight: 700; }

/* 卡片 / 列表 */
.card { background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.row { display: flex; gap: 10px; align-items: center; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 13px; }
.section-title { font-weight: 700; margin: 4px 0 10px; display: flex; justify-content: space-between; align-items: center; }
.btn-ghost { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; width: 100%; cursor: pointer; color: var(--text); }
.btn-sm { padding: 7px 12px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-size: 13px; cursor: pointer; }
.btn-danger { color: var(--red); border-color: #f3c4c4; }
.btn-ok { color: #fff; background: var(--primary); border: none; }
.geo-btn { background: #eef4ff; color: var(--blue); border: 1px solid #d6e6ff; border-radius: 10px; padding: 11px; width: 100%; cursor: pointer; font-weight: 600; }

/* 必填红色星号 */
.req { color: #e11d48; margin-left: 2px; font-weight: 700; }

/* 状态徽标 */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.b-待整改 { background: #fdeede; color: var(--orange); }
.b-整改中 { background: #e6f1fc; color: var(--blue); }
.b-已整改 { background: #e3f5ea; color: var(--green); }
.b-无需整改 { background: #e3f5ea; color: #15803d; }
.b-逾期 { background: #fde3e3; color: var(--red); }
.b-重大 { background: #fde3e3; color: #c0392b; font-weight: 800; }
.b-一般 { background: #eef0f3; color: #6b7280; }
.b-未发现 { background: #e3f5ea; color: #15803d; }
.warn-line { color: var(--red); font-size: 12px; margin-top: 6px; font-weight: 600; }

/* 照片 */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }

/* 看板统计 */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border-radius: 12px; padding: 14px 8px; text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.stat .num { font-size: 24px; font-weight: 800; }
.stat .lab { font-size: 12px; color: var(--muted); margin-top: 3px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 13px; }
.bar-name { width: 84px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; background: #eef0f3; border-radius: 6px; height: 16px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 6px; }
.bar-val { width: 28px; text-align: right; color: var(--muted); }

/* 弹层 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.modal-box { background: #fff; width: 100%; max-width: 480px; border-radius: 18px 18px 0 0; padding: 18px; max-height: 88vh; overflow-y: auto; }
.modal-head { font-weight: 700; font-size: 16px; margin-bottom: 12px; display: flex; justify-content: space-between; }
.close-x { color: var(--muted); font-size: 20px; cursor: pointer; }
/* 照片查看器：单击返回 / 双击放大 */
.photo-viewer { position: fixed; inset: 0; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; z-index: 50; }
.photo-viewer.hidden { display: none; }
.photo-viewer img { max-width: 95vw; max-height: 88vh; object-fit: contain; border-radius: 6px; transition: transform .2s; transform-origin: center; touch-action: manipulation; }
.photo-viewer img.zoomed { transform: scale(2); }
.pv-toolbar { position: absolute; top: 12px; left: 12px; z-index: 51; }
.pv-toolbar span { display: inline-block; color: #fff; font-size: 15px; background: rgba(255,255,255,.18); padding: 6px 16px; border-radius: 18px; cursor: pointer; }
.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.82); color: #fff; padding: 10px 18px; border-radius: 22px; font-size: 14px; z-index: 30; }
.filter-bar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 20px; background: #fff; border: 1px solid var(--line); font-size: 13px; cursor: pointer; color: var(--muted); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 导航角标（逾期提醒数） */
.navitem { position: relative; }
.nbadge {
  position: absolute; top: 2px; right: 18%; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--red); color: #fff; border-radius: 9px; font-size: 11px; line-height: 16px;
  text-align: center; font-weight: 700;
}
/* 通知铃铛角标（绝对定位到 topNotify 内部） */
#topNotify { position: relative; }
#topNotify .nbadge { position: absolute; top: -4px; right: -8px; right: -10px; }
/* 通知面板 */
.notif-panel { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
.notif-panel.hidden { display: none; }
.notif-panel > .notif-head, .notif-panel > .notif-body { background: #fff; }
.notif-head { width: 100%; max-width: 480px; border-radius: 18px 18px 0 0; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; font-weight: 700; border-bottom: 1px solid var(--line); }
.notif-head .close-x { color: var(--muted); cursor: pointer; line-height: 1; }
.notif-body { width: 100%; max-width: 480px; max-height: 70vh; overflow-y: auto; padding: 0 0 18px; border-radius: 0 0 18px 18px; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .15s; }
.notif-item:hover { background: #f8fafc; }
.notif-item:last-child { border-bottom: none; }
.notif-title { font-size: 14px; font-weight: 600; color: #333; }
.notif-body-text { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.notif-time { font-size: 11px; color: #999; margin-top: 4px; }
.notif-title .dot { display: inline-block; width: 8px; height: 8px; background: var(--red); border-radius: 50%; margin-left: 6px; vertical-align: middle; }

/* 提醒事项 */
.remind-card { margin-bottom: 12px; }
.remind-item { background: var(--card); border-radius: 12px; padding: 12px; margin-bottom: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.04); cursor: pointer; border-left: 4px solid var(--line); }
.remind-item.overdue { border-left-color: var(--red); background: #fff6f6; }

/* 台账导出/导入按钮在标题中 */
.section-title .btn-sm { padding: 5px 10px; font-size: 12px; }

/* stat 卡片可下钻 */
.stat.drill { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.stat.drill:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.12); border-color: var(--primary); }
.stat.drill .drill-hint { font-size: 11px; color: var(--primary); margin-top: 4px; opacity: .7; }
/* 下钻弹窗：各社区分布 */
.drill-sum { margin: 4px 0 14px; font-size: 12px; }
.drill-list { max-height: 60vh; overflow-y: auto; }
.drill-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.drill-row:hover { background: #f1f5f9; }
.drill-row:last-child { border-bottom: none; }
.drill-name { flex: 0 0 auto; width: 96px; font-size: 13px; color: #333; }
.drill-bar { flex: 1; height: 10px; background: #e2e8f0; border-radius: 5px; overflow: hidden; }
.drill-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #fb923c); border-radius: 5px; transition: width .3s; }
.drill-val { flex: 0 0 auto; min-width: 44px; text-align: right; font-size: 14px; font-weight: 700; color: var(--primary); }
