/* 洁到家 C端 H5 —— 移动端优先（375px 基准），品牌化设计规范
   视觉走查 v2：统一 4/8 栅格、对比度、热区 >=44px、安全区、极端数据不破版、空/错/载态。
   品牌 tokens、16px 圆角、渐变胶囊、藏青渐变品类图标、photo-*.png 映射均沿用不变。 */
:root {
  --primary: #1F2A56;        /* 深藏青（品牌主色，取自 logo） */
  --primary-dark: #141B3D;
  --primary-light: #3A4A9F;
  --primary-weak: #EEF1F9;   /* 主色浅底（沿用旧变量名，兼容模板） */
  --primary-bg: #EEF1F9;
  --accent: #E8A33D;         /* 琥珀金：仅促销角标/精选标签 */
  --text-1: #1F2430;
  --text-2: #4E5568;         /* 正文辅助：加深至约 7:1 */
  --text-3: #6B7280;         /* 占位/辅助：加深至约 4.7:1（无障碍对比度） */
  --bg: #F5F6FA;
  --card: #FFFFFF;
  --radius: 16px;
  --shadow: 0 2px 8px rgba(31, 42, 86, .08);
  --success: #2BA471;
  --warning: #FF8F4D;
  --danger: #E5484D;
  --border: #E3E6F0;
  --btn-grad: linear-gradient(135deg, #1F2A56 0%, #3A4A9F 100%);
  --page-x: 16px;                          /* 统一水平栅格 */
  --safe-b: env(safe-area-inset-bottom, 0px); /* 底部安全区 */
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text-1); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
.app-shell { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; padding-bottom: var(--safe-b); }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
button { font-family: inherit; border: none; cursor: pointer; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; border: none; outline: none; background: transparent; color: var(--text-1); min-width: 0; }
input:focus, textarea:focus, select:focus { outline: 1.5px solid var(--primary); border-radius: 6px; }
:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 2px; }
/* 全局：极端长文本不撑破布局 */
h1, h2, h3, b, p, span, div { overflow-wrap: anywhere; }

/* ── 顶栏（白色简洁导航） ── */
.navbar { position: sticky; top: 0; z-index: 50; background: var(--card); display: flex; align-items: center; height: 52px; padding: 0 8px; box-shadow: 0 1px 0 var(--border); }
.navbar .back { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--primary); flex-shrink: 0; }
.navbar .back:active { background: var(--primary-bg); }
.navbar .title { flex: 1; text-align: center; font-size: 17px; font-weight: 600; color: var(--text-1); min-width: 0; }
.navbar .right { width: 44px; flex-shrink: 0; }

/* ── 通用 ── */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin: 12px var(--page-x); padding: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 20px; border-radius: 22px; font-size: 15px; font-weight: 600; line-height: 1.35; text-align: center; white-space: normal; transition: transform .15s, filter .15s, box-shadow .15s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--btn-grad); color: #fff; box-shadow: 0 4px 10px rgba(31, 42, 86, .25); }
.btn-primary:active { filter: brightness(.92); }
.btn-primary[disabled] { opacity: .5; pointer-events: none; }
.btn-ghost { background: var(--primary-bg); color: var(--primary); }
.btn-ghost:active { filter: brightness(.95); }
.btn-ghost[disabled] { opacity: .5; pointer-events: none; }
.btn-danger-ghost { background: #FDECEC; color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 13px; border-radius: 18px; }
.btn[disabled] { cursor: not-allowed; }
/* 加载态：纯 CSS 旋转环，JS 仅切换类名 */
.btn.is-loading::before { content: ''; width: 15px; height: 15px; flex-shrink: 0; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-ghost.is-loading::before, .btn-danger-ghost.is-loading::before { border-color: rgba(31, 42, 86, .22); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
/* 点击热区扩展：视觉尺寸不变，命中区域 >=44px */
.tap { position: relative; }
.tap::after { content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 100%; height: 100%; min-width: 44px; min-height: 44px; }
.tag { display: inline-block; font-size: 12px; padding: 3px 8px; border-radius: 10px; background: var(--primary-bg); color: var(--primary); max-width: 100%; white-space: normal; }
.tag-warn { background: #FFF1E6; color: var(--warning); }
.tag-gray { background: #F2F3F7; color: var(--text-2); }
.tag-accent { background: #FDF3E3; color: #B9781E; }
.row { display: flex; align-items: center; }
.spacer { flex: 1; }
.muted { color: var(--text-3); font-size: 12px; line-height: 1.6; }
.price { color: var(--primary); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.price .unit { font-size: 12px; font-weight: 400; }
/* 空态：纯 CSS + 内联 data-uri 原创图形，零外链 */
.empty { text-align: center; padding: 48px 24px; color: var(--text-3); font-size: 13px; }
.empty svg { margin: 0 auto 12px; opacity: .5; }
.empty::before { content: ''; display: block; width: 96px; height: 96px; margin: 0 auto 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--border); background: var(--primary-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48' fill='none' stroke='%239AA6C8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='10' y='7' width='28' height='34' rx='4'/%3E%3Cpath d='M16 16h16M16 23h16M16 30h10'/%3E%3C/svg%3E") center / 44px 44px no-repeat; }
/* 首屏骨架（JS render 后被覆盖），零 JS 依赖 */
.boot { padding: 16px; }
.boot > * { border-radius: var(--radius); background: var(--primary-bg); animation: bootPulse 1.4s ease-in-out infinite; }
.boot-bar { width: 45%; height: 32px; border-radius: 8px; margin-bottom: 16px; }
.boot-hero { height: 108px; margin-bottom: 16px; }
.boot-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 20px; background: transparent; animation: none; }
.boot-grid i { display: block; height: 64px; border-radius: 12px; background: var(--primary-bg); animation: bootPulse 1.4s ease-in-out infinite; }
.boot-line { height: 88px; margin-bottom: 12px; }
@keyframes bootPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ── 首页：白色品牌顶栏 + 主视觉 banner + 搜索 + 品类宫格 + 推荐 ── */
.brand-bar { background: var(--card); padding: 10px var(--page-x); display: flex; align-items: center; gap: 10px; box-shadow: 0 1px 0 var(--border); position: sticky; top: 0; z-index: 60; }
.brand-bar img { height: 32px; width: auto; object-fit: contain; }
.brand-bar .mine-entry { margin-left: auto; flex-shrink: 0; display: flex; align-items: center; gap: 6px; height: 36px; min-width: 44px; padding: 0 14px 0 12px; border-radius: 18px; background: var(--primary-bg); color: var(--primary); font-size: 13px; font-weight: 600; }
.home-header { background: linear-gradient(180deg, var(--primary-bg) 0%, var(--bg) 100%); padding: 12px var(--page-x) 56px; }
.search-box { background: #fff; border-radius: 22px; height: 44px; display: flex; align-items: center; padding: 0 16px; gap: 8px; box-shadow: var(--shadow); color: var(--text-3); margin-bottom: 12px; }
.search-box input { flex: 1; font-size: 14px; height: 100%; }
.search-box svg { flex-shrink: 0; }
/* 首屏主视觉：品牌藏青渐变 + 几何装饰（纯 CSS，无外链、无 emoji） */
.home-hero { position: relative; overflow: hidden; background: var(--btn-grad); border-radius: var(--radius); padding: 16px 20px; color: #fff; box-shadow: 0 6px 16px rgba(31, 42, 86, .22); }
.home-hero::after { content: ''; position: absolute; right: -32px; top: -32px; width: 140px; height: 140px; border-radius: 50%; border: 20px solid rgba(255, 255, 255, .06); pointer-events: none; }
.hero-eyebrow { font-size: 11px; letter-spacing: 2px; opacity: .78; }
.home-hero h1 { position: relative; font-size: 19px; font-weight: 700; line-height: 1.3; margin: 4px 0; }
.home-hero p { position: relative; font-size: 12px; opacity: .88; }
.hero-badges { position: relative; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hero-badges span { font-size: 11px; padding: 4px 10px; border-radius: 12px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .18); }
.cat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: -40px; padding: 0 var(--page-x); }
.cat-item { background: var(--card); border-radius: var(--radius); padding: 12px 4px; text-align: center; box-shadow: var(--shadow); min-height: 44px; }
.cat-item:active { transform: scale(.97); }
.cat-item .ic { width: 46px; height: 46px; margin: 0 auto 8px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; box-shadow: 0 4px 10px rgba(31, 42, 86, .18); background: linear-gradient(135deg, #3A4A9F, #1F2A56); }
.cat-item .ic svg { width: 26px; height: 26px; }
/* 保留既有 CSS 优先级修复：防止历史 .ic-* 单类规则覆盖藏青渐变底 */
.cat-item .ic-cleaner, .cat-item .ic-broom, .cat-item .ic-t-shirt, .cat-item .ic-heart, .cat-item .ic-archive { background: linear-gradient(135deg, #3A4A9F, #1F2A56); }
.cat-item span { font-size: 12px; color: var(--text-1); display: block; line-height: 1.3; }
.section-title { font-size: 18px; font-weight: 700; margin: 20px var(--page-x) 4px; display: flex; align-items: center; gap: 6px; color: var(--text-1); }
.section-sub { font-size: 12px; color: var(--text-3); margin: 0 var(--page-x) 8px; }
.svc-card { display: flex; gap: 12px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin: 12px var(--page-x); padding: 12px; }
.svc-card:active { transform: scale(.995); }
.svc-card img { width: 88px; height: 88px; border-radius: 12px; object-fit: cover; background: var(--primary-bg); flex-shrink: 0; }
.svc-card h3 { font-size: 16px; font-weight: 600; line-height: 1.35; color: var(--text-1); margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.svc-card .desc { color: var(--text-3); font-size: 12px; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.svc-card .price { font-size: 18px; }
.svc-card .btn { flex-shrink: 0; }

/* ── 图片通用：统一比例 / cover 裁切 / 占位底 / 失败兜底 ── */
.img-cover { object-fit: cover; background: var(--primary-bg); }
.img-fail { opacity: 0; }   /* onerror 隐藏破图，保留圆角占位底色 */
.thumb { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: var(--primary-bg); flex-shrink: 0; }
.thumb-ph { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #3A4A9F, #1F2A56); color: #fff; }
.thumb-ph svg { width: 26px; height: 26px; }

/* ── 详情页 ── */
.banner { width: 100%; height: 220px; object-fit: cover; background: var(--primary-bg); border-radius: 0 0 16px 16px; display: block; }
.detail-head { background: var(--card); padding: 16px; }
.detail-title-row { display: flex; align-items: flex-start; gap: 8px; }
.detail-title-row h1 { flex: 1; min-width: 0; font-size: 22px; font-weight: 700; line-height: 1.35; color: var(--text-1); }
.detail-title-row .tag { flex-shrink: 0; margin-top: 4px; }
.detail-head .price { font-size: 22px; }
.guarantee { display: flex; gap: 12px; padding: 12px var(--page-x); background: var(--card); margin-top: 10px; overflow-x: auto; }
.g-item { flex: 1; min-width: 100px; display: flex; gap: 8px; align-items: flex-start; }
.g-item svg { color: var(--primary); flex-shrink: 0; margin-top: 1px; }
.g-item b { font-size: 13px; font-weight: 600; display: block; }
.g-item span { font-size: 12px; color: var(--text-3); }
.review-item { border-top: 1px solid #F2F3F7; padding: 12px 0; }
.stars { color: var(--accent); font-size: 13px; letter-spacing: 2px; }
.review-tags { margin: 6px 0; }
.review-tags .tag { margin-right: 6px; margin-bottom: 4px; }
.detail-footer { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: var(--card); padding: 10px var(--page-x) calc(10px + var(--safe-b)); box-shadow: 0 -2px 12px rgba(31, 42, 86, .1); z-index: 40; border-radius: 16px 16px 0 0; }
.detail-footer .btn { width: 100%; }
.footer-space { height: 76px; }

/* ── 弹层/规格选择器（底部抽屉） ── */
.mask { position: fixed; inset: 0; background: rgba(20, 27, 61, .5); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 480px; border-radius: 20px 20px 0 0; padding: 16px var(--page-x) calc(16px + var(--safe-b)); max-height: 80vh; overflow-y: auto; animation: up .2s; }
@keyframes up { from { transform: translateY(30%); opacity: .4; } to { transform: none; opacity: 1; } }
.spec-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-top: 10px; min-height: 44px; }
.spec-item.active { border-color: var(--primary); background: var(--primary-bg); box-shadow: inset 0 0 0 1px var(--primary); }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-bg); color: var(--primary); font-size: 16px; display: flex; align-items: center; justify-content: center; }
.stepper button[disabled] { opacity: .35; }
.confirm-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; text-align: left; }

/* ── 表单 ── */
.field { display: flex; align-items: center; min-height: 48px; border-bottom: 1px solid #F2F3F7; gap: 8px; }
.field label { width: 88px; color: var(--text-2); font-size: 14px; flex-shrink: 0; }
.field input, .field select { flex: 1; height: 100%; }
.field textarea { flex: 1; padding: 12px 0; resize: none; }
.field select { appearance: none; padding-right: 4px; }
.err { color: var(--danger); font-size: 12px; margin: 4px 0 0 88px; line-height: 1.5; }
.form-card .field:last-child { border-bottom: none; }
.code-btn { color: var(--primary); font-size: 13px; flex-shrink: 0; min-height: 44px; padding: 8px 6px; display: inline-flex; align-items: center; }
.code-btn[disabled] { color: var(--text-3); }
.agree { display: flex; gap: 6px; align-items: center; min-height: 44px; margin: 14px 0; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.agree a, .agree-link { color: var(--primary); }
.agree input[type="checkbox"], .field input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; }

/* ── 日期/时段 ── */
.date-strip { display: flex; gap: 8px; overflow-x: auto; padding: 12px var(--page-x); }
.date-chip { flex-shrink: 0; width: 60px; min-height: 60px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; color: var(--text-2); }
.date-chip b { font-size: 15px; color: var(--text-1); }
.date-chip.active { background: var(--btn-grad); color: #fff; border-color: transparent; box-shadow: 0 4px 10px rgba(31, 42, 86, .28); }
.date-chip.active b { color: #fff; }
.slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 var(--page-x) 16px; }
.slot-cell { min-height: 52px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 14px; }
.slot-cell small { font-size: 11px; color: var(--text-3); }
.slot-cell.active { background: var(--btn-grad); color: #fff; border-color: transparent; box-shadow: 0 4px 10px rgba(31, 42, 86, .28); }
.slot-cell.active small { color: rgba(255, 255, 255, .8); }
.slot-cell.full { background: #F2F3F7; color: var(--text-3); pointer-events: none; }

/* ── 订单：状态胶囊 + 卡片 ── */
.tabs { display: flex; background: var(--card); position: sticky; top: 52px; z-index: 30; border-radius: 0 0 12px 12px; }
.tabs div { flex: 1; min-height: 44px; text-align: center; padding: 12px 0; font-size: 14px; color: var(--text-2); border-bottom: 2px solid transparent; display: flex; align-items: center; justify-content: center; }
.tabs div.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.order-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin: 12px var(--page-x); padding: 14px 16px; }
.order-card:active { transform: scale(.995); }
.order-card .price { flex-shrink: 0; }
.order-card .btn { flex-shrink: 0; }
.status-line { font-weight: 600; font-size: 14px; }
.pill { display: inline-block; font-size: 12px; padding: 4px 10px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.pill-pending { background: var(--primary-bg); color: var(--primary); }
.pill-doing { background: #E8F5EE; color: var(--success); }
.pill-done { background: #F2F3F7; color: var(--text-2); }
.pill-cancel { background: #F2F3F7; color: var(--text-3); }
.pill-warn { background: #FFF1E6; color: var(--warning); }
.timeline { position: relative; padding-left: 18px; margin: 12px 0; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item::before { content: ''; position: absolute; left: -17px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: #C9CDD9; }
.tl-item.done::before { background: var(--primary); box-shadow: 0 0 0 4px var(--primary-bg); width: 10px; height: 10px; left: -18px; top: 3px; }
.tl-item b { font-size: 13px; display: block; color: var(--text-2); }
.tl-item.done b { color: var(--primary); }
.tl-item span { font-size: 11px; color: var(--text-3); }
.track-box { background: var(--primary-bg); border-radius: 12px; padding: 10px 12px; margin-top: 8px; font-size: 13px; color: var(--primary); font-weight: 600; overflow-wrap: anywhere; }
/* 取消规则提示：长文案独立成提示条，不塞进按钮 */
.rule-note { display: flex; gap: 8px; align-items: flex-start; background: #FFF7EE; border: 1px solid #F6E2C8; color: #8A5A18; border-radius: 12px; padding: 10px 12px; font-size: 12px; line-height: 1.6; margin-bottom: 10px; }
.rule-note svg { flex-shrink: 0; margin-top: 1px; }
.detail-status { position: relative; overflow: hidden; }
.detail-status::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }

/* ── 地址簿 ── */
.addr-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin: 12px var(--page-x); padding: 14px 16px; }
.addr-card .default-badge { color: var(--primary); border: 1px solid var(--primary); font-size: 11px; border-radius: 4px; padding: 0 4px; margin-left: 6px; white-space: nowrap; }
.addr-ops { display: flex; gap: 18px; margin-top: 10px; color: var(--text-2); font-size: 13px; align-items: center; flex-wrap: wrap; }
.addr-ops button { color: var(--text-2); font-size: 13px; display: flex; gap: 4px; align-items: center; min-height: 44px; }

/* ── 状态/错误态操作区 ── */
.state-actions { padding: 0 var(--page-x) 24px; }

/* ── Toast ── */
#toast-root { position: fixed; top: 45%; left: 50%; transform: translate(-50%, -50%); z-index: 999; pointer-events: none; }
.toast { background: rgba(31, 42, 86, .88); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; margin-top: 8px; text-align: center; max-width: 80vw; overflow-wrap: anywhere; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── 星级 / 评价标签 ── */
.star-picker { display: flex; gap: 8px; font-size: 30px; color: #E3E6F0; margin: 8px 0; }
.star-picker span { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 44px; }
.star-picker .on { color: var(--accent); }
.tag-select { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.tag-select .tag { padding: 10px 14px; font-size: 13px; cursor: pointer; border-radius: 16px; min-height: 44px; }
.tag-select .tag.on { background: var(--btn-grad); color: #fff; }

/* ── 个人中心 ── */
.mine-header { background: var(--btn-grad); padding: 32px var(--page-x) 48px; color: #fff; display: flex; align-items: center; gap: 14px; border-radius: 0 0 24px 24px; }
.mine-header .avatar { width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.mine-logo { height: 34px; width: auto; object-fit: contain; filter: invert(1) brightness(1.6); }
.menu { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin: 12px var(--page-x); }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 52px; border-bottom: 1px solid #F2F3F7; }
.menu-item:last-child { border-bottom: none; }
.menu-item svg { color: var(--primary); flex-shrink: 0; }
.menu-item .arrow { color: #C9CDD9; }

/* ── 窄屏兜底（<360px）：品类图标等比收敛，避免挤压 ── */
@media (max-width: 359px) {
  .cat-item .ic { width: 40px; height: 40px; }
  .cat-item .ic svg { width: 22px; height: 22px; }
  .cat-item span { font-size: 11px; }
  .home-hero h1 { font-size: 17px; }
}
