:root {
  --primary: #0a7d5f;
  --primary-dark: #086348;
  --bg: #f3f5f4;
  --card: #ffffff;
  --line: #e4e8e6;
  --text: #1f2a26;
  --muted: #6b7a74;
  --danger: #d64545;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 40, 30, 0.08);
  --header-h: 52px;
}

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

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 640px; margin: 0 auto; min-height: 100vh; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 4px;
  height: var(--header-h);
  padding: 0 8px 0 4px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.topbar .btn-icon {
  min-width: 44px; height: 44px; display: inline-flex; align-items: center;
  justify-content: center; border: 0; background: none; color: var(--text);
  font-size: 22px; cursor: pointer; padding: 0;
}
.topbar h1 { flex: 1; margin: 0; font-size: 17px; font-weight: 600; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .right { min-width: 64px; text-align: right; padding-right: 6px; font-size: 13px; color: var(--primary); }
.topbar .right button { border: 0; background: none; color: var(--primary); font-size: 14px; cursor: pointer; }

.page { padding: 12px; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }

/* 通用控件 */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.label-required::after { content: " *"; color: var(--danger); }

input[type="text"], input[type="password"], input[type="number"], input[type="tel"], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font-size: 16px; color: var(--text); background: var(--card);
  outline: none;
}
input:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 70px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px; padding: 12px 16px; font-size: 16px;
  cursor: pointer; user-select: none; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .6; }
.btn-block { width: 100%; }
.btn-ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-soft { background: #eaf4f0; color: var(--primary); }
.btn-danger-ghost { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-sm { padding: 8px 12px; font-size: 14px; border-radius: 9px; }

/* 单选组 */
.radio-group { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-chip {
  flex: 1 1 auto; min-width: 90px; text-align: center;
  padding: 11px 8px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-size: 15px;
}
.radio-chip.on { border-color: var(--primary); color: var(--primary); background: #eef8f4; font-weight: 500; }

/* 卡片 / 列表 */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.row-item {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 14px; cursor: pointer; border: 0; text-align: left; width: 100%;
}
.row-item:active { background: #f0f4f2; }
.row-item .t { font-size: 16px; font-weight: 500; margin-bottom: 4px; }
.row-item .s { font-size: 13px; color: var(--muted); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.row .grow { flex: 1; min-width: 0; }

/* ================= 登录页：清新升级 ================= */
.login-wrap {
  position: relative;
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 30px 20px;
  overflow: hidden;
  background:
    radial-gradient(1100px 560px at 85% -12%, rgba(28, 190, 142, .16), transparent 62%),
    radial-gradient(880px 520px at -14% 112%, rgba(10, 125, 95, .14), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #eaf7f1 55%, #d9f0e6 100%);
}
/* 缓慢漂浮的柔和光斑 */
.login-wrap::before,
.login-wrap::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  filter: blur(34px); z-index: 0; animation: login-float 10s ease-in-out infinite;
}
.login-wrap::before {
  width: 52vmin; height: 52vmin; top: -16vmin; right: -10vmin;
  background: radial-gradient(circle at 32% 30%, #a6ecce, #3cc69b 72%);
  opacity: .55;
}
.login-wrap::after {
  width: 44vmin; height: 44vmin; bottom: -15vmin; left: -12vmin;
  background: radial-gradient(circle at 62% 42%, #cdf3e2, #63d5ae 74%);
  opacity: .6; animation-delay: -5s;
}
@keyframes login-float {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(12px, -18px); }
}
.login-inner {
  position: relative; z-index: 1; width: 100%; max-width: 372px;
  display: flex; flex-direction: column;
}
/* 品牌区 */
.login-brand { text-align: center; margin-bottom: 24px; }
.login-emblem {
  width: 66px; height: 66px; margin: 0 auto 16px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 28px; font-weight: 800;
  background: linear-gradient(135deg, #26bd8f, #0a7d5f);
  box-shadow: 0 14px 26px -10px rgba(10, 125, 95, .55), inset 0 1px 0 rgba(255, 255, 255, .35);
  animation: login-pop .55s cubic-bezier(.2, .9, .25, 1.15);
}
.login-brand h1 {
  margin: 0 0 7px; font-size: 22px; font-weight: 700; letter-spacing: .5px; color: var(--text);
}
.login-brand p { margin: 0; font-size: 13px; color: var(--muted); }
@keyframes login-pop {
  from { transform: scale(.6); opacity: 0; }
}
/* 登录卡片 */
.login-card {
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 24px; padding: 24px 22px 22px;
  box-shadow: 0 26px 55px -22px rgba(15, 70, 50, .38);
  animation: login-rise .5s ease-out;
}
@keyframes login-rise {
  from { transform: translateY(16px); opacity: 0; }
}
.login-field { position: relative; margin-bottom: 13px; }
.login-field .lf-ico {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  color: #a3b5ad; display: flex; pointer-events: none;
  transition: color .2s ease;
}
.login-field input {
  width: 100%;
  border: 1px solid transparent; border-radius: 14px;
  background: #f2f8f5; outline: none;
  padding: 13px 14px 13px 45px; font-size: 16px; color: var(--text);
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.login-field input::placeholder { color: #a9b8b1; }
.login-field:focus-within input {
  background: #fff; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 125, 95, .14);
}
.login-field:focus-within .lf-ico { color: var(--primary); }
.login-err {
  color: var(--danger); font-size: 13px; min-height: 18px;
  margin: 0 2px 12px;
}
.login-card .btn {
  width: 100%; padding: 14px; border-radius: 14px;
  font-size: 16px; font-weight: 600; letter-spacing: 4px;
  color: #fff; background: linear-gradient(135deg, #1cb387, #0a7d5f);
  box-shadow: 0 12px 22px -10px rgba(10, 125, 95, .65);
  transition: transform .06s ease, box-shadow .2s ease, opacity .2s ease;
}
.login-card .btn:active { transform: translateY(1px) scale(.995); }
.login-card .btn:disabled { opacity: .65; box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  .login-wrap::before, .login-wrap::after, .login-emblem, .login-card { animation: none; }
}

/* 首页模块卡片 */
.module-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.module-card {
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
  padding: 22px 14px; text-align: center; cursor: pointer; text-decoration: none; color: var(--text);
  border: 0;
}
.module-card .ico { font-size: 34px; }
.module-card .name { font-weight: 600; font-size: 16px; margin-top: 10px; }
.module-card .desc { font-size: 12px; color: var(--muted); margin-top: 4px; }
.home-user { display: flex; justify-content: space-between; align-items: center; }

/* App 下载卡片：每卡仅展示名称，整卡点击下载 */
.app-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.app-card {
  background: var(--card); border: 0; border-radius: 16px; box-shadow: var(--shadow);
  padding: 22px 12px; display: flex; flex-direction: column; align-items: center;
  gap: 10px; cursor: pointer; color: var(--text); text-align: center;
  transition: transform 0.08s ease, opacity 0.08s ease;
}
.app-card:active { transform: scale(0.96); opacity: 0.92; }
.app-ico {
  width: 54px; height: 54px; border-radius: 15px; font-size: 30px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eaf4f0, #d9eee6);
}
.app-name { font-size: 14px; font-weight: 600; line-height: 1.35; word-break: break-all; }

/* 记录卡片 */
.rec-card { cursor: pointer; }
.tag {
  display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px;
  background: #eef3f0; color: var(--primary); margin-right: 6px;
}
.tag.off { background: #f6f7f7; color: var(--muted); }
.kv { font-size: 13px; color: var(--text); display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.kv .k { color: var(--muted); flex: 0 0 auto; }
.kv .v { color: var(--text); word-break: break-all; }

/* 表单增强 */
.add-row-btn { width: 100%; }
.code-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.code-row input { flex: 1; }
.code-row .del {
  flex: 0 0 40px; height: 44px; border: 0; background: none; color: var(--danger);
  font-size: 20px; cursor: pointer;
}
.seg-control { display: flex; }
.searchbox { position: relative; }
.search-result {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  background: var(--card); border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.12);
  max-height: 280px; overflow: auto;
}
.search-result .opt { padding: 11px 12px; cursor: pointer; font-size: 15px; border-bottom: 1px solid var(--line); }
.search-result .opt:last-child { border-bottom: 0; }
.search-result .opt:active { background: #eef8f4; }
.search-result .opt .s { font-size: 12px; color: var(--muted); margin-left: 6px; }
.hidden { display: none !important; }

/* 网卡照片选择（点击整块触发展开拍照） */
.photo-pick { display: block; cursor: pointer; }
.photo-pick input[type="file"] {
  position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.photo-empty {
  border: 1.5px dashed #b9c8c2; background: #f7faf8; border-radius: 12px;
  padding: 18px 12px; text-align: center; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.photo-empty:active { background: #eef6f2; }
.photo-empty .photo-ico { font-size: 30px; line-height: 1; }
.photo-empty .photo-txt { font-size: 14px; }
.photo-thumb {
  width: 100%; max-height: 150px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line); display: block;
}
.photo-pick ~ .btn { margin-top: 8px; }

/* 全屏图片查看浮层（点按任意处关闭） */
.img-view {
  position: fixed; left: 0; right: 0; top: 0; bottom: 0; z-index: 200;
  background: rgba(0, 0, 0, .88);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}
.img-view img {
  max-width: 100%; max-height: 82vh; object-fit: contain;
  border-radius: 10px; background: #111;
}
.img-view-tip { margin-top: 12px; color: rgba(255, 255, 255, .72); font-size: 13px; }

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

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%);
  background: rgba(20, 30, 26, .92); color: #fff; border-radius: 999px;
  padding: 10px 18px; font-size: 14px; z-index: 100; max-width: 86%;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
#toast.show { opacity: 1; }
#toast.err { background: rgba(160, 40, 40, .95); }

.bottom-actions { display: flex; gap: 10px; margin-top: 22px; }

/* 小区列表页（全部小区 + 美化） */
.comm-hero {
  background: linear-gradient(135deg, #0a7d5f 0%, #12a381 70%, #19b392 100%);
  border-radius: 16px;
  padding: 16px 14px;
  color: #fff;
  box-shadow: 0 4px 14px rgba(10, 125, 95, .25);
}
.comm-hero .title { font-size: 16px; font-weight: 600; margin-bottom: 12px; letter-spacing: .5px; }
.comm-search { position: relative; }
.comm-search::before {
  content: "🔍";
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 15px; opacity: .85; pointer-events: none;
}
.comm-search input {
  width: 100%;
  border: 0; outline: none;
  border-radius: 999px;
  padding: 10px 14px 10px 36px;
  font-size: 15px; color: var(--text); background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
}
.comm-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.comm-stats { margin: 12px 4px 10px; font-size: 13px; color: var(--muted); }
.comm-stats b { color: var(--primary); font-weight: 600; margin: 0 1px; }

.comm-card { display: flex; align-items: center; gap: 12px; padding: 13px 14px; }
.comm-card .avatar {
  flex: 0 0 42px; width: 42px; height: 42px; border-radius: 13px;
  color: #fff; font-size: 18px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.comm-card .grow { flex: 1; min-width: 0; display: block; }
.comm-card .name { display: block; font-size: 16px; font-weight: 600; margin-bottom: 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comm-card .meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); }
.comm-card .tag-count {
  background: var(--primary); color: #fff; border-radius: 999px;
  padding: 2px 9px; font-size: 11px; line-height: 1.4;
}
.comm-card .tag-count.zero { background: #eef1f0; color: #8a9691; }
.comm-card .meta .time { white-space: nowrap; }
.comm-card .chev { color: #c3cbc7; font-size: 22px; font-weight: 300; flex: 0 0 auto; }

/* ---------------- 上报表单：一页紧凑 + 底部常驻提交栏 ---------------- */
.page--form .field { margin-bottom: 11px; }
.page--form .field > label { margin-bottom: 5px; font-size: 12px; }
.page--form input[type="text"], .page--form input[type="search"] { padding: 9px 11px; }
.page--form input[type="search"] { font-size: 15px; }
.page--form textarea { min-height: 40px; padding: 9px 11px; }
.page--form .radio-group { gap: 7px; }
.page--form .radio-chip { padding: 9px 6px; font-size: 14px; min-width: 78px; }
.code-row { margin-bottom: 6px; }
.code-row input.code-inp { flex: 1 1 auto; min-width: 0; font-size: 15px; }
.code-row input.slot {
  flex: 0 0 84px; width: 84px; min-width: 0; text-align: center;
  font-size: 15px; padding: 9px 2px;
}
.code-row .del { flex-basis: 34px; height: 40px; font-size: 18px; }

.btn-link {
  background: none; border: 0; color: var(--primary); font-size: 14px;
  padding: 6px 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}

.geo-row { align-items: stretch; }
.geo-row input { flex: 1 1 0; min-width: 0; padding: 8px 10px; font-size: 15px; }
.geo-row .btn-locate { flex: 0 0 auto; white-space: nowrap; padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.row.between { justify-content: space-between; width: 100%; }

.pb-save { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.save-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.save-bar .btn { max-width: 608px; margin: 0 auto; display: flex; }

/* ================= 首页：清新升级 ================= */
.home { min-height: 100vh; }
.home-hero {
  position: relative; overflow: hidden;
  padding: calc(24px + env(safe-area-inset-top)) 18px 34px;
  background:
    radial-gradient(460px 300px at 96% -18%, rgba(46, 199, 152, .30), transparent 60%),
    radial-gradient(400px 260px at -12% 118%, rgba(10, 125, 95, .18), transparent 58%),
    linear-gradient(165deg, #e3f6ec 0%, #eefaf5 100%);
}
.home-hero::after {
  content: ""; position: absolute; right: -70px; bottom: -96px;
  width: 240px; height: 240px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 42% 42%, rgba(255, 255, 255, .75), rgba(255, 255, 255, 0) 70%);
}
.home-hero-top { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.home-hero-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 3px; color: #0b8a66; }
.home-hero-greet { margin-top: 7px; font-size: 25px; font-weight: 800; color: #12352a; letter-spacing: .3px; }
.home-hero-date { position: relative; margin-top: 10px; font-size: 13px; color: #5f7d71; }
.home-logout {
  flex: 0 0 auto; border: 1px solid rgba(10, 125, 95, .28); background: rgba(255, 255, 255, .62);
  color: #0b7f5f; font-size: 13px; border-radius: 999px; padding: 7px 13px; cursor: pointer;
}
.home-logout:active { background: #fff; }

.module-list {
  position: relative; z-index: 1;
  margin: -26px 16px calc(30px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.module-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 12px;
  background: #fff; border: 0; cursor: pointer;
  border-radius: 22px; padding: 24px 12px 20px; min-height: 168px;
  box-shadow: 0 16px 34px -18px rgba(15, 70, 50, .42);
  animation: home-card .45s cubic-bezier(.2, .8, .2, 1) backwards;
}
.module-card:nth-of-type(1) { animation-delay: .05s; }
.module-card:nth-of-type(2) { animation-delay: .15s; }
@keyframes home-card { from { transform: translateY(14px); opacity: 0; } }
.module-card:active { transform: scale(.97); }
.mc-ico {
  width: 60px; height: 60px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center; font-size: 30px;
}
.mc-ico.dl { background: linear-gradient(135deg, #5fd6e6, #1499c4); box-shadow: 0 8px 18px -8px rgba(20, 153, 196, .55); }
.mc-ico.rp { background: linear-gradient(135deg, #34cd96, #0a7d5f); box-shadow: 0 8px 18px -8px rgba(10, 125, 95, .55); }
.mc-body { width: 100%; }
.mc-name { font-size: 16.5px; font-weight: 700; color: #1f332b; }
.mc-desc { margin-top: 4px; font-size: 12px; color: #7d9289; line-height: 1.4; }

@media (prefers-reduced-motion: reduce) {
  .module-card { animation: none; }
}
