*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--tx); font: var(--fs)/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: var(--ac); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; }
[hidden] { display: none !important; }
.boot { padding: 48px 16px; text-align: center; color: var(--mu); }
.muted { color: var(--mu); }
.err { color: var(--dg); min-height: 1.5em; }
.row { display: flex; align-items: center; gap: var(--gap-s); }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.sp { height: var(--gap); }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cut { clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut))); }

/* 按钮：最小点击区域 44px */
.btn { min-height: 44px; padding: 0 16px; border: 1px solid var(--ln); background: var(--cd); color: var(--tx); border-radius: var(--r); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--pr); color: var(--pr-tx); border-color: transparent; font-weight: 700; border-radius: 0; }
.btn.danger { color: var(--dg); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: var(--fs-s); }
.btn.block { width: 100%; }
.ib { width: 44px; height: 44px; border: 1px solid var(--ln); background: var(--cd); border-radius: var(--r); display: inline-grid; place-items: center; cursor: pointer; padding: 0; }
.ib svg, .nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* 表单 */
.field { display: grid; gap: 6px; margin-bottom: var(--gap); }
.field label { color: var(--mu); font-size: var(--fs-s); }
.field input, .field select, .field textarea, .search { width: 100%; min-height: 44px; padding: 8px 12px; background: var(--cd); border: 1px solid var(--ln); border-radius: var(--r); }
.field textarea { min-height: 88px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: flex-start; color: var(--mu); font-size: var(--fs-s); margin-bottom: var(--gap); }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--pr); }

/* 卡片、标签 */
.card { background: var(--cd); border: 1px solid var(--ln); border-left: 3px solid var(--pr); border-radius: var(--r); padding: var(--gap); margin-bottom: var(--gap); }
.card h2 { font-size: var(--fs-l); margin-bottom: var(--gap-s); }
.tag { display: inline-block; padding: 0 8px; border-radius: 3px; background: var(--hi); color: var(--pr); font-size: var(--fs-s); line-height: 22px; white-space: nowrap; }
.tag.ok { color: var(--ok); } .tag.warn { color: var(--warn); } .tag.dg { color: var(--dg); }
.price { color: var(--ac); font-weight: 700; font-size: var(--fs-l); }
.empty { text-align: center; color: var(--mu); padding: 40px 16px; }
.kv { display: grid; grid-template-columns: 88px 1fr; gap: 4px 12px; }
.kv dt { color: var(--mu); } .kv dd { margin: 0; word-break: break-all; }

/* 分段/筛选标签 */
.tabs { display: flex; gap: var(--gap-s); overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; min-height: 40px; padding: 0 14px; border: 0; background: var(--cd); color: var(--tx); cursor: pointer; clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px)); }
.tab.on { background: var(--hi); color: var(--pr); font-weight: 700; }
:root[data-theme="dark"] .tab.on { color: var(--ac); }

/* 弹层 */
.modal { position: fixed; inset: 0; background: var(--ov); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.sheet { width: min(100%, 520px); max-height: 88dvh; overflow: auto; background: var(--bg); border-top: 3px solid var(--pr); padding: var(--gap-l) var(--gap-l) calc(var(--gap-l) + env(safe-area-inset-bottom)); }
.sheet h3 { font-size: var(--fs-l); margin-bottom: var(--gap); }
.sheet .btns { display: flex; gap: var(--gap-s); justify-content: flex-end; margin-top: var(--gap); }
@media (min-width: 768px) { .modal { align-items: center; } .sheet { border: 1px solid var(--ln); border-top: 3px solid var(--pr); } }
.toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: min(92vw, 420px); background: var(--tx); color: var(--bg); padding: 10px 16px; border-radius: var(--r); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 80; text-align: center; }
.toast.show { opacity: 1; }

/* 安装页 */
.install { background: var(--bg); }
.inst { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; }
.inst h1 { font-size: var(--fs-xxl); margin-bottom: 8px; }
.clist { list-style: none; padding: 0; margin: 0 0 var(--gap); display: grid; gap: 6px; }
.clist .ok { color: var(--ok); } .clist .bad { color: var(--dg); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
