:root {
  --bg-gray: #FDF8F3;
  --text-main: #2D3748;
  --text-light: #A0AEC0;
  --text-sub: #718096;
  --border: #EDF2F7;
  --main-color: #1E3A5F;
  --main-color-light: #2C5282;
  --accent-color: #E67E22;
  --accent-color-light: #F39C12;
  --light-color: #EBF4FF;
  --card-bg: #FFFFFF;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-gray);
  min-height: 100vh;
  padding-top: 56px;
  padding-bottom: 96px;
  min-width: 320px;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

.main-container {
  flex: 1;
}

.site-header {
  background: linear-gradient(135deg, var(--main-color) 0%, var(--main-color-light) 100%);
  box-shadow: 0 2px 12px rgba(30, 58, 95, 0.15);
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 1000;
}

.header-container {
  width: 100%;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color-light) 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(230, 126, 34, 0.4);
}

.logo-img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(30, 58, 95, 0.25);
  display: block;
}

.header-logo {
  flex-shrink: 0;
  min-width: auto;
  white-space: nowrap;
}

.logo-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  white-space: nowrap;
}

.logo-text {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.logo-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}

.header-franchise {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 16px;
  background: rgba(255,255,255,0.12);
  transition: all 0.2s;
}

.header-franchise-select {
  font-size: 12px;
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 16px;
  padding: 5px 10px;
  padding-right: 24px;
  cursor: pointer;
  outline: none;
  appearance: none;
  max-width: 100px;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.header-franchise-select option {
  color: #333;
  background: #fff;
}

.header-franchise:hover {
  background: rgba(255,255,255,0.2);
}

.franchise-arrow {
  font-size: 10px;
}

.header-login {
  font-size: 12px;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.3);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-login:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.5);
}

.login-role {
  font-size: 10px;
  padding: 2px 5px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-nav a {
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  transition: color 0.2s;
}

.header-nav a:hover {
  color: #fff;
}

.back-btn {
  font-size: 14px;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  padding: 6px 16px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  transition: all 0.2s;
  text-decoration: none;
}

.back-btn:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.1);
}

.points-info {
  background: rgba(255,255,255,0.15);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}

.main-container {
  padding: 16px;
  width: 100%;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.section-more { font-size: 12px; color: var(--text-light); cursor: pointer; font-weight: normal; }
.section-more:hover { color: var(--main-color); }

.bottom-nav {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 8px 0;
  display: flex;
  justify-content: space-around;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.nav-item-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-light);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 10px;
  transition: color 0.2s;
  text-decoration: none;
}

.nav-item-bottom:hover { color: var(--main-color); }
.nav-item-bottom.active { color: var(--main-color); }
.nav-icon { font-size: 20px; }
.nav-icon-wrap { position: relative; display: flex; align-items: center; justify-content: center; }
.nav-role { font-size: 8px; color: #fff; background: #e74c3c; padding: 1px 4px; border-radius: 8px; position: absolute; bottom: -4px; right: -6px; white-space: nowrap; }

/* ===========================================================
 * 全局小区页顶（绿色品牌 Header）
 * 由 global-components.js 渲染，供 community.html 与生活端小区路由共用
 * =========================================================== */
.community-card-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 56px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  box-sizing: border-box;
  background: linear-gradient(135deg, #0b5e33 0%, #16a34a 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(11, 94, 51, 0.25);
}

.cch-back {
  flex: none;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  text-decoration: none;
  transition: background 0.15s ease;
}

.cch-back:active {
  background: rgba(255, 255, 255, 0.28);
}

.cch-back-icon {
  width: 10px;
  height: 10px;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(45deg);
  margin-left: 4px;
}

.cch-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.25;
}

.cch-title strong {
  font-size: 16px;
  font-weight: 800;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.cch-title span {
  font-size: 10px;
  letter-spacing: 3px;
  opacity: 0.85;
  margin-top: 1px;
}

.cch-share {
  flex: none;
  height: 32px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.cch-share:active {
  background: rgba(255, 255, 255, 0.3);
}

/* 安全区：顶部刘海避让 */
@supports (padding: max(0px)) {
  .community-card-header {
    padding-top: max(0px, env(safe-area-inset-top));
    height: calc(56px + env(safe-area-inset-top, 0px));
    box-sizing: border-box;
  }
}

/* ===========================================================
 * 全局小区底部导航（小区名片 / 物业缴费 / 报修 / 便民 / 我的社区）
 * 由 global-components.js 渲染，供 community.html 与生活端小区路由共用
 * =========================================================== */
.community-card-bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 100;
  background: #fff;
  border-top: 1px solid rgba(22, 163, 74, 0.14);
  box-shadow: 0 -2px 14px rgba(11, 94, 51, 0.1);
  border-radius: 16px 16px 0 0;
}

.community-card-nav {
  display: flex;
  align-items: stretch;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}

.community-card-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 2px;
  color: #7c8ba1;
  font-size: 11px;
  text-decoration: none;
  transition: color 0.15s ease;
}

.community-card-nav-item.active {
  color: #15803d;
  font-weight: 700;
}

.community-card-nav-item .ccn-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}

.community-card-nav-item .ccn-icon svg {
  width: 22px;
  height: 22px;
}

.community-card-nav-item.active .ccn-icon {
  width: 40px;
  height: 26px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.14);
  transform: none;
}

.community-card-nav-item.active .ccn-icon svg {
  filter: drop-shadow(0 2px 4px rgba(22, 163, 74, 0.28));
}

.global-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 12px;
  text-align: center;
}

.global-footer .footer-slogan {
  font-size: 13px;
  color: var(--main-color);
  font-weight: 600;
  margin-bottom: 6px;
}

.global-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.global-footer .footer-link {
  color: var(--text-sub);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
}

.global-footer .footer-link:hover {
  color: var(--main-color);
}

.global-footer .footer-copyright {
  color: var(--text-light);
  font-size: 11px;
  line-height: 1.6;
}

.banner-swiper {
  width: 100%;
  height: 160px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}

.banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.category-section {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.life-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
  padding-left: 8px;
  border-left: 3px solid var(--main-color);
}

.life-section-title small {
  font-size: 11px;
  font-weight: normal;
  color: var(--text-light);
  margin-left: 6px;
}

.level1-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.level1-item {
  background: var(--bg-gray);
  border-radius: 8px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.level1-item:hover {
  background: var(--light-color);
}

.level1-item .icon {
  font-size: 22px;
}

.level1-item .name {
  font-size: 11px;
  color: var(--text-main);
}

.level1-item .arrow {
  font-size: 10px;
  color: var(--text-light);
}

.all-btn {
  background: var(--bg-gray);
}

.all-btn .icon, .all-btn .name, .all-btn .arrow {
  color: var(--text-main);
}

.all-btn:hover {
  background: var(--light-color);
}

.all-btn.expanded {
  background: var(--light-color);
}

.all-btn.active {
  background: var(--light-color);
}

.level1-item.active {
  background: var(--light-color);
}

.hidden-categories {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.hidden-categories.show {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.level2-panel {
  display: none;
  background: #fff;
  padding: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  margin-top: 6px;
  border-radius: 0 0 12px 12px;
}

.level2-panel.show {
  display: block;
}

.level2-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.level2-item {
  background: var(--bg-gray);
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.level2-item:hover {
  background: var(--light-color);
}

.level2-item .icon {
  font-size: 18px;
}

.level2-item .name {
  font-size: 10px;
  color: var(--text-main);
  margin-top: 3px;
}

.shop-card {
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  display: flex;
  gap: 10px;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.shop-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.shop-avatar {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.shop-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.shop-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.shop-category {
  font-size: 11px;
  color: var(--text-light);
}

.shop-address {
  font-size: 11px;
  color: var(--text-sub);
}

.shop-extra {
  display: flex;
  gap: 6px;
}

.shop-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--light-color);
  color: var(--main-color);
}

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 25px;
  font-size: 13px;
  outline: none;
}

.search-input:focus {
  border-color: var(--main-color);
}

.search-btn {
  padding: 10px 20px;
  background: var(--main-color);
  color: #fff;
  border: none;
  border-radius: 25px;
  font-size: 13px;
  cursor: pointer;
}

.search-btn:hover {
  background: var(--main-color-light);
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.activity-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.activity-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.activity-cover {
  width: 100%;
  height: 80px;
  position: relative;
}

.activity-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.activity-countdown {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 4px;
}

.activity-name {
  font-size: 11px;
  color: var(--text-main);
  padding: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-meta {
  font-size: 10px;
  color: var(--text-light);
  padding: 0 6px 6px;
}

.dining-product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.dining-product-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.dining-product-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.dining-product-cover {
  width: 100%;
  height: 80px;
}

.dining-product-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dining-product-name {
  font-size: 11px;
  color: var(--text-main);
  padding: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dining-product-meta {
  font-size: 10px;
  color: var(--text-light);
  padding: 0 6px 4px;
}

.dining-product-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-color);
  padding: 0 6px 6px;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal-content {
  background: #fff;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.modal-close {
  font-size: 22px;
  color: var(--text-light);
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 14px 16px;
}

.modal-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  text-align: right;
}

.btn-primary {
  background: var(--main-color);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--main-color-light);
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  font-size: 12px;
  color: var(--text-main);
  margin-bottom: 5px;
  display: block;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}

.form-input:focus {
  border-color: var(--main-color);
}

.form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}

.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  resize: vertical;
  min-height: 80px;
}

.life-entry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.life-entry {
  background: #fff;
  border-radius: 10px;
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.life-entry:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.life-entry-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--light-color);
  color: var(--main-color);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  font-weight: 600;
}

.life-entry-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 4px;
}

.life-entry-desc {
  font-size: 10px;
  color: var(--text-light);
}

.life-todo-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.life-todo {
  background: #fff;
  border-radius: 10px;
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.life-todo:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.life-todo strong {
  font-size: 20px;
  font-weight: 700;
  color: var(--main-color);
  display: block;
  margin-bottom: 4px;
}

.life-todo span {
  font-size: 12px;
  color: var(--text-light);
}

.merchant-channel-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.merchant-channel-item {
  background: #fff;
  border-radius: 10px;
  padding: 12px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.merchant-channel-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.merchant-channel-item.active {
  background: var(--light-color);
}

.merchant-channel-icon {
  font-size: 22px;
  display: block;
  margin-bottom: 6px;
}

.merchant-channel-name {
  font-size: 11px;
  color: var(--text-main);
}

.floating-service {
  position: fixed;
  right: 12px;
  bottom: 70px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 900;
}

.floating-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--main-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: all 0.2s;
}

.floating-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}
