/*
 * av-scan design system — visual language inspired by Ant Design v5:
 * system font, 14px base, 6–8px radii, soft borders, blue primary, quiet surfaces.
 * Mobile first: bottom tab bar under 768px, sider on wider screens.
 */
:root {
    --primary: #1677ff;
    --primary-hover: #4096ff;
    --primary-active: #0958d9;
    --primary-bg: #e6f4ff;
    --primary-border: #91caff;
    --success: #52c41a;
    --success-bg: #f6ffed;
    --success-border: #b7eb8f;
    --warning: #faad14;
    --warning-bg: #fffbe6;
    --warning-border: #ffe58f;
    --error: #ff4d4f;
    --error-bg: #fff2f0;
    --error-border: #ffccc7;
    --text: rgba(0, 0, 0, .88);
    --text-2: rgba(0, 0, 0, .65);
    --text-3: rgba(0, 0, 0, .45);
    --text-4: rgba(0, 0, 0, .25);
    --border: #d9d9d9;
    --split: #f0f0f0;
    --fill: rgba(0, 0, 0, .04);
    --fill-2: rgba(0, 0, 0, .06);
    --bg-layout: #f5f5f5;
    --bg: #fff;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --shadow: 0 1px 2px 0 rgba(0, 0, 0, .03), 0 1px 6px -1px rgba(0, 0, 0, .02), 0 2px 4px 0 rgba(0, 0, 0, .02);
    --shadow-lg: 0 6px 16px 0 rgba(0, 0, 0, .08), 0 3px 6px -4px rgba(0, 0, 0, .12), 0 9px 28px 8px rgba(0, 0, 0, .05);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --sider-w: 224px;
    --header-h: 56px;
    --tabbar-h: 60px;
    --c-active: #1677ff;
    --c-new: #52c41a;
    --c-sold: #ff4d4f;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5715;
    color: var(--text);
    background: var(--bg-layout);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0 0 .5em; color: var(--text); font-weight: 600; line-height: 1.35; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p { margin: 0 0 .75em; }
a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; }
svg.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pos { color: var(--success); }
.neg { color: var(--error); }
.strong { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.layout { min-height: 100vh; }
.sider {
    position: fixed; inset: 0 auto 0 0; width: var(--sider-w); z-index: 20;
    background: var(--bg); border-right: 1px solid var(--split);
    display: flex; flex-direction: column; padding: 12px 8px;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 8px 12px 18px; color: var(--text); font-weight: 700; font-size: 16px; }
.logo:hover { color: var(--text); }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #1677ff, #69b1ff); color: #fff; display: grid; place-items: center; }
.logo-mark svg.icon { width: 18px; height: 18px; }
.menu { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.menu a {
    display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: var(--radius);
    color: var(--text); transition: background .2s, color .2s;
}
.menu a:hover { background: var(--fill); color: var(--text); }
.menu a.active { background: var(--primary-bg); color: var(--primary); font-weight: 500; }
.sider-foot { margin-top: auto; border-top: 1px solid var(--split); padding-top: 8px; }
.main { margin-left: var(--sider-w); min-height: 100vh; display: flex; flex-direction: column; }
.header {
    position: sticky; top: 0; z-index: 10; height: var(--header-h);
    display: flex; align-items: center; gap: 12px; padding: 0 24px;
    background: rgba(255, 255, 255, .85); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--split);
}
.header .logo { display: none; padding: 0; }
.header-search { flex: 1; max-width: 380px; }
.header-spacer { flex: 1; }
.content { padding: 20px 24px; width: 100%; flex: 1; min-width: 0; }
.tabbar { display: none; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; }
.page-head .sub { color: var(--text-3); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-title { font-size: 16px; font-weight: 600; margin: 24px 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 32px; padding: 0 15px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg); color: var(--text);
    font: inherit; font-size: 14px; line-height: 1; white-space: nowrap; cursor: pointer;
    box-shadow: 0 2px 0 rgba(0, 0, 0, .02); transition: all .2s cubic-bezier(.645, .045, .355, 1);
    text-decoration: none; user-select: none;
}
.btn:hover { color: var(--primary-hover); border-color: var(--primary-hover); }
.btn:active { color: var(--primary-active); border-color: var(--primary-active); }
.btn:disabled, .btn.disabled { color: var(--text-4); background: var(--fill); border-color: var(--border); cursor: not-allowed; box-shadow: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 0 rgba(5, 145, 255, .1); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-primary:active { background: var(--primary-active); border-color: var(--primary-active); color: #fff; }
.btn-danger { color: var(--error); border-color: var(--error); }
.btn-danger:hover { color: #ff7875; border-color: #ff7875; }
.btn-text { border-color: transparent; background: transparent; box-shadow: none; }
.btn-text:hover { background: var(--fill); border-color: transparent; color: var(--text); }
.btn-sm { height: 24px; padding: 0 7px; font-size: 13px; border-radius: 4px; }
.btn-lg { height: 40px; padding: 0 15px; font-size: 16px; border-radius: var(--radius); }
.btn-block { width: 100%; }
.btn-icon { width: 32px; padding: 0; }
.btn-sm.btn-icon { width: 24px; }
.inline-form { display: inline; margin: 0; }

/* ---------- Form controls ---------- */
.input, .select {
    width: 100%; height: 32px; padding: 4px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg); color: var(--text); font: inherit; font-size: 14px; transition: all .2s; outline: none;
}
.input:hover, .select:hover { border-color: var(--primary-hover); }
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(5, 145, 255, .1); }
.input-lg { height: 40px; font-size: 16px; border-radius: var(--radius); }
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .icon { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.input-affix .input { padding-left: 34px; }
.input-affix.round .input { border-radius: 16px; background: var(--fill); border-color: transparent; }
.input-affix.round .input:focus { background: var(--bg); border-color: var(--primary); }
.input-number { width: 96px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .field-label { color: var(--text); font-size: 14px; }
.field-hint { font-size: 12px; color: var(--text-3); }
.form-error { color: var(--error); font-size: 13px; }

/* Checkable chips (Ant CheckableTag-like) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
    display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 3px 12px;
    border: 1px solid var(--border); border-radius: 15px; background: var(--bg); color: var(--text-2);
    font-size: 13px; cursor: pointer; transition: all .2s; user-select: none;
}
.chip span:hover { color: var(--primary); border-color: var(--primary-hover); }
.chip input:checked + span { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); }
.chip input:checked + span::before { content: "✓"; font-size: 12px; font-weight: 700; }
.chip input:focus-visible + span { box-shadow: 0 0 0 2px rgba(5, 145, 255, .2); }
.fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.fieldset legend { padding: 0; margin-bottom: 8px; font-size: 13px; color: var(--text-2); font-weight: 500; }

/* ---------- Surfaces ---------- */
.card { background: var(--bg); border-radius: var(--radius); border: 1px solid var(--split); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 0 16px; border-bottom: 1px solid var(--split); font-weight: 600; font-size: 15px; }
.card-head .extra { font-weight: 400; font-size: 13px; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }
.card + .card { margin-top: 16px; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-radius: var(--radius); border: 1px solid; margin-bottom: 16px; font-size: 14px; }
.alert .icon { margin-top: 3px; }
.alert-info { background: var(--primary-bg); border-color: var(--primary-border); }
.alert-info .icon { color: var(--primary); }
.alert-success { background: var(--success-bg); border-color: var(--success-border); }
.alert-success .icon { color: var(--success); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); }
.alert-warning .icon { color: var(--warning); }
.alert-error { background: var(--error-bg); border-color: var(--error-border); }
.alert-error .icon { color: var(--error); }

.tag {
    display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 4px;
    border: 1px solid var(--border); background: #fafafa; color: var(--text); font-size: 12px; line-height: 20px; white-space: nowrap;
}
.tag-blue { color: #0958d9; background: #e6f4ff; border-color: #91caff; }
.tag-green { color: #389e0d; background: #f6ffed; border-color: #b7eb8f; }
.tag-gold { color: #d48806; background: #fffbe6; border-color: #ffe58f; }
.tag-red { color: #cf1322; background: #fff1f0; border-color: #ffa39e; }
.tag-gray { color: var(--text-3); background: var(--fill); border-color: transparent; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* Statistic tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--bg); border: 1px solid var(--split); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.stat-title { color: var(--text-3); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 24px; font-weight: 600; line-height: 1.3; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-foot { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.stat-accent { width: 8px; height: 8px; border-radius: 2px; }

/* Segmented (period switch) */
.segmented { display: inline-flex; padding: 2px; gap: 2px; background: var(--fill-2); border-radius: var(--radius-sm); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented a { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 4px; color: var(--text-2); white-space: nowrap; transition: all .2s; }
.segmented a:hover { color: var(--text); background: rgba(0, 0, 0, .04); }
.segmented a.active { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .08); font-weight: 500; }

/* Tabs */
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--split); margin-bottom: 0; overflow-x: auto; scrollbar-width: none; padding: 0 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 12px 0; color: var(--text-2); white-space: nowrap; }
.tabs a:hover { color: var(--primary-hover); }
.tabs a.active { color: var(--primary); font-weight: 500; }
.tabs a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--primary); border-radius: 1px; }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--fill-2); color: var(--text-2); font-size: 12px; }
.tabs a.active .count { background: var(--primary-bg); color: var(--primary); }

.page-tabs {
    position: sticky; top: calc(var(--header-h) + 8px); z-index: 9; margin: 0 0 16px; padding: 0 20px;
    background: var(--bg); border: 1px solid var(--split); border-bottom: 1px solid var(--split); border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.page-tabs a { font-size: 15px; padding: 14px 0; }

/* Table */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { background: #fafafa; color: var(--text); font-weight: 600; text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--split); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--split); vertical-align: middle; }
.table tbody tr { transition: background .2s; }
.table tbody tr:hover td { background: #fafafa; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.compact th, .table.compact td { padding: 8px 12px; }
.table th.num, .table td.num { text-align: right; }
.table th a { color: inherit; display: inline-flex; gap: 4px; align-items: center; }
.table th a:hover { color: var(--primary); }
.table th a .sort-ind { color: var(--text-4); font-size: 10px; }
.table th a.sorted .sort-ind { color: var(--primary); }
.table td.name { min-width: 200px; max-width: 340px; }
.table.dense { font-size: 13px; }
.table.dense th { white-space: normal; line-height: 1.3; vertical-align: bottom; }
.table.dense th a { display: inline; }
.table.dense td.name { min-width: 170px; max-width: 300px; }
@media (max-width: 1400px) { .table.dense .col-spark { display: none; } }
.table.dense th, .table.dense td { padding: 9px 8px; }
.table.dense th:first-child, .table.dense td:first-child { padding-left: 16px; }
.table.dense th:last-child, .table.dense td:last-child { padding-right: 16px; }

/* List (listings) */
.list { display: flex; flex-direction: column; }
.list-item { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--split); color: inherit; transition: background .2s; }
.list-row { position: relative; }
.list-row:last-child .list-item { border-bottom: 0; }
.list-item:last-child { border-bottom: 0; }
.list-av {
    position: absolute; right: 16px; bottom: 12px; display: inline-flex; align-items: center; gap: 4px;
    height: 24px; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 500;
    color: var(--primary); background: var(--primary-bg); border: 1px solid var(--primary-border);
}
.list-av:hover { color: #fff; background: var(--primary); border-color: var(--primary); }
.list-av svg.icon { width: 12px; height: 12px; }
.list-row .list-side { padding-bottom: 30px; }
.list-item:hover { background: #fafafa; color: inherit; }
.list-title { font-weight: 500; color: var(--text); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.list-meta { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.list-meta .mp { white-space: nowrap; }
.list-meta .mp + .mp::before { content: "·"; margin: 0 6px 0 2px; color: var(--text-4); }
.list-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.list-side { text-align: right; white-space: nowrap; }
.list-price { font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; }
.list-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.thumb { width: 96px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); background: var(--fill-2); display: block; }
.thumb.photo-missing { display: grid; place-items: center; color: var(--text-4); font-size: 12px; }

/* Origin badge: region code only (US, EU, CN, RU, KR, JP) */
.origin { display: inline-grid; place-items: center; height: 22px; min-width: 30px; padding: 0 7px; border-radius: 4px; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .05em; white-space: nowrap; cursor: help; }
.origin.r-us { background: linear-gradient(135deg, #cf1322 0%, #cf1322 58%, #1d39c4 58%); }
.origin.r-eu { background: #2f54eb; }
.origin.r-cn { background: #d46b08; }
.origin.r-ru, .origin.r-kr, .origin.r-jp { background: #722ed1; }
.origin.lg { height: 26px; min-width: 36px; font-size: 12px; }
.thumb-wrap { position: relative; }
.thumb-flag { position: absolute; left: 4px; top: 4px; padding: 1px 5px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: .04em; color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.thumb-flag.r-us { background: #cf1322; }
.thumb-flag.r-eu { background: #2f54eb; }
.thumb-flag.r-cn { background: #d46b08; }
.thumb-flag.r-ru, .thumb-flag.r-kr, .thumb-flag.r-jp { background: #722ed1; }

/* Empty */
.empty { text-align: center; padding: 40px 16px; color: var(--text-3); }
.empty .icon { width: 40px; height: 40px; color: var(--text-4); stroke-width: 1.2; margin-bottom: 8px; }

/* Charts */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-card .card-body { padding: 12px 16px 16px; }
.chart-card .card-head { font-size: 14px; }
.chart-note { font-size: 12px; color: var(--text-3); margin: 0 0 8px; min-height: 0; }
.chart-note:empty { display: none; }
.chart-box { position: relative; height: 300px; }
.chart-empty { display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; height: 100%; color: var(--text-3); font-size: 13px; text-align: center; }
.skeleton { background: linear-gradient(90deg, #f2f2f2 25%, #e6e6e6 37%, #f2f2f2 63%); background-size: 400% 100%; animation: skeleton 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Ranking cards (mobile dashboard) */
.rank-cards { display: none; }
.rank-card { display: block; color: inherit; padding: 14px 16px; border-bottom: 1px solid var(--split); }
.rank-card:last-child { border-bottom: 0; }
.rank-card:hover { color: inherit; background: #fafafa; }
.rank-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.rank-card-title { font-weight: 500; color: var(--text); }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px; margin-top: 10px; }
.mini-stats .k { font-size: 12px; color: var(--text-3); }
.mini-stats .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.progress { height: 6px; border-radius: 3px; background: var(--fill-2); overflow: hidden; min-width: 60px; }
.progress > i { display: block; height: 100%; border-radius: 3px; background: var(--primary); }

/* Collapse / tree */
.collapse { border: 1px solid var(--split); border-radius: var(--radius); background: var(--bg); overflow: hidden; box-shadow: var(--shadow); }
.collapse > details + details { border-top: 1px solid var(--split); }
.collapse summary, .sub-collapse summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px 16px; user-select: none;
}
.collapse summary::-webkit-details-marker, .sub-collapse summary::-webkit-details-marker { display: none; }
.chev { transition: transform .2s; color: var(--text-3); }
details[open] > summary .chev { transform: rotate(90deg); }
.collapse summary:hover, .sub-collapse summary:hover { background: #fafafa; }
.brand-name { font-weight: 600; font-size: 15px; }
.models { border-top: 1px solid var(--split); background: #fcfcfc; }
.sub-collapse { border-bottom: 1px solid var(--split); }
.sub-collapse:last-child { border-bottom: 0; }
.sub-collapse summary { padding: 10px 16px 10px 28px; }
.generations { padding: 4px 16px 12px 28px; display: flex; flex-direction: column; gap: 8px; }
.gen { background: var(--bg); border: 1px solid var(--split); border-radius: var(--radius); }
.gen.tracked { border-color: var(--primary-border); }
.gen-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.gen-head input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; flex: none; }
.gen-name { font-weight: 500; }
.gen-body { padding: 0 12px 12px; }
.gen-body:empty { display: none; }
.filter-box { border: 1px solid var(--split); border-radius: var(--radius); padding: 12px; background: #fafafa; margin-top: 8px; }
.filter-box.new { background: var(--bg); border-color: var(--primary-border); box-shadow: 0 0 0 3px rgba(22, 119, 255, .06); }
.filter-box.paused { opacity: .65; }
.filter-box-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-box-head .title { font-weight: 500; color: var(--text); }
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.disclosure > summary { list-style: none; cursor: pointer; color: var(--primary); font-size: 13px; display: inline-flex; gap: 4px; align-items: center; margin: 8px 0; }
.disclosure > summary::-webkit-details-marker { display: none; }

/* Descriptions */
.desc { display: grid; grid-template-columns: max-content minmax(0, 1fr); }
.desc dt, .desc dd { padding: 9px 0; border-bottom: 1px solid var(--split); margin: 0; }
.desc dt { color: var(--text-3); padding-right: 16px; }
.desc dd { text-align: right; overflow-wrap: anywhere; }
.desc dt:last-of-type, .desc dd:last-of-type { border-bottom: 0; }
.description { white-space: pre-wrap; line-height: 1.65; }

/* Listing gallery */
.gallery-main { position: relative; background: #141414; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gallery-counter { position: absolute; right: 10px; bottom: 10px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.gallery-main img { cursor: zoom-in; }
.gallery-nav, .gallery-zoom {
    position: absolute; display: grid; place-items: center; border: 0; cursor: pointer; padding: 0;
    background: rgba(255, 255, 255, .88); color: rgba(0, 0, 0, .85); box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    transition: background .2s, transform .2s, opacity .2s;
}
.gallery-nav { top: 50%; width: 40px; height: 40px; border-radius: 50%; transform: translateY(-50%); }
.gallery-nav:hover { background: #fff; transform: translateY(-50%) scale(1.06); }
.gallery-nav.prev { left: 12px; }
.gallery-nav.next { right: 12px; }
.gallery-nav svg.icon { width: 20px; height: 20px; stroke-width: 2.2; }
.gallery-nav.prev svg.icon, .lb-prev svg.icon { transform: rotate(180deg); }
.gallery-zoom { top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 8px; background: rgba(0, 0, 0, .5); color: #fff; box-shadow: none; }
.gallery-zoom:hover { background: rgba(0, 0, 0, .7); }
.lightbox {
    position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .94);
    display: flex; align-items: center; justify-content: center; touch-action: pan-y; animation: lb-in .15s ease-out;
}
.lightbox[hidden] { display: none; }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox img { max-width: 100vw; max-height: 100vh; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb-btn {
    position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; border: 0; padding: 0;
    background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; transition: background .2s;
}
.lb-btn:hover { background: rgba(255, 255, 255, .28); }
.lb-btn svg.icon { width: 24px; height: 24px; stroke-width: 2; }
.lb-close { top: calc(16px + env(safe-area-inset-top)); right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lb-counter { position: absolute; top: calc(26px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); color: rgba(255, 255, 255, .85); font-size: 14px; font-variant-numeric: tabular-nums; }
body.lightbox-open { overflow: hidden; }
@media (max-width: 767px) {
    .gallery-nav { width: 36px; height: 36px; }
    .gallery-nav.prev { left: 8px; }
    .gallery-nav.next { right: 8px; }
    .lb-btn { width: 42px; height: 42px; background: rgba(255, 255, 255, .18); }
    .lb-prev, .lb-next { top: auto; bottom: calc(24px + env(safe-area-inset-bottom)); transform: none; }
    .lb-prev { left: 24px; }
    .lb-next { right: 24px; }
}
.gallery-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 2px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.gallery-thumbs button { flex: none; width: 84px; height: 63px; padding: 0; border: 2px solid transparent; border-radius: var(--radius-sm); overflow: hidden; background: var(--fill-2); cursor: pointer; scroll-snap-align: start; }
.gallery-thumbs button.active { border-color: var(--primary); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-missing { display: grid; place-items: center; width: 100%; height: 100%; color: var(--text-3); background: var(--fill-2); font-size: 13px; }
.listing-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.price-big { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
    background: radial-gradient(1200px 600px at 10% -10%, #e6f4ff 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #f0f5ff 0%, transparent 60%), var(--bg-layout); }
.auth-card { width: 100%; max-width: 380px; background: var(--bg); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 32px 28px; }
.auth-card .logo { justify-content: center; padding: 0 0 8px; font-size: 20px; }
.auth-card .logo-mark { width: 40px; height: 40px; border-radius: 10px; }
.auth-sub { text-align: center; color: var(--text-3); margin-bottom: 24px; }

/* Sparkline */
.spark { display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .charts { grid-template-columns: minmax(0, 1fr); }
    .listing-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 767px) {
    body { font-size: 15px; }
    .sider { display: none; }
    .main { margin-left: 0; }
    .header { padding: 0 12px; padding-top: env(safe-area-inset-top); height: calc(var(--header-h) + env(safe-area-inset-top)); }
    .header .logo { display: flex; }
    .header .logo .logo-text { display: none; }
    .header-search { max-width: none; }
    .header .user-link { display: none; }
    .content { padding: 12px 12px calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); }
    .tabbar {
        display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 30;
        height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
        background: rgba(255, 255, 255, .94); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
        border-top: 1px solid var(--split);
    }
    .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-3); font-size: 11px; }
    .tabbar a svg.icon { width: 22px; height: 22px; }
    .tabbar a.active { color: var(--primary); }
    .page-head h1 { font-size: 19px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .stat { padding: 10px 12px; }
    .stat-value { font-size: 20px; }
    .chart-box { height: 240px; }
    .card-body { padding: 12px; }
    .card-head { padding: 0 12px; min-height: 44px; }
    .tabs { padding: 0 12px; gap: 20px; }
    .page-tabs { top: calc(var(--header-h) + env(safe-area-inset-top) + 6px); margin: 0 0 12px; padding: 0 14px; }
    .page-tabs a { font-size: 14px; }
    .rank-table { display: none; }
    .rank-cards { display: block; }
    .list-item { grid-template-columns: 76px minmax(0, 1fr); gap: 10px; padding: 12px; align-items: start; }
    .thumb { width: 76px; height: 57px; }
    .list-side { grid-column: 2; text-align: left; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
    .list-row .list-side { padding-bottom: 0; padding-right: 70px; }
    .list-av { right: 12px; bottom: 12px; height: 28px; padding: 0 10px; }
    .list-price { font-size: 15px; }
    .collapse summary { padding: 12px; }
    .sub-collapse summary { padding: 10px 12px 10px 20px; }
    .generations { padding: 4px 8px 10px 12px; }
    .desc dd { text-align: left; }
    .btn { height: 36px; }
    .btn-sm { height: 30px; padding: 0 10px; }
    .input, .select { height: 38px; font-size: 16px; }
    .input-affix.round .input { height: 36px; }
    .sort-bar { flex-wrap: nowrap; }
    .sort-bar .select { flex: 1; min-width: 0; width: auto !important; }
    .hide-mobile { display: none !important; }
}

@media (min-width: 768px) {
    .show-mobile { display: none !important; }
}
