/* ============ 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f2f5f9;
  color: #1e293b;
  font-size: 14px;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; outline: none; }

.view { display: none; }
.view.active { display: block; }

:root {
  --primary: #4f6ef7;
  --primary-dark: #3b5bdb;
  --primary-soft: rgba(79, 110, 247, .12);
  --ww-green: #07c160;
  --text: #1e293b;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --bg: #f2f5f9;
  --card: #ffffff;
  --line: #eef2f7;
  --border: #e2e8f0;
  --status-our: #fcc419;    /* 黄 */
  --status-other: #ff6b6b;  /* 红 */
  --status-done: #40c057;   /* 绿 */
  --danger: #e03131;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .05), 0 6px 18px rgba(15, 23, 42, .06);
}

/* ============ 登录页 ============ */
#view-login {
  background: linear-gradient(160deg, #3b5bdb 0%, #5f3dc4 55%, #9c36b5 100%);
}
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 22px 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 24px;
  padding: 32px 24px 26px;
  color: var(--text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .28);
  text-align: center;
}
.login-logo {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), #7048e8);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  box-shadow: 0 8px 20px rgba(79, 110, 247, .4);
}
.login-title { font-size: 21px; font-weight: 800; letter-spacing: 1px; }
.login-sub { font-size: 13px; color: var(--text-2); margin: 8px 0 24px; }
.ww-btn {
  width: 100%; height: 48px;
  border-radius: 12px;
  background: var(--ww-green);
  color: #fff;
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 8px 20px rgba(7, 193, 96, .32);
  transition: transform .12s, opacity .2s;
}
.ww-btn:active { transform: scale(.97); opacity: .9; }
.divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-3); font-size: 12px;
  margin: 20px 0 14px;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.dev-tip { font-size: 12px; color: var(--text-3); margin-bottom: 10px; }
.dev-users { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.dev-user {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 13px; color: var(--text);
  transition: all .15s;
}
.dev-user:active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.admin-login-link {
  margin-top: 18px;
  font-size: 13px; color: var(--text-3);
  text-decoration: underline;
  cursor: pointer;
}
.admin-login { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.admin-login input {
  height: 44px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  font-size: 14px;
}
.admin-login input:focus { border-color: var(--primary); }
.login-foot { color: rgba(255, 255, 255, .8); font-size: 12px; margin-top: 22px; letter-spacing: 1px; }

/* ============ 小区列表页 ============ */
#view-communities { background: var(--bg); min-height: 100dvh; padding-bottom: 30px; }
.ctn-header {
  background: linear-gradient(135deg, var(--primary) 0%, #7048e8 100%);
  padding: calc(16px + env(safe-area-inset-top)) 18px 18px;
  color: #fff;
}
.ctn-top { display: flex; align-items: center; justify-content: space-between; }
.ctn-title { font-size: 20px; font-weight: 800; letter-spacing: 1px; }
.ctn-user { font-size: 12px; opacity: .85; margin-top: 4px; }
.logout-btn {
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 12px;
  backdrop-filter: blur(4px);
}
.logout-btn:active { background: rgba(255, 255, 255, .3); }

.search-block {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  padding: 12px 14px 10px;
}
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: #fff;
  border-radius: 999px;
  padding: 0 14px;
  height: 42px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.search-bar input {
  flex: 1; border: none; background: transparent;
  font-size: 14px; color: var(--text);
}
.search-bar input::placeholder { color: var(--text-3); }
.letter-bar {
  display: flex; gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.letter-bar::-webkit-scrollbar { display: none; }
.letter-chip {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: #fff;
  color: var(--text-2);
  font-size: 13px; font-weight: 700;
  border: 1px solid var(--line);
  transition: all .15s;
}
.letter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.community-list { padding: 2px 14px 0; }
.community-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .1s;
  animation: fadeUp .25s ease both;
}
.community-card:active { transform: scale(.985); }
.comm-avatar {
  flex: none;
  width: 46px; height: 46px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; font-weight: 700;
}
.comm-info { flex: 1; min-width: 0; }
.comm-name { font-size: 16px; font-weight: 700; }
.comm-meta { font-size: 12px; color: var(--text-3); margin: 3px 0 8px; }
.comm-meta .comm-py { color: var(--primary); font-weight: 600; }
.comm-stats { display: flex; gap: 12px; }
.stat { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-2); font-weight: 600; }
.comm-arrow { color: var(--text-3); font-size: 22px; font-weight: 300; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dot-none { background: #fff; border: 1.5px solid #cbd5e1; }
.dot-our { background: var(--status-our); }
.dot-other { background: var(--status-other); }
.dot-done { background: var(--status-done); }

.empty {
  text-align: center; color: var(--text-3);
  padding: 48px 20px; font-size: 14px; line-height: 1.9;
}
.empty.small { padding: 24px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ 楼栋详情页 ============ */
#view-building { height: 100vh; height: 100dvh; display: none; flex-direction: column; background: var(--bg); }
#view-building.active { display: flex; }

.page-header {
  display: flex; align-items: center; gap: 8px;
  background: var(--card);
  padding: calc(12px + env(safe-area-inset-top)) 12px 12px;
  box-shadow: 0 1px 0 var(--line);
}
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.icon-btn:active { background: var(--bg); }
.header-title { flex: 1; min-width: 0; }
.ht-main { font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ht-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-space { width: 38px; flex: none; }
.header-action {
  flex: none;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px; font-weight: 600;
}
.header-action:active { opacity: .85; }

.stats-bar { display: flex; gap: 8px; padding: 10px 12px 0; }
.stat-pill {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 4px;
  font-size: 11px; color: var(--text-2); font-weight: 600;
  white-space: nowrap;
}
.stat-pill b { color: var(--text); font-size: 14px; font-weight: 800; }

.building-layout { flex: 1; display: flex; min-height: 0; margin-top: 10px; }
.building-side {
  flex: none; width: 50px;
  background: var(--card);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: none;
}
.building-side::-webkit-scrollbar { display: none; }
.building-item {
  width: 100%; height: 46px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-2);
  position: relative;
  transition: color .15s;
}
.building-item:active { color: var(--primary); }
.building-item.active { color: var(--primary); font-weight: 800; background: var(--primary-soft); }
.building-item.active::before {
  content: ''; position: absolute; left: 0; top: 25%; bottom: 25%;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--primary);
}

.grid-scroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; }
.grid { min-width: max-content; padding: 2px 8px 46px; }
.grid-header-row, .grid-row { display: flex; gap: 6px; }
.grid-header-row { margin-bottom: 6px; }
.grid-corner {
  position: sticky; left: 0; top: 0; z-index: 10;
  flex: none; width: 34px;
  height: 30px;
  background: var(--bg);
}
.grid-header-cell {
  position: sticky; top: 0; z-index: 5;
  flex: none; width: 80px; height: 30px;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: var(--text);
}
.grid-row { margin-bottom: 5px; }
.grid-floor {
  position: sticky; left: 0; z-index: 5;
  flex: none; width: 34px;
  padding: 0;
  background: var(--bg);
  border: none;
  font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-2); font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s, background .15s;
}
.grid-floor:active { color: var(--primary); background: var(--primary-soft); }
.grid-cell {
  flex: none; width: 78px; height: 52px;
  border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  cursor: pointer;
  user-select: none;
  transition: transform .1s;
}
.grid-cell:active { transform: scale(.92); }
.cell-code { font-size: 13px; font-weight: 800; line-height: 1.2; }
.cell-note {
  font-size: 10px;
  max-width: 88%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: .85;
}

/* 状态配色 */
.grid-cell.status-none { background: #ffffff; border: 1.5px solid var(--border); color: #334155; }
.grid-cell.status-our   { background: #fff4c2; border: 1.5px solid var(--status-our);   color: #8a5b0a; }
.grid-cell.status-other { background: #ffe2e2; border: 1.5px solid var(--status-other); color: #b02a2a; }
.grid-cell.status-done  { background: #d8f5dd; border: 1.5px solid var(--status-done);  color: #1f7a34; }

.grid-hint {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
  font-size: 11px; color: var(--text-3);
}
.grid-hint span { display: inline-flex; align-items: center; gap: 4px; }
.grid-hint i { font-style: normal; color: var(--text-2); }

/* ============ 底部导航 ============ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, .06);
}
.tab-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: 56px;
  color: var(--text-3);
  font-size: 11px;
  transition: color .15s;
}
.tab-item.active { color: var(--primary); font-weight: 700; }
.tabbar-space { height: calc(64px + env(safe-area-inset-bottom)); }

/* ============ 修改记录页 ============ */
#view-records { background: var(--bg); min-height: 100dvh; }
.date-nav {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 12px 14px 4px;
}
.date-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.date-btn:active { background: var(--bg); }
.date-label {
  min-width: 170px;
  padding: 9px 14px;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  font-size: 13px; font-weight: 700; color: var(--text);
  text-align: center;
}
.records-summary { padding: 10px 14px 0; }
.summary-total {
  background: linear-gradient(135deg, var(--primary), #7048e8);
  color: #fff;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
}
.summary-total b { font-size: 20px; margin: 0 2px; }
.summary-users {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 10px;
}
.summary-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px; color: var(--text-2);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.summary-chip:active { background: var(--bg); opacity: .7; }
.summary-chip b { font-size: 15px; color: var(--primary); font-weight: 800; }
.summary-clear {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 10px; padding: 6px 14px;
  border: 1px solid var(--primary); border-radius: 999px;
  background: #fff; color: var(--primary);
  font-size: 12px; cursor: pointer;
}
.summary-clear:active { opacity: .7; }

.records-list { padding: 12px 14px 0; }
.log-item {
  display: flex; align-items: stretch; gap: 10px;
  background: var(--card);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .1s;
}
.log-item:active { transform: scale(.985); }
.log-bar { flex: none; width: 4px; border-radius: 4px; }
.log-bar.bar-none { background: #cbd5e1; }
.log-bar.bar-our { background: var(--status-our); }
.log-bar.bar-other { background: var(--status-other); }
.log-bar.bar-done { background: var(--status-done); }
.log-body { flex: 1; min-width: 0; }
.log-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 14px; font-weight: 700;
}
.log-time { font-size: 11px; color: var(--text-3); font-weight: 400; flex: none; }
.log-change2 { margin-top: 4px; font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.log-note {
  margin-top: 5px;
  font-size: 12px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 状态徽标 */
.st {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700;
  border-radius: 6px; padding: 2px 7px;
}
.st-none { background: #f1f5f9; color: #64748b; }
.st-our { background: #fff4c2; color: #8a5b0a; }
.st-other { background: #ffe2e2; color: #b02a2a; }
.st-done { background: #d8f5dd; color: #1f7a34; }

/* ============ 我的页 ============ */
.me-page { background: var(--bg); min-height: 100dvh; }
.me-profile {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, var(--primary), #7048e8);
  padding: calc(20px + env(safe-area-inset-top)) 18px 24px;
  color: #fff;
}
.me-avatar {
  width: 56px; height: 56px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .22);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800;
  border: 2px solid rgba(255, 255, 255, .4);
}
.me-name-row { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 800; }
.me-id { font-size: 12px; opacity: .8; margin-top: 4px; }
.role-badge {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px;
  flex: none;
}
.role-badge.user { background: #e8eaf6; color: #5c6bc0; }
.role-badge.manager { background: #fff3bf; color: #9a6700; }
.role-badge.admin { background: #ffe3e3; color: #c92a2a; }
.me-profile .role-badge { background: rgba(255, 255, 255, .22); color: #fff; }

.me-today {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  margin: -12px 14px 0;
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  position: relative;
}
.me-today-num { font-size: 30px; font-weight: 800; color: var(--primary); line-height: 1; }
.me-today-label { font-size: 13px; color: var(--text-2); }
.me-today-arrow { margin-left: auto; color: var(--text-3); font-size: 22px; }

.me-menu {
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.me-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform .1s;
}
.me-item:active { transform: scale(.985); }
.me-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; flex: none;
}
.me-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.me-text b { font-size: 15px; color: var(--text); }
.me-text i { font-style: normal; font-size: 12px; color: var(--text-3); }
.me-arrow { color: var(--text-3); font-size: 20px; }

/* ============ 管理页 ============ */
#view-admin-communities, #view-admin-users { background: var(--bg); min-height: 100dvh; }
.admin-list { padding: 12px 14px; }
.admin-community-item, .admin-user-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border-radius: 14px;
  padding: 13px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.admin-user-item .user-avatar {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #7048e8);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; flex: none;
}
.mini-btn {
  flex: none;
  padding: 7px 13px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px; font-weight: 700;
  transition: opacity .15s;
}
.mini-btn:active { opacity: .75; }
.mini-btn.danger { background: #ffe3e3; color: var(--danger); }

/* ============ 小区编辑页 ============ */
#view-admin-community-edit, #view-admin-companies { background: var(--bg); min-height: 100dvh; }
.admin-edit { padding: 14px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 7px; }
.form-row input {
  width: 100%; height: 44px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  font-size: 14px;
  background: #fff;
}
.form-row input:focus { border-color: var(--primary); }
.form-inline { display: flex; gap: 8px; align-items: center; }
.form-inline input { flex: 1; }
.form-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 800;
  color: var(--text);
  margin: 6px 0 10px;
}
.admin-building-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}

.edit-actions { display: flex; gap: 10px; margin-top: 20px; }
.btn {
  flex: 1; height: 46px;
  border-radius: 12px;
  font-size: 15px; font-weight: 700;
  transition: transform .1s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(79, 110, 247, .3); }
.btn-primary:disabled { opacity: .6; }
.btn-ghost { background: #fff; color: var(--text-2); border: 1px solid var(--border); }
.btn-danger { background: #fff; color: var(--danger); border: 1.5px solid #ffc9c9; }

/* ============ 公司管理页 ============ */
.admin-company-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--card);
  border-radius: 12px;
  padding: 13px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}

/* ============ 弹层通用 ============ */
.modal-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 23, 42, .45);
  display: none;
  align-items: flex-end;
}
.modal-mask.open { display: flex; }
.modal-sheet {
  width: 100%;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  max-height: 88vh;
  overflow-y: auto;
  animation: slideUp .25s cubic-bezier(.32, .72, .28, 1);
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 38px; height: 4px; border-radius: 4px; background: #e2e8f0; margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; }
.sheet-title { font-size: 17px; font-weight: 800; }
.sheet-room { font-size: 26px; font-weight: 800; letter-spacing: 2px; }
.sheet-sub { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.sheet-close {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.sheet-close:active { background: var(--border); }

.status-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 4px; }
.status-option {
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 12px 12px 11px;
  text-align: left;
  background: #fff;
  transition: all .15s;
}
.status-option .so-label { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.status-option .so-label::before { content: ''; flex: none; width: 12px; height: 12px; border-radius: 4px; }
.status-option.none .so-label::before { background: #fff; border: 1.5px solid #cbd5e1; }
.status-option.our .so-label::before { background: var(--status-our); }
.status-option.other .so-label::before { background: var(--status-other); }
.status-option.done .so-label::before { background: var(--status-done); }
.status-option .so-desc { display: block; font-size: 11px; color: var(--text-3); margin-top: 4px; }
.status-option.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.status-option.active .so-label::after { content: '✓'; margin-left: auto; color: var(--primary); font-weight: 800; font-size: 15px; }

/* 公司选择 */
.company-select { margin-top: 12px; }
.company-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.company-chip {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 13px; color: var(--text);
  transition: all .15s;
}
.company-chip.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

/* 客户信息 */
.customer-wrap { display: none; margin-top: 14px; }
.customer-inputs { display: flex; gap: 8px; }
.customer-inputs input {
  flex: 1; min-width: 0; height: 42px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s;
}
.customer-inputs input:focus { border-color: var(--primary); }
.customer-inputs input::placeholder { color: var(--text-3); }

.note-wrap { margin-top: 14px; }
.note-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.note-wrap textarea {
  width: 100%; min-height: 76px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  resize: none;
  line-height: 1.5;
  color: var(--text);
  transition: border-color .15s;
}
.note-wrap textarea:focus { border-color: var(--primary); }
.note-count { text-align: right; font-size: 11px; color: var(--text-3); margin-top: 4px; }

.modal-meta { font-size: 11px; color: var(--text-3); margin: 10px 0 14px; }
.confirm-text { font-size: 15px; color: var(--text-2); line-height: 1.6; padding: 16px 0 18px; }
.modal-actions { display: flex; gap: 10px; }

/* 记录详情 */
.log-change {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0;
}
.log-change .arrow { color: var(--text-3); font-size: 16px; }
.log-block {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.log-block .note-title { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.log-text { font-size: 14px; color: var(--text); line-height: 1.6; word-break: break-all; }

/* ============ Toast ============ */
#toast {
  position: fixed; left: 50%; bottom: 90px; z-index: 99;
  transform: translateX(-50%) translateY(10px);
  background: rgba(15, 23, 42, .88);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0; pointer-events: none;
  transition: all .25s;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ v3 追加：未定状态（灰） ============ */
:root {
  --status-pending: #98a2ad;      /* 灰 */
  --pending-soft-bg: #eceff2;
  --pending-soft-tx: #4b5560;
  --pending-border: #b6bfc9;
}
.dot-pending { background: var(--status-pending); }
.grid-cell.status-pending {
  background: var(--pending-soft-bg);
  border: 1.5px solid var(--pending-border);
  color: var(--pending-soft-tx);
}
.st-pending { background: var(--pending-soft-bg); color: var(--pending-soft-tx); }
.bar-pending { background: var(--status-pending); }
.status-option.pending .so-label::before { background: var(--status-pending); }

/* 5 个统计标签换行显示 */
.stats-bar { flex-wrap: wrap; }
.stats-bar .stat-pill { flex: 1 1 calc(33.333% - 8px); min-width: 88px; }
#view-building .grid-hint { flex-wrap: wrap; row-gap: 6px; }

/* ============ v3 追加：底部单元栏（屏幕正下方，多单元时显示） ============ */
.unit-bar {
  flex: none;
  display: none;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
  border-top: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.unit-bar::-webkit-scrollbar { display: none; }
.unit-bar .unit-item {
  flex: none;
  min-width: 66px;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text-2);
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  white-space: nowrap;
  transition: all .15s;
}
.unit-bar .unit-item:active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.unit-bar .unit-item.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(79, 110, 247, .3);
}

/* ============ v3 追加：每层增减房间（点击楼层号弹出） ============ */
.floor-opts { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 6px; }
.floor-opt {
  display: flex; align-items: center; gap: 12px;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  background: #fff;
  text-align: left;
  transition: all .15s;
}
.floor-opt:active { transform: scale(.98); }
.floor-opt.opt-plus { border-color: #b2e0b7; background: #f6fef7; }
.floor-opt.opt-minus { border-color: #ffc9c9; background: #fff5f5; }
.floor-opt .fo-icon {
  flex: none;
  width: 38px; height: 38px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800;
}
.floor-opt.opt-plus .fo-icon { background: #e6f7e9; color: #2f9e44; }
.floor-opt.opt-minus .fo-icon { background: #ffe3e3; color: var(--danger); }
.floor-opt .fo-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.floor-opt .fo-text b { font-size: 15px; color: var(--text); }
.floor-opt .fo-text i { font-style: normal; font-size: 12px; color: var(--text-3); }

/* 小区修改记录弹层列表 */
.cidlog-list { margin: 6px 0 2px; }

/* ============ v3 追加：小区卡片「网站链接」 ============ */
.comm-right { flex: none; display: flex; align-items: center; gap: 6px; margin-left: 2px; }
.comm-link {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(79, 110, 247, .22);
  flex: none;
  transition: transform .12s, opacity .15s;
}
.comm-link:active { transform: scale(.9); opacity: .8; }
.comm-link-empty {
  background: #fff; color: var(--text-3);
  border: 1.5px dashed #cbd5e1;
}
.comm-link svg { display: block; }

/* ============ v3 追加：网站弹层（全屏 iframe） ============ */
#site-modal { align-items: center; justify-content: center; padding: 16px 12px calc(16px + env(safe-area-inset-bottom)); }
.site-panel {
  width: 100%; max-width: 860px;
  height: min(92dvh, 920px);
  background: var(--card);
  border-radius: 18px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .35);
  animation: fadeUp .22s ease both;
}
.site-bar {
  flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 10px 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.site-title {
  flex: 1; min-width: 0;
  font-size: 16px; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-actions { flex: none; display: flex; align-items: center; gap: 8px; }
.site-btn {
  min-width: 36px; height: 34px;
  padding: 0 13px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  color: var(--text-2);
  font-size: 13px; font-weight: 600;
  transition: opacity .15s;
}
.site-btn:active { opacity: .75; }
.site-btn svg { display: block; }
#site-iframe { flex: 1; width: 100%; border: none; background: #fff; }

/* ============ v3 追加：楼栋表单单元配置 ============ */
.bf-unit-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 8px;
}
.bf-unit-row input {
  height: 38px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0 10px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
  min-width: 0;
}
.bf-unit-row input:focus { border-color: var(--primary); }
.bf-u-name { flex: 1; }
.bf-u-lbl { flex: none; font-size: 12px; color: var(--text-2); }
.bf-u-floors { flex: none; width: 54px; }
.bf-u-per { flex: none; width: 60px; }
.bf-unit-row .mini-btn { padding: 7px 11px; }

/* ============ v3 追加：表单提示 ============ */
.form-tip {
  font-size: 12px;
  background: #eef3fd;
  border: 1px solid #dbe4fb;
  color: #4c6ef5;
  border-radius: 10px;
  padding: 8px 11px;
  margin: 2px 0 12px;
  line-height: 1.55;
}

/* ============ ICP 备案号条（工信部要求展示于页面底部） ============ */
#beian-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: .2px;
  color: #8ca0b3;
  background: rgba(242, 245, 249, .88);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  pointer-events: none;   /* 不拦截下方内容触摸 */
  user-select: none;
}
#beian-bar a {
  color: inherit;
  text-decoration: none;
  pointer-events: auto;   /* 仅备案号本身可点击 */
}
#beian-bar a:active { opacity: .7; }
/* 登录页为深色背景，不显示浅色备案条 */
#view-login.active ~ #beian-bar { display: none; }
