/* 卡奇米 · 三端共用样式。主色由后台「店铺设置 · 品牌主题」控制（--c） */
:root { --c: #C2410C; --c2: #FFF1E6; --c3: #F5C9A8; --bg: #F5F5F4; --card: #FFFFFF; --t1: #1C1917; --t2: #44403C; --t3: #78716C; --t4: #A8A29E; --line: #F0EEEB; --ok: #15803D; --warn: #B45309; --bad: #B91C1C; --r: 14px; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--t1); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
.hide { display: none !important; }

/* 布局 */
.page { min-height: 100vh; padding-bottom: 76px; }
.page.nobar { padding-bottom: 24px; }
.top { position: sticky; top: 0; z-index: 20; height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top h1 { flex: 1; font-size: 17px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .back, .top .act { min-width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 15px; color: var(--t2); }
.top .back { font-size: 22px; justify-content: flex-start; }
.top .act { justify-content: flex-end; color: var(--c); font-size: 22px; }
.top .act.txt { font-size: 14px; }
.wrap { padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 4px; }
.grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.wrapx { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

/* 文字 */
.t1 { color: var(--t1); } .t2 { color: var(--t2); } .t3 { color: var(--t3); } .t4 { color: var(--t4); } .tc { color: var(--c); } .tok { color: var(--ok); } .twarn { color: var(--warn); } .tbad { color: var(--bad); }
.fs11 { font-size: 11px; } .fs12 { font-size: 12px; } .fs13 { font-size: 13px; } .fs15 { font-size: 15px; } .fs17 { font-size: 17px; } .fs20 { font-size: 20px; } .fs24 { font-size: 24px; }
.b { font-weight: 600; } .ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .ell2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pre { white-space: pre-wrap; word-break: break-word; } .center { text-align: center; } .right { text-align: right; }

/* 卡片和列表 */
.card { background: var(--card); border-radius: var(--r); padding: 14px; }
.card.flat { padding: 0; overflow: hidden; }
.sec-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.sec-title .more { font-size: 12px; color: var(--t4); font-weight: 400; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); background: var(--card); width: 100%; text-align: left; }
.item:last-child { border-bottom: 0; }
.item .arrow { color: #D6D3D1; font-size: 16px; }
.kv { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv > span:first-child { width: 88px; flex-shrink: 0; color: var(--t3); }
.empty { padding: 60px 0; text-align: center; color: var(--t4); font-size: 13px; }
.divider { height: 1px; background: var(--line); }

/* 按钮 */
.btn { height: 44px; padding: 0 20px; border-radius: 22px; background: var(--c); color: #fff; font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn.sm { height: 32px; padding: 0 14px; border-radius: 16px; font-size: 13px; }
.btn.ghost { background: #fff; color: var(--t2); border: 1px solid #E7E5E4; }
.btn.soft { background: var(--c2); color: var(--c); }
.btn.block { width: 100%; }
.btn[disabled], .btn.off { background: #E7E5E4; color: var(--t4); pointer-events: none; }
.link { color: var(--c); font-size: 13px; }

/* 标签、筛选 */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 1px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; height: 32px; padding: 0 14px; border-radius: 16px; background: #fff; color: var(--t2); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; border: 1px solid transparent; }
.chip.on { background: var(--c); color: #fff; }
.chip.line { border-color: #E7E5E4; }
.chip.line.on { background: var(--c2); color: var(--c); border-color: var(--c); }
.chip.add { border: 1px dashed var(--c3); color: var(--c); width: 32px; padding: 0; justify-content: center; font-size: 16px; }
.tabs { display: flex; gap: 22px; padding: 0 14px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { padding: 12px 0 10px; font-size: 14px; color: var(--t3); border-bottom: 2px solid transparent; white-space: nowrap; flex-shrink: 0; }
.tabs button.on { color: var(--c); font-weight: 600; border-color: var(--c); }
.seg { display: inline-flex; background: #EFEDEB; border-radius: 10px; padding: 3px; }
.seg button { height: 30px; padding: 0 16px; border-radius: 8px; font-size: 13px; color: var(--t3); }
.seg button.on { background: #fff; color: var(--c); font-weight: 600; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--c); color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11px; background: var(--c2); color: var(--c); }
.tag.gray { background: #F5F5F4; color: var(--t3); } .tag.ok { background: #DCFCE7; color: var(--ok); } .tag.warn { background: #FEF3C7; color: var(--warn); } .tag.bad { background: #FEE2E2; color: var(--bad); }

/* 表单 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; color: var(--t3); }
.input, .textarea, .select { width: 100%; height: 44px; border-radius: 10px; border: 1px solid #E7E5E4; background: #fff; padding: 0 12px; font-size: 15px; outline: 0; }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.6; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--c); }
.search { height: 38px; border-radius: 19px; background: #F5F5F4; border: 0; padding: 0 14px 0 34px; width: 100%; font-size: 14px; outline: 0; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23A8A29E' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3 3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 12px center; }
.sw { width: 46px; height: 28px; border-radius: 14px; background: #D6D3D1; position: relative; flex-shrink: 0; transition: background .15s; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 11px; background: #fff; transition: left .15s; }
.sw.on { background: var(--c); } .sw.on::after { left: 21px; }
.check { width: 20px; height: 20px; border-radius: 10px; border: 1.5px solid #D6D3D1; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; font-size: 12px; }
.check.on { background: var(--c); border-color: var(--c); }
.check.on::after { content: '✓'; }

/* 底部栏 */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: rgba(255,255,255,.97); border-top: 1px solid var(--line); display: flex; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--t4); position: relative; }
.tabbar a.on { color: var(--c); }
.tabbar svg { width: 24px; height: 24px; }
.tabbar .dot { position: absolute; top: 6px; left: calc(50% + 6px); }
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }

/* 弹层 */
.mask { position: fixed; inset: 0; z-index: 90; background: rgba(28,25,23,.42); animation: fade .15s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 91; max-height: 88vh; overflow-y: auto; background: #fff; border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); animation: up .2s; }
.sheet .sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet .sheet-head b { font-size: 16px; }
.full { position: fixed; inset: 0; z-index: 92; background: var(--bg); overflow-y: auto; animation: up .2s; }
.toast { position: fixed; left: 50%; top: 40%; transform: translateX(-50%); z-index: 200; max-width: 80vw; padding: 12px 18px; border-radius: 12px; background: rgba(28,25,23,.9); color: #fff; font-size: 14px; text-align: center; animation: fade .15s; }
.dialog { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 95; width: min(86vw, 380px); background: #fff; border-radius: 16px; padding: 22px 20px 16px; }
.dialog p { font-size: 15px; line-height: 1.6; margin-bottom: 18px; text-align: center; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* 其他组件 */
.avatar { width: 40px; height: 40px; border-radius: 20px; background: #FED7AA; color: #7C2D12; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.thumb { width: 72px; height: 72px; border-radius: 10px; background: #F5F5F4; flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--t4); font-size: 22px; }
.thumb img, .ph img { width: 100%; height: 100%; object-fit: cover; }
.ph { background: linear-gradient(135deg, #FED7AA, #FFF1E6); display: flex; align-items: center; justify-content: center; color: var(--c); font-weight: 700; overflow: hidden; }
.price { color: var(--c); font-weight: 700; }
.bar { height: 8px; border-radius: 4px; background: #F5F5F4; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--c); border-radius: 4px; }
.spin { width: 22px; height: 22px; border: 2px solid var(--c3); border-top-color: var(--c); border-radius: 50%; animation: rot .7s linear infinite; margin: 40px auto; }
@keyframes rot { to { transform: rotate(360deg); } }

/* 聊天 */
.chat { padding: 12px 14px 90px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 8px; align-items: flex-start; max-width: 86%; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble { padding: 10px 13px; border-radius: 14px; background: #fff; font-size: 15px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.msg.me .bubble { background: var(--c); color: #fff; }
.msg.ai .bubble { background: #fff; border: 1px dashed var(--c3); }
.msg.me.ai .bubble { background: var(--c2); color: var(--t1); border: 0; }
.msg .who { font-size: 11px; color: var(--t4); margin-bottom: 2px; }
.msg .cardmsg { width: 240px; background: #fff; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; color: var(--t1); }
.sys { align-self: center; font-size: 12px; color: var(--t4); background: #EFEDEB; padding: 3px 10px; border-radius: 10px; }
.composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
.composer .inputrow { display: flex; gap: 8px; align-items: center; }
.composer textarea { flex: 1; min-height: 38px; max-height: 120px; border-radius: 19px; border: 0; background: #F5F5F4; padding: 9px 14px; resize: none; outline: 0; font-size: 15px; line-height: 20px; }
.circle { width: 36px; height: 36px; border-radius: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 20px; color: var(--t2); }
.circle.c { background: var(--c); color: #fff; font-size: 15px; }
.panel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 14px 4px 6px; }
.panel button { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--t2); }
.panel button span:first-child { width: 52px; height: 52px; border-radius: 14px; background: #F5F5F4; display: flex; align-items: center; justify-content: center; font-size: 22px; }

@media (min-width: 720px) { .mobile-shell { max-width: 480px; margin: 0 auto; background: var(--bg); min-height: 100vh; box-shadow: 0 0 0 1px var(--line); } .tabbar, .bottom-bar, .composer, .sheet { max-width: 480px; margin: 0 auto; } }
