:root {
  --bg: #fff; --line: #e8e8ec; --line-soft: #f0f0f3; --text: #17171c; --muted: #7c7c88; --dim: #a9a9b3;
  --soft: #f4f4f6; --hover: #f7f7f9; --black: #111114; --red: #e5333a;
  --r-pill: 999px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.45 "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { display: block; flex: none; }
.dim { color: var(--dim); }
.muted { color: var(--muted); }

/* ---------- 布局 ---------- */
.app { display: flex; height: 100vh; }
.rail { width: 76px; flex: none; border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 18px 0; gap: 6px; }
.rail .logo { width: 34px; height: 34px; border-radius: 50%; background: var(--red); margin-bottom: 14px; }
.rail hr { width: 40px; border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.rail button { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #2a2a31; position: relative; }
.rail button:hover { background: var(--hover); }
.rail button.active { background: #efeff2; }
.rail button::after {
  content: attr(data-tip); position: absolute; left: 54px; top: 50%; transform: translateY(-50%); background: var(--black); color: #fff;
  font-size: 12.5px; padding: 5px 9px; border-radius: 7px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 50;
}
.rail button:hover::after { opacity: 1; }
.rail .grow { flex: 1; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { height: 72px; flex: none; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 32px; gap: 14px; }
.crumb { color: var(--muted); font-size: 15.5px; display: flex; gap: 12px; align-items: center; }
.crumb b { color: var(--text); font-weight: 600; }
.top .spacer { flex: 1; }
.demo-tag { font-size: 12.5px; color: #9a6a00; background: #fdf3cf; padding: 5px 11px; border-radius: var(--r-pill); white-space: nowrap; }
.demo-tag .short { display: none; }
.crumb { white-space: nowrap; min-width: 0; }
.tb-g { display: contents; }
.msort { display: none; }
.kbd-search { display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 12px 0 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); font-size: 14px; min-width: 250px; }
.kbd-search:hover { border-color: #cfcfd6; }
.kbd-search kbd { margin-left: auto; font: 12px inherit; background: var(--soft); border-radius: 6px; padding: 2px 6px; color: var(--muted); }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 24px 32px 20px; }
.view.scroll { overflow: auto; display: block; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; align-items: center; gap: 6px; padding-bottom: 18px; border-bottom: 1px solid var(--line); position: relative; flex-wrap: wrap; row-gap: 10px; }
.tab { height: 40px; padding: 0 17px; border-radius: var(--r-pill); color: var(--muted); font-weight: 500; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--black); color: #fff; font-weight: 600; }
.vr { width: 1px; height: 26px; background: var(--line); margin: 0 12px; }
.tool { height: 40px; padding: 0 14px; border-radius: var(--r-pill); display: inline-flex; align-items: center; gap: 9px; color: #55555f; font-weight: 500; }
.tool:hover { background: var(--hover); color: var(--text); }
.tool.filter { background: var(--soft); color: var(--text); padding-right: 6px; }
.tool.filter .badge { min-width: 28px; height: 28px; border-radius: 50%; background: var(--red); color: #fff; font-size: 13px; font-weight: 600; display: grid; place-items: center; }
.tool.filter .badge.zero { background: #d9d9de; }
.count { color: var(--muted); white-space: nowrap; }
.count b { color: var(--text); font-weight: 600; font-size: 16px; }
.toolbar .spacer { flex: 1; }
.searchbox { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; width: 280px; color: var(--muted); }
.searchbox:focus-within { border-color: var(--black); color: var(--text); }
.searchbox input { border: 0; outline: 0; flex: 1; min-width: 0; background: none; }
.btn { height: 40px; padding: 0 16px; border-radius: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.btn.primary { background: var(--black); color: #fff; }
.btn.primary:hover { background: #2c2c33; }
.btn.line { border: 1px solid var(--line); }
.btn.line:hover { background: var(--hover); }
.btn.danger { color: var(--red); border: 1px solid #f6c9cb; }
.btn.danger:hover { background: #fdecec; }
.btn.sm { height: 32px; padding: 0 11px; border-radius: 9px; font-size: 13.5px; font-weight: 500; }
.btn[disabled] { opacity: .45; cursor: default; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 12px; background: var(--soft); border-radius: var(--r-pill); font-size: 13.5px; }
.chip span { color: var(--muted); }
.chip button { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.chip button:hover { background: #dedee3; color: var(--text); }
.chip.clear { background: none; color: var(--muted); padding: 0 6px; cursor: pointer; }
.chip.clear:hover { color: var(--text); }

/* ---------- 弹层 ---------- */
.pop { position: absolute; top: 48px; z-index: 40; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 50px rgba(20, 20, 30, .14); padding: 18px; }
.pop h4 { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.pop .grp { margin-bottom: 16px; }
.pop .grp:last-child { margin-bottom: 0; }
.opts { display: flex; flex-wrap: wrap; gap: 7px; }
.opt { height: 31px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--line); font-size: 13.5px; color: #44444d; }
.opt:hover { border-color: #c5c5cd; }
.opt.on { background: var(--black); border-color: var(--black); color: #fff; }
.pop .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pop-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; padding: 5px 0; }
.check input { width: 16px; height: 16px; accent-color: var(--black); }
.field-in, .pop select, .pop input[type=text], .pop input[type=number] {
  width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 0 11px; background: #fff; outline: 0;
}
.pop select:focus, .pop input:focus { border-color: var(--black); }
.range { display: flex; align-items: center; gap: 8px; }

/* ---------- 表格 ---------- */
.table-wrap { flex: 1; min-height: 0; margin-top: 18px; border: 1px solid var(--line); border-radius: 14px; overflow: auto; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; white-space: nowrap; }
.grid th, .grid td { height: 56px; padding: 0 22px; text-align: left; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.grid th:last-child, .grid td:last-child { border-right: 0; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid th { position: sticky; top: 0; background: #fff; font-weight: 600; z-index: 2; user-select: none; }
.grid th.sortable { cursor: pointer; }
.grid th.sortable:hover { background: var(--hover); }
.grid th .arr { display: inline-block; margin-left: 6px; color: var(--dim); font-size: 11px; }
.grid th.sorted .arr { color: var(--text); }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: var(--hover); }
.idp { color: var(--muted); margin-right: 4px; }
.person { display: flex; align-items: center; gap: 12px; }
.av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.av.lg { width: 52px; height: 52px; font-size: 21px; }
.person small { color: var(--muted); font-size: 12.5px; margin-left: 2px; }
.ell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.cell-sub { color: var(--muted); font-size: 12.5px; margin-left: 8px; }
.empty { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }

.pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 13px 0 11px; border-radius: var(--r-pill); font-weight: 500; font-size: 14px; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.sm { height: 25px; font-size: 12.5px; padding: 0 10px 0 9px; gap: 6px; }
.pill.red { background: #fde7e8; color: #de3b43; }
.pill.green { background: #e2f6e7; color: #23924c; }
.pill.blue { background: #e3ecff; color: #3567dc; }
.pill.yellow { background: #fdf2c9; color: #a97c00; }
.pill.purple { background: #f1e6fe; color: #8540d4; }
.pill.orange { background: #ffe8d9; color: #dc5f14; }
.pill.lime { background: #ecf6d3; color: #5f8f10; }
.pill.gray { background: #efeff2; color: #62626d; }
.dupe { display: inline-grid; place-items: center; height: 22px; padding: 0 7px; margin-left: 8px; border-radius: 7px; background: #fff0e0; color: #d45f00; font-size: 12px; font-weight: 600; }
.rc { display: inline-block; margin-right: 10px; color: var(--muted); }
.rc b { font-weight: 600; margin-right: 2px; }
.rc.g b { color: #23924c; } .rc.r b { color: #de3b43; }
.rate { display: flex; align-items: center; gap: 10px; }
.rate .bar { width: 90px; height: 6px; border-radius: 3px; background: #f6dadb; overflow: hidden; }
.rate .bar i { display: block; height: 100%; background: #2fa85b; border-radius: 3px; }
.rate .bar.none { background: var(--soft); }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 14px; color: var(--muted); font-size: 14px; }
.pager button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--text); }
.pager button:hover:not([disabled]) { background: var(--hover); }
.pager button[disabled] { opacity: .35; cursor: default; }

/* ---------- 抽屉 ---------- */
.scrim { position: fixed; inset: 0; background: rgba(18, 18, 24, .28); z-index: 60; animation: fade .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 94vw); background: #fff; z-index: 61; display: flex; flex-direction: column; box-shadow: -20px 0 60px rgba(20, 20, 30, .16); animation: slide .2s cubic-bezier(.2, .8, .2, 1); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.d-head { padding: 22px 28px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 16px; align-items: flex-start; }
.d-head .ttl { flex: 1; min-width: 0; }
.d-head h2 { margin: 0 0 6px; font-size: 21px; font-weight: 650; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.d-head h2 small { font-size: 14px; color: var(--muted); font-weight: 400; }
.d-head .sub { color: var(--muted); font-size: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.iconbtn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #55555f; flex: none; }
.iconbtn:hover { background: var(--soft); color: var(--text); }
.iconbtn.sm { width: 30px; height: 30px; border-radius: 8px; }
.d-body { flex: 1; overflow: auto; padding: 22px 28px 40px; }
.sec { margin-bottom: 28px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sec-h h3 { margin: 0; font-size: 15.5px; font-weight: 650; }
.sec-h h3 span { color: var(--muted); font-weight: 400; margin-left: 6px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.fact { padding: 13px 16px; min-width: 0; background: #fff; }
.fact label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.fact div { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact.wide { grid-column: 1 / -1; }
.fact.wide div { white-space: normal; font-weight: 400; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.kpi b { font-size: 24px; font-weight: 650; letter-spacing: -.01em; }
.kpi b small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.kpi.g b { color: #23924c; } .kpi.r b { color: #de3b43; }
.season-h { font-size: 13px; color: var(--muted); margin: 16px 0 8px; display: flex; gap: 10px; align-items: center; }
.season-h::after { content: ""; flex: 1; border-top: 1px solid var(--line-soft); }
.rows { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.arow { display: flex; align-items: center; gap: 12px; padding: 11px 14px 11px 16px; border-bottom: 1px solid var(--line); min-height: 54px; }
.arow:last-child { border-bottom: 0; }
.arow.click { cursor: pointer; }
.arow.click:hover, .arow:hover { background: var(--hover); }
.arow .grow { flex: 1; min-width: 0; }
.arow .t1 { font-weight: 550; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.arow .t2 { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow .acts { display: flex; gap: 2px; opacity: 0; }
.arow:hover .acts { opacity: 1; }
.arow .gpa { width: 78px; text-align: right; font-weight: 550; flex: none; }
select.result { appearance: none; -webkit-appearance: none; border: 0; outline: 0; height: 28px; padding: 0 12px; border-radius: var(--r-pill); font-weight: 550; font-size: 13.5px; cursor: pointer; text-align: center; text-align-last: center; flex: none; }
select.result.green { background: #e2f6e7; color: #23924c; } select.result.red { background: #fde7e8; color: #de3b43; }
select.result.yellow { background: #fdf2c9; color: #a97c00; } select.result.blue { background: #e3ecff; color: #3567dc; }
select.result.gray { background: #efeff2; color: #62626d; } select.result.purple { background: #f1e6fe; color: #8540d4; }
.strip { position: relative; height: 74px; border: 1px solid var(--line); border-radius: 14px; margin-top: 12px; }
.strip .lane { position: absolute; left: 62px; right: 18px; height: 1px; background: var(--line-soft); }
.strip .lbl { position: absolute; left: 14px; font-size: 12px; color: var(--muted); transform: translateY(-50%); }
.strip .dot { position: absolute; width: 11px; height: 11px; border-radius: 50%; transform: translate(-50%, -50%); border: 2px solid #fff; cursor: pointer; }
.strip .dot:hover { transform: translate(-50%, -50%) scale(1.5); z-index: 2; }
.strip .axis { position: absolute; left: 62px; right: 18px; bottom: 3px; height: 14px; font-size: 11px; color: var(--dim); }
.strip .axis span { position: absolute; transform: translateX(-50%); }
.note { background: var(--soft); border-radius: 12px; padding: 12px 14px; font-size: 14px; white-space: pre-wrap; }

/* ---------- 表单 ---------- */
.modal { position: fixed; z-index: 71; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(660px, 94vw); max-height: 90vh; background: #fff; border-radius: 18px; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(20, 20, 30, .25); animation: fade .15s; }
.m-head { padding: 20px 24px 14px; display: flex; align-items: center; justify-content: space-between; }
.m-head h3 { margin: 0; font-size: 18px; font-weight: 650; }
.m-body { padding: 4px 24px 8px; overflow: auto; display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px 14px; }
.m-foot { padding: 16px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.f { grid-column: span 3; display: flex; flex-direction: column; gap: 5px; }
.f.s2 { grid-column: span 2; } .f.s4 { grid-column: span 4; } .f.s6 { grid-column: span 6; }
.f label { font-size: 13px; color: var(--muted); }
.f label em { color: var(--red); font-style: normal; }
.f input, .f select, .f textarea { height: 40px; border: 1px solid var(--line); border-radius: 11px; padding: 0 12px; outline: 0; background: #fff; width: 100%; }
.f textarea { height: 76px; padding: 9px 12px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus { border-color: var(--black); }
.f .hint { font-size: 12px; color: var(--dim); }

/* ---------- 全局搜索 ---------- */
.palette { position: fixed; z-index: 81; left: 50%; top: 12vh; transform: translateX(-50%); width: min(640px, 92vw); background: #fff; border-radius: 18px; box-shadow: 0 30px 90px rgba(20, 20, 30, .3); overflow: hidden; animation: fade .12s; }
.palette .in { display: flex; align-items: center; gap: 12px; padding: 0 20px; height: 60px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette input { flex: 1; border: 0; outline: 0; font-size: 17px; background: none; }
.palette .res { max-height: 58vh; overflow: auto; padding: 8px; }
.palette h5 { margin: 10px 12px 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.palette .item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; cursor: pointer; }
.palette .item.sel { background: var(--soft); }
.palette .item .grow { flex: 1; min-width: 0; }
.palette .item .t2 { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette .tip { padding: 26px; text-align: center; color: var(--muted); font-size: 14px; }
.sq { width: 30px; height: 30px; border-radius: 9px; background: var(--soft); display: grid; place-items: center; color: #55555f; flex: none; }

/* ---------- 统计 / 导入 ---------- */
.page-h { margin: 0 0 18px; font-size: 22px; font-weight: 650; }
.panels { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 16px; }
.panel { border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.panel.full { grid-column: 1 / -1; }
.panel h3 { margin: 0 0 4px; font-size: 15.5px; font-weight: 650; }
.panel p.desc { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.hbar { display: grid; grid-template-columns: 110px 1fr 120px; gap: 12px; align-items: center; padding: 7px 0; font-size: 14px; }
.hbar.click { cursor: pointer; border-radius: 8px; }
.hbar.click:hover { background: var(--hover); }
.hbar .track { height: 10px; border-radius: 5px; background: var(--soft); overflow: hidden; display: flex; }
.hbar .track i { display: block; height: 100%; }
.hbar .track .g { background: #2fa85b; } .hbar .track .r { background: #ee8a8f; } .hbar .track .p { background: #d5d5db; }
.hbar .val { text-align: right; color: var(--muted); white-space: nowrap; }
.hbar .val b { color: var(--text); font-weight: 600; }
.hbar .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
textarea.paste { width: 100%; height: 150px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; outline: 0; font: 13px/1.5 ui-monospace, Menlo, monospace; resize: vertical; white-space: pre; }
textarea.paste:focus { border-color: var(--black); }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.inline input[type=text] { flex: 1; min-width: 260px; height: 40px; border: 1px solid var(--line); border-radius: 11px; padding: 0 12px; outline: 0; }
.inline input[type=text]:focus { border-color: var(--black); }
.result-box { margin-top: 12px; background: var(--soft); border-radius: 12px; padding: 12px 14px; font-size: 14px; max-height: 260px; overflow: auto; }
.result-box .ln { display: flex; gap: 10px; padding: 4px 0; align-items: center; }
.result-box .ln .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px); background: var(--black); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 100; max-width: 80vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: #c8262d; }

@media (max-width: 900px) {
  .rail { width: 60px; } .top, .view { padding-left: 16px; padding-right: 16px; }
  .panels { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, 1fr); }
  .kbd-search { min-width: 0; } .kbd-search span { display: none; }
  .facts { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 登录 ---------- */
.auth { position: fixed; inset: 0; z-index: 200; background: #f6f6f8; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(400px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 34px 32px 30px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(20, 20, 30, .08); }
.auth-card .logo { width: 40px; height: 40px; border-radius: 50%; background: var(--red); }
.auth-card h1 { margin: 6px 0 0; font-size: 22px; font-weight: 650; }
.auth-card p { margin: 0 0 6px; color: var(--muted); font-size: 14.5px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.auth-card input { height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 0 13px; outline: 0; font-size: 15px; color: var(--text); }
.auth-card input:focus { border-color: var(--black); }
.auth-card .btn { height: 44px; justify-content: center; margin-top: 6px; }
.auth-err { color: #c8262d; font-size: 13.5px; min-height: 18px; }

/* ---------- 中等宽度：顶栏文字收短 ---------- */
@media (max-width: 1100px) {
  .demo-tag .full { display: none; } .demo-tag .short { display: inline; }
}

/* ---------- 手机 ---------- */
@media (max-width: 720px) {
  html, body { overflow: hidden; }
  input, select, textarea { font-size: 16px !important; } /* 防止 iOS 聚焦时自动放大页面 */
  .app { flex-direction: column-reverse; height: 100vh; height: 100dvh; }
  .main { min-height: 0; }

  /* 导航移到底部 */
  .rail { width: 100%; flex-direction: row; justify-content: space-around; align-items: center; border-right: 0; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); gap: 0; background: #fff; }
  .rail .logo, .rail hr, .rail .grow { display: none; }
  .rail button { width: 48px; height: 44px; }
  .rail button::after { display: none; }

  .top { height: 54px; padding: 0 14px; gap: 10px; }
  .crumb span { display: none; }
  .crumb b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; }
  .kbd-search { min-width: 0; width: 38px; padding: 0; justify-content: center; }
  .kbd-search span, .kbd-search kbd { display: none; }

  .view { padding: 12px 14px 0; overflow-y: auto; display: block; }
  .view.scroll { padding-bottom: 20px; }

  /* 工具栏分三行：标签 / 筛选排序 / 搜索 */
  .toolbar { gap: 10px; padding-bottom: 12px; position: static; }
  .toolbar > .vr, .toolbar > .spacer, .tb-tools .vr, .tool-cols { display: none; }
  .tb-g { display: flex; width: 100%; align-items: center; gap: 8px; }
  .tb-tabs { background: var(--soft); border-radius: var(--r-pill); padding: 3px; gap: 0; }
  .tb-tabs .tab { flex: 1; height: 36px; padding: 0; }
  .tool.filter { height: 38px; }
  .msort { display: inline-flex; align-items: center; gap: 2px; height: 38px; padding: 0 4px 0 12px; background: var(--soft); border-radius: var(--r-pill); min-width: 0; }
  .msort select { border: 0; background: none; outline: 0; font-size: 14px !important; font-weight: 500; max-width: 104px; appearance: none; -webkit-appearance: none; }
  .msort .iconbtn { font-size: 15px; }
  .count { margin-left: auto; font-size: 13.5px; }
  .count b { font-size: 15px; }
  .tb-right .searchbox { flex: 1; width: auto; min-width: 0; height: 42px; }
  .tb-right .btn { width: 42px; height: 42px; padding: 0; justify-content: center; flex: none; }
  .tb-right .btn span { display: none; }
  .chips { padding-top: 0; padding-bottom: 12px; }

  /* 筛选做成底部弹层 */
  .pop { position: fixed; left: 0 !important; right: 0; top: auto; bottom: 0; width: auto !important; max-height: 78dvh !important; overflow: auto; border-radius: 20px 20px 0 0; border-width: 1px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -18px 60px rgba(20, 20, 30, .22); z-index: 55; }
  .pop .row2 { grid-template-columns: 1fr; }
  .pop-foot { position: sticky; bottom: -18px; background: #fff; padding-bottom: 4px; }
  .opt { height: 34px; }

  /* 列表卡片 */
  .table-wrap { margin-top: 0; border: 0; border-radius: 0; overflow: visible; }
  .mcard { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 9px; cursor: pointer; }
  .mcard:active { background: var(--hover); }
  .mc-top { display: flex; align-items: center; gap: 11px; }
  .mc-top .av { width: 38px; height: 38px; font-size: 15px; }
  .mc-main { flex: 1; min-width: 0; }
  .mc-t { font-weight: 600; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mc-t small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
  .mc-s { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mc-s.clamp { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .mc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
  .mc-row .pill { max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mc-prog { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; white-space: normal; }
  .mc-prog .pill { max-width: none; }
  .mc-prog .dupe { margin-left: 0; }
  .rate .bar { width: 64px; }
  .pager { justify-content: center; padding: 6px 0 16px; }
  .empty { padding: 50px 10px; }

  /* 详情：全屏 */
  .drawer { width: 100vw; animation-name: rise; }
  @keyframes rise { from { transform: translateY(30px); opacity: 0; } }
  .d-head { padding: 14px 12px 12px 14px; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
  .d-head .av.lg, .d-head > .sq { margin-right: 4px; }
  .d-head .av.lg, .d-head > .sq { width: 42px !important; height: 42px !important; font-size: 17px; }
  .d-head .ttl { flex: 1 1 110px; }
  .d-head .iconbtn { width: 32px; height: 32px; }
  .d-head h2 { font-size: 18px; margin-bottom: 4px; }
  .d-head .sub { font-size: 13px; gap: 6px; }
  .d-head > .btn { order: 5; width: 100%; justify-content: center; height: 36px; }
  .d-body { padding: 16px 14px calc(30px + env(safe-area-inset-bottom)); }
  .sec { margin-bottom: 22px; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .drawer .kpis { grid-template-columns: repeat(4, 1fr); }
  .drawer .kpi { padding: 10px 10px; }
  .drawer .kpi b { font-size: 20px; }
  .drawer .kpi b small { display: block; margin: 0; font-size: 11.5px; }
  .kpi b small { display: block; margin: 2px 0 0; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .sec-h { flex-wrap: wrap; gap: 6px; }
  .arow { padding: 10px 10px 10px 12px; gap: 8px; }
  .arow .acts { opacity: 1; }
  .arow .gpa { width: auto; font-size: 14px; }
  .arow .t2 { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  select.result { font-size: 13.5px !important; padding: 0 9px; }
  .strip .lane, .strip .axis, .strip > div[style] { left: 46px !important; right: 12px !important; }
  .strip .lbl { left: 10px; }

  /* 表单：底部弹出 */
  .modal { left: 0; top: auto; bottom: 0; transform: none; width: 100vw; max-height: 92dvh; border-radius: 20px 20px 0 0; }
  .m-head { padding: 16px 16px 10px; }
  .m-body { padding: 4px 16px 8px; gap: 12px 10px; }
  .m-foot { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }
  .m-foot .btn { flex: 1; justify-content: center; height: 44px; }
  .f, .f.s2, .f.s4 { grid-column: span 3; }
  .f.s6 { grid-column: span 6; }
  .f input, .f select { height: 44px; }

  /* 全局搜索：贴顶全宽 */
  .palette { top: 0; left: 0; transform: none; width: 100vw; border-radius: 0 0 18px 18px; }
  .palette .in { height: 56px; padding: 0 16px; }
  .palette .res { max-height: 70dvh; }
  .palette .item { gap: 10px; padding: 9px 8px; }
  .palette .item .rc { margin-right: 4px; font-size: 13px; }
  .palette .item > .muted { display: none; }
  .palette .tip br { display: none; }

  /* 概览 / 导入 */
  .page-h { font-size: 20px; margin-bottom: 14px; }
  .panels { grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
  .panel { padding: 16px 14px; }
  .hbar { grid-template-columns: 78px 1fr 88px; gap: 8px; font-size: 13px; }
  .inline input[type=text] { min-width: 0; flex: 1 1 100%; }
  .inline .btn { flex: 1; justify-content: center; }
  .inline > span[style] { display: none; }
  textarea.paste { font-size: 13px !important; height: 130px; }
  #toast { bottom: calc(76px + env(safe-area-inset-bottom)); width: max-content; }
}
@media (hover: none) { .arow .acts { opacity: 1; } }
